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. CentOS7.0关于libguestfs的bug

    libguestfs,libguestfs-tools是用来在不启动虚拟机的情况下,快速简单访问虚拟机磁盘的工具. 今天在CentOS7.0系统上通过guestmount命令去mount虚拟机磁盘的时 ...

  2. 【转】eclipse集成开发工具的插件安装

    转发一:打开Eclipse下载地址(http://www.eclipse.org/downloads/),可以看到有好多版本的Eclipse可供下载,初学者往往是一头雾水,不知道下载哪一个版本. 各个 ...

  3. Spring3整合Hibernate4-我们到底能走多远系列(30)

    我们到底能走多远系列(30) 扯淡: 30篇啦!从2012-08-15开始的系列,东平西凑将近一年的时间也就这么几篇.目标的100篇,按这个速度也要再搞两年呢. 发博客果然不是件容易的事,怪不得更多的 ...

  4. TCP/IP 协议大致的概念

    最近在看<图解HTTP>和<HTTP权威指南>,对TCP/IP大致过了一下. TCP/IP 不仅仅是TCP 和 IP  TCP/IP 是协议族,与之相对的事IEEE等标准组织设 ...

  5. 274. H-Index

    Given an array of citations (each citation is a non-negative integer) of a researcher, write a funct ...

  6. SQL注入测试平台 SQLol -3.INSERT注入测试

    访问首页的insert模块,http://127.0.0.1/sql/insert.php,开始对insert模块进行测试. insert语句: INSERT INTO [users] ([usern ...

  7. JavaWeb学习记录(二)——防盗链技术

    public class TestServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpSer ...

  8. phpwind将服务器数据同步到本地之后网站不显示或者排版错误

    在将phpwind的数据同步到本地服务器之后 如果访问本地服务器的首页不能显示的话 首先要查看global.php文件中的D_P变量,官方默认 的此变量应该指向和R_P变量是同一个文件夹即网站的根目录 ...

  9. 织梦DedeCMS"当前位置"去除最后一个 > 符号的方法

    首先找到根目录下面的include 目录,然后找到 typelink.class.php 文件, 再查找到 GetPositionLink 方法 下面的 return $this->valueP ...

  10. hdu5438(2015长春赛区网络赛1002)拓扑序+DFS

    题意:给出一张无向图,每个节点有各自的权值,问在点数为奇数的圈中的点的权值总和是多少. 通过拓扑序的做法标记出所有非圈上的点,做法就是加每条边的时候将两点的入度都加一,然后将所有度数为1的点入队,删去 ...