I can't figure out how to setup Nginx and php-fpm to allow more than 6 concurrent connections from single IP. I have the following simple PHP files (no FW):
<?php
// long-request.php
sleep(15);
—
<?php
// instant-request.php
echo 'Meow World!';
If I open more than 6 browser windows with long-request.php
then instant-request.php
is delayed until window with first long time request is finished. When it happens php-fpm gives me the following status:
pool: www
process manager: ondemand
start time: 28/Jun/2018:23:30:05 +0200
start since: 183
accepted conn: 56
listen queue: 0
max listen queue: 0
listen queue len: 0
idle processes: 0
active processes: 7
total processes: 7
max active processes: 7
max children reached: 0
slow requests: 0
My configuration:
MacOS 10.13.5 (17F77), PHP 7.2.5, nginx/1.13.12
php-fpm.d/www.conf
pm = ondemand
pm.max_children = 100
I tried several configurations. I set pm to static, dynamic, I increased number of *_servers, nothing helped.
edit: Here is the output from /usr/local/var/log/php-fpm.log
(nothing suspicious)
[28-Jun-2018 23:57:07] NOTICE: fpm is running, pid 62887
[28-Jun-2018 23:57:07] NOTICE: ready to handle connections
Best Answer
I found the answer. It was caused by the maximum number of parallel connections allowed by the browser/http protocol. Read the detailed answer at Stackoverflow.