我知道有很多很好的答案这样的问题在stackoverflow或serverfault,但我无法find我的问题的答案。
我有我的php-fpm 7.0进程的以下/status输出。
pool: www process manager: dynamic start time: 04/Jul/2017:15:09:20 +0200 start since: 609 accepted conn: 6113 listen queue: 0 max listen queue: 0 listen queue len: 0 idle processes: 89 active processes: 11 total processes: 100 max active processes: 27 max children reached: 0 slow requests: 0
正如你所看到的,我有很多闲置的进程正在等待某些事情要做。 闲置的stream程是好还是不好的做法?
; The number of child processes to be created when pm is set to 'static' and the ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. ; This value sets the limit on the number of simultaneous requests that will be ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP ; CGI. The below defaults are based on a server without much resources. Don't ; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' ; Note: This value is mandatory. pm.max_children = 550 ; The number of child processes created on startup. ; Note: Used only when pm is set to 'dynamic' ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 pm.start_servers = 100 ; The desired minimum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' pm.min_spare_servers = 50 ; The desired maximum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' pm.max_spare_servers = 150 ; The number of seconds after which an idle process will be killed. ; Note: Used only when pm is set to 'ondemand' ; Default Value: 10s pm.process_idle_timeout = 10s; ; The number of requests each child process should execute before respawning. ; This can be useful to work around memory leaks in 3rd party libraries. For ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. ; Default Value: 0
我试图为我们的服务器find完美的configuration,因为有些东西在泄漏我们的内存。 日复一日的PHP使用越来越多的内存,直到服务器停止工作。
如果我看看/status输出,我认为我在www.conf中定义的值太高。 我对吗? 只有27个进程活动(最多)我有超过80个进程在等待。 那不好?
感谢您的帮助!