This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: asyncio accepting connection limit
Type: behavior Stage:
Components: asyncio Versions: Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, lguo, yselivanov
Priority: normal Keywords:

Created on 2018-06-08 22:53 by lguo, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg319116 - (view) Author: Lisa Guo (lguo) Date: 2018-06-08 22:53 describes a situation where accept rate of connection is too slow for use cases where spikes of incoming connection warrants fast accept. The fix for that was to accept socket connection in a tight loop until it reaches "backlog" connections.

This doesn't work very well in a web server scenario where we have many processes listening on the same socket. Each process should not accept up to "backlog" connections, for better load balancing among processes. It would be ideal if this is a separate argument for the server configuration so that the application can decide up to how many connections it is willing to accept in the loop, independent of the backlog parameter for listen() system call.

Let me know if this makes sense.

msg319119 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-06-08 23:57
In principle this sounds good, but I'm not sure how the API and implementation would look like. Maybe you can share a bit more details?
msg319189 - (view) Author: Lisa Guo (lguo) Date: 2018-06-10 00:11
One rough idea would be like this: Another option is to associate it with the loop:


and then later

self._loop._start_serving(....., max_accept=self._loop._max_accept)
Date User Action Args
2022-04-11 14:59:01adminsetgithub: 77992
2018-06-10 00:11:37lguosetmessages: + msg319189
2018-06-08 23:57:20yselivanovsetnosy: + asvetlov, yselivanov
messages: + msg319119
components: + asyncio
2018-06-08 22:53:47lguocreate