<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <p>the db_timer_clean is actually needed only you face situations
      when some contact records remain in the database after they
      expired. Normally should be deleted by the process detecting that
      they are deleted, however, there are some corner cases when the
      operation to database failed when the record in memory is removed
      (e.g., you restart mysql server). Over long time, if Kamailio is
      not restarted, but the "corner" cases keep happening, many invalid
      records can accumulate to database.</p>
    <p>The "secondary" timer is from core and was added to execute the
      tasks that are not "real-time" critical and can take longer time
      to execute, to offload the primary timer system (composed by
      fast+slow timer processes), which is more sensitive as it takes
      care of retransmissions, etc ...</p>
    <p>Many modules started to create own timer processes to offload
      primary timer, and that can still be useful when dealing with some
      heavy tasks, but for some modules, creating a dedicated timer
      process just to execute a lengthy task from time to time is a
      waste of resource, so they can use the secondary timer.</p>
    <p>The timer_procs is not related to db_timer_clean. Set
      timer_procs>=1 when having to manage a lot of active contacts,
      no matter is just in-memory storage or together with database. For
      write back (sycn the db peridiocally) it would be probably better
      to have at least timer_proc=1, so the db sync operations are done
      by this timer, provided you have more than a few active contacts.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 20.02.20 01:11, Joel Serrano wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMtXxQnVKjB+SehqeWDizT6xeMuzcB8ao48g0AH0Qkx8-YFvoQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hello,<br>
        <div><br>
        </div>
        <div>I have an installation using usrloc + db_mode=1.</div>
        <div><br>
        </div>
        <div>If I want on db_mode=1 or db_mode=2 the expired contacts to
          be cleaned up I have to enable the modparam db_timer_clean:</div>
        <div><br>
        </div>
        <div><a
href="https://www.kamailio.org/docs/modules/devel/modules/usrloc.html#usrloc.p.db_timer_clean"
            moz-do-not-send="true">https://www.kamailio.org/docs/modules/devel/modules/usrloc.html#usrloc.p.db_timer_clean</a><br>
        </div>
        <div><br>
        </div>
        <div>The docs say:</div>
        <div><br>
        </div>
        <div>"<i>Enable (1) or disable (0) cleaning of expired db
            records on timer basis for db_mode WRITE-BACK and
            WRITE-THROUGH. It uses the secondary timer process.</i>"</div>
        <div><br>
        </div>
        <div>I have the following doubts:</div>
        <div><br>
        </div>
        <div>1- What does the reference "it uses <b><i>the</i></b>
          secondary timer process" mean? Is there a specific secondary
          timer just for this purpose?<br>
        </div>
        <div>2- Is  #1 related to the modparam timer_procs? (so it uses
          one of those when enabled?)</div>
        <div>3- Why/When would you need a timer_proces modparam with a
          value higher than "1"? </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Thanks, </div>
        <div>Joel.</div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - March 9-11, 2020, Berlin - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - April 27-29, 2020, in Berlin -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>