Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Database \ Redis logging system     - Binding multiple network cards in Linux using command nmcli (Linux)

- Four levels to deal with Linux server attacks (Linux)

- Linux terminal interface font color settings (Linux)

- MySQL backup tool to back up mydumper (Database)

- Unsafe reboot start (Linux)

- Linux novice common commands (Linux)

- OpenSSH version smooth upgrade method (Linux)

- Java polymorphism and exception handling (Programming)

- Ubuntu 14.04 Solution login interface infinite loop (Linux)

- Linux foundation tutorial: how to modify the host name on CentOS or RHEL 7 (Linux)

- EXP-00091 Error resolved (Database)

- Python control multi-process and multi-threaded concurrency (Programming)

- RedHat Linux 6 desktop installation (Linux)

- Hadoop connection failed or stuck processing (Server)

- IOS distributed management using GitHub project development (Linux)

- Increase ssh security service under Linux (Linux)

- Grep, Ack, Ag searches Efficiency Comparison (Linux)

- Grep how to find files based on file contents in UNIX (Linux)

- Ubuntu root user profiles (Programming)

- How to become a better Node.js developers in 2016 (Programming)

  Redis logging system
  Add Date : 2018-11-21      
  Today middleware interfaces response time is very long, generally after investigation, it found that access Redis is slow, and the cpu Redis has indeed risen to about 98%, and now need to locate the problem. The first open redis slowlog.


Slow log Redis is used to record the query execution time logging system.

Query execution time is the response does not include things like client (talking), and other IO operations to send a reply, and just execute a query time-consuming.

In addition, slow log stored in memory inside, read and write very fast, so you can safely use it, do not worry because open slow log detriment Redis speed.

Slow log behavior is specified by two configuration parameters (configuration parameter), and CONFIG commands CONFIG can modify them dynamically by overwriting files or redis.conf.

The first option is slowlog-log-slower-than, it decided to execution time is greater than the number of microseconds (microsecond, 1 second = 1,000,000 microseconds) queries recorded.

For example, execute the following command to make slow log records all queries time is greater than or equal to 100 microseconds query:

CONFIG set slowlog-log-slower-than 100

The following command logs all queries longer than 1000 microseconds query:

CONFIG set slowlog-log-slower-than 1000

Another option is slowlog-max-len, it decided to slow log can hold the maximum number of logs, slow log itself is a LIFO queue, when the queue size exceeds slowlog-max-len, one of the oldest log will be deleted, and the latest to join a log to slow log, and so on.

The following command allows slow log store up to 1000 log:

CONFIG get slowlog-max-len

Using the CONFIG command to query the current value of the two options

View slow log

To view the slow log, you can use SLOWLOG GET or SLOWLOG GET number command, the former print all slow log, the maximum length depends on the value slowlog-max-len option, and SLOWLOG number only print the specified number of logs.

The latest log will be the first to be printed

Unique id log in Redis server restart only time will reset to avoid repetitive processing of logs (for example, you might want to send e-mail notification every time you discover a new slow query).

Check the number of the current log

Using the command SLOWLOG can see the number of the current log.

Please note that the value of this distinction and slower-max-len, which is the number of a current log, a record of the number of allowed maximum log.
(Integer) 14

Clear log

Using the command SLOWLOG RESET can be emptied slow log.
(Integer) 14

(Integer) 0

By slow log can be found in the program using keys message_ * command, leading middleware long response time to modify the code troubleshooting.
- Ubuntu how to install and use Objective-C (Linux)
- Ubuntu install VMware Workstation 11 tutorials at 14.04 / 14.10 (Linux)
- To protect the temporary files for Linux security (Linux)
- Linux Hard Disk Partition and file system management (Linux)
- PostgreSQL 9.3.2 Json type of use (Database)
- Oracle table space is too large processing time (Database)
- Java memory area (Programming)
- Graphical interface for the CentOS 6.4 installed and connected by remote VNC (Linux)
- New features of Java 9 HTTP2 and REPL (Programming)
- Ubuntu 12.04 installation instructions under GAMIT10.40 (Linux)
- The FreeBSD zfs: failed with error 6 Error Resolution (Linux)
- Use top to monitor the remote server (Server)
- The source code compiler installation Nginx 1.8.0 under Ubuntu 14.10 (Server)
- Installation Android IDE development tools, Android Studio 1.5 under Ubuntu (Linux)
- Ubuntu 14.10 / 14.04 / 12.04 installation GNOME Pie 0.5.6 (Linux)
- Red-black tree in C ++ (Programming)
- Getting Started with Linux system to learn: how to install the Shrew Soft IPsec VPN on Linux (Linux)
- Talking about the implementation and the JVM garbage collection mechanism (Programming)
- These days have been tossing in the Linux under the ASP.NET 5, on the next in the other operating systems in the ASP.NET 5 or. NET applications, in order to complete the MS VM (CoreCLR) run is not far Reach, the effect of the application.

- CentOS6 installation configuration rsh (Server)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.