【Redis】Windows下使用Redis自带的redis-benchmark工具对Redis进行压测

Windows下使用Redis自带的redis-benchmark工具对Redis进行压测

1、打开Redis服务

(Redis服务的打开可以参考https://blog.csdn.net/waiting971118/article/details/122392382?spm=1001.2014.3001.5501
因为我已经注册了Redis服务,所以我的电脑Redis服务一直处于打开状态。

2、打开dos窗口进行测试

(1)测试命令

Usage: redis-benchmark [-h] [-p] [-c] [-n[-k]
-h    Server hostname (default 127.0.0.1)
-p    Server port (default 6379)
-s    Server socket (overrides host and port)
-c    Number of parallel connections (default 50)
-n    Total number of requests (default 10000)
-d      Data size of SET/GET value in bytes (default 2)
-k      1=keep alive 0=reconnect (default 1)
-r      Use random keys for SET/GET/INCR, random values for SADD
Using this option the benchmark will get/set keys
in the form mykey_rand:000000012456 instead of constant
keys, the argument determines the max
number of values for the random number. For instance
if set to 10 only rand:000000000000 - rand:000000000009
range will be allowed.
-P      Pipelinerequests. Default 1 (no pipeline).
-q      Quiet. Just show query/sec values
—csv    Output in CSV format
-l      Loop. Run the tests forever
-t      Only run the comma-separated list of tests. The test
names are the same as the ones produced as output.
-I      Idle mode. Just open N idle connections and wait.

(2)测试命令示例:

redis-benchmark -h 127.0.0.1 -p 6379 -c 100 -n 100000
//100个并发连接,100000个请求,检测 host 为 localhost 端口为6379的 redis 服务器性能。
redis-benchmark -h 127.0.0.1 -p 6379 -q -d 100
//测试存取大小为100字节的数据包的性能。
redis-benchmark -t set,lpush -n 100000 -q
//只测试某些操作的性能
redis-benchmark -n 100000 -q script load "redis.call('set','foo','bar')"
//只测试某些数值存取的性能

(3)测试结果
在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值