How nginx define a free worker?

chen cw crk_world at yahoo.com.cn
Fri Nov 23 03:38:06 UTC 2012


1. How nginx define a free worker
    "ngx_accept_disabled = ngx_cycle->connection_n / 8 -
ngx_cycle->free_connection_n;"
    so when the number of free connections is more than the value of
"worker_connections" directive, the worker is free.

2. Will it be doing round robin?

No, it is not RR.
In fact, nginx use the tecnology called  "accept mutax", so only one worker
is listening on the port, others are waiting.
you can refer to "ngx_process_events_and_timers()" for more information.




On Thu, Nov 22, 2012 at 12:51 AM, Vivek Goel <goelvivek2011 at gmail.com>wrote:

> Hi,
> If  I have n cores and I am running n nginx worker process how nginx will
> decide free worker for next connection?
>
>
>    1. Will it be doing round robin?
>
> If it is not using round robin what method it use? Is there a way I can
> force it to use round robin method?
> regards
> Vivek Goel
>
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>



-- 

--

Charles Chen

Software Engineer

Server Platforms Team at Taobao.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20121123/07786ab1/attachment.html>


More information about the nginx-devel mailing list