POST-ing to php-fpm increases disk i/o writes

孤者浪人 提交于 2019-12-12 04:08:56

问题


I'm sending POST data about 100KB to my application and it causes php-pfm process to create many pipes and write to disk.

I'm wondering how this can be avoided.

  PID USERNAME     VCSW  IVCSW   READ  WRITE  FAULT  TOTAL PERCENT COMMAND
 3915 www          6773    298      0     38      0     38   8.86% php-fpm
 3932 www          4744    177      0     10      0     10   2.33% php-fpm
 3753 www          4522    157      0     52      0     52  12.12% php-fpm
 3910 www          3551    166      0     51      0     51  11.89% php-fpm
 3934 www          4169    207      0     45      0     45  10.49% php-fpm
 3989 www          3183    152      0     13      0     13   3.03% php-fpm
 3844 www          4176    134      0     47      0     47  10.96% php-fpm
 3925 www          3533    123      0     13      0     13   3.03% php-fpm
 3935 www          3315    169      0     21      0     21   4.90% php-fpm
 3933 www          3164    144      0     17      0     17   3.96% php-fpm
 3931 www          3313    129      0     13      0     13   3.03% php-fpm
 3917 www          2846    169      0     48      0     48  11.19% php-fpm
 3845 www          2634    178      0     34      0     34   7.93% php-fpm
 3913 www          2660    119      0     26      0     26   6.06% php-fpm

data from fstat

www      php-fpm     5266    1* pipe fffff80e7ef52460  fffff80e7ef522f8      0 rw
www      php-fpm     5266    2* pipe fffff81c75730a50  fffff81c757308e8      0 rw
www      php-fpm     5265    1* pipe fffff801430b6168  fffff801430b6000      0 rw
www      php-fpm     5265    2* pipe fffff801432c4a50  fffff801432c48e8      0 rw
...
root     php-fpm    72450   10* pipe fffff816b3ca72f8  fffff816b3ca7460      0 rw
root     php-fpm    72450   11* pipe fffff801430cdbe0  fffff801430cdd48      0 rw
root     php-fpm    72450   12* pipe fffff80143318be0  fffff80143318d48      0 rw
root     php-fpm    72450   13* pipe fffff8018a5b65f0  fffff8018a5b6758      0 rw
root     php-fpm    72450   14* pipe fffff81b7e6595f0  fffff81b7e659758      0 rw
root     php-fpm    72450   15* pipe fffff816b33ef000  fffff816b33ef168      0 rw
root     php-fpm    72450   16* pipe fffff814569a32f8  fffff814569a3460      0 rw
root     php-fpm    72450   17* pipe fffff81b5384a000  fffff81b5384a168      0 rw
root     php-fpm    72450   18* pipe fffff81b5336bbe0  fffff81b5336bd48      0 rw
root     php-fpm    72450   19* pipe fffff80e7ef532f8  fffff80e7ef53460      0 rw
root     php-fpm    72450   20* pipe fffff81b53a548e8  fffff81b53a54a50      0 rw
root     php-fpm    72450   21* pipe fffff8018a77a5f0  fffff8018a77a758      0 rw
...

PHP application is:

<?php exit; ?>

I do not have errors in the logs.

PID 72450 is php-fpm: master process

Almost each child process has 2 pipes open.

Thanks!


回答1:


The php-fpm master process will 'spin up' a number of child processes, as determined in your /etc/php-fpm.conf file (usual location for the config file). Each child process has pipes open for STDOUT and STDERR, hence the parameters listed in fstat.

To change/tweek this behaviuour you would need to familiarise yourself with your particlar config file, and maybe reduce the size of the php-fpm pool created by default? The pool is obviously intended to be spun up and ready to handle any subsequent queries without delay, so suitable config values will depend upon your intended site usage etc.

HTH



来源:https://stackoverflow.com/questions/46597383/post-ing-to-php-fpm-increases-disk-i-o-writes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!