Hello,<div><br></div><div>We found an issue when using nat pinger <br><br></div><div>Previously our system had 1 Kamailio as entry point and we were using usrloc in mode  2 so:</div><div><div>modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,2)</div>

<div>modparam(&quot;usrloc&quot;, &quot;db_url&quot;,</div><div>        &quot;mysql://openser:openserrw@&lt;DB_IP&gt;/openser&quot;)</div></div><div><br></div><div>On our system we like to use the pinger NAT_HELPER module to keep the connections alive for the users of our system.<div>

<div><br></div> Now we&#39;re trying to configure two Kamailio K1 and K2 as entry point of the system and having both of them active at the same time with a virtual IP as common entry point for both. </div><div>I believe this approach requires to flush information on the usrloc immediately because following use case can happen and needs to work:</div>

<div>- A registers on K1 server</div><div>- B registers on K2 server</div><div>-After 5 seg  B makes an INVITE to A through K2=&gt;  we need K2 kamailio instance to be able to locate A immediately and not wait until the first Kamailio flushes the info to the db. (it looks to be around 20/30 seg by default  on mode 2 I think , correct so this looks to be  too much time)</div>

<div><br></div><div>So to improve this we tried to change to use usrloc in mode 3 instead of mode 2. But then we&#39;ve a big issue: when enabling the pinger module for NATted users we see  it opens a new connection to the db for each OPTIONS ping we want to send.  That looks too many connections for our MySQL server because for eg if I leave two users registered for 1 hour after some time I start to see errors like:</div>

<div>13(5292) ERROR: &lt;core&gt; [db_query.c:130]: error while submitting query</div><div><div>13(5292) ERROR: usrloc [dlist.c:151]: raw_query failed</div><div>13(5292) ERROR: nathelper [nathelper.c:3459]: failed to fetch contacts</div>

<div>13(5292) ERROR: db_mysql [km_dbase.c:117]: driver error on query: Too many conne                                                                                                                       </div></div><div>

<br></div><div>How should this problem be approached? Could this be due to wrong mysql configuration? But anyway if for each ping done by NAT_PINGER we make a query to the db I think this is a lot of &quot;noise&quot; for the db as pings happen often!</div>

<div>Thanks</div><div><br></div><div>BR</div><div>Albert</div></div>