<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    The weight mechanism does not work for this type of algorithm.
    However, you can simulate it - for example, for each destination,
    add a multiplier in the dispatcher's attribute field. The multiplier
    should be 1, 2, 3, etc. When increasing the statistic, instead of
    increasing it with 1, you can increase it with that attribute. This
    way you can control how much traffic each destination will receive.<br>
    <br>
    The load balance is always done equally, based on the statistic
    evaluation.<br>
    <br>
    Best regards,<br>
    Răzvan<br>
    <br>
    <div class="moz-cite-prefix">On 12/23/2015 06:59 PM, DHAVAL
      INDRODIYA wrote:<br>
    </div>
    <blockquote
cite="mid:CAE8gfe_MAjRJkh2QWJvGQRCyZ1AyCM79dJnhSE1tVNbxQA0kMA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000">Hi
          Razvan,</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000">Thanks
          for reply. I will test this on my script a quick question on
          this is if we have multiple destinations how to define a
          weight of each how dispatcher will take into considerations.</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000">Let say i
          have two destination and following entry in DB.</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000">ID      
             SOCKET               WEIGHT      PRIORITY</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000">----------------------------------------------------------</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000">1        
           sip:<a moz-do-not-send="true" href="http://1.1.1.1:6060">1.1.1.1:6060</a>
                 100            1</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000">2        
           sip:<a moz-do-not-send="true" href="http://2.2.2.2:6060">2.2.2.2:6060</a>
                 200            2</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000">3        
           sip:<a moz-do-not-send="true" href="http://3.3.3.3:6060">3.3.3.3:6060</a>
                 300            3</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000">How Load
          balance distribute a call let say we receive 10 cps ?</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000">Any help
          appreciated.</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000">Best
          Regards,</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:#000000">Dhaval</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Wed, Dec 23, 2015 at 7:24 PM, Răzvan
          Crainea <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF"> <tt>Hi, Dhaval!<br>
                <br>
                A use case for this algorithm is setting the
                pv_algo_pattern as shown in the documentation page[1]:<br>
                modparam("dispatcher", "pvar_algo_pattern",
                "$stat(load_%u)")<br>
                <br>
                This parameter indicates that whenever you are using a
                ds_select_*() function with algorithm 9, OpenSIPS will
                check the load for each destination, and order them
                based on each value.<br>
                For example, consider we have two destinations:
                sip:1.1.1.1 and sip:2.2.2.2. Algorithm 9 will evaluate
                for each destination the following pvars:<br>
                $stat(load_sip:1.1.1.1) and $stat(load_sip:2.2.2.2) and
                order them based on its values. Then of course, first
                picks the least used one.<br>
                <br>
                All that's left for you is to update the statistic
                accordingly. For example:<br>
                <br>
                if (ds_select_dst("0", "9"))<br>
                    update_stat("load_sip:$dd", "+1");<br>
                <br>
                Hope that's clear now.<br>
              </tt><tt> <br>
                [1] <a moz-do-not-send="true"
href="http://www.opensips.org/html/docs/modules/2.1.x/dispatcher#id293975"
                  target="_blank">http://www.opensips.org/html/docs/modules/2.1.x/dispatcher#id293975</a><br>
                <br>
                Best regards,</tt><br>
              <pre cols="72">Răzvan Crainea
OpenSIPS Solutions
<a moz-do-not-send="true" href="http://www.opensips-solutions.com" target="_blank">www.opensips-solutions.com</a></pre>
              <div>
                <div class="h5">
                  <div>On 12/18/2015 01:05 PM, DHAVAL INDRODIYA wrote:<br>
                  </div>
                </div>
              </div>
              <blockquote type="cite">
                <div>
                  <div class="h5">
                    <div dir="ltr">
                      <div class="gmail_default"
                        style="font-family:verdana,sans-serif;color:rgb(0,0,0)">Dear

                        All,<br>
                        <br>
                      </div>
                      <div class="gmail_default"
                        style="font-family:verdana,sans-serif;color:rgb(0,0,0)">I
                        am working on opensips dispatcher and found that
                        dispatcher is able to do loadbalancing in
                        function ds_select_dst.<br>
                        <br>
                      </div>
                      <div class="gmail_default"
                        style="font-family:verdana,sans-serif;color:rgb(0,0,0)">I
                        have found a good description on DISPATCHER
                        module itself it says  - " <b>The <span><em>pvar_algo_pattern</em></span>
                          parameter is used to determine the load on
                          each server. If the parameter is not
                          specified, then the first entry in the set is
                          chosen.</b>"<br>
                        <br>
                      </div>
                      <div class="gmail_default"
                        style="font-family:verdana,sans-serif;color:rgb(0,0,0)">Now

                        the question here is how to use this load
                        balancing and what should be exact value we need
                        to put in pvar_algo_pattern?<br>
                        <br>
                        How to define weight in table I mean what should
                        be value of weight in table it is like number of
                        call handling capability?<br>
                        <br>
                      </div>
                      <div class="gmail_default"
                        style="font-family:verdana,sans-serif;color:rgb(0,0,0)">I
                        have found some of the reference and that some
                        how not working i might be using in wrong way if
                        any one have a good example then would be a
                        great help for me.</div>
                      <br>
                      <div class="gmail_default"
                        style="font-family:verdana,sans-serif;color:rgb(0,0,0)">​
                        BR,<br>
                      </div>
                      <div class="gmail_default"
                        style="font-family:verdana,sans-serif;color:rgb(0,0,0)">DI
                        ​</div>
                      <br>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                  </div>
                </div>
                <pre>_______________________________________________
Users mailing list
<a moz-do-not-send="true" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" 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>
            </div>
            <br>
            _______________________________________________<br>
            Users mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
              rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
            <br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature">
          <div dir="ltr">
            <div>
              <div><span style="color:rgb(61,133,198)"><span
                    style="font-family:verdana,sans-serif"><br>
                    Best Regards,<br>
                  </span></span></div>
              <b><span style="color:rgb(61,133,198)"><span
                    style="font-family:verdana,sans-serif">Dhaval
                    Indrodiya<br>
                  </span></span></b></div>
            <b><span style="color:rgb(61,133,198)"><span
                  style="font-family:verdana,sans-serif">skype:
                  dki123sabse</span></span></b><br>
          </div>
        </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>
    <pre class="moz-signature" cols="72">-- 
Răzvan Crainea
OpenSIPS Core Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
  </body>
</html>