LoginSignup
2
0

More than 3 years have passed since last update.

redis-fainaを用いてRedisの実行コマンドを解析する

Posted at

redis-cliのmonitorコマンドでコマンドの実行ログを見ることでが出来ますが、自力で解析するのは大変です。
redis-fainaを用いることでmonitorコマンドの結果を解析して、統計情報を表示してくれるので、頻繁に実行されているコマンドやキーを特定したい時に役立ちます。

redis-faina

redis-fainaはInstagramの開発者によって作られ、facebookが公開しているpython製のツールで、簡単に使うことが出来ます。

インストール

$ git clone https://github.com/facebookarchive/redis-faina.git
$ cd redis-faina

実行

ファイルから読み込む場合

$ redis-cli -p 6379 monitor | head -n 10000 > outfile.txt
$ .redis-faina.py outfile.txt

標準出力からから読み込む場合

$ redis-cli -p 6379 monitor | head -n 10000 | .redis-faina.py outfile.txt

実行結果

Overall Stats
========================================
Lines Processed         10000
Commands/Sec            12967.49

Top Prefixes
========================================
key             2000    (20.00%)
counter         1000    (10.00%)

Top Keys
========================================
mylist                  2999    (29.99%)
myset                   2000    (20.00%)
key:__rand_int__        2000    (20.00%)
counter:__rand_int__    1000    (10.00%)

Top Commands
========================================
PING    2000    (20.00%)
LPUSH   1999    (19.99%)
INCR    1000    (10.00%)
SET     1000    (10.00%)
SADD    1000    (10.00%)
GET     1000    (10.00%)
SPOP    1000    (10.00%)
LPOP    1000    (10.00%)

Command Time (microsecs)
========================================
Median          68.0
75%             84.75
90%             116.0
99%             241.75

Heaviest Commands (microsecs)
========================================
PING    160997.25
LPUSH   152823.0
GET     83242.75
SET     80229.75
SADD    76377.0
INCR    75668.25
LPOP    71876.0
SPOP    69945.0

参考

redis-faina: a query analysis tool for Redis

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0