redis做压测可以用自带的redis-benchmark工具,使用简单,效果也比较不错。

linux下一般无需下载,windows下redis-benchmark压力测试工具下载地址:http://www.daixiaorui.com/source/18.html(解压后的redis-benchmark.exe)

压测命令:redis-benchmark -h 127.0.0.1 -p 6379 -c 50 -n 10000

-c表示连接数

-n表示请求数

更多参数请输入 --help 查看~

压测需要一段时间,因为它需要依次压测多个命令的结果,如:get、set、incr、lpush等等,所以我们需要耐心等待,如果只需要压测某个命令,如:get,那么可以在以上的命令后加一个参数-t(红色部分):

redis-benchmark -h 127.0.0.1 -p 6086 -c 50 -n 10000 -t get

压测结果:

[root@1234 ~]# redis-benchmark -h 127.0.0.1 -p 6086 -c 50 -n 10000 -t get

====== GET ======

10000 requests completed in 0.15 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.16% <= 1 milliseconds

100.00% <= 1 milliseconds

68027.21 requests per second

不带-t的压测结果如下:

[root@1234 ~]# redis-benchmark -h 127.0.0.1 -p 6086 -c 50 -n 10000

====== PING_INLINE ======

10000 requests completed in 0.15 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.35% <= 1 milliseconds

100.00% <= 1 milliseconds

67114.09 requests per second

====== PING_BULK ======

10000 requests completed in 0.15 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.38% <= 1 milliseconds

100.00% <= 1 milliseconds

66666.66 requests per second

====== SET ======  (处理set的性能)

10000 requests completed in 0.17 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.11% <= 1 milliseconds

99.51% <= 25 milliseconds

100.00% <= 25 milliseconds

57142.86 requests per second

====== GET ======  (处理get请求的性能)

10000 requests completed in 0.15 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.09% <= 1 milliseconds

99.51% <= 11 milliseconds

100.00% <= 12 milliseconds

66666.66 requests per second

====== INCR ======

10000 requests completed in 0.15 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.33% <= 1 milliseconds

100.00% <= 1 milliseconds

66666.66 requests per second

====== LPUSH ======

10000 requests completed in 0.16 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.20% <= 1 milliseconds

100.00% <= 1 milliseconds

64516.13 requests per second

====== LPOP ======

10000 requests completed in 0.16 seconds

50 parallel clients

3 bytes payload

keep alive: 1

98.56% <= 1 milliseconds

99.51% <= 14 milliseconds

100.00% <= 14 milliseconds

61349.69 requests per second

====== SADD ======

10000 requests completed in 0.15 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.36% <= 1 milliseconds

100.00% <= 1 milliseconds

67114.09 requests per second

====== SPOP ======

10000 requests completed in 0.14 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.32% <= 1 milliseconds

100.00% <= 1 milliseconds

69930.07 requests per second

====== LPUSH (needed to benchmark LRANGE) ======

10000 requests completed in 0.15 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.47% <= 1 milliseconds

100.00% <= 1 milliseconds

67567.57 requests per second

====== LRANGE_100 (first 100 elements) ======

10000 requests completed in 0.14 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.41% <= 1 milliseconds

100.00% <= 1 milliseconds

72992.70 requests per second

====== LRANGE_300 (first 300 elements) ======

10000 requests completed in 0.14 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.41% <= 1 milliseconds

100.00% <= 1 milliseconds

72463.77 requests per second

====== LRANGE_500 (first 450 elements) ======

10000 requests completed in 0.14 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.35% <= 1 milliseconds

100.00% <= 1 milliseconds

68965.52 requests per second

====== LRANGE_600 (first 600 elements) ======

10000 requests completed in 0.15 seconds

50 parallel clients

3 bytes payload

keep alive: 1

99.37% <= 1 milliseconds

100.00% <= 1 milliseconds

66225.17 requests per second

====== MSET (10 keys) ======

10000 requests completed in 0.17 seconds

50 parallel clients

3 bytes payload

keep alive: 1

94.94% <= 1 milliseconds

100.00% <= 1 milliseconds

58479.53 requests per second

这样看起来很冗余,如果我们只想看最终的结果,可以带上参数-q,完整的命令如下:

redis-benchmark -h 127.0.0.1 -p 6086 -c 50 -n 10000 -q

显示结果为:

[root@1234 ~]# redis-benchmark -h 127.0.0.1 -p 6086 -c 50 -n 10000 -q

PING_INLINE: 66225.17 requests per second

PING_BULK: 65789.48 requests per second

SET: 66666.66 requests per second

GET: 69444.45 requests per second

INCR: 62893.08 requests per second

LPUSH: 65789.48 requests per second

LPOP: 68027.21 requests per second

SADD: 64935.07 requests per second

SPOP: 67114.09 requests per second

LPUSH (needed to benchmark LRANGE): 62893.08 requests per second

LRANGE_100 (first 100 elements): 69444.45 requests per second

LRANGE_300 (first 300 elements): 68965.52 requests per second

LRANGE_500 (first 450 elements): 68965.52 requests per second

LRANGE_600 (first 600 elements): 68965.52 requests per second

MSET (10 keys): 59171.60 requests per second

温馨提示:

压测结果跟机器的性能有关,其中windows下压测的结果要比在linux下差一大截。

redis压力测试详解的更多相关文章

  1. web 压力测试工具ab压力测试详解

    Web性能压力测试工具之ApacheBench(ab)详解 原文:http://www.ha97.com/4617.html PS:网站性能压力测试是性能调优过程中必不可少的一环.只有让服务器处在高压 ...

  2. 使用ab进行压力测试详解

    ab是apache自带的压力测试工具,非常好用.转载几篇对ab工具的详细使用的博文.猛击下面的链接地址 http://www.365mini.com/page/apache-benchmark.htm ...

  3. CodeBenchmark之压力测试详解

    CodeBenchmark是一款高性能可视化的并发测试组件,通过组件可以对任意逻辑代码或服务进行并发测试:组件最终通过可视化的方式来显示测试结果,在测试结果中可以看到具体的并发情况和处理延时的分布.组 ...

  4. Redis 配置文件 redis.conf 项目详解

    Redis.conf 配置文件详解 # [Redis](http://yijiebuyi.com/category/redis.html) 配置文件 # 当配置中需要配置内存大小时,可以使用 1k, ...

  5. Redis主从复制机制详解

    Redis主从复制机制详解 Redis有两种不同的持久化方式,Redis服务器通过持久化,把Redis内存中持久化到硬盘当中,当Redis宕机时,我们重启Redis服务器时,可以由RDB文件或AOF文 ...

  6. [转]Reids配置文件redis.conf中文详解

    转自: Reids配置文件redis.conf中文详解 redis的各种配置都是在redis.conf文件中进行配置的. 有关其每项配置的中文详细解释如下: 对应的中文版解释redis.conf # ...

  7. nosql Redis命令操作详解

    Redis命令操作详解 一.key pattern 查询相应的key (1)redis允许模糊查询key 有3个通配符 *.?.[] (2)randomkey:返回随机key (3)type key: ...

  8. Redis常见配置文件详解

    Redis常见配置文件详解 # vi redis.conf 1 2 3 daemonize yes #是否以后台进程运行 4 5 pidfile /var/run/redis/redis-server ...

  9. Redis配置参数详解

    Redis配置参数详解 /********************************* GENERAL *********************************/ // 是否作为守护进 ...

随机推荐

  1. MySQL 函数笔记

    统计相关函数 COUNT和SUM函数使用小技巧 参考自: MySQL - Conditional COUNT with GROUP BY 在一个 SQL 中统计多个指标的个数: SELECT COUN ...

  2. mha安装报错 [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln361] None of slaves can be master. Check failover configuration file or log-bin settings in my.cnf

    查找资料 参考 http://blog.51cto.com/16769017/1878451 解决方法: 在两个从库上开启二进制日志即可(花了 一天时间,找不到解决方法,最后还是靠自己的理解及测试解决 ...

  3. (一)关于jQuery的网上资源

    jQuery官网: http://jquery.com/ jQuery API: http://jquery.cuishifeng.cn/ w3school学习网站:http://www.w3scho ...

  4. VTK学习之路——画画我的小苹果

    数据集主要由描写叙述数据集几何形状的点集数据及构成数据集的单元构成,因此构建数据集的主要任务就是确定点集和构建单元,本演示样例程序构建了一个苹果的实体,然后绘制苹果.演示样例程序运行的过程例如以下: ...

  5. Android之Intent和Activity

    Intent能够说是Android的灵魂,程序跳转和传递数据的时候基本上就是靠Intent了.Intent在Android应用中是相当重要的,理解Intent相应用编程非常有帮助.在Android的官 ...

  6. 通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明。

    错误原因: xml文件中,本来是要配置成下面这样的: http://www.springframework.org/schema/context http://www.springframework. ...

  7. PowerBuilder -- 日期控件

    MonthCalendar

  8. 多媒体开发之---h264中 的RTP PAYLOAD 格式

    H.264 视频 RTP 负载格式 1. 网络抽象层单元类型 (NALU) NALU 头由一个字节组成, 它的语法如下: +---------------+      |0|1|2|3|4|5|6|7 ...

  9. LeetCode222——Count Complete Tree Nodes

    Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from W ...

  10. WPF实现带全选复选框的列表控件

    本文将说明如何创建一个带全选复选框的列表控件.其效果如下图: 这个控件是由一个复选框(CheckBox)与一个 ListView 组合而成.它的操作逻辑: 当选中“全选”时,列表中所有的项目都会被选中 ...