日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
RedisBenchmark性能測試
為了解 Redis 在不同配置環(huán)境下的性能表現(xiàn),Redis 提供了一種行性能測試工具 redis-benchmark(也稱壓力測試工具),它通過同時執(zhí)行多組命令實現(xiàn)對 Redis 的性能測試。

性能測試的作用是讓我們了解 Redis 服務器的性能優(yōu)劣。在實際的業(yè)務場景中,性能測試是必不可少的。在業(yè)務系統(tǒng)上線之前,我們都需要清楚地了解 Redis 服務器的性能,從而避免發(fā)生某些意外情況,比如數(shù)據(jù)量過大會導致服務器宕機等。

測試命令格式

執(zhí)行測試命令,要在 Redis 的安裝目錄下執(zhí)行,命令如下所示:

redis-benchmark [option] [option value]

其中 option 為可選參數(shù), option value 為具體的參數(shù)值。 redis-benchmark 命令的可選參數(shù)如下所示:

Benchmark性能測試參數(shù)
參數(shù)選項 說明
-h 指定服務器主機名。
-p 指定服務器端口。
-s 指定服務器 socket。
-c 指定并發(fā)連接數(shù)。
-n 指定請求的具體數(shù)量。
-d 以字節(jié)的形式指定 SET/GET 值的數(shù)據(jù)大小。
-k 1 表示 keep alive;0 表示 reconnect,默認為 1。
-r SET/GET/INCR 使用隨機 key, SADD 使用隨機值。
-P Pipeline 請求
-q 強制退出 Redis,僅顯示 query/sec 值。
--csv 以 CSV 格式輸出。
-l 生成循環(huán),永久執(zhí)行測試。
-t 僅運行以逗號分隔的測試命令列表。
-I(大寫i) 空閑模式,打開 N 個空閑連接并等待連接。

在 Windows 系統(tǒng)下,其目錄文件如圖所示:



圖1:Redis Benchmark性能測試

執(zhí)行測試命令

1) Windows環(huán)境

在 Windows 10 系統(tǒng)環(huán)境下,同時執(zhí)行了 10000 個命令來檢測 Redis 服務器的性能,示例如下:

D:\Redis-x64-5.0.10>redis-benchmark.exe -n 10000 -q
PING_INLINE: 21786.49 requests per second
PING_BULK: 21231.42 requests per second
#每秒執(zhí)行22935.78個請求
SET: 22935.78 requests per second
GET: 22573.36 requests per second
INCR: 19011.41 requests per second
LPUSH: 7473.84 requests per second
RPUSH: 20618.56 requests per second
LPOP: 17793.60 requests per second
RPOP: 21367.52 requests per second
SADD: 15847.86 requests per second
HSET: 21551.72 requests per second
SPOP: 19531.25 requests per second
LPUSH (needed to benchmark LRANGE): 18348.62 requests per second
LRANGE_100 (first 100 elements): 6835.27 requests per second
LRANGE_300 (first 300 elements): 4535.15 requests per second
LRANGE_500 (first 450 elements): 3913.89 requests per second
LRANGE_600 (first 600 elements): 3177.63 requests per second
MSET (10 keys): 15128.59 requests per second

注意:若是 Linux 系統(tǒng),其每秒鐘執(zhí)行的請求數(shù)量是 Windows 系統(tǒng)的好幾倍。

2) Linux環(huán)境

Linux 環(huán)境下,Redis 的性能測試結果,如下所示:

$ redis-benchmark -n 10000  -q
PING_INLINE: 141043.72 requests per second
PING_BULK: 142857.14 requests per second
#服務器每秒執(zhí)行的請求數(shù)量
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

3) 執(zhí)行指定的測試命令 

帶參數(shù)的命令,使用示例如下:

D:\Redis-x64-5.0.10>redis-benchmark.exe -h 127.0.0.1 -p 6379 -n 10000 -t set,get,lpush -q
SET: 17064.85 requests per second
GET: 16051.36 requests per second
LPUSH: 14224.75 requests per second

網(wǎng)頁題目:RedisBenchmark性能測試
當前網(wǎng)址:http://www.5511xx.com/article/ccdjcjp.html