Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the slow query in Redis

Shulou Source: shulou.com Published: 2022-06-02 06:55:49 10月02日 Update

This article mainly introduces "what is the slow query in Redis". In the daily operation, I believe that many people have doubts about what the slow query in Redis is. The editor consulted all kinds of materials and sorted out a simple and easy-to-use operation method. I hope it will be helpful to answer the doubt of "what is the slow query in Redis?" Next, please follow the editor to study!

It has been described in other Redis articles that a Redis command is executed in four steps:

Send a command

Command queue

Command execution

Return the result

This is shown in the following figure:

Note: the slow query described above refers to the time in step 3, that is, the execution time of the Redis command, so the slow query time in Redis is not the same as the client timeout.

Configuration parameters of slow query

To use the slow query feature in Redis, we need to understand two things:

How to set timeout parameters

Log directory recorded

In Redis we can use the

Showlog-log-slower-than

Parameter to set the timeout of the command, and the unit of the timeout is subtle (1 second = 1000 milliseconds = 1000000 subtle)

Showlog-log-slower-than

The parameter has its own default value, which defaults to 10000. That is, if we do not modify any parameters in Redis, when the execution time of a command in Redis exceeds 10000 subtleties, Redis will log the information about the command.

Note: if the parameter showlog-log-slower-than=0, Redis will record all executed commands, if when showlog-log-slower-than

Tags: Queries commands parameters information time logs storage that is learning subtlety too much configuration two functions remarks actual customers articles time more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Information Huawei Apple OPPO Reno