So I'm fairly new to Linux and web servers but we moved our sites from a shared hosting environment to a Linux Virtual Server about 8 months ago, much faster and has ran bullet proof until we re-build one of our sites in Wordpress and published.
The WP site ran fine on a test server but now that it went onto our live server we're having trouble. Here's what is happening and what I've done so far.
Site is running good then I notice that the Apache RAM and CPU spikes to 100% and a bunch of
php-cgi process start. Then I get an error:
mod_fcgid: process ##### graceful kill fail, sending SIGKILL
the wordpress sites then start to give a 503 error, but non-wordpress site work just fine.
An apache restart fixes the problem. So after that I made some changes the fcgid conf file as follows:
FcgidIdleTimeout 60 FcgidProcessLifeTime 120 FcgidMaxProcesses 150 FcgidMaxProcessesPerClass 8 FcgidMinProcessesPerClass 0 FcgidConnectTimeout 30 FcgidIOTimeout 2000 FcgidInitialEnv RAILS_ENV production FcgidIdleScanInterval 30 FcgidMaxRequestLen 1073741824
Now when the CPU/RAM spike happens I still get a bunch of the
php-cgi processes but after a little while it calms down and I get left with a bunch of Zombie
php-cgi processes, but the server keeps going so I'm happy about that. But I have to still restart occasionally to get those processes cleaned out.
We tested our websites on a test server for months with no issues but of course now we have 10-20 people on the site at a time. But I don't know what is causing this out of control spike, not even sure where to start. Maybe it's a code issue maybe it's a server configuration issue.
- 2GB RAM
- CentOS 6
- site usually has 500-1000MB RAM FREE
Let me know if you need other details, I can look them up.
UPDATE: so I think this may be related to some bad php code but that will take time to track down. Seems like there should be some more robust server configs I could setup to keep it from going down. Today I had it go down 2-3 times one of them crashed the apache service all together.