[ejabberd] External Component Load Balancing

Pedro Melo melo at simplicidade.org
Tue Jan 26 14:05:19 MSK 2010


2010/1/26 Mickaël Rémond <mickael.remond at process-one.net>:
> It is not possible with XEP 114 for external components because you need a
> unique id per component.

Mickael, yes it is. He is talking about the domain load balancing that
was coded into ejabberd for 2.0 (I believe the code was derived from a
patch for SAPO, we use it to load balance several pymsnt gateways, all
with the same domain.)

As for the original question, it depends. You can do it if you are
careful. If you use

{domain_balancing, "component.example.com", source}.

then all stanzas for client with jid X will end-up in the same
component instance. As long as your query originates in that
component, the answer will arrive at the proper component. Of course
if two or more instances of your component die at the same time, the
order of components might change and all bets are off (my
understanding of the code 3 years ago, it might have changed by now).

Having said that, I would strongly recommend you that you don't code
your solution around this logic. I would recommend that when you send
off the query, store the data needed to process the reply in a
external storage system (even memcached or redis would be enough), and
let any of the components process the reply.

I believe you'll end up with a more robust system all around.

Pedro Melo
xmpp:melo at simplicidade.org
mailto:melo at simplicidade.org

More information about the ejabberd mailing list