当前位置:网站首页>[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 .

边栏推荐
- Altaro o365 total backup subscription plan
- 70 shell script interview questions and answers
- [advanced pointer (1)] | detailed explanation of character pointer, pointer array, array pointer
- [untitled]
- Use telnet to check whether the port corresponding to the IP is open
- NG Textarea-auto-resize
- "C and pointer" - Chapter 13 advanced pointer int * (* (* (*f) () [6]) ()
- Making coco datasets
- DEX net 2.0 for crawl detection
- [branch and cycle] | | super long detailed explanation + code analysis + a trick game
猜你喜欢
![[set theory] relational closure (reflexive closure | symmetric closure | transitive closure)](/img/c8/2995c503e9dabae4e2cc704449e04f.jpg)
[set theory] relational closure (reflexive closure | symmetric closure | transitive closure)
![[explain in depth the creation and destruction of function stack frames] | detailed analysis + graphic analysis](/img/df/884313a69fb1e613aec3497800f7ba.jpg)
[explain in depth the creation and destruction of function stack frames] | detailed analysis + graphic analysis

Notepad++ wrap by specified character
![[escape character] [full of dry goods] super detailed explanation + code illustration!](/img/33/ec5a5e11bfd43f53f2767a9a0f0cc9.jpg)
[escape character] [full of dry goods] super detailed explanation + code illustration!

Method of finding prime number
![[advanced pointer (2)] | [function pointer, function pointer array, callback function] key analysis + code explanation](/img/9b/a309607c037b0a18ff6b234a866f9f.jpg)
[advanced pointer (2)] | [function pointer, function pointer array, callback function] key analysis + code explanation

Exception when introducing redistemplate: noclassdeffounderror: com/fasterxml/jackson/core/jsonprocessingexception

中职网络子网划分例题解析

大二困局(复盘)

穀歌 | 蛋白序列的深度嵌入和比對
随机推荐
ES 2022 正式发布!有哪些新特性?
今天很多 CTO 都是被幹掉的,因為他沒有成就業務
Redhat7 system root user password cracking
Understand one-way hash function
Mapbox tasting value cloud animation
How do I migrate my altaro VM backup configuration to another machine?
Making coco datasets
Calculation method of AUC
Introduction to redis using Lua script
Xaml gradient issue in uwp for some devices
配置xml文件的dtd
Download the corresponding version of chromedriver
ROS Compilation Principle
@Solutions to null pointer error caused by Autowired
PHP notes are super detailed!!!
Jetson AgX Orin platform porting ar0233 gw5200 max9295 camera driver
@Import annotation: four ways to import configuration classes & source code analysis
Communication - how to be a good listener?
Apache+PHP+MySQL环境搭建超详细!!!
Beaucoup de CTO ont été tués aujourd'hui parce qu'il n'a pas fait d'affaires