Redis 性能测试

redis-benchmark 参数

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

  • -h <hostname> 服务主机地址, 默认 127.0.0.1
  • -p <port> 服务端口, 默认 6379
  • -s <socket> Server socket (overrides host and port)
  • -a <password> Password for Redis Auth
  • --user <username> Used to send ACL style ‘AUTH username pass’. Needs-a.
  • -c <clients> 并发连接数, 默认: 50
  • -n <requests> 总的 请求数, 默认值: 10_0000
  • -d <size> SET/GET值的数据大小(字节)(默认值3)
  • --dbnum <db> 选择指定的数据库号(默认为0)
  • --threads <num> 启用多线程模式。
  • --cluster 启用群集模式。
  • --enable-tracking 在开始基准测试之前发送客户端跟踪。
  • -k <boolean> 1=keep alive 0=reconnect (default 1)
  • -r <keyspacelen> 对SET/GET/INCR使用随机键,对SADD使用随机值,ZADD的随机成员和分数。使用此选项,基准将展开字符串 __rand_int__ 在指定范围内具有12位数字的参数中从0到keyspacelen-1。每次执行命令时替换都会更改已执行。默认测试使用它来命中指定范围。
  • -P <numreq> Pipeline 中 redis 指令的个数. Default 1 (no pipeline).
  • -e 如果服务器回复有错误,请在标准输出上显示它们。(每秒显示的错误不超过1个)
  • -q 安静的。只显示每秒请求数
  • --precision 延迟输出中显示的小数位数(默认为0)
  • --csv 以CSV格式输出
  • -l 循环。永远运行测试
  • -t <tests> 只运行逗号分隔的测试列表。测试名称与作为输出生成的名称相同。
  • -I 空闲模式。只需打开N个空闲连接并等待。
  • --version 输出版本并退出。

帮助文档提供的示例:

使用默认配置针对127.0.0.1:6379运行基准测试:

redis-benchmark

对192.168.1.1使用20个并行客户端,总共100k请求:

redis-benchmark -h 192.168.1.1 -p 6379 -n 100000 -c 20

仅使用SET测试,用大约一百万个 key 填充127.0.0.1:6379:

redis-benchmark -t set -n 1000000 -r 100000000

基准127.0.0.1:6379提供了一些产生CSV输出的命令:

redis-benchmark -t ping,set,get -n 100000 --csv

对特定命令行进行基准测试:

redis-benchmark -r 10000 -n 10000 eval 'return redis.call("ping")' 0

用10000个随机元素填充列表:

redis-benchmark -r 10000 -n 10000 lpush mylist __rand_int__

在用户指定的命令行上,将 __rand_int__ 替换为随机整数,该整数的值范围由-r选项选择。

测试

50 个并发测试: redis-benchmark -q

命令 结果
PING_INLINE 176678.45 requests per second, p50=0.143 msec
PING_MBULK 173611.12 requests per second, p50=0.143 msec
SET 176366.86 requests per second, p50=0.143 msec
GET 174520.06 requests per second, p50=0.143 msec
INCR 174216.03 requests per second, p50=0.143 msec
LPUSH 177619.89 requests per second, p50=0.143 msec
RPUSH 176991.16 requests per second, p50=0.143 msec
LPOP 178253.12 requests per second, p50=0.143 msec
RPOP 178571.42 requests per second, p50=0.143 msec
SADD 174825.17 requests per second, p50=0.143 msec
HSET 175131.36 requests per second, p50=0.143 msec
SPOP 174216.03 requests per second, p50=0.143 msec
ZADD 175746.92 requests per second, p50=0.143 msec
ZPOPMIN 176366.86 requests per second, p50=0.143 msec
LPUSH (needed to benchmark LRANGE) 178890.88 requests per second, p50=0.143 msec
LRANGE_100 (first 100 elements) 104058.27 requests per second, p50=0.239 msec
LRANGE_300 (first 300 elements) 42337.00 requests per second, p50=0.583 msec
LRANGE_500 (first 450 elements) 30816.64 requests per second, p50=0.799 msec
LRANGE_600 (first 600 elements) 24527.84 requests per second, p50=1.007 msec
MSET (10 keys) 195312.48 requests per second, p50=0.143 msec

1 万 并发测试 redis-benchmark -q -c 10000

命令 结果
PING_INLINE 132275.14 requests per second, p50=36.415 msec
PING_MBULK 132802.12 requests per second, p50=36.959 msec
SET 131233.59 requests per second, p50=36.095 msec
GET 133155.80 requests per second, p50=36.351 msec
INCR 131926.12 requests per second, p50=36.383 msec
LPUSH 131578.95 requests per second, p50=36.607 msec
RPUSH 133155.80 requests per second, p50=36.735 msec
LPOP 128369.71 requests per second, p50=38.111 msec
RPOP 132100.39 requests per second, p50=36.735 msec
SADD 132100.39 requests per second, p50=36.415 msec
HSET 126422.25 requests per second, p50=38.815 msec
SPOP 122699.39 requests per second, p50=40.415 msec
ZADD 125313.29 requests per second, p50=39.391 msec
ZPOPMIN 118906.06 requests per second, p50=39.263 msec
LPUSH (needed to benchmark LRANGE) 121065.38 requests per second, p50=38.943 msec
LRANGE_100 (first 100 elements) 73800.73 requests per second, p50=65.343 msec
LRANGE_300 (first 300 elements) 30120.48 requests per second, p50=165.503 msec
LRANGE_500 (first 450 elements) 22593.76 requests per second, p50=222.335 msec
LRANGE_600 (first 600 elements) 16501.65 requests per second, p50=303.359 msec
MSET (10 keys) 120627.27 requests per second, p50=51.135 msec

5000个并发 每个请求 1024 个字节 redis-benchmark -q -c 5000 -d 1024

命令 结果
PING_INLINE 126103.41 requests per second, p50=20.623 msec
PING_MBULK 129032.27 requests per second, p50=20.287 msec
SET 119760.48 requests per second, p50=21.583 msec
GET 130548.30 requests per second, p50=19.167 msec
INCR 125470.52 requests per second, p50=20.991 msec
LPUSH 120481.93 requests per second, p50=21.679 msec
RPUSH 121654.50 requests per second, p50=21.535 msec
LPOP 130890.05 requests per second, p50=19.151 msec
RPOP 131233.59 requests per second, p50=19.119 msec
SADD 126742.72 requests per second, p50=20.687 msec
HSET 121802.68 requests per second, p50=21.471 msec
SPOP 128369.71 requests per second, p50=20.431 msec
ZADD 125628.14 requests per second, p50=20.847 msec
ZPOPMIN 128700.12 requests per second, p50=20.399 msec
LPUSH (needed to benchmark LRANGE) 119904.08 requests per second, p50=21.823 msec
LRANGE_100 (first 100 elements) 10784.00 requests per second, p50=107.071 msec
LRANGE_300 (first 300 elements) 3735.25 requests per second, p50=135.935 msec
LRANGE_500 (first 450 elements) 2488.24 requests per second, p50=146.431 msec
LRANGE_600 (first 600 elements) 1842.94 requests per second, p50=167.423 msec 4)
MSET (10 keys) 87950.75 requests per second, p50=27.807 msec

Redis 性能测试相关推荐

  1. 10.Redis 性能测试

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

  2. redis php 性能测试工具,redis性能测试与客户端连接详解

    Redis 性能测试(推荐:redis入门教程) 语法redis-benchmark [option] [option value] 实例 实例一 以下实例同时执行 1000 个请求来检测性能:$ r ...

  3. Redis性能测试、jedis连接原理、弱事务

    Redis 性能测试.jedis连接原理.弱事务. 一.性能测试.jedis连接原理 1. 什么是Redis慢查询 和MySQL一样:当sql执行时间超过 long_query_time 参数设定的时 ...

  4. 转Redis性能测试

    Redis Primer(1)基于JedisPool的Redis hset并发性能测试 作者:钟超(Poechant) 邮箱:zhongchao.ustc#gmail.com 博客:blog.csdn ...

  5. 八、redis性能测试

    一.介绍 redis-benchmark是Redis自带的基准性能测试工具, 它提供了很多选项帮助开发和运维人员测试Redis的相关性能. 二.例子 50个并发同时请求Redis,一共一万次. red ...

  6. 实战:Redis 性能测试

    为什么需要性能测试? 性能测试的使用场景有很多,例如以下几个: 技术选型,比如测试 Memcached 和 Redis: 对比单机 Redis 和集群 Redis 的吞吐量: 评估不同类型的存储性能, ...

  7. 万万没 想到,Redis性能测试还能这样做

    01 服务器环境 Redis之redis-benchmark redis 提供了 redis-benchmark 工具便于我们做性能测试,可以使用 redis-benchmark- h 查看参数. 0 ...

  8. Redis性能测试工具benchmark简介

    Redis自己提供了一个性能测试工具redis-benchmark.redis-benchmark可以模拟N个机器,同时发送M个请求. 用法:redis-benchmark [-h -h <ho ...

  9. Redis 性能测试工具(redis-benchmark)

    测试每个命令的性能: -h 指定服务器主机名 127.0.0.1 -p 指定服务器端口 6379 -s 指定服务器 socket -c 指定并发连接数 50 -n 指定请求数 10000 -d 以字节 ...

最新文章

  1. 差分 ---- Codeforces Round #672 (Div. 2):C2. Pokémon Army (hard version)[差分的思想]
  2. 先使用皮尔逊相似性特征选择来训练随机森林
  3. PHP中调用SVN命令更新网站方法(解决文件名包含中文更新失败的问题)
  4. 父与子的编程之旅:与小卡特一起学Python.pdf
  5. lambda 表达式中的 this 与普通情况下的 this 指向
  6. UNIX(进程间通信):02---父子进程之间的数据共享分析
  7. php字符集转换,php字符集转换
  8. 【老孙随笔】 神秘的茶馆
  9. bzoj2763 [JLOI2011]飞行路线
  10. 最简单的DLL导出函数隐藏方式
  11. 文献精读丨GWAS+TRN多组学方法揭示小麦穗发育调控过程
  12. php极简云网盘网页版源码,PHP极简云盘个人网盘源码 文件管理与共享系统 自适应手机端...
  13. 如何使用 you-get 下载视频
  14. Python glob()用法
  15. 基于javaweb的医院挂号预约系统-计算机毕业设计
  16. Maven Archetype脚手架制作
  17. 网管:信息时代的“锦衣卫”
  18. mysql 默认字符集_设定mysql的默认字符集
  19. Mac下远程桌面连接Microsoft Remote Desktop安装与使用
  20. 《新劳动合同法》关键词解读

热门文章

  1. 动力登山绳 EN 892标准
  2. tenforflow版YOLOv3下COCO格式的raccoon(浣熊)数据集的准备(未完待续)
  3. 计算机视觉英语论文,计算机视觉导论论文中英双语版(10页)-原创力文档
  4. OpenPR开源代码项目
  5. thymeleaf: th:src=@{}
  6. Go 语言的 13 年
  7. 自动驾驶技术综述1:自动驾驶算法软件架构介绍
  8. 《麦子学院深度学习应用之基础》笔记
  9. axure画扇形_如何利用axure制作一个动态的饼状图
  10. vgpu服务器显卡性能,如何在vGPU环境中优化GPU性能