Setting a cronjob to reset PHP-FPM
Our shared servers seem to gradually build up CPU use until we reset PHP-FPM. It then comes down right away.
I was thinking of running a weekly or maybe even a daily cronjob to reset it.
Do you think this could have any negative precautions?
And what would be the best cron job to do this say daily for example?
-
Probably a better approach would be to figure out what is cause the high CPU usage of php-fpm. Is it one particular account? Is that account being flooded with PHP requests? Perhaps opcache is misconfigured? Hard to really say. But if you're resorting to periodically restarting services, that's generally not a great solution because it means you're just masking the underlying issue. 0 -
Thanks, I was thinking that too. It just seems odd that resetting FPM lowers the load so much each time on multiple servers. I can't see anything else obvious that might be related. So I was thinking FPM just gets bloated. I'll check opcache. Do you have any suggestions for configuring opcache? 0 -
Well there is a known issue with php-fpm and opcache and there has been for a long time though it's not necessarily the fault of opcache. That could be the cause of the issue you're seeing though without more information I couldn't tell you for sure. The PHP bug is here: As far as restarting php-fpm, it's not an ideal solution, the best solution would be as @sparek-3 suggests but to restart the service it's /scripts/restartsrv_apache_php_fpm
0
Please sign in to leave a comment.
Comments
3 comments