redis-faina 是由Instagram 開發(fā)并開源的一個(gè)Redis 查詢分析小工具。
redis-faina通過解析redis的MONITOR命令的輸出,從而對redis實(shí)例進(jìn)行性能診斷的工具。
該工具使用雖然簡單,但是功能還是很不錯(cuò),對于定位線上redis性能問題,確實(shí)是一把利器。
- 通過管道從stdin讀取redis monitor 輸出,解析
# yum install git
# git clone https://github.com/facebookarchive/redis-faina.git
# cd redis-faina
# redis-cli -h xx.xx.xx.xx -p 6379 -a 'XXX' monitor | head -n 10000 | ./redis-faina.py
- 將redis monitor 輸出重定向到文件,然后讀取解析
# yum install git
# git clone https://github.com/facebookarchive/redis-faina.git
# cd redis-faina
# redis-cli -h xx.xx.xx.xx -p 6379 -a 'XXX' monitor > m.log
另開窗口,查詢輸出日志行數(shù),到達(dá)自己目標(biāo)行,就中斷掉
# wc -l m.log
# ./redis-faina.py m.log
Overall Stats
========================================
Lines Processed 10000
Commands/Sec 274.73
Top Prefixes #按照key的前綴統(tǒng)計(jì)
========================================
testcache-rendsord-lang 1684(16.84%)
testcache-inuanGoods-id 1090(10.90%)
testcache-riceroup-cat_id 307 (3.07%)
testcache-ategorynfo-id 190 (1.90%)
testcache-ategoryey-lang 189 (1.89%)
testcache-earchtrremplate-id 61 (0.61%)
testcache-riceroup-id 15 (0.15%)
testcache-otordata-lang 9 (0.09%)
Top Keys #請求最頻繁的key
========================================
testcache-acebookhareandsave 2373(23.73%)
testcache-hippingFee 2198(21.98%)
testcache-rendsord-lang:en 1464(14.64%)
testcache-ountryurrency 1181(11.81%)
testcache-inuanoods 442 (4.42%)
testcache-ategoryey-lang: 183 (1.83%)
testcache-rendsord-lang:es 124 (1.24%)
testcache-inuanoods-id:68 114 (1.14%)
Top Commands # 執(zhí)行最頻繁的命令
========================================
GET 9957(99.57%)
AUTH 13 (0.13%)
COMMAND 13 (0.13%)
SADD 10 (0.10%)
info 5 (0.05%)
SET 1 (0.01%)
Command Time (microsecs) # 命令執(zhí)行時(shí)長
========================================
Median 2309.0
75% 4959.75
90% 8447.0
99% 18482.0
Heaviest Commands (microsecs) #耗時(shí)最多的命令
========================================
GET 36281717.75
COMMAND 85269.25
SADD 17985.75
info 10698.5
SET 3228.0
AUTH 625.5
Slowest Calls #執(zhí)行最慢的命令
========================================
179962.0 "GET" "testcache-hippingee"
62659.0 "GET" "testcache-romotionullateeduce"
44902.0 "GET" "testcache-hippingee"
40305.25 "GET" "testcache-hippingee"
39559.0 "GET" "testcache-hippingee"
36831.25 "GET" "testcache-hippingee"
33852.0 "GET" "testcache-hippingee"
33501.0 "GET" "testcache-hippingee"
參考
redis 熱 key 發(fā)現(xiàn)以及解決辦法
https://blog.csdn.net/hellozhxy/article/details/119773333
redis中BigKey、HotKey的發(fā)現(xiàn)與處理
https://developer.aliyun.com/article/788271
redis 熱 key 發(fā)現(xiàn)以及解決辦法
https://blog.csdn.net/hellozhxy/article/details/119773333
redis monitor
https://redis.io/commands/monitor/
redis性能分析工具redis-faina
https://developer.aliyun.com/article/511562
https://www.cnblogs.com/zhoubaojian/articles/7866506.html
redis運(yùn)行狀態(tài)圖形化監(jiān)控工具 — RedisLive
http://t.zoukankan.com/Leo_wl-p-5870006.html
nkrode/RedisLive
https://github.com/nkrode/RedisLive