redis 性能测试 redis-benchmark

数据存储

2017-06-17

299

1

技术:redis

运行环境:redis_version:3.2.9+centos7(vps) + SSD+RAM 1G

demo功能:学习怎么测试redis各种操作的性能。每秒执行多少次命令(qps), 并发数

测试单个命令的性能-测试set,lpush qps

并发数=50,总共请求次数=10,000,每次请求数据大小=2字节

root@ce920cd2beb8:/data# redis-benchmark -t set,lpush -n 100000 -q
SET: 41876.05 requests per second #代表每秒钟可以响应41,876个set请求
LPUSH: 43010.75 requests per second #代表每秒钟可以响应43,876个plush请求

测试全部命令的性能 qps

redis-benchmark -c 10 -n 100000 -d 1024

结果同单个命令测试结果形式

命令帮助

以下参数被支持:

Usage: redis-benchmark [-h ] [-p ] [-c ] [-n <requests]> [-k ]

 -h       Server hostname (default 127.0.0.1) redis所在服务的ip或者host名字
 -p           Server port (default 6379) redis提供服务的端口号
 -s         Server socket (overrides host and port) 这个将替换host 和 port
 -a       Password for Redis Auth redis密码
 -c        Number of parallel connections (default 50) 测试时模拟多少个客户端一起连接,即并发数
 -n       Total number of requests (default 100000) 测试是总共执行多少个命令
 -d           Data size of SET/GET value in bytes (default 2) 一次请求使用多少字节的数据, 比如get set 的value
 -dbnum         SELECT the specified db number (default 0) 使用redis的哪个db进行测试
 -k        1=keep alive 0=reconnect (default 1) 1=保持连接不断, 0=每次都重新连接redis
 -r    Use random keys for SET/GET/INCR, random values for SADD 使用随机key
  Using this option the benchmark will expand the string __rand_int__
  inside an argument with a 12 digits number in the specified range
  from 0 to keyspacelen-1. The substitution changes every time a command
  is executed. Default tests use this to hit random keys in the
  specified range.
 -P         Pipeline  requests. Default 1 (no pipeline). 是否使用管道执行
 -q                 Quiet. Just show query/sec values 静默输出每秒执行多少命令
 --csv              Output in CSV format 将测试结果输出到csv文件
 -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. 这个不知道啥意思

 

欢迎添加微信,互相学习↑↑↑ -_-

发表评论

全部评论:0条

白老虎

programming is not only to solve problems, ways to think