Skip to content

Instantly share code, notes, and snippets.

@rooty
Last active January 30, 2018 09:41
Show Gist options
  • Save rooty/4d88b79f92fccd53e6e808a87a8da918 to your computer and use it in GitHub Desktop.
Save rooty/4d88b79f92fccd53e6e808a87a8da918 to your computer and use it in GitHub Desktop.
how many PHP-FPM processes a server could handle easily
It's good to test how many PHP-FPM processes a server could handle easily, first start Nginx and PHP-FPM and load some PHP pages, preferably all of the heaviest pages. Then check memory usage per PHP-FPM process example with Linux top or htop command. Let's assume that the server has 512 Mb memory and 220 Mb could be used for PHP-FPM, every process use 24 Mb RAM (some huge content management system with plugins can easily use 20-40 Mb / per PHP page request or even more). Then simply calculate the server max_children value:
220 / 24 = 9.17
So good pm.max_children value is 9. This is based just quick average and later this could be something else when you see longer time memory usage / per process. After quick testing it's much easier to setup pm.start_servers value, pm.min_spare_servers value and pm.max_spare_servers value.
https://www.kinamo.be/en/support/faq/determining-the-correct-number-of-child-processes-for-php-fpm-on-nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment