Why is My Webserver Hanging?!? (Spoiler: It was PHP-FPM)
HTML-код
- Опубликовано: 3 окт 2024
- My webserver randomly hangs, kicking my websites offline. After some investigating, it turned out to be PHP-FPM, and its default settings. With multiple PHP websites, the 5 default children get used up quickly!
This video shows how to calculate the best number of child processes for your webserver, along with how to make the change on your system. I used the calculator tool found here: https//spot13.com/pmcalculator
If you'd like to see more videos about my favorite webserver (Caddyserver), let me know in the comments!
NOTE: I know this video wasn't actually about my webserver at all... but the question still stands, lol!
If you want to be one of my Patreon supporters, head on over to / shawnp0wers for details on the benefits you could receive! Thanks again, supporters. :)
All my stuff: shawnp0wers.com
#linux #php #caddyserver
Very useful info for anyone running PHP-FPM, whatever the web server may be. We’re running it through Apache2 and this is setting us on the right track. Thanks!
Hey great stuff we would love to see Caddyserver videos. thanks for your informative video
Thanks for this info.
I just want to say, I'm running a few websites of my VPS from Vultr. I'm running Apache, with PHP, and MySQL, and my entire VM only has 1GB of RAM and 1GB of SWAP.
If you have 12GB or RAM and you're having issues, I don't think the issue is needing more RAM.
I think the issue is quite a few Wordpress sites getting crawled at one time.
Thank you so much. I spent way too many hours that I am ashamed to disclose and tried all sorts of configs with magic calculations from the net. The tool you shared and the steps to calculate size and processes was just what I needed
Glad it helped!
Thank you for the content! You helped me a lot with a challenge that only who maintain a big traffic website will face of, awesome. Greetings from Brazil 🤘
Hey Shawn good video love these real life examples and troubleshooting.
tyvm. this is awesome
Great stuff, would love to see more caddy material perhaps setting it up from scratch?
great video as always 🙂
You should use a fixed number of child processes in a production server. Killing and respawning processes has a performance hit. Should also have a max requests set to respawn to preventemory leaks
++ caddy v Apache ; and thank you.
and this spesefic video totally relates to my past 4 hours.
Great video! Thanks!
Wow best explanation
Brilliant ! Thanks !
You are welcome!
php-fpm is a lovely thing. I once wrote a 3-page document for work detailing how you can `kill -USR2` an fpm poolrunner's PID to cause it to be like "yo shit ain't right" and reload that pool's config.
There was more to this story... when my multiple wordpress sites got scanned, it caused a TON of processes. Upwards of 250 were required to keep things working! And in dynamic mode, they would stay active but unresponsive. I moved to "ondemand", which is less responsive (on paper), but seems to work really well with regard to scaling up and down.
@@shawnp0wers this comment saved me!
Helpful! I ran too way to many...
i checked my fpm conf its default to 50 child-process. Do I still need to adjust them?
Hi,
thanks for sharing.
my new settings based in aval ram;
pm.max_children = 201
pm.start_servers = 50
pm.min_spare_servers = 50
pm.max_spare_servers = 150
pm.max_request = 2000
After changed i have the same error, i thing the values are not set! I already restarted the php and server too.
The message shows the old value pm.max_children setting (5)!
WARNING: [pool librenms] server reached pm.max_children setting (5), consider raising it
What else do I need to do?
Thanks
Thank you.
You're welcome!
I have multiple php running should the the numbers be remain same for all the php-fpms.
Harris Brian Clark Gary Miller Paul