How to manage runaway PHP procs for a site?
I have a particular site that is being a real hassle. They're running WordPress, but php processes seem to be spawning to the point of being far beyond any other sites on the system. I frequently find them chewing away on 16-20 of the processor cores at 100% levels for each and I am also experiencing `-bash: fork: retry: Resource temporarily unavailable` when I ssh in as the user. Root and other users seem okay, except for the sluggishness of the system being chewed up by this user.
What should I do to manage situations like this better? I have contemplated killing php procs with a cronjob to just look for php procs > 1 hour. I have also considered adjusting the ulimit for this user as well... but I am just not sure what the "best" approach to take may be for this scenario, especially given perhaps preferred cPanel options if there are any.
-
FYI, here is a script that I wrote to kill php processes (I have it set to kill them all with pid runtime > 1, but that can be adjusted to 3600 for an hour; and you would want to replace USERNAME with a desired username there): /https://gist.github.com/996c8ab0609811425457 This doesn't seem to resolve the performance problem though for the site and a slew more php processes appear to spawn fairly rapidly again for this WordPress site. 0 -
Hello, Most likely this user has a plugin that is resource intensive. I would advise him to disable all plugins, and enable one at a time until you find the cause of the problem. 0 -
In my experience, this isoften either a site in need of a caching plugin (i.e. wp_supercache or similar) or a site being scanned by a vulnerability finding tool. I'd suggest taking a look at the apache log for the site, this may indicate what's happening (the latter case will for example have lots of requests to plugin files that aren't actually installed). 0
Please sign in to leave a comment.
Comments
3 comments