当前位置:网站首页>[teacher Zhao Yuqiang] redis's slow query log
[teacher Zhao Yuqiang] redis's slow query log
2022-07-03 05:45:00 【Teacher zhaoyuqiang】

Redis Slow query log helps developers and operation and maintenance personnel locate the slow operation of the system . Slow query log is that the system calculates the execution time of each command before and after the execution of the command , When the default threshold is exceeded , This command will be the relevant information ( The slow query ID, Occurrence timestamp , Time consuming , Command details ) recorded .
Redis A client command is divided into four parts as follows :

It should be noted that , Slow query log is just a statistical step 3) Time of execution of order , So slow query does not mean that the client has no timeout problem . It should be noted that , Slow query log is just a statistical step 3) Time of execution of order , So slow query does not mean that the client has no timeout problem .
One 、 Configuration parameters for slow queries :
- Default threshold for slow query slowlog-log-slower-than
slowlog-log-slower-than The parameter is the default threshold , The unit is microseconds , The default value is 10000, If the execution time of a command exceeds 10000 subtle , Then it will be recorded in the slow query log .
If slowlog-log-slower-than The value of is 0, All orders will be recorded .
If slowlog-log-slower-than The value is less than 0, Then no command will log .
- Slow query log length slowlog-max-len
slowlog-max-len It just shows how many slow query logs can be stored at most .Redis Use a list to store slow query logs ,showlog-max-len Is the maximum length of the list . When the slow query log has reached the maximum length of the list , Another slow query log to enter the list , The first log inserted into the list will be removed from the list , The new log is inserted at the end of the list .
Two 、 Composition of slow query log
The slow query log consists of the following four properties :
identification ID, Occurrence timestamp , The command takes time , Execute commands and parameters
3、 ... and 、 Slow query log access and management
Get slow query log slowlog get [n]
command :slowlog get [N]
The selection :N, Optional , Represents the number of log entries obtained
for example :showlog get 5
Four 、 Slow query log best practices
- slowlog-max-len Suggestions for setting up
It is recommended to increase and slow down the list of query logs in the online environment , When logging slow queries Redis Will truncate long commands , It doesn't take up a lot of memory . Increasing the list of slow queries can slow down the possibility that slow queries will be removed from the list . For example, the line can be set to 1000 above .
- slowlog-log-lower-than Suggestions for setting up
Need basis redis The concurrency value is adjusted . because redis Using single thread response fame and fortune , For high traffic scenarios , If the order is executed at 1 Milliseconds or more , that redis Support at most OPS( Number of operations per second ) Less than 1000, So high OPS Of the scene REDIS Recommended setting is 1 millisecond .
- Slow queries only record command execution time , Does not include command queuing time and network transmission time .
Therefore, the execution time of client command is longer than redis The time the server actually executed the command . Because command execution queuing is extreme , Slow queries can cause command cascading blocking , So when the client has a request timeout , You need to check whether there is a corresponding slow query at this time point , So as to analyze whether the command cascade blocking caused by slow query
- The slow query log is a first in, first out queue
When there are more slow queries , Some slow query commands may be lost , It can be carried out on a regular basis slow get Command to persist slow query logs to other stores . Then make a visual interface query .

边栏推荐
- Ensemble, série shuishu] jour 9
- DEX net 2.0 for crawl detection
- Apt update and apt upgrade commands - what is the difference?
- 【一起上水硕系列】Day 7 内容+Day8
- Personal outlook | looking forward to the future from Xiaobai's self analysis and future planning
- Explanation of several points needing attention in final (tested by the author)
- AtCoder Beginner Contest 258(A-D)
- Skip table: principle introduction, advantages and disadvantages of skiplist
- 期末复习(DAY7)
- College campus IP network broadcasting - manufacturer's design guide for college campus IP broadcasting scheme based on campus LAN
猜你喜欢
![Together, Shangshui Shuo series] day 9](/img/39/c1ba1bac82b0ed110f36423263ffd0.png)
Together, Shangshui Shuo series] day 9

Mapbox tasting value cloud animation
![[branch and cycle] | | super long detailed explanation + code analysis + a trick game](/img/aa/543d4f0dcbcd664be963579af77ec9.jpg)
[branch and cycle] | | super long detailed explanation + code analysis + a trick game

Deploy crawl detection network using tensorrt (I)

Understand one-way hash function

Primary school campus IP network broadcasting - Design of primary school IP digital broadcasting system based on campus LAN

Redhat7系统root用户密码破解
![[minesweeping of two-dimensional array application] | [simple version] [detailed steps + code]](/img/b0/aa5dce0bb60c50eea907de9e127d6c.jpg)
[minesweeping of two-dimensional array application] | [simple version] [detailed steps + code]

Qt读写Excel--QXlsx插入图表5

Why should we rewrite hashcode when we rewrite the equals method?
随机推荐
Strategy pattern: encapsulate changes and respond flexibly to changes in requirements
Primary school campus IP network broadcasting - Design of primary school IP digital broadcasting system based on campus LAN
Pytorch through load_ state_ Dict load weight
chromedriver对应版本下载
獲取並監控遠程服務器日志
获取并监控远程服务器日志
Disassembly and installation of Lenovo r7000 graphics card
Apt update and apt upgrade commands - what is the difference?
"C and pointer" - Chapter 13 function pointer 1: callback function 2 (combined with template to simplify code)
Altaro o365 total backup subscription plan
期末复习(Day5)
Es 2022 officially released! What are the new features?
6.23星期四库作业
Altaro virtual machine replication failed: "unsupported file type vmgs"
Jetson AgX Orin platform porting ar0233 gw5200 max9295 camera driver
Redis encountered noauth authentication required
redis 无法远程连接问题。
Xaml gradient issue in uwp for some devices
Notepad++ wrap by specified character
期末复习(Day2)