`
fantaxy025025
  • 浏览: 1249787 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类

Redis性能测试Redis-benchmark

 
阅读更多

=

最近排查redis的问题和优化,真费劲儿。

功夫都在细节处。

=

测试暂时用的脚本如下,还是能发现不少问题的。

-c并发数,

-n请求数,

-q仅仅输出简要结果避免太长,

-d以字节的形式指定 SET/GET 值的数据大小,

-r(Use random keys 且 指定key的长度,比如30)

./redis-benchmark -n 1000000 -q

./redis-benchmark -n 1000000 -q -r 30

./redis-benchmark -n 1000000 -q -r 50

./redis-benchmark -n 1000000 -q -r 80

./redis-benchmark -n 1000000 -q -r 30

./redis-benchmark -n 1000000 -q -r 30 -c 50

./redis-benchmark -n 1000000 -q -r 30 -c 50 -d 1024

./redis-benchmark -n 1000000 -q -r 30 -c 50 -d 2048

./redis-benchmark -n 1000000 -q -r 30 -d 398092

=

#首先看看标准文档,其实总比各种文要全。排查问题,很多还得弄的仔细些。

./redis-benchmark --help

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

 

 -h <hostname>      Server hostname (default 127.0.0.1)

 -p <port>          Server port (default 6379)

 -s <socket>        Server socket (overrides host and port)

 -a <password>      Password for Redis Auth

 -c <clients>       Number of parallel connections (default 50)

 -n <requests>      Total number of requests (default 100000)

 -d <size>          Data size of SET/GET value in bytes (default 2)

 -dbnum <db>        SELECT the specified db number (default 0)

 -k <boolean>       1=keep alive 0=reconnect (default 1)

 -r <keyspacelen>   Use random keys for SET/GET/INCR, random values for SADD

  Using this option the benchmark will expand the string __rand_int__

  inside an argument with a 12 digits number in the specified range

  from 0 to keyspacelen-1. The substitution changes every time a command

  is executed. Default tests use this to hit random keys in the

  specified range.

 -P <numreq>        Pipeline <numreq> requests. Default 1 (no pipeline).

 -e                 If server replies with errors, show them on stdout.

                    (no more than 1 error per second is displayed)

 -q                 Quiet. Just show query/sec values

 --csv              Output in CSV format

 -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.

 

Examples:

 

 Run the benchmark with the default configuration against 127.0.0.1:6379:

   $ redis-benchmark

 

 Use 20 parallel clients, for a total of 100k requests, against 192.168.1.1:

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

 

 Fill 127.0.0.1:6379 with about 1 million keys only using the SET test:

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

 

 Benchmark 127.0.0.1:6379 for a few commands producing CSV output:

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

 

 Benchmark a specific command line:

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

 

 Fill a list with 10000 random elements:

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

 

 On user specified command lines __rand_int__ is replaced with a random integer

 with a range of values selected by the -r option.

 

#例子

测试命令事例:

1、redis-benchmark -h 192.168.1.201 -p 6379 -c 100 -n 100000 
100个并发连接,100000个请求,检测host为localhost 端口为6379的redis服务器性能 

2、redis-benchmark -h 192.168.1.201 -p 6379 -q -d 100  

测试存取大小为100字节的数据包的性能

3、redis-benchmark -t set,lpush -n 100000 -q

只测试某些操作的性能

4、redis-benchmark -n 100000 -q script load "redis.call('set','foo','bar')"

只测试某些数值存取的性能

 

中文参考:redis-benchmark http://www.runoob.com/redis/redis-benchmarks.html

redis-benchmark使用方法总结  https://blog.csdn.net/xubo245/article/details/48320689 中文翻译:

 -h <hostname>      Server hostname (default 127.0.0.1)                    //服务主机名  

 -p <port>          Server port (default 6379)                             //服务器端口号  

 -s <socket>        Server socket (overrides host and port)                //socket,覆盖host和port  

 -a <password>      Password for Redis Auth                                //密码  

 -c <clients>       Number of parallel connections (default 50)            //并行请求的客户端数量,默认50  

 -n <requests>      Total number of requests (default 100000)              //请求的总量,默认100000  

 -d <size>          Data size of SET/GET value in bytes (default 2)        //set或get的数据尺寸,单位是字节,默认是2  

 -dbnum <db>        SELECT the specified db number (default 0)             //选择指定的数据号  

 -k <boolean>       1=keep alive 0=reconnect (default 1)                   //布尔量,1代表保持活跃,0代表重连  

 -r <keyspacelen>   Use random keys for SET/GET/INCR, random values for SADD //set/get/incr使用随机的keys,SADD使用随机值...  

  Using this option the benchmark will expand the string __rand_int__  

  inside an argument with a 12 digits number in the specified range  

  from 0 to keyspacelen-1. The substitution changes every time a command  

  is executed. Default tests use this to hit random keys in the  

  specified range.  

 -P <numreq>        Pipeline <numreq> requests. Default 1 (no pipeline).    //管道请求,默认是1,没管道(并行?)  

 -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    //仅仅运行tests  

                    names are the same as the ones produced as output.  

 -I                 Idle mode. Just open N idle connections and wait.       //闲置模型,进打开N个闲置链接且等待  

=

=

 

分享到:
评论

相关推荐

    Python库 | redis-benchmarks-specification-0.1.8.tar.gz

    python库。 资源全名:redis-benchmarks-specification-0.1.8.tar.gz

    redis-6.2.4-x64-windows-bin.zip

    修复不受支持的配置上的 redis-benchmark 崩溃 ( #8916 ) 其他错误修复: 修复 UNLINK 在 deleted consumer groups 的 stream key 上的崩溃( #8932 ) SINTERSTORE:当不存在任何 sources 时添加丢失的 keyspace ...

    redis-benchmark.exe

    redis-benchmark.exe--

    redis-5.0.4.tar.gz下载及redis安装过程

    redis-benchmark 性能测试工具 redis-check-aof 日志文件检测工(比如断电造成日志损坏,可以检测并修复) redis-check-dump 快照文件检测工具,效果类上 redis-cli 客户端 redis-server 服务端 10: 启动与连接 ...

    redis_for_windows_32_64bit

    redis-benchmark.exe:性能测试,用以模拟同时由N个客户端发送M个 SETs/GETs 查询 (类似于 Apache 的ab 工具). 启动测试: redis-server.exe redis.conf 连接测试: redis-cli.exe -h localhost -p 6379

    Redis-x64-6.2.7-win.rar

    Redis-x64-6.2.7-win 最新版,包含redis-server、redis-cli、redis-benchmark等

    Redis-x64-7.0.2-win.rar

    Redis-x64-7.0.2-win 最新版,包含redis-server、redis-cli、redis-benchmark等

    Redis-x64-6.2.6-win.rar

    Redis-x64-6.2.6-win 最新版,包含redis-server、redis-cli、redis-benchmark等

    redis-6.0.6-x64-for-windows

    Redis 6.0.6 已发布,此版本修复了一些 bug,其中主要内容...在集群模式下的 redis-cli 和 redis-benchmark 中使用 user+pass 进行迁移 redis-cli 支持 --pipe、-rdb 和 --replica 选项的 TLS TLS:支持会话缓存配置

    Redis-x64-3.2.100 For Windows 下载

    redis-benchmark.exe:性能测试,用于模拟同时由N个客户端发送M个set/get查询; redis-cli.exe:服务端开启后,我们的客户端就可以输入各种命令测试。 二. 使用命令窗口运行redis服务 ( 管理员身份运行 ): 1、...

    redis-6.0.6-x64-for-windows-bin.zip

    Redis 6.0.6 已发布,此版本修复了一些 bug,其中主要内容...在集群模式下的 redis-cli 和 redis-benchmark 中使用 user+pass 进行迁移 redis-cli 支持 --pipe、-rdb 和 --replica 选项的 TLS TLS:支持会话缓存配置

    redis_4.0.10-1_arm64.deb 银河麒麟v4+飞腾

    │ ├── redis-benchmark │ ├── redis-check-aof │ ├── redis-check-rdb │ ├── redis-cli │ ├── redis-sentinel -&gt; redis-server │ └── redis-server └── redis.conf

    redis 在java中的使用示例工程

    redis-benchmark.exe:性能测试,用以模拟同时由N个客户端发送M个 SETs/GETs 查询 (类似于 Apache 的ab 工具). 启动Redis服务(conf文件指定配置文件,若不指定则默认): D:\redis-2.0.2&gt;redis-server.exe ...

    Redis-x64-6.2.5.rar

    Redis for Windows,包含redis_server, redis-cli, redis-benchmark等

    redis-java-complex-benchmark:这个基准压力 redis 与 unionstore 命令

    redis-java-complex-benchmark redis java benchmark 是一个用于使用复杂命令 zunionstore 加载 redis 的工具。 它是一个 java maven 项目,因此可以轻松地在任何支持 maven 的 IDE 中使用,例如 eclipse 和 InteliJ...

    《redis运维与开发》读书笔记

    可以为Redis进行基准性能测试 • -c。代表客户端的并发数量(默认是50) • -n(num) 。代表客户端请求总量(默认是100000) 。redis-benchmark-c100-n20000代表100各个客户端同时请求Redis, 一共执行20000次 •...

    redis-6.0.1-x64-for-windows-bin.zip

    模块系统新增多个API。 支持SSL/TLS加密。 支持新的Redis协议:RESP3。 服务端支持多模式的客户端缓存。 副本中支持无盘复制(diskless ...Redis-benchmark新增了Redis集群模式。 支持重写Systemd。 支持Disque模块。

    Window搭建Redis

    redis-benchmark.exe redis-check-aof.exe redis-check-dump.exe redis-cli.exe redis-server.exe 解压直接双击 redis-server.exe文件启动redis系统会报一个错误,无法识别是32bit还是64bit的...

    Redis 性能测试

    Redis 性能测试 Redis 性能测试是通过同时执行多个命令实现的。 语法 redis 性能测试的基本命令如下: redis-benchmark [option] [option value] 注意:该命令是在 redis 的目录下执行的,而不是 redis 客户端的...

    交叉编译好的 redis-server arm 版本

    叉编译好的ARM 板 redis-server 5.0,可直接放板上linux/andriod跑 编译对高手不难,但对于小白来讲还是挺麻烦的,一个小错误就会导致中断。今天我帮你编译好了,拿去吧。 运行: 放到系统中: chmod +x redis-...

Global site tag (gtag.js) - Google Analytics