Redis Slow Query log

Source: Internet
Author: User
Tags log log

OPS needs to record the "slow action" commands in the master Redis and then find the relevant business party, otherwise, block

It's not funny anymore. The relevant commands are then found directly in the Redis Handbook.

SLOWLOG subcommand [argument] What is Slowlogslow log is the journaling system used by Redis to record query execution times. Query execution time refers to not including IO operations such as client response (talking), sending replies, and simply the time spent executing a query command. In addition, the slow log is stored in memory and reads and writes very quickly, so you can use it with confidence, without worrying about the speed of Redis due to opening slow log. The behavior of setting Slowlogslow log is specified by two configuration parameters (config parameter), which can be dynamically modified by overwriting redis.conf files or by using the config GET and config SET commands. The first option is Slowlog-log-slower-than, which determines how many microseconds (microsecond,1 seconds = 1,000,000 microseconds) of execution time are logged. For example, executing the following command will let slow log log all queries that have a query time greater than or equal to 100 microseconds: Config set Slowlog-log-slower-than 100 and the following command logs all queries with a query time greater than 1000 microseconds: Config set slo Wlog-log-slower-than 1000 Another option is Slowlog-max-len, which determines how many logs slow log can hold, slow log itself is a FIFO queue when the queue size exceeds Slowlog-max-len , the oldest log is deleted, and the latest log is added to slow log, and so on. The following command allows slow log to save up to 1000 logs: CONFIG SET Slowlog-max-len 1000

From the above paragraph, probably see the two properties: Slowlog-log-slower-than and Slowlog-max-len, for testing convenience, I do not config set, directly to get rid of

redis.conf files can ...

# The following time is expressed in microseconds and so 1000000 are equivalent# to one second. Note that a negative number disables the slow log, while# a value of zero forces the logging of every command.slowlog-log- Slower-than 0# There is the no limit to this length.  Just be aware that it'll consume memory.# you can reclaim memory used by the slow log with Slowlog Reset.slowlog-max-len 10

Then I simply test that all the command will be recorded in the Slowlog inside, the red box is the comand execution time.

With this, can I now find out which slow command commands are on all the lines??? So that everyone will not be passing the buck ...

Redis Slow Query log

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.