Redis performance test
Redis performance testing is achieved by executing multiple commands at the same time.
Syntax
The basic commands for redis performance testing are as follows:
redis-benchmark [option] [option value]
Instance
The following instances simultaneously execute 10000 requests to detect performance:
$ redis-benchmark -n 10000 -qPING_INLINE: 141043.72 requests per secondPING_BULK: 142857.14 requests per secondSET: 141442.72 requests per secondGET: 145348.83 requests per secondINCR: 137362.64 requests per secondLPUSH: 145348.83 requests per secondLPOP: 146198.83 requests per secondSADD: 146198.83 requests per secondSPOP: 149253.73 requests per secondLPUSH (needed to benchmark LRANGE): 148588.42 requests per secondLRANGE_100 (first 100 elements): 58411.21 requests per secondLRANGE_300 (first 300 elements): 21195.42 requests per secondLRANGE_500 (first 450 elements): 14539.11 requests per secondLRANGE_600 (first 600 elements): 10504.20 requests per secondMSET (10 keys): 93283.58 requests per second
The redis performance testing tool has the following optional parameters:
Serial number |
Option |
Description |
Default Value |
1 |
-H |
Specify the server host name |
127.0.0.1 |
2 |
-P |
Specify the server port |
6379 |
3 |
-S |
Specify server socket |
|
4 |
-C |
Number of concurrent connections |
50 |
5 |
-N |
Number of requests |
10000 |
6 |
-D |
Specify the data size of the Set/get value in bytes |
2 |
7 |
-K |
1 = Keep Alive 0 = reconnect |
1 |
8 |
-R |
Set/get/incr use random key, sadd use random Value |
|
9 |
-P |
Transfer <numreq> requests in a pipeline |
1 |
10 |
-Q |
Force exit redis. Show query/sec values only |
|
11 |
-- CSV |
Output in CSV format |
|
12 |
-L |
Generate a loop and run the test permanently |
|
13 |
-T |
Run only the list of test commands separated by commas. |
|
14 |
-I |
Idle mode. Open only N idle connections and wait. |
|
Instance
The following instances use multiple parameters to test redis performance:
$ redis-benchmark -h 127.0.0.1 -p 6379 -t set,lpush -n 10000 -qSET: 146198.83 requests per secondLPUSH: 145560.41 requests per second
In the above instance, the host is 127.0.0.1, the port number is 6379, the command to be executed is set, lpush, and the number of requests is 10000. Through the-Q Parameter, only the number of requests executed per second is displayed.
Redis performance test