English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Performance Testing

Redis performance testing is achieved by executing multiple commands simultaneously.

Syntax

The basic commands for redis performance testing are as follows:

redis-benchmark [option] [option value]

Note:This command is executed in the redis directory, not an internal command of the redis client.

Online Example

The following examples are executed simultaneously 10000 requests to test performance:

$ redis-benchmark -n 10000  -q
PING_INLINE: 141043.72 requests per second
PING_BULK: 142857.14 requests per second
SET: 141442.72 requests per second
GET: 145348.83 requests per second
INCR: 137362.64 requests per second
LPUSH: 145348.83 requests per second
LPOP: 146198.83 requests per second
SADD: 146198.83 requests per second
SPOP: 149253.73 requests per second
LPUSH (needed to benchmark LRANGE): 148588.42 requests per second
LRANGE_100 (first 100 elements): 58411.21 requests per second
LRANGE_300 (first 300 elements): 21195.42 requests per second
LRANGE_500 (first 450 elements): 14539.11 requests per second
LRANGE_600 (first 600 elements): 10504.200 elements):
0 requests per second10 MSET ( 93283.58 requests per second

keys):

The optional parameters of the redis performance testing tool are as follows:NumberOptionsDescription
1-hDefault value127.0.0.1
2-pSpecify the server hostname6379
3-Specify the server ports
4-Specify the server socketc50
5-nSpecify the number of concurrent connections10000
6-Specify the number of requestsSpecify SET in bytes/GET the size of the value data2
7-k1=keep alive 0=reconnect1
8-rSET/GET/INCR uses random key, SADD uses random value
9-PTransmit <numreq> requests through the pipe1
10-qForcefully exit redis. Only display query/sec value
11--csvOutput in CSV format
12-lGenerate a loop and permanently execute the test
13-tOnly run the test command list separated by commas.
14-IIdle mode. Only open N idle connections and wait.

Online Example

In the following example, we used multiple parameters to test the performance of redis:

$ redis-benchmark -h 127.0.0.1 -p 6379 -t set,lpush -n 10000 -q
SET: 146198.83 requests per second
LPUSH: 145560.41 requests per second

The host in the above example is 127.0.0.1, the port number is 6379, the executed command is set, lpush, and the number of requests is 10000, through -The 'q' parameter makes the result show the number of requests executed per second.