download & runRedis Labs Enterprise Cluster

Learn more

free download

Connect & useRedis Cloud





By creating your account, you agree to our Terms of Use

Forgot your password?

Not Registered?

Forgot your password?

Enter your email address below to have your password reset. We'll send you an email with a link to change your password.

Your IP address will be logged and monitored for this request.

Cancel

Your password has reset!

We have sent you an email with a link to change your password.

OK

Blog

Posted on by Garantia Data

Enhancing Redis Slow Log

 

Redis Slow Log is one of the best tools for debugging and tracing your Redis database, especially if you experience high latency and high CPU usage with Redis operations. This online discussion in a Redis DB group is just one of many examples that show how efficient Redis Slow Log is. Because Redis is based on a single threaded architecture, Redis Slow Log can be much more useful than slow log mechanisms of multi-threaded database systems such as MySQL Slow Query Log.

Unlike tools that include the software locking overhead which makes the debugging process very complex, Redis Slow Log is highly effective at showing the actual processing time of each slow command. As a provider of Redis Cloud, we use Redis Slow Log intensively for internal monitoring and to help our users solve latency issues related to their complex queries. And we often find ourselves struggling to understand the differences between two execution times of the same Redis command shown in the Slow Log – usually with complex commands such as ZUNIONSTORE, ZINTERSTORE, ZRANGEBYSCORE. Based on our experience, we thought the Redis community could benefit from adding the time complexity parameters for each command stored in the Slow Log. With this enhancement, we expect users to get a better understanding of their Redis DB operations, including differences between execution times of the same command and spikes in CPU usage. So without further ado, here’s (bold) what we’ve contributed for the Enhanced Redis Slow Log:

33) 1) (integer) 468359

2) (integer) 1358158701

3) (integer) 132912

4) Complexity info: N:48362,M:38687

5)1) "ZUNIONSTORE"

2) "AAA"

3) "5"

4) "BBB"

5) "CCC"

6) "DDD"

7) "EEE"

8) "FFF"

9) "WEIGHTS"

10) "1"

11) "1"

12) "1"

13) "1"

14) "1"

15) "AGGREGATE"

16) "MIN"

34) 1) (integer) 61701

2) (integer) 1354754379

3) (integer) 15217

4) Complexity info: N:886,M:885

5)    1) "ZREVRANGE"

2) "XYZ"

3) ”1”

4) ”1000”

5) “WITHSCORES”

35) 1) (integer) 61700

2) (integer) 1354754379

3) (integer) 16067

4) Complexity info: N:897,K:2,M:897

5)    1) "ZINTERSTORE"

2) "XYZ"

3) ”2”

4) ”YZX”

5) “ZXY”

 

  For better understanding of the complexity, you may want to use the table below:

Command Value of interest Complexity
LINSERT N - list len O(N)
LREM N - list len O(N)
LTRIM N - number of removed elemnts O(N)
PUBLISH N - number of channel subscribersM - number of subscribed patterns O(N+M)
PSUBSCRIBE N - number of patterns client is subscribed toargc - number of arguments passed to the command O(argc*N)
PUNSUBSCRIBE N - number of patterns client is subscribed toM - total number of subscribed patternsargc - number of arguments passed to the command O(argc*(N+M))
SDIFF N - total number of elements in all sets O(N)
SDIFFSTORE N - total number of elements in all sets O(N)
SINTER N - number of elements in smallest setargc - number of arguments passed to the command O(argc*N)
SINTERSTORE N - number of elements in smallest setargc - number of arguments passed to the command O(argc*N)
SMEMBERS N - number of elements in a set O(N)
SORT N - number of elements in the list/set/zsetM - number of elements in result O(N+M*log(M))O(N) when no sorting
SUNION N - total number of elements in all sets O(N)
SUNIONSTORE N - total number of elements in all sets O(N)
UNSUBSCRIBE N - total number of clients subscribed to all channels O(N)
ZADD N - number of elements in the zset O(log(N))
ZCOUNT N - number of elements in the zsetM - number of elements between min and max O(log(N)+M)
ZINCRBY N - number of elements in the zset O(log(N))
ZINTERSTORE N - number of elements in the smallest zsetK - number of zsetsM - number of elements in the results set O(N*K)+O(M*log(M))
ZRANGE N - number of elements in the zsetM - number of results O(log(N)+M)
ZRANGEBYSCORE N - number of elements in the zsetM - number of results O(log(N)+M)
ZRANK N - number of elements in the zset O(log(N))
ZREM N - number of elements in the zsetargc - number of arguments passed to the command O(argc*log(N))
ZREMRANGEBYRANK N - number of elements in the zsetM - number of elements removed O(log(N)+M)
ZREMRANGEBYSCORE N - number of elements in the zsetM - number of elements removed O(log(N)+M)
ZREVRANGE N - number of elements in the zsetM - number of results O(log(N)+M)
ZREVRANK N - number of elements in the zset O(log(N))
ZUNIONSTORE N - sum of element counts of all zsetsM - element count of result O(N)+O(M*log(M))

For those who are interested, this enhancement is part of our extended Redis 2.6. version and can be found here in our GitHub account.

Remarkably Simple. Epic Performance.

60

Subscribe

Get the latest blog posts by email

8 32

Redis Watch

Get the hottest Redis news with our
periodic newsletter!

27

Interact with Redis

Enter your Redis commands,
see how fast it responds!

Redis Cloud > |
37 59

Gartner Acknowledges Redis Labs as a Leader

In the 2015 Magic Quadrant for Operational Database Management Systems (ODBMS)

Leaders
47

User Satisfaction and
Market Presence -
Redis Ranked as
#1 NoSQL

g2crowd
64

#2 Database in
User Satisfaction

user satisfaction

g2crowd.com

63

Top 10 Data Stores

Redis in containers
1st
MySQL
2nd
Redis
3rd
MongoDB
4th
PostgreSQL

stackshare.io

45
62

Top 10 Technologies
on Docker

Percent of companies running this technology

Redis in containers

datadoghq.com

28

See Our Open Source Contributions

48

NoSQL Databases
in Containers

Redis in containers

DevOps.com & ClusterHQ.com

11

About Us

Redis Labs is the open source home and commercial provider of Redis, a database benchmarked as the world’s fastest. Gartner has named the company as a Leader in it's 2015 ODBMS Magic Quadrant. Redis Labs' software and service solutions power cutting edge applications with blazing fast enterprise-class Redis and are trusted by thousands of customers for high performance, seamless scalability, true high availability and best-in-class expertise. Redis is ranked the #1 NoSQL (and #2 database) in User Satisfaction and Market Presence by G2 Crowd, the top database technology on Docker by Datadog, the most popular NoSQL database in containers by DevOps.com and ClusterHQ, the #1 NoSQL among Top 10 Data Stores by Stackshare and both the fastest growing database since January 2013 and one of the top three NoSQL databases by DB-engines.

66

Why Redis Labs?

Watch the video
61 53 Stance

"How We Perform
in Peak Times at Sub-millisecond Latencies with Redis Labs"

21

Latest News

19 18 44 7 55
60

Subscribe

Get the latest blog posts by email

8 32

Redis Watch

Get the hottest Redis news with our
periodic newsletter!

27

Interact with Redis

Enter your Redis commands,
see how fast it responds!

Redis Cloud > |
37 59

Gartner Acknowledges Redis Labs as a Leader

In the 2015 Magic Quadrant for Operational Database Management Systems (ODBMS)

Leaders