Redis的效能測試

翔之天空發表於2016-10-31


Redis-benchmark是官方自帶的Redis效能測試工具,可以有效的測試Redis服務的效能

 

以下例項同時執行 10000 個請求來檢測效能:

[root@localhost src]# ./redis-benchmark -n100000

====== PING_INLINE ======

 100000 requests completed in 1.00 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

99.72% <= 1 milliseconds

99.77% <= 2 milliseconds

99.86% <= 4 milliseconds

99.95% <= 5 milliseconds

99.97% <= 6 milliseconds

100.00% <= 6 milliseconds

100100.10 requests per second

 

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

 100000 requests completed in 1.04 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

99.70% <= 1 milliseconds

99.84% <= 2 milliseconds

99.92% <= 3 milliseconds

99.98% <= 5 milliseconds

99.98% <= 7 milliseconds

100.00% <= 7 milliseconds

96061.48 requests per second

 

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

 100000 requests completed in 1.00 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

99.71% <= 1 milliseconds

99.84% <= 2 milliseconds

99.90% <= 5 milliseconds

99.95% <= 6 milliseconds

100.00% <= 6 milliseconds

100000.00 requests per second

 

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

 100000 requests completed in 1.01 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

99.73% <= 1 milliseconds

99.90% <= 5 milliseconds

99.95% <= 10 milliseconds

100.00% <= 10 milliseconds

99009.90 requests per second

 

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

 100000 requests completed in 1.09 seconds

  50 parallelclients

  3bytes payload

 keep alive: 1

 

99.08% <= 1 milliseconds

99.68% <= 2 milliseconds

99.78% <= 6 milliseconds

99.86% <= 7 milliseconds

99.92% <= 8 milliseconds

100.00% <= 8 milliseconds

91575.09 requests per second

 

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

 100000 requests completed in 0.94 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

99.42% <= 1 milliseconds

99.84% <= 2 milliseconds

99.89% <= 3 milliseconds

100.00% <= 6 milliseconds

100.00% <= 6 milliseconds

106837.61 requests per second

 

====== RPUSH ======

 100000 requests completed in 1.20 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

98.77% <= 1 milliseconds

99.67% <= 2 milliseconds

99.86% <= 3 milliseconds

99.89% <= 4 milliseconds

99.92% <= 5 milliseconds

99.95% <= 6 milliseconds

100.00% <= 6 milliseconds

83472.46 requests per second

 

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

 100000 requests completed in 0.99 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

99.70% <= 1 milliseconds

99.82% <= 2 milliseconds

99.90% <= 5 milliseconds

99.90% <= 6 milliseconds

99.95% <= 8 milliseconds

99.97% <= 9 milliseconds

100.00% <= 9 milliseconds

101112.23 requests per second

 

====== RPOP ======

 100000 requests completed in 0.98 seconds

  50parallel clients

  3bytes payload

  keep alive: 1

 

99.82% <= 1 milliseconds

99.86% <= 2 milliseconds

99.91% <= 5 milliseconds

99.96% <= 10 milliseconds

100.00% <= 10 milliseconds

102145.05 requests per second

 

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

 100000 requests completed in 0.96 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

99.96% <= 1 milliseconds

100.00% <= 8 milliseconds

100.00% <= 8 milliseconds

103734.44 requests per second

 

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

 100000 requests completed in 1.00 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

99.87% <= 1 milliseconds

99.91% <= 2 milliseconds

99.96% <= 5 milliseconds

99.97% <= 6 milliseconds

100.00% <= 6 milliseconds

99900.09 requests per second

 

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

 100000 requests completed in 0.94 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

99.76% <= 1 milliseconds

99.92% <= 2 milliseconds

99.95% <= 6 milliseconds

99.98% <= 7 milliseconds

100.00% <= 7 milliseconds

106951.88 requests per second

 

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

 100000 requests completed in 2.73 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

72.96% <= 1 milliseconds

98.47% <= 2 milliseconds

99.64% <= 3 milliseconds

99.78% <= 4 milliseconds

99.91% <= 6 milliseconds

99.95% <= 7 milliseconds

99.95% <= 8 milliseconds

100.00% <= 8 milliseconds

36643.46 requests per second

 

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

 100000 requests completed in 6.72 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

0.22% <= 1 milliseconds

75.92% <= 2 milliseconds

97.36% <= 3 milliseconds

98.66% <= 4 milliseconds

99.38% <= 5 milliseconds

99.74% <= 6 milliseconds

99.86% <= 7 milliseconds

99.89% <= 8 milliseconds

99.93% <= 9 milliseconds

99.97% <= 11 milliseconds

99.99% <= 12 milliseconds

100.00% <= 12 milliseconds

14883.17 requests per second

 

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

 100000 requests completed in 9.47 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

0.16% <= 1 milliseconds

46.66% <= 2 milliseconds

79.67% <= 3 milliseconds

96.84% <= 4 milliseconds

98.39% <= 5 milliseconds

99.12% <= 6 milliseconds

99.46% <= 7 milliseconds

99.70% <= 8 milliseconds

99.79% <= 9 milliseconds

99.89% <= 10 milliseconds

99.91% <= 11 milliseconds

99.95% <= 12 milliseconds

99.99% <= 13 milliseconds

100.00% <= 13 milliseconds

10564.12 requests per second

 

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

 100000 requests completed in 12.43 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

0.08% <= 1 milliseconds

2.21% <= 2 milliseconds

60.07% <= 3 milliseconds

80.96% <= 4 milliseconds

94.44% <= 5 milliseconds

96.63% <= 6 milliseconds

97.93% <= 7 milliseconds

98.61% <= 8 milliseconds

99.05% <= 9 milliseconds

99.32% <= 10 milliseconds

99.50% <= 11 milliseconds

99.63% <= 12 milliseconds

99.74% <= 13 milliseconds

99.79% <= 14 milliseconds

99.81% <= 15 milliseconds

99.85% <= 16 milliseconds

99.91% <= 17 milliseconds

99.92% <= 18 milliseconds

99.94% <= 19 milliseconds

99.96% <= 20 milliseconds

99.97% <= 21 milliseconds

99.97% <= 22 milliseconds

99.98% <= 23 milliseconds

99.98% <= 24 milliseconds

99.99% <= 27 milliseconds

100.00% <= 28 milliseconds

100.00% <= 33 milliseconds

8044.41 requests per second

 

====== MSET (10 keys) ======

 100000 requests completed in 1.77 seconds

  50parallel clients

  3bytes payload

 keep alive: 1

 

72.76% <= 1 milliseconds

99.48% <= 2 milliseconds

99.70% <= 3 milliseconds

99.80% <= 6 milliseconds

99.88% <= 7 milliseconds

99.95% <= 9 milliseconds

100.00% <= 9 milliseconds

56338.03 requests per second

 

 

 

redis效能測試工具可選引數如下所示:

選項       描述       預設值

-h    指定伺服器主機名       127.0.0.1

-p    指定伺服器埠   6379

-s     指定伺服器 socket      

-c    指定併發連線數   50

-n    指定請求數   10000

-d    以位元組的形式指定SET/GET 值的資料大小      2

-k    1=keepalive 0=reconnect      1

-r     SET/GET/INCR使用隨機 key, SADD 使用隨機值      

-P    通過管道傳輸<numreq> 請求   1

-q    強制退出 redis。僅顯示query/sec 值     

--csv        以 CSV 格式輸出        

-l     生成迴圈,永久執行測試  

-t     僅執行以逗號分隔的測試命令列表。      

-I     Idle模式。僅開啟 N 個 idle 連線並等待。

相關文章