This is a pure-python TCP load balancer. It takes inbound TCP connections and connects them to one of a number of backend servers.
Advantages of pythondirector:
class LeastConnsScheduler(BaseScheduler): schedulerName = "leastconns" counter = 0 def nextHost(self, client_addr): if not self.openconns.keys(): return None hosts = [ (x,x) for x in self.openconns.items() ] hosts.sort() return hosts
Availability: right now, available either via CVS from the sourceforge project page (link in footer), or as a distutils-installable package from the 'Files' page. Current version is 0.0.7, released 10th October 2003.
Status: the core of the system is complete and working. The admin interface is still being completed, but is mostly done. The system has been in fairly heavy production use for well over 12 months, balancing both HTTP and FastCGI connections.
Requirements: Python 2.1 or later. It should work on pretty much any platform, but has only been tested on Solaris and Linux to date. The default mode needs Twisted - it's been tested with versions 1.0.0, 1.0.3 and 1.0.4. Python 2.2 seems to be about 10% slower than Python 2.3, while Python 2.1 is nearly 25% slower than Python 2.2.
Installation: Unpack the distribution, run
python setup.py installThen create a config.xml file, and run
pydir.py myconf.xmlEasy. Well, ok, it'd be easier if there was more documentation of the config XML format. For now, have a look at the confex.xml sample in the distribution.
This software is covered by the following license:
Copyright (c) 2002-2003 ekit.com Inc (http://www.ekit-inc.com/) and Anthony Baxter (email@example.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.