NOTE

3.3 Redis Slow Queries

Redis command execution flow, slow-query configuration and commands, and the in-memory FIFO implementation.

Redis / CacheCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. Redis Command Execution Flow

  • The client sends a command to the server.
  • The server queues the command.
  • The server executes the command.
    • Slow-query statistics measure this time.
  • The server returns the result.

2. Usage

2.1. Record Slow Queries

# Slow queries are recorded in an in-memory queue. Generally set to 1000
slowlog-max-len=1000
# Threshold, in microseconds. Generally set to 1 ms
slow-log-slower-than=10000

2.2. Slow-Query Commands

slowlog get [n]
slowlog len
slowlog reset

2.3. Analyze the Cause of Slow Queries

3. Implementation

A first-in-first-out queue stored in memory.

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub