Why nginx just use 511 for listen backlog

I found that :

#define NGX_LISTEN_BACKLOG 511

and use it as the backlog of listen()

ls.backlog = NGX_LISTEN_BACKLOG;
if (listen(s, ls.backlog) == -1) {

Does it mean that only 511 connection could be accept at the same time
?
May I modify it to 1024 or higher( I am sure use it less than
SOMAXCONN )

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,9959,9959#msg-9959

On Tue, Sep 29, 2009 at 11:32:32AM -0400, zhijianpeng wrote:

I found that :

#define NGX_LISTEN_BACKLOG 511

and use it as the backlog of listen()

ls.backlog = NGX_LISTEN_BACKLOG;
if (listen(s, ls.backlog) == -1) {

Does it mean that only 511 connection could be accept at the same time ?

No, it means that up to 511 connections can be queued in kernel listen
queue. 511 is just a safe limit for the most OSes. For FreeBSD it’s -1,
i.e., value of sysctl kern.ipc.somaxconn.

May I modify it to 1024 or higher( I am sure use it less than SOMAXCONN )

 listen  80  default  backlog=1024;

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs