[email protected]
Twitter
LinkedIn
GitHub
  • Services
  • Blog
  • Repositories
  • GitHub
  • Resume
  • Contact
Product was added to your cart

Cart

PHP-FPM Process Calculator

September 9, 2021Back-End, Tools, Tricksjfadev

How to calculate pm.max_children setting?

Check how much memory the average process is using, to be able to calculate how many processes we can execute with the RAM available in our server.

$ ps -ef | grep '[f]'pm
//Results on this machine :
root      4073     1  0 Sep19 ?        00:02:02 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
www-data 24905  4073  1 18:14 ?        00:00:29 php-fpm: pool www
www-data 25056  4073  1 18:30 ?        00:00:11 php-fpm: pool www
www-data 25125  4073  1 18:32 ?        00:00:09 php-fpm: pool www

Check the memory that is required for these processes:

$ ps -C php-fpm7.4 -o rss=
//Results on this machine :
21080
92892
91272
90816

Generally, the first line of this list shows the master process, which in this case is running PHP, and the following results show the resources that each child process uses. These numbers are in kilobytes, so in this example, I would ignore the first process and round to establish an average of 100 MB of physical memory per child process.

[RAM disponible total] - [RAM reservada] - [10% de búfer] = [RAM disponible para PHP]
[RAM disponible para PHP] / [Tamaño medio del proceso] = [max_children]
pm.max_children = [max_children]
pm.start_servers = [25% de max_children]
pm.min_spare_servers = [25% de max_children]
pm.max_spare_servers = [75% de max_children]

Calculator

https://spot13.com/pmcalculator/

Repository

A simple process manager calculator that helps determine the correct values for child processes in PHP-FPM
https://github.com/spot13/pmcalculator
27 forks.
122 stars.
2 open issues.

Recent commits:
  • allow for .25 steps for buffer, Chris Moore
  • allow for 0 percent buffer, Chris Moore
  • Merge branch 'master' of github.com:spot13/pmcalculator, Chris Moore
  • responsive adjustments, Chris Moore
  • Update README.md, GitHub

: PHP, PHP-FPM

Services

  • Excel2chatGPT $10.00 $5.00
  • Bot Tok $5.00
  • Fix bugs in your Wordpress Site $40.00 $30.00 / hr
  • Fix bugs in your PHP Symfony App $50.00 / hr
  • Tasks Automation using Node.js $50.00 / hr

Blog

  • Jfa Whatsapp Chatbot
  • TikTok Bot
  • Bot Tok (TikTok Bot)
  • Excel2chatGPT (Excel to ChatGPT)
  • Web Scraping and Automation Resources

Explore

  • Los Mejores Top 10
  • Upcycling Fashion BCN
Twitter
LinkedIn
GitHub

© 2013-2023 Jordi Fernandes Alves (@jfadev)