PHP-FPM performance tuning - bursts of traffic PHP-FPM performance tuning - bursts of traffic laravel laravel

PHP-FPM performance tuning - bursts of traffic


There are too many child processes in relation to the number of cores.

First, you need to know the server status at normal and burst time.

1) Check the number of php-fpm processes.

ps -ef | grep 'php-fpm: pool' | wc -l

2) Check the load average. At 2 cores, 2 or more means that the work's starting delayed.

tophtopglances

3) Depending on the service, we start to adjust from twice the number of cores.

; Example;pm.max_children = 120       ; normal) pool 5, load 0.1 / burst) pool 120, load 5  **Bad**;pm.max_children = 4    ; normal) pool 4, load 0.1 / burst) pool 4, load 1pm.max_children = 8    ; normal) pool 6, load 0.1 / burst) pool 8, load 2  **Good**

load 2 = Maximum Performance 2 cores


It is more accurate to test the web server with a load similar to the actual load through the apache benchmark(ab).

ab -c100 -n10000 http://example.comTime taken for tests:   60.344 secondsRequests per second:    165.72 [#/sec] (mean) 100%    880 (longest request)