Tuesday, September 6, 2022

How to Calculate a Perfect PHP-FPM Configuration

How Calculate php-fpm max-children

To be safe though, I’ll reserve 1 GiB for all other processes and round up php process size to 55MiB.


maxclients = (Total RAM - Memory used for Linux, DB, etc.) / process size

maxclients = (16384MB - 2400MB) / 55MB = 256


In the /etc/php/7.1/fpm/pool.d/www.conf change the following settings:


pm = dynamic            

pm.max_children         (total RAM - (DB etc) / process size)

pm.start_servers        (cpu cores * 4)

pm.min_spare_servers    (cpu cores * 2)

pm.max_spare_servers    (cpu cores * 4)

pm.max_requests         1000

0 comments:

Post a Comment