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

  使用说明如下:

 Usage: redis-benchmark [-h <host>] [-p <port>] [-c <clients>] [-n <requests]> [-k <boolean>]

  -h <hostname>      Server hostname (default 127.0.0.1)
-p <port> Server port (default 6379)
-s <socket> Server socket (overrides host and port)
-c <clients> Number of parallel connections (default 50)
-n <requests> Total number of requests (default 10000)
-d <size> Data size of SET/GET value in bytes (default 2)
-k <boolean> 1=keep alive 0=reconnect (default 1)
-r <keyspacelen> 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 <keyspacelen> 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 <numreq> Pipeline <numreq> requests. Default 1 (no pipeline).
-q Quiet. Just show query/sec values
--csv Output in CSV format
-l Loop. Run the tests forever
-t <tests> 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 127.0.0.1 -p 6379 -c 100 -n 100000 
  100个并发连接,100000个请求,检测host为localhost 端口为6379的redis服务器性能

  2、redis-benchmark -h 127.0.0.1 -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')"

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

测试结果分析

  1 [root@H__D redis]# redis-benchmark -h 127.0.0.1 -p 6379 -c 100 -n 100000
2 ====== PING_INLINE ======
3 100000 requests completed in 0.94 seconds
4 100 parallel clients
5 3 bytes payload
6 keep alive: 1
7
8 99.50% <= 1 milliseconds
9 99.97% <= 2 milliseconds
10 100.00% <= 2 milliseconds
11 106951.88 requests per second
12
13 ====== PING_BULK ======
14 100000 requests completed in 0.89 seconds
15 100 parallel clients
16 3 bytes payload
17 keep alive: 1
18
19 99.43% <= 1 milliseconds
20 99.98% <= 2 milliseconds
21 100.00% <= 2 milliseconds
22 111856.82 requests per second
23
24 ====== SET ======
25 100000 requests completed in 0.92 seconds
26 100 parallel clients
27 3 bytes payload
28 keep alive: 1
29
30 99.67% <= 1 milliseconds
31 100.00% <= 2 milliseconds
32 108459.87 requests per second
33
34 ====== GET ======
35 100000 requests completed in 0.91 seconds
36 100 parallel clients
37 3 bytes payload
38 keep alive: 1
39
40 99.60% <= 1 milliseconds
41 100.00% <= 2 milliseconds
42 100.00% <= 2 milliseconds
43 109769.48 requests per second
44
45 ====== INCR ======
46 100000 requests completed in 0.92 seconds
47 100 parallel clients
48 3 bytes payload
49 keep alive: 1
50
51 99.64% <= 1 milliseconds
52 100.00% <= 2 milliseconds
53 100.00% <= 2 milliseconds
54 109289.62 requests per second
55
56 ====== LPUSH ======
57 100000 requests completed in 0.92 seconds
58 100 parallel clients
59 3 bytes payload
60 keep alive: 1
61
62 99.71% <= 1 milliseconds
63 100.00% <= 2 milliseconds
64 100.00% <= 2 milliseconds
65 109170.30 requests per second
66
67 ====== RPUSH ======
68 100000 requests completed in 0.92 seconds
69 100 parallel clients
70 3 bytes payload
71 keep alive: 1
72
73 99.64% <= 1 milliseconds
74 99.99% <= 2 milliseconds
75 100.00% <= 2 milliseconds
76 108695.65 requests per second
77
78 ====== LPOP ======
79 100000 requests completed in 0.91 seconds
80 100 parallel clients
81 3 bytes payload
82 keep alive: 1
83
84 99.62% <= 1 milliseconds
85 99.99% <= 2 milliseconds
86 100.00% <= 2 milliseconds
87 109529.02 requests per second
88
89 ====== RPOP ======
90 100000 requests completed in 0.91 seconds
91 100 parallel clients
92 3 bytes payload
93 keep alive: 1
94
95 99.74% <= 1 milliseconds
96 99.99% <= 2 milliseconds
97 100.00% <= 2 milliseconds
98 109409.20 requests per second
99
100 ====== SADD ======
101 100000 requests completed in 0.92 seconds
102 100 parallel clients
103 3 bytes payload
104 keep alive: 1
105
106 99.61% <= 1 milliseconds
107 99.99% <= 2 milliseconds
108 100.00% <= 2 milliseconds
109 109051.26 requests per second
110
111 ====== HSET ======
112 100000 requests completed in 0.93 seconds
113 100 parallel clients
114 3 bytes payload
115 keep alive: 1
116
117 99.32% <= 1 milliseconds
118 99.98% <= 2 milliseconds
119 100.00% <= 2 milliseconds
120 107642.62 requests per second
121
122 ====== SPOP ======
123 100000 requests completed in 0.90 seconds
124 100 parallel clients
125 3 bytes payload
126 keep alive: 1
127
128 99.76% <= 1 milliseconds
129 100.00% <= 1 milliseconds
130 110741.97 requests per second
131
132 ====== LPUSH (needed to benchmark LRANGE) ======
133 100000 requests completed in 0.92 seconds
134 100 parallel clients
135 3 bytes payload
136 keep alive: 1
137
138 99.69% <= 1 milliseconds
139 99.99% <= 2 milliseconds
140 100.00% <= 2 milliseconds
141 108577.63 requests per second
142
143 ====== LRANGE_100 (first 100 elements) ======
144 100000 requests completed in 0.93 seconds
145 100 parallel clients
146 3 bytes payload
147 keep alive: 1
148
149 99.77% <= 1 milliseconds
150 100.00% <= 1 milliseconds
151 108108.11 requests per second
152
153 ====== LRANGE_300 (first 300 elements) ======
154 100000 requests completed in 0.93 seconds
155 100 parallel clients
156 3 bytes payload
157 keep alive: 1
158
159 99.52% <= 1 milliseconds
160 100.00% <= 2 milliseconds
161 100.00% <= 2 milliseconds
162 107296.14 requests per second
163
164 ====== LRANGE_500 (first 450 elements) ======
165 100000 requests completed in 0.94 seconds
166 100 parallel clients
167 3 bytes payload
168 keep alive: 1
169
170 99.64% <= 1 milliseconds
171 99.99% <= 2 milliseconds
172 100.00% <= 2 milliseconds
173 106723.59 requests per second
174
175 ====== LRANGE_600 (first 600 elements) ======
176 100000 requests completed in 0.92 seconds
177 100 parallel clients
178 3 bytes payload
179 keep alive: 1
180
181 99.73% <= 1 milliseconds
182 100.00% <= 2 milliseconds
183 108225.10 requests per second
184
185 ====== MSET (10 keys) ======
186 100000 requests completed in 1.06 seconds
187 100 parallel clients
188 3 bytes payload
189 keep alive: 1
190
191 91.36% <= 1 milliseconds
192 99.97% <= 2 milliseconds
193 100.00% <= 2 milliseconds
194 94517.96 requests per second
 [root@H__D redis]# redis-benchmark -h 127.0.0.1 -p 6379 -q -d 100
PING_INLINE: 113122.17 requests per second
PING_BULK: 117785.63 requests per second
SET: 114285.71 requests per second
GET: 116144.02 requests per second
INCR: 116144.02 requests per second
LPUSH: 113895.21 requests per second
RPUSH: 113507.38 requests per second
LPOP: 116550.12 requests per second
RPOP: 116279.07 requests per second
SADD: 115740.73 requests per second
HSET: 112866.82 requests per second
SPOP: 116279.07 requests per second
LPUSH (needed to benchmark LRANGE): 113636.37 requests per second
LRANGE_100 (first 100 elements): 114025.09 requests per second
LRANGE_300 (first 300 elements): 113895.21 requests per second
LRANGE_500 (first 450 elements): 113507.38 requests per second
LRANGE_600 (first 600 elements): 114155.25 requests per second
MSET (10 keys): 93023.25 requests per second

【Redis】Redis-benchmark测试Redis性能的更多相关文章

  1. YCSB benchmark测试mongodb性能——和web服务器测试性能结果类似

    转自:http://blog.sina.com.cn/s/blog_48c95a190102v9kg.html         YCSB(Yahoo! Cloud Serving Benchmark) ...

  2. YCSB benchmark测试cassandra性能——和web服务器测试性能结果类似

    转自:http://www.itdadao.com/articles/c15a531189p0.html http://www.cnblogs.com/bettersky/p/6158172.html ...

  3. Redis-benchmark测试Redis性能

    Redis-benchmark是官方自带的Redis性能测试工具,可以有效的测试Redis服务的性能. 使用说明如下: Usage: redis-benchmark [-h <host>] ...

  4. Redis(十九):Redis压力测试工具benchmark

    redis-benchmark使用参数介绍 Redis 自带了一个叫 redis-benchmark 的工具来模拟 N 个客户端同时发出 M 个请求. (类似于 Apache ab 程序).你可以使用 ...

  5. 搭建和测试 Redis 主备和集群

    本文章只是自我学习用,不适宜转载. 1. Redis主备集群 1.1 搭建步骤 机器:海航云虚机(2核4GB内存),使用 Centos 7.2 64bit 操作系统,IP 分别是 192.168.10 ...

  6. Redis配置文件各项参数说明及性能调优

    Redis配置文件参数说明: 1. Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程 daemonize no 2. 当Redis以守护进程方式运行时,Redis默 ...

  7. 【Redis】Redis基础 - Redis安装启动测试

    Redis基本 - 安装 文章目录 Redis基本 - 安装 Linux下安装Redis Docker 方式 Github 源码编译方式 直接安装方式 Windows下Redis安装 记录 - Red ...

  8. Jedis测试redis

    首先:Jedis是redis的java版本的客户端. public class JedisTest { //单机版测试Jedis,不使用连接池 @Test public void testJedis( ...

  9. 测试redis+keepalived实现简单的主备切换【转载】

    转自: 测试redis+keepalived实现简单的主备切换 - Try My Best 尽力而为 - ITeye技术网站http://raising.iteye.com/blog/2311757 ...

随机推荐

  1. [Android] TextView长按复制实现方法小结(转载)

    这是别人写的,既然别人总结过了,那我就不花时间研究这个了,但往后会补充一些使用经验之类的 原文地址:http://blog.csdn.net/stzy00/article/details/414778 ...

  2. 一些网站的meta标签的作用

    转载:https://www.cnblogs.com/Lily-nercel/p/6693293.html <!DOCTYPE html> <html lang="en&q ...

  3. 【mybatis基础】mybatis开发dao两种方法

    mybatis是一个支持普通SQL查询,存储过程和高级映射的优秀的持久层的框架,是apache下的顶级项目.mybatis消除了几乎所有的JDBC代码和参数的手工设置以及对结果集的检索封装.mybat ...

  4. Genymotion 模拟器上网出现 net::ERR_NAME_NOT_RESOLVED

    Genymotion 模拟器在公司网络安装的,然后启动能正常上网,把笔记本带回家,网络变化了,再使用模拟器 上网显示: (net::ERR_NAME_NOT_RESOLVED) 各种百度,最后用如下方 ...

  5. [Java学习]面向对象-super关键字;final关键字

    super关键字 super代表的是当前子类对象中的父类型特征,可以看做是this的一部分.与this不同,不是引用,不存储对象内存地址. super可以用在什么位置 1 可以用在成员方法中.不能用在 ...

  6. 畅谈Redis和Memcached的区别

    简述 memcached 和 redis 都很类似:都是内存型数据库,数据保存在内存中,通过tcp直接存取,优势是速度快,并发高,缺点是数据类型有限,查询功能不强,一般用作缓存. 那么题主说 memc ...

  7. elastic5.4安装错误解决

    首先,我们从官网下载:(官网:https://www.elastic.co/downloads/elasticsearch)(推荐下载deb或者rpm包,否则坑很多) 启动 (需要依赖java环境) ...

  8. spirng中的asm与jdk不兼容<已解决>

    转载自:spirng中的asm与jdk不兼容<已解决> 前言 不知道前面对eclipse做了什么,使用maven来创建项目,然后转成web,启动的时候一直报错.我弄了好久,还是无法解决,先 ...

  9. Spring mvc项目导出jar包无法识别正常映射问题

    笔者的代码很简单,平常的配置文件,web.xml如下 <servlet> <!--名称 --> <servlet-name>springmvc</servle ...

  10. C语言中简单的for循环和浮点型变量

    浮点型变量:常数中带有小数点的叫做浮点型 以下用for循环写一个摄氏度和华氏度的转换的C程序 [见 http://www.linuxidc.com/Linux/2013-08/88513.htm ] ...