How can we distinguish whether Redis Server is busy or hung?

47 views
Skip to first unread message

gkkum...@gmail.com

unread,
Aug 14, 2021, 10:08:42 PMAug 14
to Redis DB
Hi,

For the monitoring purpose, we will query the Redis server periodically. If the Redis server is unresponsive (busy/hung), the monitoring queries can fail. We need to distinguish whether the Redis Server is busy (i.e. due to slow commands execution in progress or any other operation) or hung.

Kindly let me if there is any way to achieve this.

Redis version: 5.0.3

Thanks,
Ganesh

Greg Andrews

unread,
Aug 16, 2021, 3:45:21 AMAug 16
to Redis DB
The most powerful tool for you is the slow log file.  Allowing your monitoring querys to time out after a very long wait (e.g. 10 seconds) can also help you understand whether your Redis server process is merely slow or is actually hung.  Having your monitoring querys measure the response time from Redis server and pass the measurement to a graphing system is also useful to see when slowness happens and whether it's a steady increase in response time or sudden spikes.  Also whether it happens at regular times/intervals.

Another event that people often link to slowness or unresponsiveness in Redis server is if there is a sudden large spike in the rate of new connections being made to Redis.  If your clients only make short-lived connections that send one command/reply and disconnect again -- rather then keeping a connection open to your Redis server, then you can make your server vulnerable to this sort of thing.

If you're looking for extreme measures, attaching a client that issues the MONITOR command and logs the resulting output can show you what commands are being handled by your Redis server.  This can reveal unexpected commands that incur performance hits.

gkkum...@gmail.com

unread,
Aug 17, 2021, 1:10:11 PMAug 17
to Redis DB
Thanks for the response.

Let me share some more details. Our setup is standalone redis with master and slave. The monitoring will periodically (i.e. every 5 secs) query the redis server to check the health. In case of continuous monitoring failures, the slave will take over as a master.

As I mentioned, If the redis is unresponsive (busy/hung), then monitoring queries can fail. Just wondering, if we could distinguish then the failover can be avoided in case of redis busy (slow/blocking command or other operations). Even if someone ran such commands in production mistakenly. 

We also monitor the slow logs, redis calls response time and other parameters (connection, eviction, etc). Actions will be taken accordingly. The slow log will have a commands history. To handle the above case, I am looking for the redis server state at that moment (if possible).

Mehedi Hasan

unread,
Aug 17, 2021, 3:20:26 PMAug 17
to redi...@googlegroups.com
The failover you are thinking about, doesn’t Sentinel can ensure that?

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redis-db/8bd16583-dbc8-479c-8c4f-c5479cdd295an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages