Challenge - 5 Problems
Redis Pipeline & Transaction Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
What is the main difference between a Redis pipeline and a transaction?
In Redis, both pipelines and transactions can group multiple commands. Which statement best describes their main difference?
Attempts:
2 left
💡 Hint
Think about whether commands run all together or can be interrupted.
✗ Incorrect
A Redis pipeline batches commands to reduce network overhead but does not guarantee atomic execution. A transaction (MULTI/EXEC) ensures all commands run atomically without interruption.
🧠 Conceptual
intermediate1:30remaining
Which Redis feature ensures that either all commands in a group succeed or none do?
You want to make sure a group of Redis commands run together without interference and either all succeed or all fail. Which feature should you use?
Attempts:
2 left
💡 Hint
Atomicity means all or nothing.
✗ Incorrect
Redis transactions (MULTI/EXEC) guarantee atomic execution of commands, so either all commands succeed or none do.
❓ query_result
advanced2:00remaining
What is the output of this Redis transaction example?
Consider this Redis transaction commands sent together:
What is the output returned by the EXEC command?
MULTI SET key1 10 INCR key1 EXEC
What is the output returned by the EXEC command?
Redis
MULTI
SET key1 10
INCR key1
EXECAttempts:
2 left
💡 Hint
Remember what MULTI and EXEC do in Redis.
✗ Incorrect
In a Redis transaction (MULTI/EXEC), the SET and INCR commands return 'QUEUED'. The EXEC command returns an array of the results: ["OK", 11].
📝 Syntax
advanced1:30remaining
Which Redis command sequence correctly uses a transaction to increment a key safely?
You want to increment a key's value atomically in Redis. Which command sequence is correct?
Attempts:
2 left
💡 Hint
Only MULTI/EXEC define transactions.
✗ Incorrect
Only MULTI starts a transaction and EXEC executes it atomically. PIPELINE is not a Redis command and DISCARD cancels the transaction.
❓ optimization
expert2:00remaining
Why might using a Redis pipeline improve performance over individual commands?
You send 100 commands to Redis. Which reason best explains why using a pipeline improves performance compared to sending commands one by one?
Attempts:
2 left
💡 Hint
Think about network communication overhead.
✗ Incorrect
Pipelining batches commands to reduce the number of network round trips, which lowers latency and improves throughput. It does not guarantee atomicity or compress data.