[ejabberd] External Component Load Balancing

Paul Aurich paul at darkrain42.org
Tue Jan 26 19:13:55 MSK 2010


On Jan 26, 2010, at 03:05, Pedro Melo wrote:
> Hi,
> 
> 
> 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).

It's my understanding that the "domain_balancing_component_number" is designed specifically to address this problem with what you described, in that it makes the algorithm stable even if one or more of the components disconnect[s] (of course, this will mean sessions handled by an offline component are just DOWN instead of being handled by a different component).

> 
> 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.
> 
> Bye,


~Paul


More information about the ejabberd mailing list