[email protected]
Twitter
LinkedIn
YouTube
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
51 forks.
210 stars.
4 open issues.

Recent commits:
  • Merge pull request #5 from AysadKozanoglu/generate_textAreaConfigPhpini_copyButtontextarea with generated values with copy button, GitHub
  • textarea with generated values with copy button, aysadkozanoglu
  • 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

: PHP, PHP-FPM

Services

  • Excel2chatGPT $10.00
  • Bot Tok $45.00
  • Fix bugs in your PHP Symfony App $70.00 / hr
  • Fix bugs in your Wordpress Site $70.00 / hr
  • Tasks Automation using Node.js $70.00 / hr

Blog

  • How to Pay with a Bank Card on Cryptomus
  • Complete Beginner’s Guide to Bot Tok: Terminal Commands Explained
  • Top Site to Gain Views on TikTok
  • Jfa Whatsapp Chatbot
  • TikTok Bot

Explore

  • Free 10 Tiktok Likes
  • Free 2K TikTok Views
  • Free 100 TikTok Favorites
  • Free 300 TikTok Shares
  • Buy TikTok Views
  • Free 100 Instagram Likes
Twitter
LinkedIn
YouTube
GitHub

© 2013-2025 Jordi Fernandes Alves (@jfadev)