成人免费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í)行時間指的是不包括像客戶端響應(yīng)(talking)、發(fā)送回復(fù)等IO操作,而單單是執(zhí)行一個查詢命令所耗費(fèi)的時間。

另外,slow log保存在內(nèi)存里面,讀寫速度非???,因此你可以放心地使用它,不必?fù)?dān)心因?yàn)殚_啟slow log而損害Redis的速度。

慢查詢參數(shù)

首先來關(guān)注下慢日志分析對應(yīng)的兩個參數(shù):

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

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

  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ù)進(jìn)行調(diào)整,或者在配置文件中設(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]

如,進(jìn)行查詢慢查詢、獲取慢查詢記錄的數(shù)量、重置慢查詢?nèi)罩镜炔僮鳎?/p>

  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   

 

責(zé)任編輯:龐桂玉 來源: Java技術(shù)棧
相關(guān)推薦

2022-03-22 10:52:02

Redis變慢服務(wù)器

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查詢?nèi)罩?/a>數(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ù)結(jié)構(gòu)

2017-04-01 19:00:25

MySQL慢查詢

2022-07-14 14:46:51

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

2024-09-14 14:18:43

2010-10-14 15:07:44

MySQL慢查詢

2024-06-03 10:10:01

2021-11-08 06:57:35

Redis架構(gòu)設(shè)計

2022-10-27 09:42:22

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

2009-02-27 08:56:30

IIS.Net原理分析

2018-08-20 10:40:09

Redis位圖操作
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 精品久久久一区二区 | 日韩区 | 久久久久久高清 | 亚洲精品日韩在线 | 91精品中文字幕一区二区三区 | 亚洲精品自拍视频 | 日韩欧美在线播放 | av免费在线观看网站 | 老司机67194精品线观看 | 国产成人精品a视频一区www | 91久久久久久久久久久 | 国产精品a久久久久 | 欧美又大粗又爽又黄大片视频 | 亚洲一区二区在线视频 | 日日夜夜精品视频 | 天天天久久久 | 免费视频一区二区 | 成人国产精品免费观看视频 | 欧美另类视频 | 精品1区2区3区4区 | 毛片大全| 一区二区中文 | 91精品国产91久久久久久最新 | 国产精品欧美日韩 | 91视频播放 | 国产成人99久久亚洲综合精品 | 国产精品国色综合久久 | 欧美高清视频 | 日韩成人在线免费观看 | 国产精品99久久久久久久久久久久 | 国产 日韩 欧美 在线 | 在线视频成人 | 欧美精品在线一区二区三区 | 91成人免费电影 | 中文字幕视频在线观看 | 韩日一区二区三区 | 在线观看国产三级 | 一区二区三区精品视频 | 日韩有码一区二区三区 | 免费一级黄色 | 午夜网|