博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Redis-benchmark测试Redis性能
阅读量:6232 次
发布时间:2019-06-21

本文共 3024 字,大约阅读时间需要 10 分钟。

Redis-benchmark是官方自带的Redis性能测试工具,可以有效的测试Redis服务的性能。

使用说明如下:

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
Pipeline
requests. 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.

测试命令事例:

1、redis-benchmark -h 192.168.1.201 -p 6379 -c 100 -n 100000 

100个并发连接,100000个请求,检测host为localhost 端口为6379的redis服务器性能 

2、redis-benchmark -h 192.168.1.201 -p 6379 -q -d 100  

测试存取大小为100字节的数据包的性能

3、redis-benchmark -t set,lpush -n 100000 -q

只测试某些操作的性能

4、redis-benchmark -n 100000 -q script load "redis.call('set','foo','bar')"

只测试某些数值存取的性能

 

测试结果分析:

www@iZ23s8agtagZ:~$ redis-benchmark -h 121.41.88.209 -p 63789  -t lRange -c 10====== LPUSH (needed to benchmark LRANGE) ======  10000 requests completed in 0.16 seconds  10 parallel clients  3 bytes payload  keep alive: 1100.00% <= 0 milliseconds62111.80 requests per second====== LRANGE_100 (first 100 elements) ======  10000 requests completed in 0.26 seconds  10 parallel clients  3 bytes payload  keep alive: 1100.00% <= 0 milliseconds39062.50 requests per second====== LRANGE_300 (first 300 elements) ======  10000 requests completed in 0.62 seconds  10 parallel clients  3 bytes payload  keep alive: 1100.00% <= 0 milliseconds16051.36 requests per second====== LRANGE_500 (first 450 elements) ======  10000 requests completed in 0.91 seconds  10 parallel clients  3 bytes payload  keep alive: 1100.00% <= 0 milliseconds10940.92 requests per second====== LRANGE_600 (first 600 elements) ======  10000 requests completed in 1.18 seconds  10 parallel clients  3 bytes payload  keep alive: 199.35% <= 1 milliseconds99.88% <= 2 milliseconds99.91% <= 4 milliseconds100.00% <= 4 milliseconds8474.58 requests per second

测试结果2:

www@iZ23s8agtagZ:~$ redis-benchmark -h 121.41.88.209 -p 63789  -t lRange -c 10 -qLPUSH (needed to benchmark LRANGE): 64102.56 requests per secondLRANGE_100 (first 100 elements): 39370.08 requests per secondLRANGE_300 (first 300 elements): 16694.49 requests per secondLRANGE_500 (first 450 elements): 11001.10 requests per secondLRANGE_600 (first 600 elements): 8319.47 requests per second

 

转载地址:http://wuana.baihongyu.com/

你可能感兴趣的文章
Java IO最详解
查看>>
关于错误error C4430 error C2365 error C2078 error C2440 error C2143的处理。
查看>>
用python写一个抽奖程序
查看>>
npm使用入门(package.json)
查看>>
You are beautiful
查看>>
inline和宏之间的区别
查看>>
hibernate篇章五--Hibernage工作原理
查看>>
MongodDB学习笔记(二)(复制)
查看>>
oracle在线迁移同步数据,数据库报错
查看>>
Java中1.0 / 0.0 会输出什么?
查看>>
linux性能剖析工具
查看>>
DP ZOJ 3872 Beauty of Array
查看>>
jQuery Ajax实例 ($.ajax_$.post_$.get)
查看>>
垃圾桶丁
查看>>
HDU 4757 可持久化trie树
查看>>
spring-boot入门
查看>>
USB HID 分析
查看>>
驱动属性
查看>>
IOS 学习笔记(6) 控件 文本域(UITextField)的使用方法
查看>>
第一次写JQuery插件--用于显示子菜单
查看>>