0
0
Redisquery~20 mins

Why pub/sub enables real-time messaging in Redis - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Real-Time Messaging Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2: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?
ASubscribers must poll Redis repeatedly to check for new messages, which creates real-time delivery.
BSubscribers receive messages instantly because Redis pushes messages directly to them as soon as they are published.
CMessages are stored in a queue and delivered only when subscribers request them explicitly.
DRedis batches messages and sends them to subscribers at fixed time intervals.
Attempts:
2 left
💡 Hint
Think about how messages reach subscribers without delay.
query_result
intermediate
2: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"
A
Subscribed to news channel
Hello
World
B
Hello
World
C
news: Hello
news: World
D
message
news
Hello
message
news
World
Attempts:
2 left
💡 Hint
Look at the exact Redis subscriber output format.
📝 Syntax
advanced
2:00remaining
Which Redis command syntax correctly subscribes to multiple channels?
Select the correct Redis command to subscribe to channels 'sports' and 'weather' simultaneously.
ASUBSCRIBE sports weather
BSUBSCRIBE sports, weather
CSUBSCRIBE 'sports' 'weather'
DSUBSCRIBE sports; SUBSCRIBE weather
Attempts:
2 left
💡 Hint
Redis commands separate multiple channels by spaces, not commas or semicolons.
optimization
advanced
2: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?
ASubscribe to channels with pattern matching to catch all messages.
BIncrease Redis server memory to buffer more pub/sub messages.
CUse Redis Streams instead of pub/sub to store messages until consumed.
DPublish messages less frequently to avoid overload.
Attempts:
2 left
💡 Hint
Think about message persistence and delivery guarantees.
🔧 Debug
expert
3: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}"
ASubscriber cannot process messages fast enough, causing message loss because Redis pub/sub does not queue messages.
BSubscriber did not authenticate properly, so messages are blocked.
CPublisher is using wrong channel name, so messages go elsewhere.
DRedis server is down, so messages are lost.
Attempts:
2 left
💡 Hint
Consider how Redis pub/sub handles message delivery under load.