Simple threading question

Splitice mat999 at gmail.com
Mon Sep 27 19:47:48 MSD 2010


Ian, nice pickup never conidered session locking.

Another soln, dont start a session on the blocking page if it is not  
needed.

Sent from my iPod

On 27/09/2010, at 9:59 PM, Ian Hobson <ian at ianhobson.co.uk> wrote:

> On 27/09/2010 07:05, Ankur Gupta wrote:
>> 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 (from the same IP address),  
>> 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?
>
> This is a feature of PHP.
>
> It carefully sequences the accesses so that only one thread at a  
> time can access the session variables.
>
> You can call session_write_close() after you have updated all your  
> session variables, to tell php you are done with the session and it  
> will release any waiting thread.
>
> If nginx is serving static content, these serves will not be effected.
>
> Regards
>
> Ian
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list