redis-faina 是由Instagram 开发并开源的一个Redis 查询分析小工具。
redis-faina通过解析redis的MONITOR命令的输出,从而对redis实例进行性能诊断的工具。
该工具使用虽然简单,但是功能还是很不错,对于定位线上redis性能问题,确实是一把利器。
- 通过管道从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
另开窗口,查询输出日志行数,到达自己目标行,就中断掉
# wc -l m.log
# ./redis-faina.py m.log
Overall Stats
========================================
Lines Processed 10000
Commands/Sec 274.73
Top Prefixes #按照key的前缀统计
========================================
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 # 执行最频繁的命令
========================================
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) # 命令执行时长
========================================
Median 2309.0
75% 4959.75
90% 8447.0
99% 18482.0
Heaviest Commands (microsecs) #耗时最多的命令
========================================
GET 36281717.75
COMMAND 85269.25
SADD 17985.75
info 10698.5
SET 3228.0
AUTH 625.5
Slowest Calls #执行最慢的命令
========================================
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 发现以及解决办法
https://blog.csdn.net/hellozhxy/article/details/119773333
redis中BigKey、HotKey的发现与处理
https://developer.aliyun.com/article/788271
redis 热 key 发现以及解决办法
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运行状态图形化监控工具 — RedisLive
http://t.zoukankan.com/Leo_wl-p-5870006.html
nkrode/RedisLive
https://github.com/nkrode/RedisLive
网友评论