[Kamailio-Users] Dispatcher hash algorithms.

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 29 13:36:23 CEST 2008



On 09/29/08 14:22, Alex Balashov wrote:
> samuel wrote:
>   
>> The Call-ID hash is used to send all requests of the same dialog to the 
>> same endpoint (proxy,application server,gateway,whatever...).  The 
>> reason after this behaviour is not to have these SIP endpoints sharing 
>> the status of all the dialogs (not many applications out there share 
>> this status and therefore you are required to send all within-dialog 
>> messages to the same SIP instance).
>>
>> simple: to send the BYE to the same gateway you sent the INVITE...
>>
>> This does not guarantee fare load distribution....that's why depending 
>> on what you are dispatching you can hash on several headers (if you 
>> don't have to keep dialog state,...)
>>     
>
> Yes, but is that not a relatively minor use case that applies to 
> situations in which stateful transaction forwarding (TM module) is not 
> used?
>
> Meaning, if I t_relay() an INVITE to a gateway selected by dispatcher, 
> subsequent provisional responses and in-dialog requests will be passed 
> between the original endpoints without further intervention.
>
> If it didn't work that way, round-robin and random wouldn't work as 
> algorithms because the next message would be sent to another server.
>
> So, stateless forwarding aside (why would you want to do that in a 
> dispatcher load balancing or failover scenario?), why do these hash 
> algorithms make any sense to use?
>   
There are use cases even when doing stateful processing. So:
- hash over call id - it is fast, good distribution, can be used for 
calls to be sent to gateways, etc, works for stateless processing as well
- hash over from uri - caller is sent to same server, good for cdr 
collection, authentication, etc
- hash over to uri - good to send registrations for a user to same 
location server
- hash over r-uri - good to send calls to same location server as the 
registration server for that user

Using a farm of servers, grouped by users, by combining the last three 
you can route the sip messages inside your network to get auth, acc and 
location services ok, and the first one to send to gateways :-)

Cheers,
Daniel


-- 
Daniel-Constantin Mierla
http://www.asipto.com





More information about the Users mailing list