Challenge - 5 Problems
Redis Latency Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Why does Redis use an in-memory data store?
Redis stores data primarily in memory rather than on disk. What is the main reason this design helps Redis achieve sub-millisecond latency?
Attempts:
2 left
💡 Hint
Think about the speed difference between memory and disk access.
✗ Incorrect
Redis keeps data in memory to avoid slow disk reads and writes. Memory access is much faster, enabling quick data retrieval and updates.
🧠 Conceptual
intermediate2:00remaining
How does Redis handle commands to maintain speed?
Redis processes commands using a single-threaded event loop. Why does this design help keep latency low?
Attempts:
2 left
💡 Hint
Think about what happens when a program switches between many tasks.
✗ Incorrect
Using a single thread avoids delays caused by switching between threads, which can slow down processing. This keeps command execution fast and predictable.
❓ query_result
advanced2:00remaining
What is the output of this Redis command sequence?
Given the following Redis commands executed in order, what is the output of the final command?
1. SET user:1 "Alice"
2. INCR visits:1
3. INCR visits:1
4. GET visits:1
Redis
SET user:1 "Alice" INCR visits:1 INCR visits:1 GET visits:1
Attempts:
2 left
💡 Hint
INCR increases the integer value stored at the key by 1.
✗ Incorrect
The key visits:1 is incremented twice starting from 0 (default). So after two increments, its value is 2.
❓ optimization
advanced2:00remaining
Which Redis feature helps reduce latency by avoiding disk writes on every command?
Redis can be configured to save data to disk periodically instead of after every command. Which feature allows this behavior to help maintain sub-millisecond latency?
Attempts:
2 left
💡 Hint
Think about saving data in batches rather than immediately.
✗ Incorrect
Snapshotting saves the dataset to disk at intervals, reducing disk I/O during normal operations and keeping latency low.
🔧 Debug
expert3:00remaining
Why does this Redis Lua script cause latency spikes?
A Redis Lua script runs a long loop that processes 1 million items in one call. What is the main reason this causes latency spikes for other clients?
Attempts:
2 left
💡 Hint
Consider how Redis handles commands when one takes a long time to run.
✗ Incorrect
Redis runs Lua scripts atomically and single-threaded, so a long-running script blocks all other commands, causing latency spikes.