HI Guido,

If you're refering the the backlog param of listen(), this controls how 
many sockets the kernel will establish on your behalf when your accept() 
calls fall behind the incoming connection rate.   E.g. an accept queue. 
 There is a good write up here 
http://veithen.github.io/2014/01/01/how-tcp-backlog-works-in-linux.html.

I need a way to prevent accept() from running so I can actually bump up 
against the listen() backlog and not run out of memory when I get flooded 
with connections.

JM


On Tuesday, October 18, 2016 at 1:20:31 PM UTC-6, Guido van Rossum wrote:
>
> Could you do this by changing listen()? 
>
> On Tue, Oct 18, 2016 at 11:42 AM, Yury Selivanov <yseli...@gmail.com 
> <javascript:>> wrote: 
> > Hi, 
> > 
> > No, I don’t think we have an API for that.  I suppose you can make a PR 
> (or open an issue) at github.com/python/asyncio proposing to add 
> `pause_serving()`/`resume_serving()`.  I’m afraid we aren’t going to add 
> them until 3.7, since Python 3.6 is in feature freeze mode now. 
> > 
> > Yury 
> > 
> >> On Oct 18, 2016, at 2:39 PM, Justin Mayfield <too...@gmail.com 
> <javascript:>> wrote: 
> >> 
> >> Is there a public interface for controlling the connection limit on 
> servers created with `loop.create_server`?  Specifically a way to ~ 
> `remove_reader(_accept_connection)` temporarily. 
> >> 
> >> I've developed a statsd proxy for a client that needs to implement 
> backpressure all the way to the listening socket but I don't see a good way 
> to pause the _accept_connection handler that monitors the listening socket 
> for read events. 
> >> 
> >> I'd be happy to implement my own logic for the back pressure using a 
> public `pause_serving()`/`resume_serving()` API but a simple 
> `max_connections` param to the create_server would suffice too. 
> >> 
> >> Cheers, 
> >> JM 
> > 
>
>
>
> -- 
> --Guido van Rossum (python.org/~guido) 
>

Reply via email to