django-websocket-redis icon indicating copy to clipboard operation
django-websocket-redis copied to clipboard

Redis server keep trace of closed connections

Open plegal opened this issue 10 years ago • 2 comments

Hi, Thx for the great job, it's very usefull for me. I'm facing a problem on heroku : a simple refresh of the page where the ws4redis connection is done in the browser increment the number of connection to the redis cloud server and theses connections stay and the limit of 10 clients of the free Redis Cloud is reached very quickly...

ex with 3 refresh: redis pub-redis-15333.us-east-1CLIENT LIST id=418 addr=54.211.147.243:59713 fd=3917 name= age=19 idle=8 flags=N db=0 sub=1 psub=0 multi=-1 qbuf=0 qbuf-free=2147483647 obl=0 oll=0 omem=0 events=r cmd=subscribe id=420 addr=54.211.147.243:59881 fd=1520 name= age=2 idle=1 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=2147483647 obl=0 oll=0 omem=0 events=r cmd=setex id=303 addr=88.123.88.205:38988 fd=949 name= age=48261 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=2147483647 obl=0 oll=0 omem=0 events=r cmd=client id=417 addr=54.211.147.243:53307 fd=1458 name= age=394 idle=19 flags=N db=0 sub=1 psub=0 multi=-1 qbuf=0 qbuf-free=2147483647 obl=0 oll=0 omem=0 events=r cmd=subscribe id=419 addr=54.211.147.243:59826 fd=1612 name= age=8 idle=2 flags=N db=0 sub=1 psub=0 multi=-1 qbuf=0 qbuf-free=2147483647 obl=0 oll=0 omem=0 events=r cmd=subscribe

Is it a simple way to kill theses connection ?

thx in advance

plegal avatar Feb 10 '15 11:02 plegal

I am wondering a little bit about your conclusion. ws4redis keeps open only connection per thread (of the ws-loop) to Redis, while it opens many connections with the clients.

Simply check method __call__ in wsgi_server.WebsocketWSGIServer. There I only use one file descriptor to Redis: redis_fd.

jrief avatar Feb 10 '15 22:02 jrief

Thx for your quick response. I'm new to Redis and perhaps it's a persistency in it's side. The solution I found is to add a Celery task to connect to the Redis server and kill client with idle > idle_max I choose. It works fine !

plegal avatar Feb 11 '15 17:02 plegal