May 26, 2018

TCP load balancer written in Python

This is a pure-python TCP load balancer. It takes inbound TCP connections and connects them to one of a number of backend servers.


  • async i/o based, so much less overhead than fork/thread based balancers. Can use either twisted or python’s standard asyncore library twisted is recommended, and asyncore support will be removed in a future version.
  • Multiple scheduling algorithms random, round robin, leastconns, leastconns+roundrobin
  • If a server fails to answer, it’s removed from the pool - the client that failed to connect gets transparently failed over to a new host.
  • XML based configuration file see a sample
  • separate management thread that periodically re-adds failed hosts if they’ve come back up.
  • optional builtin webserver for admin sample of the running screen
  • webserver has methods suitable for both interactive and automated systems

WWW http//