Charles-François Natali added the comment: >> 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21455> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com