未加星标

Redis-benchmark测试Redis性能

字体大小 | |
[数据库(综合) 所属分类 数据库(综合) | 发布者 店小二04 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

背景: 有时间对Redis的一个测试来看,特别是经过了网络,此时,会傻傻分不清楚是Redis本来性能就差,还是网络不好php调用Redis的机器和Redis分离或不在同一网段),这个工具可以直接在Redis上测试Redis,或是在PHP上测试Redis,这样有一个粗粒度的判断和把握。

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

Redis-benchmark是官方自带的Redis性能测试工具,可以有效的测试Redis服务的性能。

使用说明如下:

复制代码

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)

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

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

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

-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 get/set keys

in the form mykey_rand:000000012456 instead of constant

keys, the <keyspacelen> argument determines the max

number of values for the random number. For instance

if set to 10 only rand:000000000000 - rand:000000000009

range will be allowed.

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

-q Quiet. Just show query/sec values

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

复制代码

测试命令事例:

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')"

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

测试结果分析:

复制代码

10000 requests completed in 0.30 seconds

100 parallel clients

3 bytes payload

keep alive: 1

0.11% <= 1 milliseconds

86.00% <= 2 milliseconds

90.12% <= 3 milliseconds

96.68% <= 4 milliseconds

99.27% <= 5 milliseconds

99.54% <= 6 milliseconds

99.69% <= 7 milliseconds

99.78% <= 8 milliseconds

99.89% <= 9 milliseconds

100.00% <= 9 milliseconds

33222.59 requests per second

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

10000 requests completed in 0.27 seconds

100 parallel clients

3 bytes payload

keep alive: 1

0.93% <= 1 milliseconds

97.66% <= 2 milliseconds

100.00% <= 2 milliseconds

37174.72 requests per second

====== SET ======

10000 requests completed in 0.32 seconds

100 parallel clients

3 bytes payload

keep alive: 1

0.22% <= 1 milliseconds

91.68% <= 2 milliseconds

97.78% <= 3 milliseconds

98.80% <= 4 milliseconds

99.38% <= 5 milliseconds

99.61% <= 6 milliseconds

99.72% <= 7 milliseconds

99.83% <= 8 milliseconds

99.94% <= 9 milliseconds

100.00% <= 9 milliseconds

30959.75 requests per second

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

10000 requests completed in 0.28 seconds

100 parallel clients

3 bytes payload

keep alive: 1

0.55% <= 1 milliseconds

98.86% <= 2 milliseconds

100.00% <= 2 milliseconds

35971.22 requests per second

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

10000 requests completed in 0.14 seconds

100 parallel clients

3 bytes payload

keep alive: 1

95.61% <= 1 milliseconds

100.00% <= 1 milliseconds

69444.45 requests per second

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

10000 requests completed in 0.21 seconds

100 parallel clients

3 bytes payload

keep alive: 1

18.33% <= 1 milliseconds

100.00% <= 1 milliseconds

48309.18 requests per second

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

10000 requests completed in 0.23 seconds

100 parallel clients

3 bytes payload

keep alive: 1

0.29% <= 1 milliseconds

99.76% <= 2 milliseconds

100.00% <= 2 milliseconds

44052.86 requests per second

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

10000 requests completed in 0.22 seconds

100 parallel clients

3 bytes payload

keep alive: 1

2.37% <= 1 milliseconds

99.81% <= 2 milliseconds

100.00% <= 2 milliseconds

44444.45 requests per second

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

10000 requests completed in 0.22 seconds

100 parallel clients

3 bytes payload

keep alive: 1

4.27% <= 1 milliseconds

99.84% <= 2 milliseconds

100.00% <= 2 milliseconds

44642.86 requests per second

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

10000 requests completed in 0.22 seconds

100 parallel clients

3 bytes payload

keep alive: 1

12.35% <= 1 milliseconds

99.62% <= 2 milliseconds

100.00% <= 2 milliseconds

46082.95 requests per second

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

10000 requests completed in 0.48 seconds

100 parallel clients

3 bytes payload

keep alive: 1

0.01% <= 1 milliseconds

3.27% <= 2 milliseconds

98.71% <= 3 milliseconds

99.93% <= 4 milliseconds

100.00% <= 4 milliseconds

20964.36 requests per second

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

10000 requests completed in 1.26 seconds

100 parallel clients

3 bytes payload

keep alive: 1

0.01% <= 2 milliseconds

0.14% <= 3 milliseconds

0.90% <= 4 milliseconds

7.03% <= 5 milliseconds

31.68% <= 6 milliseconds

78.93% <= 7 milliseconds

98.88% <= 8 milliseconds

99.56% <= 9 milliseconds

99.72% <= 10 milliseconds

99.95% <= 11 milliseconds

100.00% <= 11 milliseconds

7961.78 requests per second

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

10000 requests completed in 1.82 seconds

100 parallel clients

3 bytes payload

keep alive: 1

0.01% <= 2 milliseconds

0.06% <= 3 milliseconds

0.14% <= 4 milliseconds

0.30% <= 5 milliseconds

0.99% <= 6 milliseconds

2.91% <= 7 milliseconds

8.11% <= 8 milliseconds

43.15% <= 9 milliseconds

88.38% <= 10 milliseconds

97.25% <= 11 milliseconds

98.61% <= 12 milliseconds

99.26% <= 13 milliseconds

99.30% <= 14 milliseconds

99.44% <= 15 milliseconds

99.48% <= 16 milliseconds

99.64% <= 17 milliseconds

99.85% <= 18 milliseconds

99.92% <= 19 milliseconds

99.95% <= 20 milliseconds

99.96% <= 21 milliseconds

99.97% <= 22 milliseconds

100.00% <= 23 milliseconds

5491.49 requests per second

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

10000 requests completed in 2.29 seconds

100 parallel cl

本文数据库(综合)相关术语:系统安全软件

分页:12
转载请注明
本文标题:Redis-benchmark测试Redis性能
本站链接:http://www.codesec.net/view/520258.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 数据库(综合) | 评论(0) | 阅读(79)