Redis 性能测试

用 redis-benchmark 压测吞吐与延迟。

Beginner
Key Pointsredis-benchmark 是官方压测工具,能快速看出单实例 QPS 上限。

常用压测

Shell
redis-benchmark -q -n 100000        # 10 万次请求,精简输出
redis-benchmark -t set,get -n 100000 -c 50   # 50 并发跑 SET/GET
redis-benchmark -n 100000 -d 256    # value 256 字节
Output
SET: 110000.00 requests per second
GET: 120000.00 requests per second
QPS depends on value size, concurrency and whether AOF is on. Benchmark close to real traffic (similar value sizes, command mix) — don't trust only the default SET/GET numbers.

Friends & Partners