[OpenSIPS-Users] Redis connections not closing
Samuel Muller
sam at ims-dynamics.com
Fri Jun 26 21:55:46 CEST 2015
Hello,
I would like to understand how's working the cachedb_redis with redis :
it seems the connections to Redis server are not closed after a redis raw
query or a child sip process ends (why not ? :).
# environment :
OpenSips v 1.11.3 (dedicated server)
Redis 3.0.2 (dedicated server)
Debian Jessie everywhere
# conf story :
loadmodule "cachedb_redis.so"
modparam("cachedb_redis","cachedb_url","redis://redis.backend.fqdn:6379/1")
modparam("cachedb_redis","cachedb_url","redis:log://redis.backend.fqdn:6379/2")
...
# routing story :
cache_raw_query("redis","hmget $var(my_hash) key1 key2", "$avp(r)");
if ($avp(r) != null) {
$avp(key1) = $(avp(r)[0]);
$var(key2) = $(avp(r)[1]);
avp_delete("$avp(r)");
}
...
$avp(my_kv) = $var(a) + $var(b);
cache_raw_query("redis:log","RPUSH my_hash $avp(my_kv)");
...
Ok, everything'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.
# in the redis-server :
$ redis-cli --stat
------- data ------ --------------------- load -------------------- - child
-
keys mem clients blocked requests
connections
92 785.04M 214 0 1937714 (+0) 13691
92 785.04M 214 0 1937715 (+1) 13691
92 785.04M 214 0 1937716 (+1) 13691
...
info that can be retrieved here - stats reseted in the next copy/paste, but
the ids and connections are increasing really freakin' fast :
$ redis-cli client list
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
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
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
and the counters and connections increased for each new request.
in the --stat command, it returns that i've 214 clients, but i've only 5
opensips servers ...
maybe other useful info: for each server : -m 2048 -M 16, udp only,
children=32, maxbuffer=2097152.
There's no problem with that for 10 calls per day, but actually my servers
are managing around 480 cps ...
I'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).
Do you have any idea how to close the connections ? (without doing a
redis-cli client kill $id ...)
Thanks a lot,
Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20150626/8596c563/attachment.htm>
More information about the Users
mailing list