<div dir="ltr"><div><div>Hello,<br></div><div><br></div><div>I would like to understand how&#39;s working the cachedb_redis with redis :<br>it seems the connections to Redis server are not closed after a redis raw query or a child sip process ends (why not ? :).</div><div><br># environment :<br><br>OpenSips v 1.11.3 (dedicated server)</div><div>Redis 3.0.2 (dedicated server)<br></div><div>Debian Jessie everywhere<br></div><div><br></div># conf story :<br></div><div><div><br>loadmodule &quot;cachedb_redis.so&quot;<br>modparam(&quot;cachedb_redis&quot;,&quot;cachedb_url&quot;,&quot;redis://redis.backend.fqdn:6379/1&quot;)<br>modparam(&quot;cachedb_redis&quot;,&quot;cachedb_url&quot;,&quot;redis:log://redis.backend.fqdn:6379/2&quot;)<br>...<br></div><div><br># routing story :<br><br></div><div>cache_raw_query(&quot;redis&quot;,&quot;hmget $var(my_hash) key1 key2&quot;, &quot;$avp(r)&quot;);<br>if ($avp(r) != null) {<br>    $avp(key1) = $(avp(r)[0]);<br>    $var(key2) = $(avp(r)[1]);<br>    avp_delete(&quot;$avp(r)&quot;);<br></div>}<br>...<br></div><div>$avp(my_kv) = $var(a) + $var(b);<br></div><div>cache_raw_query(&quot;redis:log&quot;,&quot;RPUSH my_hash $avp(my_kv)&quot;);<br>...<br><br></div><div>Ok, everything&#39;s fine after a lot of tuning as deleting the returned avp to free the mem, prevent some bad redis returns that can break the opensips routing process, and so on, but my real problem is that the connections to redis are not closing.<br></div><div><br></div><div># in the redis-server  :<br></div><div><br>$ redis-cli --stat<br>------- data ------ --------------------- load -------------------- - child -<br>keys       mem      clients blocked requests            connections          <br>92         785.04M    214     0       1937714 (+0)        13691       <br>92         785.04M    214     0       1937715 (+1)        13691       <br>92         785.04M    214     0       1937716 (+1)        13691       <br>...<br><br></div><div>info that can be retrieved here - stats reseted in the next copy/paste, but the ids and connections are increasing really freakin&#39; fast :<br><br>$ redis-cli client list<br>id=3 addr=ip_opensips:57508 fd=7 name= age=534 idle=534 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=hmget<br>id=4 addr=ip_opensips:52579 fd=8 name= age=534 idle=534 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=hmget<br>id=5 addr=ip_opensips:52587 fd=6 name= age=407 idle=407 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=hmget<br></div><div><br></div><div>and the counters and connections increased for each new request.<br><br></div><div>in the --stat command, it returns that i&#39;ve 214 clients, but i&#39;ve only 5 opensips servers ...<br>maybe other useful info: for each server : -m 2048 -M 16, udp only, children=32, maxbuffer=2097152.<br></div><div><br></div><div>There&#39;s no problem with that for 10 calls per day, but actually my servers are managing around 480 cps ...<br>I&#39;ve to start/stop the redis-server every 24h to manage the number of connections to prevent to reach the max connections limit (ulimit and all the sysadmin stuff).<br></div><div><br></div><div>Do you have any idea how to close the connections ? (without doing a redis-cli client kill $id ...)<br></div><div><br></div><div>Thanks a lot,<br><br></div><div><br>Sam<br></div><br></div>