Author neologix
Recipients neologix, pitrou, sbt, vstinner
Date 2014-05-13.04:50:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAH_1eM264tKc5nVBHE635qvkNXqS+HgXBp0Lkg_BQxgzEDsxvQ@mail.gmail.com>
In-reply-to <1399931225.03.0.143877159485.issue21455@psf.upfronthosting.co.za>
Content
>> Py_MIN(SOMAXCONN, 128)
>
> On Windows, it's not the best choice to use this hardcoded limit. socket.SOMAXCONN is 2^31-1.

I don't see what this would bring: 128 *is* a reasonable limit.

> listen() documentation says that Windows chooses a reasonable backlog value for you if you pass SOMAXCONN:
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms739168%28v=vs.85%29.aspx
>
> You should maybe use SOMAXCONN by default on Windows, and Py_MIN(SOMAXCONN, 128) by default on other platforms (UNIX).

Trying to come up with a good heuristic is a lost battle, since it
depends not only on the OS but also the application.  The goal is to
have a default value that works, is large enough to avoid connection
drops in common use cases, and not too large to avoid resource
consumption.

> An article suggests to use max(1024, socket.SOMAXCONN) (to "listen() backlog as large as possible")
> instead of socket.SOMAXCONN because the OS maximum can be larger than SOMAXCONN (and that
> it's not possible in Python to get the OS value):

In theory we could use net.core.somaxconn sysctl & Co (that's what go
does), but IMO it's overkill.
History
Date User Action Args
2014-05-13 04:50:45neologixsetrecipients: + neologix, pitrou, vstinner, sbt
2014-05-13 04:50:45neologixlinkissue21455 messages
2014-05-13 04:50:45neologixcreate