Redis medium
How does Redis prevent the Append Only File (AOF) from consuming all available disk space as logs accumulate over time?
- A It periodically truncates the file and deletes all history older than 24 hours to preserve partition space.
- B AOF Rewrite: A background process rebuilds the log from the current memory state to remove redundant writes.
- C It uses standard GZIP compression on the log file every time it reaches a predefined physical size limit.
- D It shifts all overflow write commands into a secondary unlogged staging area on a separate physical disk.
Answer: B. AOF Rewrite: A background process rebuilds the log from the current memory state to remove redundant writes.
If a key is incremented 1,000 times, the old AOF has 1,000 lines. The Rewrite process replaces those with a single `SET key 1000` command, creating a much smaller, concise file for recovery.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- If the Redis memory limit is reached, what specific behavior is exhibited by the `allkeys-lru` eviction policy?
- What is the defining characteristic of a Redis 'Set' data type compared to a standard Redis 'List'?
- In the context of Redis messaging, what is the functional definition of the 'Pub/Sub' feature?
- How does the Redis background snapshotting process (`BGSAVE`) leverage the operating system's `fork()` mechanism to minimize memory overhead?
- Why does Redis proactively disconnect a Pub/Sub client that exhibits high 'output buffer' usage relative to its ingestion rate?
- How does a 'Sorted Set' (ZSET) manage its internal membership and ordering differently from a plain Set?