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 example executes 10,000 requests at the same time to detect performance:
redis-benchmark -n 10000 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.20 requests per second MSET (10 keys): 93283.58 requests per second
The optional parameters of the redis performance testing tool are as follows:
Serial number | Option | Description | Default value |
---|---|---|---|
1 | -h | Specifies the server host name | 127.0.0.1 |
2 | -p | Specify the server port | 6379 |
3 | -s | Specify server socket | |
-c | Specify the number of concurrent connections50 | ||
-n | Specify the number of requests10000 | ||
-d | Specify the data size of the SET/GET value in bytes2 | ||
-k | 1=keep alive 0=reconnect1 | ||
-r | SET/GET/INCR uses random keys, SADD uses random values | ||
##-P | Piping <numreq> request | 110 | |
-q | Force to exit redis. Only display query/sec values | ##11 | |
to CSV format output | 12 | ||
#Generate loop, execute permanently Test | ##13 | ||
Run only comma separated tests Command list. | 14 | ||
Idle mode. Open only N idle connections and wait. | ##Example | We use multiple parameters to test redis performance in the following example: