DJabberd::Plugin::Balancer (Was: Re: XMPP Perlbal-like
daniel at ruoso.com
Wed Apr 9 19:28:03 UTC 2008
Qua, 2008-04-09 às 17:54 +0100, Daniel Ruoso escreveu:
> Qua, 2008-04-09 às 15:04 +0100, Daniel Ruoso escreveu:
> > The idea is pretty simple, the component registers itself in some
> > server, and accepts connection from clients, allowing a JID to
> > more than once, and then dispatch the incoming messages to the
> > grouped by the jid, doing a job very similar to the one done by
> After some more code browsing, I think I found out where to implement
> that feature, it seems that I just have to create a VHost subclass
> overrides register_jid, find_jid and unregister_jid.
> I can do a simple trick of registering the jid with a postfix of, for
> instance, '#'.$sock, and keep a HoA with the full jid and all
> connections for that jid. In find_jid it's then just a matter of
> choosing which $sock to return.
I've just saw that the server might actually reply a different JID than
the user had requested. That way, the client will actually have a JID
with the sufix, but the server will keep track of which clients tried to
connect to the original resource and load balance based on that.
I'll be implementing DJabberd::Plugin::Balancer that will re-bless the
vhost with a subclass that takes care of that.
BTW... for the moment, the load balancing will be round-robin. While the
Perlbal concept of delivering to whatever backend is available is cool,
this is not possible for XMPP because the backend job is asynchronous.
More information about the Djabberd