<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Alex, we’re primarily using MSSQL as our database server and would like to keep it that way. But since Gary has accomplished this with MTREE, I’ll give that a go. 7 million records is very impressive. Our tables won’t have near that much records, just a few hundred. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I’d like to reload the data every x interval, but I don’t see the MTREE having support for this, except a MI command mt_reload. I can’t call this from within the configuration script right? If not, how does the TIMER module work? Does it run independently from requests, and gets triggered every set interval?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] <b>On Behalf Of </b>Gary Chen<br><b>Sent:</b> Thursday, July 4, 2013 4:09 AM<br><b>To:</b> Kamailio (SER) - Users Mailing List<br><b>Subject:</b> Re: [SR-Users] Load database table in memory<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>I am using mtree for the same purpose and it works great. It never expire. I had loaded about 7 millions records in mtree table and there is no performance issue at all. <o:p></o:p></p></div><p class=MsoNormal>Gary<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>On Wed, Jul 3, 2013 at 7:57 AM, Alex Balashov <<a href="mailto:abalashov@evaristesys.com" target="_blank">abalashov@evaristesys.com</a>> wrote:<o:p></o:p></p><p class=MsoNormal>Sure, you can do it that way.  However, htable and mtree accommodate relatively primitive data sets.<br><br>Given sufficient table complexity and/or size, your best bet is to use an in-memory storage backend on the database side itself.<br><br>In MySQL, this is called:<br><br>   <a href="http://dev.mysql.com/doc/refman/5.7/en/memory-storage-engine.html" target="_blank">http://dev.mysql.com/doc/refman/5.7/en/memory-storage-engine.html</a><br><br>-- Alex<o:p></o:p></p><div><div><p class=MsoNormal style='margin-bottom:12.0pt'><br><br>On 07/03/2013 05:41 AM, Grant Bagdasarian wrote:<o:p></o:p></p></div></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Hello,<br><br>I need to query a database for every SIP request coming into Kamailio,<br>but I want this to be handled as fast as possible, so I was thinking of<br>loading the data I need in memory using the HTABLE or MTREE modules.<br><br>When the SIP request is coming from one of our carriers, the called<br>number ($rU) must be used to get the data for this called number.<br>Normally, I would query the database, using sqlops, and pass the value<br>of $rU as the parameter and get the column values using the $dbr<br>variable. Can this be accomplished with HTABLE or MTREE?<br><br>Also, the autoexpire parameter in HTABLE; once expired, will the data be<br>reloaded again from the database?<br><br>Thanks,<br><br><br>Grant<br><br><br><o:p></o:p></p></div></div><p class=MsoNormal style='margin-bottom:12.0pt'>_______________________________________________<br>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br><a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br><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><o:p></o:p></p></blockquote><p class=MsoNormal><br><br>-- <br>Alex Balashov - Principal<br>Evariste Systems LLC<br>235 E Ponce de Leon Ave<br>Suite 106<br>Decatur, GA 30030<br>United States<br>Tel: <a href="tel:%2B1-678-954-0670" target="_blank">+1-678-954-0670</a><br>Web: <a href="http://www.evaristesys.com/" target="_blank">http://www.evaristesys.com/</a>, <a href="http://www.alexbalashov.com/" target="_blank">http://www.alexbalashov.com/</a><br><br>_______________________________________________<br>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br><a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br><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><o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>