Welcome! Log In Create A New Profile

Advanced

Very obvious but simple PHP-FPM threading question

Posted by Ankur Gupta 
Ankur Gupta
Very obvious but simple PHP-FPM threading question
September 26, 2010 10:20PM
Hi,

I have a bunch of nginx and php-fpm worker threads. I am running a
very simple test with a script doing: <? sleep(20); ?>. I notice that
if I make two requests at the same time, they get serialized on the
php-fpm side and have a twenty second differential. Why would this
happen and the two requests not get processed in parallel when there
are an abundant number of threads? Here are the two requests in the
slow log file and they have a twenty second difference:

Sep 26 19:02:38.177091 pid 13597 (pool default)
script_filename = /var/www/test1/test.php
[0x00000000095b5280] sleep() /var/www/test1/test.php:2

Sep 26 19:02:58.321560 pid 13609 (pool default)
script_filename = /var/www/test1/test.php
[0x000000000942a890] sleep() /var/www/test1/test.php:2

I have 100+ nginx threads
$ ps -afe | grep nginx | wc -l
120

and 150 php-fpm threads
$ ps -afe | grep php-fpm | wc -l
150

Thanks,
Ankur
Re: Very obvious but simple PHP-FPM threading question
September 28, 2010 03:36AM
I think that problem in you brouser, it send all request throw one
connection.

2010/9/27 Ankur Gupta <ankur655@gmail.com>

> Hi,
>
> I have a bunch of nginx and php-fpm worker threads. I am running a
> very simple test with a script doing: <? sleep(20); ?>. I notice that
> if I make two requests at the same time, they get serialized on the
> php-fpm side and have a twenty second differential. Why would this
> happen and the two requests not get processed in parallel when there
> are an abundant number of threads? Here are the two requests in the
> slow log file and they have a twenty second difference:
>
> Sep 26 19:02:38.177091 pid 13597 (pool default)
> script_filename = /var/www/test1/test.php
> [0x00000000095b5280] sleep() /var/www/test1/test.php:2
>
> Sep 26 19:02:58.321560 pid 13609 (pool default)
> script_filename = /var/www/test1/test.php
> [0x000000000942a890] sleep() /var/www/test1/test.php:2
>
> I have 100+ nginx threads
> $ ps -afe | grep nginx | wc -l
> 120
>
> and 150 php-fpm threads
> $ ps -afe | grep php-fpm | wc -l
> 150
>
> Thanks,
> Ankur
>
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 125
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready