<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Matt,<br>
    <br>
    If you want good distribution, why don't you use instead the
    round-robin or the random dispatcher algorithms? <br>
    <br>
    [1] <a
href="http://www.opensips.org/html/docs/modules/devel/dispatcher.html#id293072">http://www.opensips.org/html/docs/modules/devel/dispatcher.html#id293072</a><br>
    <br>
    Regards,<br>
    <pre class="ecxmoz-signature">-- 
Vlad Paiu
OpenSIPS Developer
<a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://opensips-solutions.org/" target="_blank">http://opensips-solutions.org/</a></pre>
    <br>
    Pe 2/3/2012 2:59 AM, Matt Hamilton a scris:
    <blockquote cite="mid:BAY170-W131E441A43A3A0418D82E04B3710@phx.gbl"
      type="cite">
      <style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
      <div dir="ltr">
        <pre class="ecxmoz-signature"><font style="" face="Arial">Hi R&#259;zvan,

I don't assign any weights, and I use the dispatcher.list file:
</font></pre>
        <font style="" face="Arial">1 <a class="moz-txt-link-freetext" href="sip:x.x.x.11:5060">sip:x.x.x.11:5060</a></font><font
          style="" face="Arial"><br>
        </font><font style="" face="Arial">1 <a class="moz-txt-link-freetext" href="sip:x.x.x.12:5060">sip:x.x.x.12:5060</a></font><font
          style="" face="Arial"><br>
        </font><font style="" face="Arial">1 <a class="moz-txt-link-freetext" href="sip:x.x.x.13:5060">sip:x.x.x.13:5060</a></font><font
          style="" face="Arial"><br>
        </font><font style="" face="Arial"><br>
        </font><font style="" face="Arial"><br>
          When there are only 2 servers in that file, I always get:<br>
        </font>
        <pre class="ecxmoz-signature"><font style="" face="Arial">DBG:dispatcher:ds_select_dst: alg hash [1], id [1] and dispatcher selects the 2nd entry.</font></pre>
        <br>
        When there are 3 servers - when the dispatcher distributes to
        all 3 servers, I get<br>
        <font style="" face="Arial"><br>
        </font><font style="" face="Arial"><br>
        </font><font style="" face="Arial">DBG:dispatcher:ds_select_dst:
          alg hash [0], id [0]</font><font style="" face="Arial">&nbsp;
          before it dispatches to server1 (x.x.x.11)</font><br>
        <pre class="ecxmoz-signature"><font style="" face="Arial">DBG:dispatcher:ds_select_dst: alg hash [1], id [1] for x.x.x.12</font></pre>
        <font style="" face="Arial">DBG:dispatcher:ds_select_dst: alg
          hash [2], id [2]</font> for x.x.x.13<br>
        <br>
        <br>
        <br>
        Anyway I did some more tests, and it turns out that the hash
        algorithm is very sensitive to the PV. <br>
        <br>
        1. when the input hash_pvar is from this set (my original set
        that gave me problems): "061002"&nbsp; "061003"&nbsp; "061005"&nbsp; "061006"&nbsp;
        "61007"&nbsp; "061008"<br>
        Dispatcher splits them:<br>
        Server1: 0<br>
        server2: 6<br>
        <br>
        2. if I add a 1 in front of my hash PV - so that the new values
        are 1"061002", etc.&nbsp; (indentation mark is part of the string)<br>
        Server1: 2<br>
        Server2: 4<br>
        <br>
        3. If I add another character, so that PVs look like x1"061002"<br>
        Server1: 3<br>
        Server2: 3<br>
        <br>
        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.<br>
        <br>
        Thanks,<br>
        Matt<br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <div>
          <hr id="stopSpelling">Date: Fri, 3 Feb 2012 00:36:37 +0200<br>
          From: <a class="moz-txt-link-abbreviated" href="mailto:razvancrainea@opensips.org">razvancrainea@opensips.org</a><br>
          To: <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
          Subject: Re: [OpenSIPS-Users] dispatcher problem<br>
          <br>
          <meta http-equiv="Content-Type" content="text/html;
            charset=ISO-8859-1">
          <meta name="Generator" content="Microsoft SafeHTML">
          Hi, Matt!<br>
          <br>
          So for different hashed strings like:<br>
          <pre class="ecxmoz-signature">DBG:dispatcher:ds_hash_pvar: Hashing "061002"!</pre>
          you always get the same output:<br>
          <pre class="ecxmoz-signature">DBG:dispatcher:ds_select_dst: alg hash [1], id [1]</pre>
          <br>
          Also, are you assigning different weights for any of the
          Asterisk?<br>
          <br>
          Regards,<br>
          <pre class="ecxmoz-signature">-- 
R&#259;zvan Crainea
OpenSIPS Developer
<a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://opensips-solutions.org/" target="_blank">http://opensips-solutions.org/</a></pre>
          <br>
          <br>
          On 02/03/2012 12:16 AM, Matt Hamilton wrote:
          <blockquote
            cite="mid:BAY170-W101531F8659E2307ACFA171B3700@phx.gbl">
            <style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}

</style>
            <div dir="ltr">
              <pre class="ecxmoz-signature">Hi R&#259;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] <a class="moz-txt-link-rfc2396E" href="sip:x.x.x.13:5060">&lt;sip:x.x.x.13:5060&gt;</a>
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

 



</pre>
              <br>
              <br>
              <div>
                <hr id="ecxstopSpelling">Date: Thu, 2 Feb 2012 22:51:46
                +0200<br>
                From: <a moz-do-not-send="true"
                  class="ecxmoz-txt-link-abbreviated"
                  href="mailto:razvancrainea@opensips.org">razvancrainea@opensips.org</a><br>
                To: <a moz-do-not-send="true"
                  class="ecxmoz-txt-link-abbreviated"
                  href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
                Subject: Re: [OpenSIPS-Users] dispatcher problem<br>
                <br>
                Hi, Matt!<br>
                <br>
                Are you sure you are not using the same hashing value
                all the time?<br>
                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 ".<br>
                <br>
                Regards,<br>
                <pre class="ecxmoz-signature">-- 
R&#259;zvan Crainea
OpenSIPS Developer
<a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://opensips-solutions.org/" target="_blank">http://opensips-solutions.org/</a></pre>
                <br>
                <br>
                On 02/02/2012 10:15 PM, Matt Hamilton wrote:
                <blockquote
                  cite="mid:BAY170-W67F0D5151A0ACC65C6CAF3B3700@phx.gbl">
                  <style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
</style>
                  <div dir="ltr"> Hi,<br>
                    <br>
                    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.,<br>
                    <br>
                    when serverB is down, dispatches to serverA<br>
                    when serverA is down, dispatches to serverB<br>
                    when both up, dispatches to serverB<br>
                    while dispatching to serverA when serverB is down,
                    if I activate serverB, all requests dispatched to
                    serverB&nbsp; <br>
                    <br>
                    <br>
                    Here is my code:<br>
                    <br>
                    modparam("dispatcher", "hash_pvar", "$avp(75)")<br>
                    <br>
                    <br>
                    in the script, I'm setting $avp(75) to one of the
                    following "061002", "061003", "061004", "061005",
                    "061006" just before calling ds_select_dst.<br>
                    <br>
                    $avp(75)=..<br>
                    ds_select_dst("1", "7");<br>
                    <br>
                    Any ideas why this is happening?<br>
                    <br>
                    Regards,<br>
                    Matt<br>
                  </div>
                  <br>
                  <fieldset class="ecxmimeAttachmentHeader"></fieldset>
                  <br>
                  <pre>_______________________________________________
Users mailing list
<a moz-do-not-send="true" class="ecxmoz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
                </blockquote>
                <br>
                _______________________________________________ Users
                mailing list <a moz-do-not-send="true"
                  class="ecxmoz-txt-link-abbreviated"
                  href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
                <a moz-do-not-send="true"
                  class="ecxmoz-txt-link-freetext"
                  href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
                  target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></div>
            </div>
            <br>
            <fieldset class="ecxmimeAttachmentHeader"></fieldset>
            <br>
            <pre>_______________________________________________
Users mailing list
<a moz-do-not-send="true" class="ecxmoz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
          </blockquote>
          <br>
          _______________________________________________
          Users mailing list
          <a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
          <a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>