[issue38699] socket: change listen() default backlog from 128 to 4096?

2020-02-07 Thread STINNER Victor
STINNER Victor added the comment: There is no clear consensus to change socket.listen() default backlog, so I close the issue. > Anyway asyncio at least should probably update its default. If someone cares, please open a separated issue ;-) > To be clear: I do still think that using a

[issue38699] socket: change listen() default backlog from 128 to 4096?

2019-12-09 Thread Nathaniel Smith
Nathaniel Smith added the comment: Yeah, I don't think it matters that much. There are lots of random gotchas that you have to watch out for using the socket module. To be clear: I do still think that using a large value by default, and clamping user input values at 65535, would be

[issue38699] socket: change listen() default backlog from 128 to 4096?

2019-12-09 Thread STINNER Victor
STINNER Victor added the comment: gunicorn, tornado, uwsgi, trio are specialized use cases which expect high concurrency. Maybe a tradeoff may be to document the default and suggest different values depending on the use cases, and/or to point to documentation. --

[issue38699] socket: change listen() default backlog from 128 to 4096?

2019-12-09 Thread STINNER Victor
STINNER Victor added the comment: > https://github.com/python-trio/trio/blob/master/trio/_highlevel_open_tcp_listeners.py Extract: # A large backlog can also use a bit more kernel memory, but this seems fairly # negligible these days. That's the main question here. Python is used on various

[issue38699] socket: change listen() default backlog from 128 to 4096?

2019-12-06 Thread Nathaniel Smith
Nathaniel Smith added the comment: Another subtlety that that code handles, and that the stdlib socket module might also want to handle: if the user passes in a custom backlog argument that's >65535, then we silently replace it with 66535 before passing it to the system. The reason is that

[issue38699] socket: change listen() default backlog from 128 to 4096?

2019-12-06 Thread Nathaniel Smith
Nathaniel Smith added the comment: Trio uses 65535 as the default backlog argument. There's a big comment here explaining why: https://github.com/python-trio/trio/blob/master/trio/_highlevel_open_tcp_listeners.py This doesn't actually set the backlog to 65635; instead it tells the kernel to

[issue38699] socket: change listen() default backlog from 128 to 4096?

2019-12-06 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +njs, yselivanov ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38699] socket: change listen() default backlog from 128 to 4096?

2019-11-05 Thread Ammar Askar
Ammar Askar added the comment: Just for some more reference points from "production" python web servers: * gunicorn - 2048 (https://github.com/benoitc/gunicorn/blob/678b326dc030b450717ec505df69863dcd6fb716/docs/source/settings.rst#backlog) * tornado - 128

[issue38699] socket: change listen() default backlog from 128 to 4096?

2019-11-05 Thread STINNER Victor
STINNER Victor added the comment: > I just saw an article suggesting to use 4096 instead: In fact, it's a change in the Linux kernel directly proposed by Eric Dumazet (Google) for Linux kernel 5.5: https://lore.kernel.org/netdev/20191030163620.140387-1-eduma...@google.com/ The change has

[issue38699] socket: change listen() default backlog from 128 to 4096?

2019-11-05 Thread STINNER Victor
New submission from STINNER Victor : Currently, socket.socket.listen() called with no argument limits the default backlog to 128: /* We try to choose a default backlog high enough to avoid connection drops * for common workloads, yet not too high to limit resource usage. */ int