Hi<br><br><div class="gmail_quote">On Wed, Nov 16, 2011 at 8:13 AM, Daniel-Constantin Mierla <span dir="ltr">&lt;<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hello,<div class="im"><br>
    <br>
    On 11/15/11 10:09 PM, Javier Gallart wrote:
    <blockquote type="cite">
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello<br>
          <br>
          coming back to the topic related to mtree, to be able to set
          values via<br>
          mi/rpc -- it won&#39;t be that difficult to add such
          functionality. Usually<br>
          with a tree is mainly reading, due to fast matching on tree
          indexing.<br>
          The question is how many times/often do you need to change
          values and<br>
          how many of them at the same time (more or less).<br>
          <br>
        </blockquote>
        <div>I was also thinking about that: our application works in
          such a way that the full tree is recalculated every 15
          minutes. Currently we have aound 60 branches with 150000
          entries each.</div>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          I assume many times the changes will be somewhere down the
          tree, since<br>
          the first part of the number is usually the same (e.g.,
          country code and<br>
          operator prefix). To update the tree at runtime, while there
          are reads<br>
          on it, there must be used a lock to be safe an consistent. If
          you do lot<br>
          of writes and very often, then you keep the tree structure
          locked a lot,<br>
          slowing the search.<br>
        </blockquote>
        <div><br>
        </div>
        <div>That&#39;s the case, tname is rarely updated, it&#39;s tvalue the
          column that we normally update.</div>
      </div>
    </blockquote>
    <br></div>
    I guess you meant actually tprefix is not updated -- tname is table
    name, tprefix is the prefix used to build the tree. What would be
    the percentage of tvalue updates, do you have add/remove of
    tprefix-es?</div></blockquote><div>You&#39;re right, sorry for the wrong names. The tprefixes are only updated once a day, and only a tiny percentage of them (less than 1%) actually changes. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#FFFFFF" text="#000000"><div class="im"><br>
    <br>
    <blockquote type="cite">
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <br>
          Can you estimate the number of writes and how often they would
          be on a<br>
          daily basis? There might be other solutions to look at, if
          writes are<br>
          very often.<br>
        </blockquote>
        <div><br>
        </div>
        <div>From the numbers above, let&#39;s say that we need to update
          around 8M records every 15 minutes (we expect this number will
          keep steadily increasing...)</div>
      </div>
    </blockquote>
    <br></div>
    But not all of them change the value, right?</div></blockquote><div>I&#39;ve been checking this, and  on average about 40% are updated in each reload.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#FFFFFF" text="#000000"><div class="im"><br>
    <br>
    <blockquote type="cite">
      <div class="gmail_quote">
        <div><br>
        </div>
        <div>As a side note, I&#39;ve looked at how to implement the
          mt_match equivalent in redis and it does&#39;t look that hard
          using kamailio s.prefixed transformation (as you suggested)
          and redis sorted sets. I&#39;ll need to make more tests to check
          the performance, I&#39;ll share the results.</div>
      </div>
    </blockquote>
    <br></div>
    I have used this solution with mysql (using a table structure in
    memory of mysql server), since the changes could have been done in
    mysql in normal way, in one update query, which is a sync operation.
    Does redis do any caching or is using always the disk file db?<br></div></blockquote><div>All the data in Redis stays in memory, you can dump periodic snapshots to disk. Some time ago they worked in a feature called disktore, with some cache mechanism between disk and memory, but as far as I know that line was abandoned.</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div bgcolor="#FFFFFF" text="#000000">
    <br>
    Cheers,<br><font color="#888888">
    Daniel<br>
    <br>
    </font><blockquote type="cite"><div class="im">
      <div class="gmail_quote">
        <div><br>
        </div>
        <div>Thanks!</div>
        <div><br>
        </div>
        <div>Javi </div>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <br>
          Cheers,<br>
          Daniel<br>
          &gt;<br>
          &gt; Regards<br>
          &gt;<br>
          &gt; Javi<br>
        </blockquote>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div><div class="im"><pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </div></blockquote>
    <br><div class="im">
    <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
Kamailio Advanced Training, Dec 5-8, Berlin: <a href="http://asipto.com/u/kat" target="_blank">http://asipto.com/u/kat</a>
<a href="http://linkedin.com/in/miconda" target="_blank">http://linkedin.com/in/miconda</a> -- <a href="http://twitter.com/miconda" target="_blank">http://twitter.com/miconda</a></pre>
  </div></div>

</blockquote></div><br>