If you are using redis and wanted to check how many open connections are there at the moment, use the client list
command in your redis terminal.
127.0.0.1:6379> client list
id=936 addr=127.0.0.1:61277 fd=8 name= age=3 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client
This is a powerful debugging tool especially when you have an app that's using redis and seems to be opening connections without closing them, meaning you run out of memory in your redis host server.
Before getting to this stage, a colleague in the SRE team had used the following command to identify the redis problem
lsof | grep <user> | grep TCP | grep 6379
The command helped us identify that our app was opening connections to redis without closing them but we didn't know what exactly was causing this since we had functionality that opened and closed connections. The client list
command helped us to know what command was being triggered from our app - cmd
field in the output of client list
command - that wasn't being closed.