Redis自己提供了一个性能测试工具redis-benchmark。redis-benchmark可以模拟N个机器,同时发送M个请求。

用法:redis-benchmark [-h ] [-p ] [-c ] [-n [-k ]

-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) set 数据大小
-k <boolean> 1=keep alive 0=reconnect (default 1) 是否采用keep alive模式
-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). 是否采用Pipeline模式请求,默认不采用
-q Quiet. Just show query/sec values 仅仅显示查询时间
--csv Output in CSV format 导出为CSV格式
-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.

常用的办法

redis-benchmark -q -n 1000
PING_INLINE: 20408.16 requests per second
PING_BULK: 25000.00 requests per second
SET: 18181.82 requests per second
GET: 21739.13 requests per second
INCR: 27027.03 requests per second
LPUSH: 27027.03 requests per second
LPOP: 27027.03 requests per second
SADD: 27027.03 requests per second
SPOP: 22222.22 requests per second
LPUSH (needed to benchmark LRANGE): 27777.78 requests per second
LRANGE_100 (first 100 elements): 10989.01 requests per second
LRANGE_300 (first 300 elements): 5434.78 requests per second
LRANGE_500 (first 450 elements): 4444.44 requests per second
LRANGE_600 (first 600 elements): 3164.56 requests per second
MSET (10 keys): 18518.52 requests per second

可以看出在我的笔记本上,redis每秒可以处理上万条请求。

如果要显示详细资料的方式

redis-benchmark -n 1000

redis-benchmark -n 1000
====== PING_INLINE ======
1000 requests completed in 0.04 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
7.30% <= 1 milliseconds
85.80% <= 2 milliseconds
95.10% <= 4 milliseconds
96.90% <= 5 milliseconds
100.00% <= 5 milliseconds
23255.81 requests per second
 
====== PING_BULK ======
1000 requests completed in 0.05 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
11.30% <= 1 milliseconds
77.00% <= 2 milliseconds
92.10% <= 3 milliseconds
95.10% <= 5 milliseconds
100.00% <= 5 milliseconds
22222.22 requests per second
 
====== SET ======
1000 requests completed in 0.04 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
11.20% <= 1 milliseconds
88.40% <= 2 milliseconds
93.30% <= 3 milliseconds
94.00% <= 4 milliseconds
94.60% <= 5 milliseconds
98.20% <= 6 milliseconds
98.60% <= 8 milliseconds
100.00% <= 8 milliseconds
22727.27 requests per second
 
====== GET ======
1000 requests completed in 0.04 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
6.30% <= 1 milliseconds
86.00% <= 2 milliseconds
100.00% <= 2 milliseconds
25641.03 requests per second
 
====== INCR ======
1000 requests completed in 0.05 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
7.30% <= 1 milliseconds
77.30% <= 2 milliseconds
83.40% <= 3 milliseconds
95.10% <= 6 milliseconds
98.20% <= 7 milliseconds
100.00% <= 7 milliseconds
20408.16 requests per second
 
====== LPUSH ======
1000 requests completed in 0.04 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
10.00% <= 1 milliseconds
75.00% <= 2 milliseconds
97.20% <= 3 milliseconds
100.00% <= 3 milliseconds
23809.52 requests per second
 
====== LPOP ======
1000 requests completed in 0.05 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
7.00% <= 1 milliseconds
79.30% <= 2 milliseconds
88.50% <= 3 milliseconds
90.60% <= 4 milliseconds
97.40% <= 5 milliseconds
100.00% <= 5 milliseconds
21276.60 requests per second
 
====== SADD ======
1000 requests completed in 0.04 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
11.10% <= 1 milliseconds
83.40% <= 2 milliseconds
91.70% <= 3 milliseconds
97.80% <= 4 milliseconds
99.60% <= 5 milliseconds
100.00% <= 5 milliseconds
23809.52 requests per second
 
====== SPOP ======
1000 requests completed in 0.04 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
7.90% <= 1 milliseconds
77.90% <= 2 milliseconds
90.60% <= 3 milliseconds
95.10% <= 5 milliseconds
100.00% <= 5 milliseconds
23255.81 requests per second
 
====== LPUSH (needed to benchmark LRANGE) ======
1000 requests completed in 0.04 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
10.10% <= 1 milliseconds
95.40% <= 4 milliseconds
97.60% <= 6 milliseconds
100.00% <= 6 milliseconds
22727.27 requests per second
 
====== LRANGE_100 (first 100 elements) ======
1000 requests completed in 0.09 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
1.20% <= 1 milliseconds
10.00% <= 2 milliseconds
50.90% <= 3 milliseconds
87.90% <= 4 milliseconds
99.60% <= 5 milliseconds
100.00% <= 5 milliseconds
10869.57 requests per second
 
====== LRANGE_300 (first 300 elements) ======
1000 requests completed in 0.18 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
0.90% <= 1 milliseconds
6.70% <= 2 milliseconds
13.70% <= 3 milliseconds
26.40% <= 4 milliseconds
41.00% <= 5 milliseconds
60.20% <= 6 milliseconds
76.40% <= 7 milliseconds
88.20% <= 8 milliseconds
95.80% <= 9 milliseconds
98.50% <= 10 milliseconds
99.60% <= 11 milliseconds
100.00% <= 11 milliseconds
5494.51 requests per second
 
====== LRANGE_500 (first 450 elements) ======
1000 requests completed in 0.24 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
0.10% <= 1 milliseconds
1.90% <= 2 milliseconds
5.60% <= 3 milliseconds
13.10% <= 4 milliseconds
26.80% <= 5 milliseconds
40.00% <= 6 milliseconds
53.90% <= 7 milliseconds
63.60% <= 8 milliseconds
74.70% <= 9 milliseconds
82.90% <= 10 milliseconds
90.00% <= 11 milliseconds
95.90% <= 12 milliseconds
99.30% <= 13 milliseconds
99.80% <= 14 milliseconds
100.00% <= 14 milliseconds
4132.23 requests per second
 
====== LRANGE_600 (first 600 elements) ======
1000 requests completed in 0.28 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
0.10% <= 1 milliseconds
0.40% <= 2 milliseconds
2.30% <= 3 milliseconds
9.10% <= 4 milliseconds
20.90% <= 5 milliseconds
32.50% <= 6 milliseconds
42.70% <= 7 milliseconds
56.10% <= 8 milliseconds
69.20% <= 9 milliseconds
83.10% <= 10 milliseconds
90.40% <= 11 milliseconds
95.90% <= 12 milliseconds
97.00% <= 13 milliseconds
97.70% <= 14 milliseconds
97.90% <= 15 milliseconds
98.20% <= 16 milliseconds
98.60% <= 17 milliseconds
98.90% <= 18 milliseconds
99.30% <= 19 milliseconds
99.60% <= 20 milliseconds
100.00% <= 21 milliseconds
3558.72 requests per second
 
====== MSET (10 keys) ======
1000 requests completed in 0.06 seconds
50 parallel clients
3 bytes payload
keep alive: 1
 
5.60% <= 1 milliseconds
47.20% <= 2 milliseconds
89.40% <= 3 milliseconds
95.80% <= 8 milliseconds
95.90% <= 10 milliseconds
99.50% <= 11 milliseconds
100.00% <= 11 milliseconds
16666.67 requests per second

很多时候,我们在局域网会调用redis,比如我有10台机器,可能同时产生大量的数据,然后这些数据同时存储在1台redis上。那么我们可以分别在10台机器上测试
redis-benchmark -h 192.168.1.124 -p 6379 -n 100000

Redis性能测试工具benchmark简介的更多相关文章

  1. redis性能测试工具的使用

    在redis安装完成后会生成一个bin的目录,在这个目录中有一个 redis-benchmark 的文件脚本工具,通过执行这个工具进行redis的性能测试. bash #执行这个脚本后脚本会自动运行r ...

  2. .NET平台性能测试工具BenchmarkDotnet 简介[译文]

    项目中需要用到性能测试,发现.net 平台的这个神器. 觉得很不错,接下来准备做个系列.具体参考官方介绍 做基线对比测试不是那么容易,你很容易就翻车掉坑里,BenchmarkDotNet 会帮你避坑( ...

  3. 性能测试工具LoadRunner02-LR简介

    使用LoadRunner的步骤 制定性能测试计划-->开发测试脚本-->设计测试场景-->执行测试场景-->监控测试场景-->分析测试结果 LoadRunner由哪些部件 ...

  4. 数据库之redis篇(2)—— redis配置文件,常用命令,性能测试工具

    redis配置 如果你是找网上的其他教程来完成以上操作的话,相信你见过有的启动命令是这样的: 启动命令带了这个参数:redis.windows.conf,由于我测试环境是windows平台,所以是这个 ...

  5. Redis性能测试

    Redis 性能测试 Redis 性能测试是通过同时执行多个命令实现的.Redis性能测试主要是通过src文件夹下的redis-benchmark来实现(Linux系统下) 语法 redis 性能测试 ...

  6. Redis 性能测试

    Redis 性能测试是通过同时执行多个命令实现的. 语法 redis 性能测试的基本命令如下: redis-benchmark [option] [option value] 实例 以下实例同时执行 ...

  7. Redis性能测试Redis-benchmark

    Redis-benchmark是官方自带的Redis性能测试工具 测试Redis在你的系统及你的配置下的读写性能 redis-benchmark可以模拟N个机器,同时发送M个请求 redis-benc ...

  8. 10.Redis 性能测试

    转自:http://www.runoob.com/redis/redis-tutorial.html Redis 性能测试是通过同时执行多个命令实现的. 语法 redis 性能测试的基本命令如下: r ...

  9. c++性能测试工具:google benchmark入门(一)

    如果你正在寻找一款c++性能测试工具,那么这篇文章是不容错过的. 市面上的benchmark工具或多或少存在一些使用上的不便,那么是否存在一个使用简便又功能强大的性能测试工具呢?答案是google/b ...

随机推荐

  1. 面向过程部分 Java 和 C++ 的区别

    前言 Java 和 C++ 在面向过程部分区别并不大,但还是有的,本文罗列了这些区别. 在 Java 中: 1. 数据类型的范围和机器无关 2. 加上前缀 0b 可以表示二进制数,如 0b1001 就 ...

  2. 右键菜单添加程序,指定图标, Notepad2、Sublime Text 2

    右键添加Sublime Text 打开方式 Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\Sublime Text] ...

  3. Sublime Text插件:HTML+CSS+JAVASCRIPT+JSON快速格式化

    安装过程简要说明如下: 在Sublime Text中,按下Ctrl+Shift+P调出命令面板; 输入install 调出 Install Package 选项并回车; 输入pretty,并在列表中选 ...

  4. 纯JavaScrip图表插件——Highcharts

    简介 Highcharts 是一个用纯JavaScript编写的一个图表库, 能够很简单便捷的在web网站或是web应用程序添加有交互性的图表,并且免费提供给个人学习.个人网站和非商业用途使用.目前H ...

  5. 用过sessionid防钓鱼

    http://www.cnblogs.com/BearsTaR/archive/2010/08/24/URL_SESSION_ID_LEEK.html DisableUrlSessionFilter

  6. 增量更新项目时的备份MyBak

    在增量更新项目时,做好备份十分重要,这里提供一个方法备份java Web所更新的文件. 把更新包放在指定目录,配好如下webappFolder.updateFolder以及bakeupFolder的路 ...

  7. kuangbin_UnionFind B (POJ 1611)

    过程是模板 merge完后扫一下几个跟0同祖先节点就是答案了 #include <iostream> #include <string> #include <cstdio ...

  8. (转) A Survival Guide to a PhD

    A Survival Guide to a PhD Sep 7, 2016 This guide is patterned after my “Doing well in your courses”, ...

  9. awesome-nlp

    awesome-nlp  A curated list of resources dedicated to Natural Language Processing Maintainers - Keon ...

  10. ADS1110/ADS1271

    ADS1110 1.初始化 软件:设置p任意2个为GPIO口 硬件:设置p0.2,p0.3为SDA,SCL 输入.输出 ADS1110的I2C地址(1001aaa)例如ADS1110A0的地址是100 ...