0Pricing
Redis Caching & Messaging (Pub/Sub, Streams) · Lektion

Das Slow Log analysieren

Verwenden Sie das Redis-Slow-Log, um Befehle zu finden, die den Server blockieren, Einträge zu interpretieren und die Erfassungsschwellenwerte anzupassen.

Das Slow Log analysieren ist eine kostenlose Redis Caching & Messaging (Pub/Sub, Streams)-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Redis Caching & Messaging (Pub/Sub, Streams)-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Redis Caching & Messaging (Pub/Sub, Streams)-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Redis Is Single-Threaded

Command execution in Redis is effectively single-threaded. One slow command blocks every other client. The slow log records commands whose execution time exceeds a threshold, so you can hunt down these blockers.

What It Measures

The slow log times only command execution, not network or I/O wait. So a logged entry means Redis itself spent that long, usually on an expensive operation over many elements.

Configuring the Threshold

slowlog-log-slower-than sets the threshold in microseconds. A value of 10000 logs commands slower than 10ms. Set it to 0 to log everything (for debugging) or -1 to disable.

CONFIG SET slowlog-log-slower-than 10000

Limiting Log Size

slowlog-max-len caps how many entries are retained; older ones are evicted. This keeps memory bounded.

CONFIG SET slowlog-max-len 128

Reading the Log

SLOWLOG GET returns recent entries; pass a count to limit them. Each entry has an ID, timestamp, microsecond duration, the command and arguments, and the client address.

SLOWLOG GET 10

Interpreting an Entry

Look at the command and its duration. A KEYS * or a large SMEMBERS over a million-element set will show big durations, pinpointing the culprit and the calling client.

# 1) id 14
# 2) timestamp 1716900000
# 3) microseconds 23000
# 4) ["KEYS", "*"]

Length and Reset

SLOWLOG LEN gives the current entry count, and SLOWLOG RESET clears the log, handy before reproducing an issue.

SLOWLOG LEN
SLOWLOG RESET

Common Offenders

Frequent slow-log culprits:

  • KEYS on large keyspaces (use SCAN)
  • Big SMEMBERS/HGETALL/LRANGE 0 -1
  • Unbounded SORT
  • Large DEL (use UNLINK)
SCAN 0 MATCH user:* COUNT 100
UNLINK biglist

From Detection to Fix

Once the slow log names a command, fix it: paginate with cursors, model data to avoid huge single keys, or move heavy work off the hot path. Re-check the log to confirm the durations drop.

Continuous Monitoring

Sample the slow log periodically from a monitoring job and alert when slow commands appear, so you catch regressions before users feel them.

redis-cli SLOWLOG GET 5

Threshold Tuning

Start with a moderate threshold (e.g. 10ms) in production. Lower it temporarily when investigating, then restore it, because logging everything adds a tiny per-command cost.

Quick Check

Test your understanding of the slow log.

Recap

You learned to use the slow log: configure slowlog-log-slower-than and slowlog-max-len, read entries with SLOWLOG GET, interpret durations, and fix common offenders like KEYS and huge single-key reads. Monitor it continuously to catch performance regressions early.

Häufig gestellte Fragen

Ist die Lektion „Das Slow Log analysieren“ kostenlos?

Ja — der vollständige Text von „Das Slow Log analysieren“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Redis Caching & Messaging (Pub/Sub, Streams)-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Redis Caching & Messaging (Pub/Sub, Streams)-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Das Slow Log analysieren“?

Verwenden Sie das Redis-Slow-Log, um Befehle zu finden, die den Server blockieren, Einträge zu interpretieren und die Erfassungsschwellenwerte anzupassen. Du übst Redis Caching & Messaging (Pub/Sub, Streams) mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Redis Caching & Messaging (Pub/Sub, Streams) zu starten?

Keine Vorkenntnisse erforderlich. Redis Caching & Messaging (Pub/Sub, Streams) auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.

Wie lange dauert die Lektion „Das Slow Log analysieren“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Redis Caching & Messaging (Pub/Sub, Streams)-Lektion Code schreiben und ausführen?

Ja. Jede Redis Caching & Messaging (Pub/Sub, Streams)-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Monitoring-Tools für Redis
  2. Performanceprobleme diagnostizieren
  3. Performance-Tuning und Optimierung
  4. Das Slow Log analysieren
← Zurück zu Redis Caching & Messaging (Pub/Sub, Streams)