Skip to main content

PHP-FPM Restart Necessary for Site Speed

Comments

7 comments

  • sparek-3
    Are you using Opcache? That's what this sounds like to me - although others might chime in with other ideas. With opcache your PHP code is compiled and left in memory for faster loading. It sounds like your opcache might be filling up with other data and that's why the website loads slow. Restarting php-fpm allows the opcache to empty and rebuild. This might be a case where file-based opcache would be helpful, and give you better control over what is being cached. There's a feature request for this some where on the feature request site. But it's stuck in feature request purgatory so I wouldn't expect to see it be implemented anytime this century.
    0
  • celiac101
    Thank you for the reply. I used to use PHP 7.1 and Memcache, but it isn't supported in PHP 7.3 so I now use Redis, as my forum app has built in support for it. Regarding my problem #1, I just found what I think is the best solution and am testing it now. It comes from: PHP5-FPM static, dynamic or on demand? I use PHP-FPM Ondemand, and just added this to my php-fpm.yaml file: emergency_restart_threshold = 5 emergency_restart_interval = 1m process_control_timeout = 10s So far it is working well, but only time will tell if this solves the issue. Any help with #2 and the swap issue would be helpful. For example, I am having trouble getting a cron job to work using: swapoff -a && swapon -a
    0
  • celiac101
    PS - Is it possible to run opcache with redis?
    0
  • cPanelLauren
    Is there anything of note in the PHP-FPM error logs? /opt/cpanel/ea-phpXX/root/usr/var/log/php-fpm/error.log
    For reference on that feature request, it can be found here: Redis as a user cache like apcu or opcache? I am so confused Redis vs APCu 2018
    0
  • celiac101
    I see nothing of note in the error log...before I did this lots of this stuff, likely from when I was manually restarting it to speed things up: [01-Apr-2019 18:26:47] NOTICE: fpm is running, pid 21233 [01-Apr-2019 18:26:47] NOTICE: ready to handle connections [01-Apr-2019 18:26:47] NOTICE: systemd monitor interval set to 10000ms [01-Apr-2019 20:49:12] NOTICE: Terminating ... [01-Apr-2019 20:49:12] NOTICE: exiting, bye-bye! [01-Apr-2019 20:49:12] NOTICE: fpm is running, pid 27339 [01-Apr-2019 20:49:12] NOTICE: ready to handle connections [01-Apr-2019 20:49:12] NOTICE: systemd monitor interval set to 10000ms [02-Apr-2019 04:26:27] NOTICE: Terminating ... [02-Apr-2019 04:26:27] NOTICE: exiting, bye-bye! And after the update I just mention, now I see lots of this: [03-Apr-2019 10:41:21] NOTICE: [pool celiac_com] child 30989 exited with code 0 after 10.799819 seconds from start [03-Apr-2019 10:41:21] NOTICE: [pool celiac_com] child 30990 started [03-Apr-2019 10:41:28] NOTICE: [pool celiac_com] child 30987 exited with code 0 after 18.164710 seconds from start [03-Apr-2019 10:41:28] NOTICE: [pool celiac_com] child 30997 started [03-Apr-2019 10:41:29] NOTICE: [pool celiac_com] child 30986 exited with code 0 after 19.327120 seconds from start [03-Apr-2019 10:41:29] NOTICE: [pool celiac_com] child 30998 started I did see this line from today when I fist restarted it after adding that info, so I will raise this: [03-Apr-2019 10:41:12] WARNING: [pool celiac_com] server reached max_children setting (5), consider raising it
    0
  • celiac101
    I have this at 800 now, and am still getting this warning. I've heard if it is too high it can cause server stability issues: [03-Apr-2019 10:41:12] WARNING: [pool celiac_com] server reached max_children setting (5), consider raising it
    0
  • cPanelLauren
    Hi @celiac101 Too high could cause issues but too low also will cause some issues as you're seeing now, I can't tell you what to set it to but it does sound like you need to increase the max_children for this 5 is actually going to be a bit low for an active site. Moderation Notice: Posts related to PHP-FPM configuration instructions were moved to a new thread:
    0

Please sign in to leave a comment.