Redis 性能测试工具介绍

发表于:2023-6-28 09:59

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:Escape    来源:51CTO博客

#
Redis
分享:
  之前,也和大家介绍过一些 redis 性能监控指标:Redis性能指标监控!,那么性能测试也是针对这些指标进行的。
  Redis 包含一个名为 redis-benchmark 的性能测试工具,它可以模拟 N 个客户端同时向 Redis 发送 M 条查询命令的应用场景(类似于 Apache 的 ab 工具)。
  语法格式
  Redis 性能测试的基本命令如下:
  注意:该命令是在 redis 的目录下执行的,而不是 redis 客户端的内部指令。
  注意:redis-benchmark 的测试结果和硬件关联比较大,尤其是 CPU 主频的频率。
  # 工具使用格式
  $ redis-benchmark [option] [option value]

  参数解释
  Redis 性能测试工具可选参数如下所示:
  实例演示
  以下实例来测试 Redis 性能:
  #同时执行 10000 个请求来检测性能
  $ redis-benchmark -n 10000  -q
  PING_INLINE: 141043.72 requests per second
  PING_BULK: 142857.14 requests per second
  SET: 141442.72 requests per second
  GET: 145348.83 requests per second
  INCR: 137362.64 requests per second
  LPUSH: 145348.83 requests per second
  LPOP: 146198.83 requests per second
  SADD: 146198.83 requests per second
  SPOP: 149253.73 requests per second
  LPUSH (needed to benchmark LRANGE): 148588.42 requests per second
  LRANGE_100 (first 100 elements): 58411.21 requests per second
  LRANGE_300 (first 300 elements): 21195.42 requests per second
  LRANGE_500 (first 450 elements): 14539.11 requests per second
  LRANGE_600 (first 600 elements): 10504.20 requests per second
  MSET (10 keys): 93283.58 requests per second
  #使用了多个参数来测试 Redis 性能
  # 主机为127.0.0.1;端口号为6379;执行的命令为set/lpush
  # 请求数为10000,通过 -q 参数让结果只显示每秒执行的请求数
  $ redis-benchmark -h 127.0.0.1 -p 6379 -t set,lpush -n 10000 -q
  SET: 146198.83 requests per second
  LPUSH: 145560.41 requests per second

  本文内容不用于商业目的,如涉及知识产权问题,请权利人联系51Testing小编(021-64471599-8017),我们将立即处理
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号