Challenge - 5 Problems
Real-Time Messaging Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
How does pub/sub achieve real-time message delivery?
In Redis pub/sub, what is the main reason messages are delivered in real-time to subscribers?
Attempts:
2 left
💡 Hint
Think about how messages reach subscribers without delay.
✗ Incorrect
Redis pub/sub pushes messages immediately to all subscribers of a channel, enabling real-time communication without polling or delays.
❓ query_result
intermediate2:00remaining
What output shows a subscriber receiving messages in real-time?
Given a Redis subscriber listening on channel 'news', what output will it show when messages are published?
Redis
SUBSCRIBE news # Then publisher runs: PUBLISH news "Hello" PUBLISH news "World"
Attempts:
2 left
💡 Hint
Look at the exact Redis subscriber output format.
✗ Incorrect
Redis subscriber outputs 'message', channel name, then the message for each published message.
📝 Syntax
advanced2:00remaining
Which Redis command syntax correctly subscribes to multiple channels?
Select the correct Redis command to subscribe to channels 'sports' and 'weather' simultaneously.
Attempts:
2 left
💡 Hint
Redis commands separate multiple channels by spaces, not commas or semicolons.
✗ Incorrect
The correct syntax is SUBSCRIBE followed by channel names separated by spaces without commas or quotes.
❓ optimization
advanced2:00remaining
How to reduce message loss in Redis pub/sub during high load?
Redis pub/sub does not store messages if no subscriber is connected. Which approach helps reduce message loss in real-time messaging?
Attempts:
2 left
💡 Hint
Think about message persistence and delivery guarantees.
✗ Incorrect
Redis Streams store messages so consumers can read them later, preventing message loss unlike pub/sub which only delivers to active subscribers.
🔧 Debug
expert3:00remaining
Why does this Redis pub/sub subscriber miss some messages?
A subscriber runs SUBSCRIBE on channel 'alerts'. The publisher sends messages rapidly. Sometimes the subscriber misses messages. What is the most likely cause?
Redis
Subscriber: SUBSCRIBE alerts Publisher: for i in range(1000): PUBLISH alerts f"Alert {i}"
Attempts:
2 left
💡 Hint
Consider how Redis pub/sub handles message delivery under load.
✗ Incorrect
Redis pub/sub delivers messages only to connected subscribers instantly. If subscriber is slow, messages sent while it is busy are lost.