[Twisted-Python] Effects of backlog parameter on listenTCP

Itamar Turner-Trauring itamar at itamarst.org
Wed Jul 18 21:19:12 EDT 2012


On 07/18/2012 07:43 PM, Tobias Oberstein wrote:
> Could someone shortly elaborate on the semantics / effect of the parameter "backlog" with listenTCP?
>
> The docs say: "size of the listen queue".
>
> Is that a tunable within Twisted?
>
> I mean, there are kernel parameters for queue sizes of not yet completely TCP handshaked connections and so on. But those are kernel tunables.
>
> What does the "backlog" parameter?
>
> The reason I am asking: I am stress testing a Twisted server and I see client connections denied upon high connection rates .. does the parameter help?
>
It's the parameter passed to the listen(2) system call - from the man page:

        The backlog argument defines the maximum length to which the 
queue of pending connections for sockfd may grow.  If a connection 
request arrives  when  the
        queue  is full, the client may receive an error with an 
indication of ECONNREFUSED or, if the underlying protocol supports 
retransmission, the request may
        be ignored so that a later reattempt at connection succeeds.

So, yes, higher values will prevent connection refused.




More information about the Twisted-Python mailing list