Redis 性能测试

一、Redis 性能测试

Redis 性能测试是通过同时执行多个命令实现的。

1.1 语法

注意:该命令是在 redis 的目录下执行的,而不是 redis 客户端的内部指令。

redis-benchmark [option] [option value]

1.2 示列

以下示列同时执行 10000 个请求来检测性能:

$ redis-benchmark -n 10000  -q

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

1.3 redis 性能测试工具可选参数

参数描述
-h 指定服务器主机名[默认值:127.0.0.1]-p 指定服务器端口 [默认值:6379]
-s 指定服务器 socket-c 指定并发连接数 [默认值50]
-n 指定请求数 [默认值10000]-d 以字节的形式指定 SET/GET 值的数据大小 [默认值2]
-k 1=keep alive 0=reconnect [默认值1]-r SET/GET/INCR 使用随机 key, SADD 使用随机值
-P 通过管道传输 请求 [默认值1]-q 强制退出 redis。仅显示 query/sec 值
–csv 以 CSV 格式输出-l 生成循环,永久执行测试
-t 仅运行以逗号分隔的测试命令列表。-I Idle 模式。仅打开 N 个 idle 连接并等待。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

书香水墨

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值