Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ Redis logging system     - Linux installation Jetty deployment under RedHat5 8 (Linux)

- Java Performance Tuning the proxy mode (Programming)

- lolcat: an output terminal rainbow effects in the Linux command-line tool (Linux)

- Let Markdown code syntax highlighting and support Django1.6 (Linux)

- Disable unnecessary services under Linux (Linux)

- Linux remote wake the computer original code [C] (Linux)

- When Linux Detailed time zone and common function of time (Linux)

- High-performance JavaScript loops and flow control (Programming)

- Linux using DenyHosts prevents ssh cracks (Linux)

- Linux support exFAT and NTFS (Linux)

- How x2go set up Remote Desktop on Linux (Linux)

- Linux Disk and File Management (Linux)

- Getting Started with Linux system to learn: how to install USB webcams come in raspberry (Linux)

- Build Nginx + uWSGI + Flask operating environment under CentOS 6.4 tutorial (Server)

- In addition to wget and curl, what better alternatives (Linux)

- Python is not C (Programming)

- Forbid screen change the window size when creating a new window under CentOS (Linux)

- ORA-14400: inserted partition key does not map to any partition (Database)

- Linux environment variable configuration and save places (Linux)

- Several back door and log tool under Linux (Linux)

 
         
  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.

What is 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.
redis> SLOWLOG LEN
(Integer) 14

Clear log

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

redis> SLOWLOG RESET
redis> SLOWLOG LEN
(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.
     
         
         
         
  More:      
 
- Intel Graphics Installer installation on Ubuntu 15.10 (Linux)
- stat Usage: Get permission to file the corresponding figures (Linux)
- Under CentOS yum install Nginx smooth switch mounted to Tengine (Server)
- Linux common network tools: hping Advanced Host Scan (Linux)
- Share useful bash aliases and functions (Linux)
- CentOS iptables firewall configuration (Linux)
- Example of use WebSocket (Programming)
- Python Basics Tutorial - lambda keyword (Programming)
- Ubuntu mysql stop fail to solve the problem (Database)
- Brief Linux commands (Linux)
- Confrontation dragged Library - Web front-end encryption slow (Linux)
- Linux installation notes under GAMIT (Linux)
- Schema snapshot rollback (Database)
- How to override the plain text files and directories soft connection in linux (Linux)
- Upgrading to MySQL 5.7 partitioning problem solving (Database)
- How to back up Debian system backupninja (Linux)
- Zabbix Agent for Linux Installation and Configuration (Server)
- Installation Flow N Play- interface stylized video player on Ubuntu (Linux)
- The first IOS Objective-C program (Programming)
- Five useful commands to manage file types and system time in linux (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.