成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Redis如何分析慢查詢操作?

數(shù)據(jù)庫 其他數(shù)據(jù)庫 Redis
和mysql的慢SQL日志分析一樣,redis也有類似的功能,來幫助定位一些慢查詢操作。Redis slowlog是Redis用來記錄查詢執(zhí)行時間的日志系統(tǒng)。

Redis如何分析慢查詢操作?

什么是慢查詢

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

Redis slowlog是Redis用來記錄查詢執(zhí)行時間的日志系統(tǒng)。

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

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

慢查詢參數(shù)

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

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

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

  1. 127.0.0.1:6379> config get slowlog-log-slower-than  
  2. 1) "slowlog-log-slower-than"  
  3. 2) "10000"  
  4. 127.0.0.1:6379> config get slowlog-max-len  
  5. 1) "slowlog-max-len"  
  6. 2) "128"  

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

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

慢查詢命令

語法:slowlog subcommand [argument]

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

  1. 192.168.10.38:9001> slowlog get  
  2. (empty list or set 
  3. 192.168.10.38:9001> slowlog get 10  
  4. (empty list or set 
  5. 192.168.10.38:9001> slowlog len   
  6. (integer) 0  
  7. 192.168.10.38:9001> slowlog reset  
  8. OK   

 

責任編輯:龐桂玉 來源: Java技術棧
相關推薦

2022-03-22 10:52:02

Redis變慢服務器

2019-09-11 10:23:58

Redis性能存儲

2020-09-13 13:05:41

MySQL慢查詢數(shù)據(jù)

2021-04-07 10:38:43

MySQL數(shù)據(jù)庫命令

2023-11-30 15:37:37

MySQL數(shù)據(jù)庫

2018-10-12 16:45:10

MySQL查詢日志數(shù)據(jù)庫

2010-06-02 13:46:19

MySQL慢查詢

2009-09-16 10:48:32

LINQ查詢操作

2019-09-18 08:06:08

Redis數(shù)據(jù)庫命令

2022-04-29 15:24:53

Redis存儲慢查詢

2023-10-16 23:12:02

Redis數(shù)據(jù)結構

2017-04-01 19:00:25

MySQL慢查詢

2022-07-14 14:46:51

數(shù)據(jù)庫SQL系統(tǒng)設計

2024-06-03 10:10:01

2024-09-14 14:18:43

2010-10-14 15:07:44

MySQL慢查詢

2021-11-08 06:57:35

Redis架構設計

2022-10-27 09:42:22

數(shù)據(jù)庫SQL

2022-10-21 10:40:08

攜程酒店MySQL慢查詢

2022-04-22 14:41:12

美團慢查詢數(shù)據(jù)庫
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 久久精品中文字幕 | 九色在线观看 | 国产日韩精品在线 | 一级黄色片在线看 | 欧美日韩高清在线一区 | 日韩精品一区二区三区视频播放 | 产真a观专区 | 色本道| 91成人免费电影 | 做a网站 | 五月激情六月婷婷 | 成人免费xxxxx在线视频 | 玖玖免费| 成人3d动漫一区二区三区91 | 久久丁香| 精品国产乱码久久久久久丨区2区 | 亚洲aⅴ | 中日av| 国产精品一区二区av | 久久久天堂 | 狠狠色综合欧美激情 | 久久婷婷国产麻豆91 | 日韩一区二区黄色片 | 91亚洲一区| 日本一区二区三区在线观看 | 成人在线观 | 亚洲成av片人久久久 | 看特级黄色片 | 国产ts一区 | 欧美日韩在线视频一区 | 不卡一二三区 | 成人精品一区二区三区四区 | 成人免费视频网站在线看 | 中文字幕视频一区二区 | 精品久久ai电影 | 欧产日产国产精品视频 | 久久久久综合 | 国产精品久久久久久久久免费相片 | 福利网址 | 欧美一卡二卡在线观看 | 日韩中文在线观看 |