Redis 性能测试
指定 10000 个请求:
> redis-benchmark -n 10000 -q
====== PING_INLINE ======
10000 requests completed in 0.14 seconds
50 parallel clients
3 bytes payload
keep alive: 1
98.91% <= 1 milliseconds
99.98% <= 2 milliseconds
100.00% <= 2 milliseconds
70921.98 requests per second
====== PING_BULK ======
10000 requests completed in 0.14 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.28% <= 1 milliseconds
100.00% <= 1 milliseconds
68965.52 requests per second
====== SET ======
10000 requests completed in 0.14 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.54% <= 1 milliseconds
100.00% <= 1 milliseconds
70921.98 requests per second
====== GET ======
10000 requests completed in 0.16 seconds
50 parallel clients
3 bytes payload
keep alive: 1
97.85% <= 1 milliseconds
99.58% <= 2 milliseconds
99.93% <= 3 milliseconds
100.00% <= 3 milliseconds
64102.56 requests per second
====== INCR ======
10000 requests completed in 0.14 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.48% <= 1 milliseconds
100.00% <= 1 milliseconds
69444.45 requests per second
====== LPUSH ======
10000 requests completed in 0.15 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.74% <= 1 milliseconds
100.00% <= 1 milliseconds
68493.15 requests per second
====== RPUSH ======
10000 requests completed in 0.15 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.60% <= 1 milliseconds
100.00% <= 1 milliseconds
67567.57 requests per second
====== LPOP ======
10000 requests completed in 0.14 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.73% <= 1 milliseconds
100.00% <= 1 milliseconds
70921.98 requests per second
====== RPOP ======
10000 requests completed in 0.15 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.57% <= 1 milliseconds
100.00% <= 1 milliseconds
67114.09 requests per second
====== SADD ======
10000 requests completed in 0.14 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.72% <= 1 milliseconds
100.00% <= 1 milliseconds
69930.07 requests per second
====== HSET ======
10000 requests completed in 0.14 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.43% <= 1 milliseconds
100.00% <= 1 milliseconds
68965.52 requests per second
====== SPOP ======
10000 requests completed in 0.14 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.00% <= 1 milliseconds
100.00% <= 1 milliseconds
70422.53 requests per second
====== LPUSH (needed to benchmark LRANGE) ======
10000 requests completed in 0.14 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.30% <= 1 milliseconds
100.00% <= 1 milliseconds
69930.07 requests per second
====== LRANGE_100 (first 100 elements) ======
10000 requests completed in 0.22 seconds
50 parallel clients
3 bytes payload
keep alive: 1
96.42% <= 1 milliseconds
100.00% <= 1 milliseconds
46296.30 requests per second
====== LRANGE_300 (first 300 elements) ======
10000 requests completed in 0.44 seconds
50 parallel clients
3 bytes payload
keep alive: 1
15.69% <= 1 milliseconds
99.41% <= 2 milliseconds
99.96% <= 3 milliseconds
100.00% <= 3 milliseconds
22831.05 requests per second
====== LRANGE_500 (first 450 elements) ======
10000 requests completed in 0.58 seconds
50 parallel clients
3 bytes payload
keep alive: 1
0.12% <= 1 milliseconds
98.48% <= 2 milliseconds
99.66% <= 3 milliseconds
99.91% <= 4 milliseconds
100.00% <= 4 milliseconds
17301.04 requests per second
====== LRANGE_600 (first 600 elements) ======
10000 requests completed in 0.73 seconds
50 parallel clients
3 bytes payload
keep alive: 1
0.03% <= 1 milliseconds
85.95% <= 2 milliseconds
99.36% <= 3 milliseconds
99.89% <= 4 milliseconds
100.00% <= 4 milliseconds
13661.20 requests per second
====== MSET (10 keys) ======
10000 requests completed in 0.14 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.70% <= 1 milliseconds
100.00% <= 1 milliseconds
69930.07 requests per second
指令参数如下:
1 | -h | 指定服务器主机名 | 127.0.0.1 |
2 | -p | 指定服务器端口 | 6379 |
3 | -s | 指定服务器 socket | |
4 | -c | 指定并发连接数 | 50 |
5 | -n | 指定请求数 | 10000 |
6 | -d | 以字节的形式指定 SET/GET 值的数据大小 | 2 |
7 | -k | 1=keep alive 0=reconnect | 1 |
8 | -r | SET/GET/INCR 使用随机 key, SADD 使用随机值 | |
9 | -P | 通过管道传输 请求 | 1 |
10 | -q | 强制退出 redis。仅显示 query/sec 值 | |
11 | –csv | 以 CSV 格式输出 | |
12 | -l | 生成循环,永久执行测试 | |
13 | -t | 仅运行以逗号分隔的测试命令列表。 | |
14 | -I | Idle 模式。仅打开 N 个 idle 连接并等待。 |