[Kamailio-Devel] [Kamailio-Users] Dispatcher hash algorithms.

Alex Balashov abalashov at evaristesys.com
Tue Sep 30 07:17:55 CEST 2008


Daniel,

Daniel-Constantin Mierla wrote:

> 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 :-)

I understand the concept of same keys hashing to the same values.  :-) 
If one hashes a value that stays consistent within a dialog, then all 
requests within that dialog will go to the same place (and not just the 
transaction, which is the only thing TM is good for).  If one hashes a 
value that's going to always be the same for a given user (such as a 
 From URI), they will always be directed to the same gateway, etc.

What I still don't understand is what benefit this deterministic domain 
of values - this sameness - confers from a practical perspective.  Yes, 
I know that if I hash the From URI, the caller will be sent to the same 
server, but, which server?  Clearly, the answer is, "Whichever server 
their From URI hashes to."  Sure.  But what particular usefulness does 
that have, whether one is doing stateful or stateless processing?

Obviously, using a hash is more elegant and simple than statically 
assigning my users various bindings, as you point out in examples like 
"good to send calls to the same location server as the registration 
server for that user."  But still, I am brought to ask - without having 
some means of determining exactly what that server will be, what's the 
advantage?  It's obviously not load balancing, unless I know that my 
 From URIs are going to have a certain desirable distribution when 
hashed, which I don't.  Just keeping certain paths the same is nice, of 
course, but I fail to see how it's actually useful.

Sure, it's great if my registrants always go to the same location 
server, but if 90% of my users end up going to one location server 
because of the distribution that the variance of their From URIs 
provides, what does this really give me except a predictable route? 
It's not as if I can use the hash to "find" a user's location server -- 
unless the location server was determined using the same hash also. 
What's the point?

-- Alex

-- 
Alex Balashov
Evariste Systems
Web    : http://www.evaristesys.com/
Tel    : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599



More information about the Devel mailing list