• Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / nginx server tutorials (installation, configuration, performance tuning, security) / php fpm ondemand vs dynamic vs Static (the dynamic pool problem)

php fpm ondemand vs dynamic vs Static (the dynamic pool problem)

Table of Contents

Toggle
  • php fpm ondemand vs dynamic vs static
  • php fpm ondemand configuration and settings
  • The php dynamic Pool Problem (idle process)
  • php fpm ondemand vs dynamic memory problem
  • php dynamic pool problem www busy process restarting bye
    • php fpm restarts when it busy
  • php fpm ondemand hassle free but some low performance
  • php fpm dynamic configuration formula but not a rule
  • php fpm pm = static
  • When Should use Php fpm Static
  • Dig: How php fpm dynamically allocated php fpm processes
  • Php memory high memory usage problem with dynamic or static

php fpm ondemand vs dynamic vs static

ondemand: creates process based on demand and up to limit of max children
dynamic: dynamically floats minimum and maximum limits sets by user.

php fpm ondemand configuration and settings

pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 10s
pm.max_requests = 500
pm.max_children = number of max php processes alive at a time concurrent.
pm.process_idle_timeout: aftet 10s idle time php process will be killed and and memory will be freed.  increase if you have no memory issues.
pm.max_requests: number of request one php process will process before its killing or dying or respawning.
PHP-FPM is always set to the max capacity of your server’s resources regardless of current traffic. Idle process stay online waiting for traffic spikes and responding immediately,
nano /etc/php/7.0/fpm/pool.d/www.conf
https://ma.ttias.be/a-better-way-to-run-php-fpm/
pm.start_servers = 3). If you’re on a low-traffic site, that could very well be overkill.
Those 3 processes will always be running, whether they’re needed or not.
high traffic sites: dynamic is best they are ready to server without spawned first.
separate fpm pool managers are better

The php dynamic Pool Problem (idle process)

pool:                 www
process manager:      dynamic
start time:           04/Aug/2021:04:28:47 +0000
start since:          470621
accepted conn:        205650
listen queue:         0
max listen queue:     3
listen queue len:     65536
idle processes:       48
active processes:     2
total processes:      50
max active processes: 46
max children reached: 0
slow requests:        0


php fpm ondemand vs dynamic memory problem

on demand = no memory allocation but delay of spawning process for connection.
dynamic: memory allocated for each process or server (upto max_memory_limit =128MB for each process) average maybe 40MB for idle.
ex: min start servers 5,  min spare servers 2 max spareservers 10
Setting
Value
max_children
100
start_servers
32
min_spare_servers
16
max_spare_servers
32

max 100*40=4000MB 4GB average

100*128MB(max) = 12800MB 12GB max

max children to>> max spare servers, max_spare servers to >> min_spare_servers  (

when will php dynamic pool reaches max_spare servers to min_spare_servers?

 

php dynamic pool problem www busy process restarting bye

when max spare servers reaches this message appears and the php fpm will restart. but there is a variable pm.max children still not reacched

and the emergency restart threshold also not enabled.

php fpm restarts when it busy

WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 6 idle, and 140 total children

Case 2:WARNING: [pool www] server reached pm.max_children setting (150), consider raising it

in case2 restart is ok, but why process existing bye bye in pool www busy situation.

 

php fpm ondemand hassle free but some low performance

minimum idle process: 12
max idle Processes: 151  (default to mysql max concurrent connections)
 max children processes = 200
php_max memory limit = 256MB (128 64 etc)  my case 256 due to sitemap timeout when google bot accessing (5000 links per sitemap) heavy
I have to switch back 128MB and split sitemap into 500 per file.
The problem:  1 active 50 Idle process
50*256=12800MB means 128GB
But case average 100MB per process
4GB out of 8GB occupying by php-fpm
3278M by mysql
htop command php fpm eqach 200+MB

php fpm dynamic configuration formula but not a rule

Setting
Value
max_children
100
start_servers
32
min_spare_servers
16
max_spare_servers
32

php fpm pm = static

Static = fixed number of processes  (memory occupies).
pm.max_children = 100
only above variable applies remaining nothing.
100 Processes are live and occupies average process memory regardless of connection / request.
faster no need to spawn while the incoming connection accepted.

When Should use Php fpm Static

There is a constant traffic >>  always below to the 100 or 1000 child processes.

Memory = average and php max memory limit

50MB Each or 20MB at Low 128MB (php limt) at high.
100*50MB =5Gb Need to dedicated for php-fpm regardless of traffic.

Dig: How php fpm dynamically allocated php fpm processes

Ans: based on, minimum and max spare servers. further and how.
why 50 idle process and 1 active.. 
the formula maybe e 30% max idle when cpu load.. \
php – fpm busy and restart when max idle servers reaches.
mysql also occurring  mysql memory allocation

Php memory high memory usage problem with dynamic or static

php max memory limit: 256MB in php.ini

Average memory limit: 50MB but it may go upto 256MB.

start servers+ idle server = 30process

30*50=1500MB in idle mode in dynamic

30*256=7680MB possible usage in attack mode or other cases.

 

> try opcache to store php files in memory.

 

service php7.0-fpm reload

nginx server tutorials (installation, configuration, performance tuning, security)

  • Letsencrypt SSL Installation on apache/Nginx ubuntu / debian wordpress
  • fix error 520 522 524 on cloudflare wordpress godaddy nginx etc
  • nginx fastcgi cache wordpress how to configure
  • install LEMP Stack on 22.04 LTS Nginx MySQL PHP fpm #wordpress #digital ocean
  • Apache vs nginx (connection handling, modules, memory usage)
  • Pagespeed module install, configure, monitor, errors ft nginx &apache
  • nginx errors (504,502, 413, unable to start, syntax errors)
  • nginx conf explained best config file performance tuning tips nginx.conf location errors tutorial
  • use nginx as reverse proxy and load balancer for apache wordpress
  • nginx rewrite rules with examples 301 redirection
  • nginx modules list (enable, disable, upgrade, install dynamic module)
  • php fpm pool manager configuration settings based on server spike high cpu wordpress
  • php fpm restart nginx ubuntu enable status page, monitor etc
  • what is TTFB & how to Reduce it (server response time) Google pagespeed
  • letsencrypt install configure on ubuntu / debian nginx
  • Top 10 tips to improve nginx server security
  • nginx performance tuning connections, buffers file descriptors
  • enable brotli compression nginx brotli vs gzip
  • nginx installation on ubuntu 20.04 LTS
  • monitor nginx request with nginx status amplify datadog new relic
  • SSL faster reduce TLS hand shake improve https performance
  • nginx rate limiting explained by location time specific url
  • datadog nginx integration installation process
  • newrelic nginx integration process and errors fix and metrics
  • php fpm seems busy fixed warning and max children reached to handle max connections / requests
  • Php fpm configuration for 1000 concurrent connections server busy max children reached
  • php fpm ondemand vs dynamic vs Static (the dynamic pool problem)
  • nginx upstream response is buffered to a temporary file
  • php fpm install ubuntu 20.04 nginx
  • install phpmyadmin ubuntu nginx 22.04
  • upgrade php fpm ubuntu nginx 7.4 to 8.2
  • nginx add last modified header (remove, php wordpress)
  • php fpm dynamic pool manager settings
  • nginx fastcgi cache purge
  • nginx open file limit connections ulimits sysctl
  • php fpm high cpu usage WordPress 4 solutions nay work for you
  • nginx buffer size for wordpress
  • Cloudflare error code 524 nginx a timeout error occured
  • server configuration for 1000 concurrent users

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy