美文网首页
Redis 性能测试

Redis 性能测试

作者: 奇点一氪 | 来源:发表于2018-12-17 15:24 被阅读6次

Redis 性能测试是通过同时执行多个命令实现的。
语法
redis 性能测试的基本命令如下:

redis-benchmark [option] [option value]

实例
以下实例同时执行 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 性能测试工具可选参数如下所示:
序号 选项 描述 默认值
1 -h 指定服务器主机名 127.0.0.1
2 -p 指定服务器端口 6379
3 -s 指定服务器 socket
4 -c 指定并发连接数 50
5 -n 指定请求数 10000
6 -d 以字节的形式指定 SET/GET 值的数据大小 2
7 -k 1=keep alive 0=reconnect 1
8 -r SET/GET/INCR 使用随机 key, SADD 使用随机值
9 -P 通过管道传输 <numreq> 请求 1
10 -q 强制退出 redis。仅显示 query/sec 值
11 --csv 以 CSV 格式输出
12 -l 生成循环,永久执行测试
13 -t 仅运行以逗号分隔的测试命令列表。
14 -I Idle 模式。仅打开 N 个 idle 连接并等待。

实例
以下实例我们使用了多个参数来测试 redis 性能:

$ 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

以上实例中主机为 127.0.0.1,端口号为 6379,执行的命令为 set,lpush,请求数为 10000,通过 -q 参数让结果只显示每秒执行的请求数。

相关文章

  • Redis 性能测试

    Redis 性能测试 Redis 性能测试是通过同时执行多个命令实现的。 语法 1、redis 性能测试的基本命令...

  • Redis_测试性能

    redis-benchmark是一个压力测试工具,官方自带的性能测试工具!redis性能测试工具可选参数如下所示:...

  • Redis 性能测试

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

  • Redis的性能测试与基本知识

    性能测试 启动redis服务器(基于自己的配置文件启动) 使用redis自带的性能测试工具测试并发性 基础知识 R...

  • redis 性能测试

    1、使用redis-benchmark工具 redis-benchmark 工具是 redis 自带性能测试工具,...

  • Redis管道技术的使用

    目录 Redis 管道技术 SpringDataRedis 使用管道 Redis 管道的性能测试 使用管道技术的注...

  • Redis 性能测试

    服务器环境 参数linux指令值系统cat /etc/redhat-releaseCentOS Linux rel...

  • Redis 性能测试

    本文使用 redis 自带的 redis-benchmark 工具进行压力测试 参数说明 命令格式如下: 参数说明...

  • 为什么单线程的Redis能够达到百万级的QPS?

    性能测试报告 查看了下阿里云 Redis 的性能测试报告如下,能够达到数十万、百万级别的 QPS(暂时忽略阿里对 ...

  • 一,性能方案设计

    一,需求分析与测试设计 根据具体的性能测试需求,确定测试类型以及压测模块(web/mysql/redis/系统整体...

网友评论

      本文标题:Redis 性能测试

      本文链接:https://www.haomeiwen.com/subject/wnqckqtx.html