[OpenSIPS-Users] dispatcher problem
    Matt Hamilton 
    mistral9999 at hotmail.com
       
    Fri Feb  3 15:53:37 CET 2012
    
    
  
Hi Vlad,
We have many locations with 5-10 phones each. We use applications that require us to keep track of device states continuously for each location. We would prefer to have each location handled by the same Asterisk server both for incoming and outbound calls including registrations and subscriptions. It's more scalable and cleaner this way. If that server goes down, the whole location traffic as a whole moves to the next available server. That's why I need more control over dispatching.
Anyway, instead of using "061002", "061003", "061005", "061006", "061007", "061008", if I use "1", "2", "3", "4", "5", "6", I get a much reasonable distribution (at least for 6 locations I use for testing). For 50+ locations, the results might be different of course.
Thanks,
Matt
Date: Fri, 3 Feb 2012 12:50:25 +0200
From: vladpaiu at opensips.org
To: users at lists.opensips.org
Subject: Re: [OpenSIPS-Users] dispatcher problem
  
    
  
  
    Hi Matt,
    
    If you want good distribution, why don't you use instead the
    round-robin or the random dispatcher algorithms? 
    
    [1] http://www.opensips.org/html/docs/modules/devel/dispatcher.html#id293072
    
    Regards,
    -- 
Vlad Paiu
OpenSIPS Developer
http://opensips-solutions.org/
    
    Pe 2/3/2012 2:59 AM, Matt Hamilton a scris:
    
      
      
        Hi Răzvan,
I don't assign any weights, and I use the dispatcher.list file:
        1 sip:x.x.x.11:5060
        1 sip:x.x.x.12:5060
        1 sip:x.x.x.13:5060
        
        
          When there are only 2 servers in that file, I always get:
        
        DBG:dispatcher:ds_select_dst: alg hash [1], id [1] and dispatcher selects the 2nd entry.
        
        When there are 3 servers - when the dispatcher distributes to
        all 3 servers, I get
        
        
        DBG:dispatcher:ds_select_dst:
          alg hash [0], id [0] 
          before it dispatches to server1 (x.x.x.11)
        DBG:dispatcher:ds_select_dst: alg hash [1], id [1] for x.x.x.12
        DBG:dispatcher:ds_select_dst: alg
          hash [2], id [2] for x.x.x.13
        
        
        
        Anyway I did some more tests, and it turns out that the hash
        algorithm is very sensitive to the PV. 
        
        1. when the input hash_pvar is from this set (my original set
        that gave me problems): "061002"  "061003"  "061005"  "061006" 
        "61007"  "061008"
        Dispatcher splits them:
        Server1: 0
        server2: 6
        
        2. if I add a 1 in front of my hash PV - so that the new values
        are 1"061002", etc.  (indentation mark is part of the string)
        Server1: 2
        Server2: 4
        
        3. If I add another character, so that PVs look like x1"061002"
        Server1: 3
        Server2: 3
        
        3-3 or 2-4 split is OK of course, but the 0-6 split threw me
        off. Is there a "safe" PV (integers, certain combinations, etc.)
        that I can use that will give me the best distribution? I can
        use a lookup table (like dialplan) to get those.
        
        Thanks,
        Matt
        
        
        
        
        
        
        
        
        
          Date: Fri, 3 Feb 2012 00:36:37 +0200
          From: razvancrainea at opensips.org
          To: users at lists.opensips.org
          Subject: Re: [OpenSIPS-Users] dispatcher problem
          
          
          
          Hi, Matt!
          
          So for different hashed strings like:
          DBG:dispatcher:ds_hash_pvar: Hashing "061002"!
          you always get the same output:
          DBG:dispatcher:ds_select_dst: alg hash [1], id [1]
          
          Also, are you assigning different weights for any of the
          Asterisk?
          
          Regards,
          -- 
Răzvan Crainea
OpenSIPS Developer
http://opensips-solutions.org/
          
          
          On 02/03/2012 12:16 AM, Matt Hamilton wrote:
          
            
            
              Hi Răzvan,
Yes, I'm using the same hashing values - the values I assign to the PV are also 
passed to the ds_select_dst correctly as far as I can see. Here is a typical
debug output:
DBG:dispatcher:ds_hash_pvar: Hashing "061002"!
DBG:dispatcher:ds_select_dst: alg hash [1], id [1]
DBG:dispatcher:ds_select_dst: selected [7-1/1] <sip:x.x.x.13:5060>
DBG:dispatcher:ds_select_dst: using entry [1/0]
I ran some test with 3 Asterisk servers with interesting results:
With 3 Asterisk servers specified in dispatcher.list, here is the distribution:
Server1: 061003
Server2: 061002, 061007, 061008
Server3: 061005, 061006
With only Server1 and Server2 specified in dispatcher.list:
Server1: 
Server2: 061002, 061003, 061005, 061006, 61007, 061008
Likewise, with Server1 and Server3, Server3 gets everything.        
          with Server2 and Server3, Server3 gets everything.
Is there anything I can do to fix this (somehow trick the function assuming the way I do is the correct way)?
Thanks,
Matt
 
              
              
              
                Date: Thu, 2 Feb 2012 22:51:46
                +0200
                From: razvancrainea at opensips.org
                To: users at lists.opensips.org
                Subject: Re: [OpenSIPS-Users] dispatcher problem
                
                Hi, Matt!
                
                Are you sure you are not using the same hashing value
                all the time?
                If yes, can you increase your debugging level to 6 and
                provide more information? I would be looking in the
                opensips log for lines that contain the following
                strings: "ds_hash_pvar: Hashing " and "ds_select_dst:
                alg hash ".
                
                Regards,
                -- 
Răzvan Crainea
OpenSIPS Developer
http://opensips-solutions.org/
                
                
                On 02/02/2012 10:15 PM, Matt Hamilton wrote:
                
                  
                   Hi,
                    
                    I'm using Opensips to dispatch to 2 servers -
                    serverA, serverB. When one of the servers is down,
                    Opensips is dispatching to the active one correctly.
                    However, when both of them are Active, it's picking
                    only one of them and ignoring the other; e.g.,
                    
                    when serverB is down, dispatches to serverA
                    when serverA is down, dispatches to serverB
                    when both up, dispatches to serverB
                    while dispatching to serverA when serverB is down,
                    if I activate serverB, all requests dispatched to
                    serverB  
                    
                    
                    Here is my code:
                    
                    modparam("dispatcher", "hash_pvar", "$avp(75)")
                    
                    
                    in the script, I'm setting $avp(75) to one of the
                    following "061002", "061003", "061004", "061005",
                    "061006" just before calling ds_select_dst.
                    
                    $avp(75)=..
                    ds_select_dst("1", "7");
                    
                    Any ideas why this is happening?
                    
                    Regards,
                    Matt
                  
                  
                  
                  
                  _______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
                
                
                _______________________________________________ Users
                mailing list Users at lists.opensips.org
                http://lists.opensips.org/cgi-bin/mailman/listinfo/users
            
            
            
            
            _______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
          
          
          _______________________________________________
          Users mailing list
          Users at lists.opensips.org
          http://lists.opensips.org/cgi-bin/mailman/listinfo/users
      
      
      
      
      _______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
    
    
  
_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20120203/126184dd/attachment-0001.htm>
    
    
More information about the Users
mailing list