1. redis-benchmark
Redis官方自带的性能测试工具,压力测试工具。
执行 redis-benchmark -h 命令,返回参数列表
常用参数:
选项 | 描述 |
-h | 服务端IP |
-p | 服务器端口 |
-a | redis密码 |
-n | 请求总数 |
-c | 客户端连接数量 |
2. 测试
# 测试:100个并发连接 100000次请求 redis-benchmark -h localhost -p 6379 -c 100 -n 100000 # 测试结果 root@redis:~# redis-benchmark -h localhost -p 6379 -c 100 -n 100000 ====== PING_INLINE ====== 100000 requests completed in 1.22 seconds # 10万次请求进行写入测试 100 parallel clients # 100个并发客户端 3 bytes payload # 每次写入3个字节 keep alive: 1 # 只有一台服务器处理这些请求,单机性能 76.42% <= 1 milliseconds 94.59% <= 2 milliseconds 98.76% <= 3 milliseconds 99.80% <= 4 milliseconds 99.95% <= 5 milliseconds 99.99% <= 6 milliseconds 100.00% <= 6 milliseconds 81900.09 requests per second ====== PING_BULK ====== 100000 requests completed in 1.18 seconds 100 parallel clients 3 bytes payload keep alive: 1 79.68% <= 1 milliseconds 94.27% <= 2 milliseconds 98.89% <= 3 milliseconds 99.72% <= 4 milliseconds 99.91% <= 5 milliseconds 99.99% <= 6 milliseconds 100.00% <= 7 milliseconds 100.00% <= 7 milliseconds 84530.86 requests per second ====== SET ====== 100000 requests completed in 1.20 seconds 100 parallel clients 3 bytes payload keep alive: 1 78.44% <= 1 milliseconds 95.79% <= 2 milliseconds 98.88% <= 3 milliseconds 99.57% <= 4 milliseconds 99.81% <= 5 milliseconds 99.94% <= 6 milliseconds 99.99% <= 7 milliseconds 100.00% <= 7 milliseconds 83542.19 requests per second ====== GET ====== 100000 requests completed in 1.42 seconds 100 parallel clients 3 bytes payload keep alive: 1 73.28% <= 1 milliseconds 94.89% <= 2 milliseconds 98.23% <= 3 milliseconds 99.19% <= 4 milliseconds 99.49% <= 5 milliseconds 99.61% <= 6 milliseconds 99.73% <= 7 milliseconds 99.78% <= 8 milliseconds 99.80% <= 9 milliseconds 99.91% <= 10 milliseconds 99.92% <= 11 milliseconds 99.93% <= 12 milliseconds 99.95% <= 13 milliseconds 99.96% <= 14 milliseconds 99.96% <= 15 milliseconds 99.98% <= 16 milliseconds 99.99% <= 17 milliseconds 100.00% <= 17 milliseconds 70472.16 requests per second ====== INCR ====== 100000 requests completed in 1.25 seconds 100 parallel clients 3 bytes payload keep alive: 1 78.25% <= 1 milliseconds 98.50% <= 2 milliseconds 99.56% <= 3 milliseconds 99.83% <= 4 milliseconds 99.99% <= 5 milliseconds 100.00% <= 5 milliseconds 79872.20 requests per second ====== LPUSH ====== 100000 requests completed in 1.29 seconds 100 parallel clients 3 bytes payload keep alive: 1 75.97% <= 1 milliseconds 97.30% <= 2 milliseconds 99.33% <= 3 milliseconds 99.75% <= 4 milliseconds 99.88% <= 5 milliseconds 99.93% <= 6 milliseconds 99.96% <= 7 milliseconds 99.98% <= 8 milliseconds 99.99% <= 9 milliseconds 100.00% <= 10 milliseconds 100.00% <= 10 milliseconds 77339.52 requests per second ====== RPUSH ====== 100000 requests completed in 1.32 seconds 100 parallel clients 3 bytes payload keep alive: 1 73.93% <= 1 milliseconds 95.33% <= 2 milliseconds 98.56% <= 3 milliseconds 99.87% <= 4 milliseconds 100.00% <= 5 milliseconds 75700.23 requests per second ====== LPOP ====== 100000 requests completed in 1.20 seconds 100 parallel clients 3 bytes payload keep alive: 1 77.92% <= 1 milliseconds 95.69% <= 2 milliseconds 98.58% <= 3 milliseconds 99.63% <= 4 milliseconds 99.89% <= 5 milliseconds 99.94% <= 6 milliseconds 99.96% <= 7 milliseconds 99.97% <= 8 milliseconds 100.00% <= 9 milliseconds 100.00% <= 9 milliseconds 83333.33 requests per second ====== RPOP ====== 100000 requests completed in 1.31 seconds 100 parallel clients 3 bytes payload keep alive: 1 76.27% <= 1 milliseconds 97.21% <= 2 milliseconds 98.94% <= 3 milliseconds 99.55% <= 4 milliseconds 99.83% <= 5 milliseconds 99.90% <= 6 milliseconds 99.91% <= 7 milliseconds 99.92% <= 8 milliseconds 99.92% <= 9 milliseconds 99.94% <= 10 milliseconds 99.97% <= 11 milliseconds 100.00% <= 12 milliseconds 76452.60 requests per second ====== SADD ====== 100000 requests completed in 1.21 seconds 100 parallel clients 3 bytes payload keep alive: 1 77.69% <= 1 milliseconds 97.11% <= 2 milliseconds 99.54% <= 3 milliseconds 99.85% <= 4 milliseconds 99.90% <= 5 milliseconds 99.90% <= 6 milliseconds 99.94% <= 7 milliseconds 100.00% <= 7 milliseconds 82644.62 requests per second ====== HSET ====== 100000 requests completed in 1.24 seconds 100 parallel clients 3 bytes payload keep alive: 1 75.84% <= 1 milliseconds 95.85% <= 2 milliseconds 99.01% <= 3 milliseconds 99.86% <= 4 milliseconds 100.00% <= 5 milliseconds 100.00% <= 5 milliseconds 80515.30 requests per second ====== SPOP ====== 100000 requests completed in 1.26 seconds 100 parallel clients 3 bytes payload keep alive: 1 74.45% <= 1 milliseconds 96.16% <= 2 milliseconds 98.84% <= 3 milliseconds 99.62% <= 4 milliseconds 99.92% <= 5 milliseconds 100.00% <= 5 milliseconds 79554.50 requests per second ====== LPUSH (needed to benchmark LRANGE) ====== 100000 requests completed in 1.25 seconds 100 parallel clients 3 bytes payload keep alive: 1 72.39% <= 1 milliseconds 95.90% <= 2 milliseconds 98.72% <= 3 milliseconds 99.76% <= 4 milliseconds 99.96% <= 5 milliseconds 100.00% <= 5 milliseconds 79872.20 requests per second ====== LRANGE_100 (first 100 elements) ====== 100000 requests completed in 1.77 seconds 100 parallel clients 3 bytes payload keep alive: 1 65.60% <= 1 milliseconds 85.06% <= 2 milliseconds 94.15% <= 3 milliseconds 98.57% <= 4 milliseconds 99.92% <= 5 milliseconds 99.98% <= 6 milliseconds 100.00% <= 7 milliseconds 56338.03 requests per second ====== LRANGE_300 (first 300 elements) ====== 100000 requests completed in 4.08 seconds 100 parallel clients 3 bytes payload keep alive: 1 0.00% <= 1 milliseconds 53.41% <= 2 milliseconds 70.07% <= 3 milliseconds 80.53% <= 4 milliseconds 87.97% <= 5 milliseconds 93.47% <= 6 milliseconds 97.15% <= 7 milliseconds 99.20% <= 8 milliseconds 99.67% <= 9 milliseconds 99.84% <= 10 milliseconds 99.94% <= 11 milliseconds 99.98% <= 12 milliseconds 99.99% <= 13 milliseconds 100.00% <= 13 milliseconds 24509.80 requests per second ====== LRANGE_500 (first 450 elements) ====== 100000 requests completed in 5.64 seconds 100 parallel clients 3 bytes payload keep alive: 1 0.00% <= 1 milliseconds 10.07% <= 2 milliseconds 55.19% <= 3 milliseconds 67.40% <= 4 milliseconds 75.58% <= 5 milliseconds 81.86% <= 6 milliseconds 86.78% <= 7 milliseconds 91.25% <= 8 milliseconds 94.82% <= 9 milliseconds 97.31% <= 10 milliseconds 98.85% <= 11 milliseconds 99.32% <= 12 milliseconds 99.52% <= 13 milliseconds 99.66% <= 14 milliseconds 99.75% <= 15 milliseconds 99.84% <= 16 milliseconds 99.92% <= 17 milliseconds 99.98% <= 18 milliseconds 99.99% <= 19 milliseconds 100.00% <= 20 milliseconds 100.00% <= 21 milliseconds 17714.79 requests per second ====== LRANGE_600 (first 600 elements) ====== 100000 requests completed in 6.96 seconds 100 parallel clients 3 bytes payload keep alive: 1 0.00% <= 1 milliseconds 0.13% <= 2 milliseconds 35.07% <= 3 milliseconds 62.88% <= 4 milliseconds 71.57% <= 5 milliseconds 77.40% <= 6 milliseconds 82.06% <= 7 milliseconds 85.88% <= 8 milliseconds 89.21% <= 9 milliseconds 92.09% <= 10 milliseconds 94.47% <= 11 milliseconds 96.40% <= 12 milliseconds 98.03% <= 13 milliseconds 99.00% <= 14 milliseconds 99.42% <= 15 milliseconds 99.54% <= 16 milliseconds 99.61% <= 17 milliseconds 99.71% <= 18 milliseconds 99.80% <= 19 milliseconds 99.86% <= 20 milliseconds 99.92% <= 21 milliseconds 99.97% <= 22 milliseconds 100.00% <= 22 milliseconds 14374.01 requests per second ====== MSET (10 keys) ====== 100000 requests completed in 0.95 seconds 100 parallel clients 3 bytes payload keep alive: 1 91.19% <= 1 milliseconds 96.88% <= 2 milliseconds 99.46% <= 3 milliseconds 99.89% <= 4 milliseconds 99.99% <= 5 milliseconds 99.99% <= 6 milliseconds 100.00% <= 6 milliseconds 105042.02 requests per second