[Twisted-Python] Returning a deferred from buildProtocol t.i.p.Factory
L. Daniel Burr
ldanielburr at me.com
Sat Nov 16 09:21:53 MST 2013
Hi Tom,
On 11/16/13 8:09 AM, Tom van Neerijnen wrote:
> Hi all
>
> I'm building a simple TCP load balancer based on a code snippet from
> Glyph on SO:
> http://stackoverflow.com/questions/4096061/general-question-regarding-wether-or-not-use-twisted-in-tcp-proxy-project
>
> It's served me well but I can't work out how to convert Glyphs round
> robin retrieval of the server endpoint into an async balancing
> decision in the buildProtocol method of the Factory. If I return a
> deferred here it fails with an AttributeError: Deferred instance has
> no attribute 'makeConnection'.
[SNIP]
Have you considered using https://pypi.python.org/pypi/txLoadBalancer as
the basis for your load-balancer? It supports random, round-robin,
least-connections, and weighted, so perhaps it would suit your needs.
Hope this helps,
L. Daniel Burr
More information about the Twisted-Python
mailing list