I am struggling to get decent performance with PHP running through fcgid.
The problem is that at times, when a virtual server is called from a browser, the server actually takes a couple of seconds to respond. About 2-3 seconds. Then the site runs perfectly fine and snappy.
To me it seems like the php process is sleeping or just not existant, so the server needs some time to get it started. But 3 seconds? Isn’t it a bit much?
The server by the way is not under heavy load… enough ram, load usually is around 0.2-0.4.
I switched a site to mod_php and the problem was gone. But since I want to retain the benefits of fcgid, I tried to improve things a bit:
i switched to the worker mpm, which also removes the mod_php thing
i removed the PHP_FCGI_CHILDREN option from the /home/*/fcgi-bin/php5.fcgi files, which now look like this:
It’s unusual to see the problems you’re describing! What does the RAM usage look like on your system? You can determine that by running “free -m”?
Also, I’m curious if you see those issues when using PHP in CGI mode… that would still retain the security benefits of using FCGID. To switch to CGI mode, you can go into Server Configuration -> Website Options, and set “PHP script execution mode” to “CGI Wrapper”.
as for cgi mode, i will test tomorrow.
btw maybe i can optimize the fcgi module settings? i have not been able to find recommended settings from a good source…
basically it seems to me that after some time idling (or maybe due to some other criteria) the php process of the virtual server is shut down, so on the next request the process has to be started again. and that takes a couple of seconds.
is there a way to lengthen the timeout period, or even to avoid the process shutting down at all? that would make the server much more responsive at all times…