tornado icon indicating copy to clipboard operation
tornado copied to clipboard

Max server connections

Open bwhooley opened this issue 5 years ago • 3 comments

Do tornado HTTPServers support the notion of max connections? In my use case, I would like the server to stop taking connections once we hit some limit (say 100 users). Then resume once connections drop out.

Barring this, is there a recommended way to know how many connections currently exist? I can add a counter to the RequestHandlers but am wondering if there's a canonical method.

Thank you!

bwhooley avatar May 13 '20 18:05 bwhooley

Maybe tornado.httpserver.HTTPServer.bind(backlog=100) helps?

spaceone avatar Nov 03 '20 12:11 spaceone

No, there is not currently any support for either limiting or observing the number of connections. (This is one of the main reasons why I recommend using a load balancer/proxy in production instead of exposing Tornado directly to the internet)

bdarnell avatar Nov 06 '20 00:11 bdarnell

The backlog option doesn't help here - that limit only applies to connections that are in a certain early phase of the TCP handshake.

bdarnell avatar Nov 06 '20 00:11 bdarnell