[email protected]
Twitter
LinkedIn
GitHub
  • Blog
  • GitHub
  • Resume

PHP-FPM Process Calculator

September 9, 2021Back-End, Tools, TricksNo Commentsjfadev

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
17 forks.
71 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
jfadev
https://jordifernandes.com
Programmer and Web Developer since 2006. Graduate in Software Engineering in Marseille 15+ years of experience in Web Technologies.

Twitter

My Tweets

Rencent Posts

  • Display a specific Instagram post in WordPress with Jfa Social Media Post
  • Build a custom image and distribute them to Azure VMSS using GitHub Actions
  • PHP-FPM Process Calculator
  • Jfa PWA Toolkit
  • List of backlinks for SEO
  • Full list backlinks generators for SEO positioning
  • Modal Dialog for Material Design Lite
  • Run Symfony2 command from cronjobs in CPanel on a shared host
  • Detecting AdBlock with jQuery or JavaScript
  • Video: Introduction to Apache Cordova in Spanish

Categories

  • Back-End (5)
  • DevOps (1)
  • Front-End (12)
  • News (8)
  • SEO (2)
  • Tools (6)
  • Tricks (10)
  • Uncategorized (3)

Discover

  • Los Mejores Top 10
  • Slow Fashion Shop
Twitter
LinkedIn
GitHub

© 2013-2022 Jordi Fernandes Alves (@jfadev)