分散式快取Redis之效能測試
阿新 • • 發佈:2018-12-12
寫在前面
本學習教程所有示例程式碼見GitHub:https://github.com/selfconzrr/Redis_Learning
Redis 效能測試是通過同時執行多個命令實現的。
語法:
redis 效能測試的基本命令如下:
redis-benchmark [option] [option value]
例項
以下例項同時執行 10000 個請求來檢測效能:
redis-benchmark -n 100000
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 效能測試工具可選引數如下所示:
例項
以下例項我們使用了多個引數來測試 redis 效能:
redis-benchmark -h 127.0.0.1 -p 6379 -t set,lpush -n 100000 -q
SET: 146198.83 requests per second
LPUSH: 145560.41 requests per second
以上例項中主機為 127.0.0.1,埠號為 6379,執行的命令為 set,lpush,請求數為 10000,通過 -q 引數讓結果只顯示每秒執行的請求數。
—–樂於分享,共同進步
—–Any comments greatly appreciated
—–誠心歡迎各位交流討論!QQ:1138517609