FcgidProcessLifeTime没有效果

我正在运行PHP处理程序fcgid

LoadModule fcgid_module modules/mod_fcgid.so FcgidMaxRequestsPerProcess 3000 FcgidMaxProcesses 3000 FcgidMaxProcessesPerClass 16 FcgidMinProcessesPerClass 1 FcgidProcessLifeTime 7200 FcgidIOTimeout 180 IPCConnectTimeout 60 FcgidIdleTimeout 600 FcgidIdleScanInterval 30 FcgidBusyTimeout 3600 FcgidBusyScanInterval 30 FcgidErrorScanInterval 3 FcgidZombieScanInterval 3 FcgidFixPathinfo 0 FcgidMaxRequestInMem 419430400 FcgidMaxRequestLen 1073741824 

每10分钟或更多的进程终止,也设置FcgidProcessLifeTime 7200

我也使用mpm_worker

 Timeout 50 <IfModule worker.c> StartServers 16 ServerLimit 1800 MaxClients 1728 MinSpareThreads 75 MaxSpareThreads 250 ThreadLimit 600 ThreadsPerChild 64 MaxRequestsPerChild 10000 KeepAlive On MaxKeepAliveRequests 50 KeepAliveTimeout 5 </IfModule> 

处理器:双Intel Xeon E5630,内存:32GB DDR3,PHPv5.3.14

我怎么解决这个问题 。? 并保持过程的生命周期。

这是一个非常古老的问题,但最近不得不解决这个问题。

你有FcgidIdleTimeout 600

这意味着如果一个进程闲置了10分钟,它将被终止,不pipe你在FcgidProcessLifeTime设置了FcgidProcessLifeTime

我没有testing过,但如果你想确认你可以设置FcgidMaxProcessesPerClass 1 ,然后每5分钟发送一次请求。 这应该保持这个过程FcgidProcessLifeTime因为它永远不会为FcgidIdleTimeout空闲。

所以优化configuration将取决于您的工作负载。

我build议使用mod_fastcgi或mod_proxy_fcgi(需要Aapache 2.4)切换到php-fpm。 PHP-FPM是自己的stream程pipe理,你甚至可以select适合你的站点的不同的stream程pipe理器。

php-fpm越来越成为部署php应用程序的标准方式。