麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 數據庫 > Redis > 正文

Redis分析慢查詢操作的實例教程

2020-03-17 12:32:44
字體:
來源:轉載
供稿:網友

什么是慢查詢

慢查詢的作用:通過慢查詢分析,找到有問題的命令進行優化。

和mysql的慢SQL日志分析一樣,redis也有類似的功能,來幫助定位一些慢查詢操作。

Redis slowlog是Redis用來記錄查詢執行時間的日志系統。

查詢執行時間指的是不包括像客戶端響應(talking)、發送回復等IO操作,而單單是執行一個查詢命令所耗費的時間。

另外,slow log保存在內存里面,讀寫速度非常快,因此你可以放心地使用它,不必擔心因為開啟slow log而損害Redis的速度。

慢查詢日志四個屬性:

1、第一個字段是每個慢查詢唯一標識。

2、處理完命令后的時間戳

3、執行改名了所需要的時間,單位微妙

4、命令的參數列表,是個數組類型

每個慢查詢實體的ID都是唯一的,而且不會被重新設置,只會在redis重啟后才會重置它.

慢查詢參數

首先來關注下慢日志分析對應的兩個參數:

1、slowlog-log-slower-than:預設閥值,即記錄超過多少時間的記錄,默認為10000微秒,即10毫秒。

2、slowlog-max-len:記錄慢查詢的條數,默認為128條,當超過設置的條數時最早進入隊列的將被移除。線上建議增大數值,如:1000,這樣可減少隊列移除的頻率。

127.0.0.1:6379> config get slowlog-log-slower-than1) "slowlog-log-slower-than"2) "10000"127.0.0.1:6379> config get slowlog-max-len1) "slowlog-max-len"2) "128"

可以用config set對這兩個參數進行調整,或者在配置文件中設置。

################################## SLOW LOG #################################### The Redis Slow Log is a system to log queries that exceeded a specified# execution time. The execution time does not include the I/O operations# like talking with the client, sending the reply and so forth,# but just the time needed to actually execute the command (this is the only# stage of command execution where the thread is blocked and can not serve# other requests in the meantime).## You can configure the slow log with two parameters: one tells Redis# what is the execution time, in microseconds, to exceed in order for the# command to get logged, and the other parameter is the length of the# slow log. When a new command is logged the oldest one is removed from the# queue of logged commands.# The following time is expressed in microseconds, so 1000000 is equivalent# to one second. Note that a negative number disables the slow log, while# a value of zero forces the logging of every command.slowlog-log-slower-than 10000# There is no limit to this length. Just be aware that it will consume memory.# You can reclaim memory used by the slow log with SLOWLOG RESET.slowlog-max-len 128

慢查詢命令

語法:slowlog subcommand [argument]

如,進行查詢慢查詢、獲取慢查詢記錄的數量、重置慢查詢日志等操作:

192.168.10.38:9001> slowlog get(empty list or set)192.168.10.38:9001> slowlog get 10(empty list or set)192.168.10.38:9001> slowlog len (integer) 0192.168.10.38:9001> slowlog resetOK

總結

以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,如果有疑問大家可以留言交流,謝謝大家對VEVB武林網的支持。


注:相關教程知識閱讀請移步到Redis頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 日本欧美一区二区 | 国产精品久久久久网站 | 小雪奶水翁胀公吸小说最新章节 | 视频一区二区在线观看 | 激情网站视频 | 久久精品在线免费观看 | 一本色道久久综合亚洲精品图片 | www国产成人免费观看视频 | 国产精品看片 | 日韩一级片一区二区三区 | 黄色网址免费在线播放 | 国产精品999在线观看 | 777zyz色资源站在线观看 | 视频一区二区三区在线播放 | 欧美日韩大片在线观看 | 欧美福利视频一区二区三区 | 欧美性生活视频免费看 | 日韩视频在线一区二区三区 | 亚洲欧美成aⅴ人在线观看 免费看欧美黑人毛片 | 日日草夜夜 | 欧美一级美片在线观看免费 | 一级成人欧美一区在线观看 | 久久久久久久久久美女 | bt 自拍 另类 综合 欧美 | 久久久久久久久日本理论电影 | 久久亚洲精品久久国产一区二区 | 91精彩视频| 成人在线视频一区 | 国产精品视频二区不卡 | 黄色大片在线免费观看 | 日韩视频―中文字幕 | 狠狠操人人干 | 2021狠狠操| 国产成人高清在线 | 91精品国产刺激国语对白 | 一区二区三区欧美在线观看 | 免费观看黄色一级视频 | 欧美老外a级毛片 | 日本在线视频免费观看 | 免费观看国产精品视频 | 久久国产精品成人免费网站 |