load balancing for tornado.httpserver.HTTPServer.start(num_processes=...)

158 views
Skip to first unread message

Roman S

unread,
Jun 19, 2018, 5:59:05 AM6/19/18
to Tornado Web Server
Hi all,

was wondering if there is any load balancing between processes when the server was started like


def run_app():
    app
= make_app()
    http_server
= tornado.httpserver.HTTPServer(app)
    http_server
.listen(PORT)
    http_server
.start(num_processes=0)
    tornado
.ioloop.IOLoop.current().start()

I do some heavy computation in each of processes... Thereby each process has additionally threads pool for to share memory inside of the process.
Would be interesting how requests are balanced when some of processes are fully busy.

thx,
r

Ben Darnell

unread,
Jun 27, 2018, 10:29:01 PM6/27/18
to python-...@googlegroups.com
In this mode of operation, load balancing is handled entirely by the kernel. There should be a feedback mechanism in that idle processes will pick up more new connections than busy processes, but this doesn't lead to balanced load in practice (I've seen the most loaded process have twice as many connections as the least loaded). If you care about balancing the load between processes, you probably need a more intelligent load balancer (maybe haproxy or nginx) instead of relying on the kernel's shared-port multiprocessing features. 

-Ben

--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages