Bird
Raised Fist0
Kafkadevops~20 mins

Kafka vs RabbitMQ vs Redis Pub/Sub - Practice Questions

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Messaging Systems Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Primary Use Case Differences
Which of the following best describes the primary use case difference between Kafka, RabbitMQ, and Redis Pub/Sub?
AKafka is used for web hosting, RabbitMQ for file storage, Redis Pub/Sub for image processing.
BKafka is mainly for caching, RabbitMQ for database storage, Redis Pub/Sub for batch processing.
CKafka is designed for high-throughput event streaming, RabbitMQ for complex routing and message queuing, Redis Pub/Sub for lightweight real-time messaging without persistence.
DKafka is a relational database, RabbitMQ is a web server, Redis Pub/Sub is a programming language.
Attempts:
2 left
💡 Hint
Think about what each system is optimized to do in messaging and data handling.
❓ Predict Output
intermediate
2:00remaining
Message Persistence Behavior
Given the following scenario, which system will retain messages if the consumer is offline and reconnects later?
Kafka
Scenario: A producer sends messages continuously. The consumer disconnects for 10 minutes and then reconnects.
AKafka will retain messages and deliver them when the consumer reconnects.
BRabbitMQ will not retain messages if the consumer is offline.
CRedis Pub/Sub will retain messages and deliver them when the consumer reconnects.
DNone of the systems retain messages for offline consumers.
Attempts:
2 left
💡 Hint
Consider which systems support message durability and replay.
🔧 Debug
advanced
2:00remaining
Unexpected Message Loss in Redis Pub/Sub
You implemented a Redis Pub/Sub system but notice that some messages are lost when subscribers are disconnected briefly. What is the root cause?
ARedis Pub/Sub uses a message broker that crashed.
BRedis Pub/Sub does not queue messages; if a subscriber is offline, it misses messages sent during that time.
CRedis Pub/Sub stores messages on disk but the disk is full.
DRedis Pub/Sub requires explicit message acknowledgments to prevent loss.
Attempts:
2 left
💡 Hint
Think about how Redis Pub/Sub handles message delivery and subscriber state.
📝 Syntax
advanced
2:00remaining
Kafka Consumer Group Configuration
Which Kafka consumer configuration option ensures that multiple consumers share the load of a topic's partitions?
ASetting 'auto.offset.reset' to 'latest'.
BSetting different 'group.id' values for each consumer.
CSetting 'enable.auto.commit' to false.
DSetting the same 'group.id' for all consumers to form a consumer group.
Attempts:
2 left
💡 Hint
Consumer groups allow load balancing across consumers.
🚀 Application
expert
3:00remaining
Choosing the Right System for Real-Time Analytics
You need to build a real-time analytics pipeline that processes millions of events per second with guaranteed message delivery and the ability to replay events for debugging. Which system is the best choice?
AKafka, because it supports high throughput, durability, and replayable event streams.
BRabbitMQ, because it is optimized for lightweight real-time messaging without persistence.
CRedis Pub/Sub, because it stores all messages and supports complex routing.
DNone of these systems can handle real-time analytics at scale.
Attempts:
2 left
💡 Hint
Consider throughput, durability, and replay features.

Practice

(1/5)
1. Which messaging system is best suited for storing message history and handling large data streams?
easy
A. None of the above
B. RabbitMQ
C. Redis Pub/Sub
D. Kafka

Solution

  1. Step 1: Understand Kafka's purpose

    Kafka is designed to handle large data streams and keeps a durable log of messages, allowing message history to be stored.
  2. Step 2: Compare with RabbitMQ and Redis Pub/Sub

    RabbitMQ focuses on reliable delivery and routing, while Redis Pub/Sub is fast but does not store messages.
  3. Final Answer:

    Kafka -> Option D
  4. Quick Check:

    Message history and big data = Kafka [OK]
Hint: Remember: Kafka stores history; Redis Pub/Sub does not [OK]
Common Mistakes:
  • Confusing Redis Pub/Sub as storing messages
  • Thinking RabbitMQ stores message history
  • Assuming all systems keep message logs
2. Which of the following is the correct statement about Redis Pub/Sub?
easy
A. Redis Pub/Sub guarantees message delivery even if subscribers are offline.
B. Redis Pub/Sub does not store messages; it only delivers messages to active subscribers.
C. Redis Pub/Sub supports complex message routing like RabbitMQ.
D. Redis Pub/Sub is designed for batch processing of messages.

Solution

  1. Step 1: Analyze Redis Pub/Sub behavior

    Redis Pub/Sub delivers messages only to subscribers currently connected; it does not store messages for offline clients.
  2. Step 2: Check other options

    Redis Pub/Sub guarantees message delivery even if subscribers are offline. is false because Redis Pub/Sub does not guarantee delivery if subscribers are offline. Redis Pub/Sub supports complex message routing like RabbitMQ. is false because Redis Pub/Sub lacks complex routing. Redis Pub/Sub is designed for batch processing of messages. is false because Redis Pub/Sub is for real-time messaging, not batch processing.
  3. Final Answer:

    Redis Pub/Sub does not store messages; it only delivers messages to active subscribers. -> Option B
  4. Quick Check:

    Redis Pub/Sub delivers only to active subscribers [OK]
Hint: Redis Pub/Sub = no message storage, only live delivery [OK]
Common Mistakes:
  • Assuming Redis Pub/Sub stores messages
  • Confusing Redis with RabbitMQ routing features
  • Thinking Redis Pub/Sub supports offline message delivery
3. Given the following scenario: You need a messaging system that supports flexible routing and guarantees message delivery even if consumers are temporarily offline. Which system fits best?
medium
A. Kafka
B. Redis Pub/Sub
C. RabbitMQ
D. None of the above

Solution

  1. Step 1: Understand RabbitMQ features

    RabbitMQ supports flexible routing through exchanges and queues and guarantees message delivery with acknowledgments and persistence.
  2. Step 2: Compare with Kafka and Redis Pub/Sub

    Kafka stores messages but is less flexible in routing. Redis Pub/Sub is fast but does not guarantee delivery if consumers are offline.
  3. Final Answer:

    RabbitMQ -> Option C
  4. Quick Check:

    Flexible routing + guaranteed delivery = RabbitMQ [OK]
Hint: Flexible routing and delivery guarantees point to RabbitMQ [OK]
Common Mistakes:
  • Choosing Kafka for flexible routing
  • Assuming Redis Pub/Sub guarantees delivery
  • Ignoring RabbitMQ's message acknowledgment feature
4. You have a system using Redis Pub/Sub, but messages are lost when subscribers disconnect. What is the best way to fix this issue?
medium
A. Switch to Kafka to store messages and allow offline consumption.
B. Increase Redis server memory to store more messages.
C. Use Redis Pub/Sub with message persistence enabled.
D. Configure Redis to retry sending messages to offline subscribers.

Solution

  1. Step 1: Identify Redis Pub/Sub limitation

    Redis Pub/Sub does not store messages; if subscribers disconnect, messages are lost.
  2. Step 2: Choose a system that stores messages

    Kafka stores messages durably, allowing consumers to read messages even after being offline.
  3. Final Answer:

    Switch to Kafka to store messages and allow offline consumption. -> Option A
  4. Quick Check:

    Redis Pub/Sub no storage; Kafka stores messages [OK]
Hint: Redis Pub/Sub can't store messages; Kafka can [OK]
Common Mistakes:
  • Trying to enable persistence on Redis Pub/Sub (not supported)
  • Assuming Redis memory increase solves message loss
  • Expecting Redis to retry offline delivery automatically
5. You want to build a real-time analytics system that processes large volumes of data and keeps a full history of all events for auditing. Which combination of messaging systems is the best approach?
hard
A. Use Kafka for event storage and Redis Pub/Sub for real-time notifications.
B. Use RabbitMQ for event storage and Redis Pub/Sub for message routing.
C. Use Redis Pub/Sub alone for both storage and real-time processing.
D. Use RabbitMQ alone for storing large data streams and real-time analytics.

Solution

  1. Step 1: Identify requirements

    The system needs to handle large data volumes, keep full event history, and provide real-time notifications.
  2. Step 2: Match systems to requirements

    Kafka is ideal for storing large data streams and keeping history. Redis Pub/Sub is fast for real-time notifications but does not store data.
  3. Step 3: Evaluate other options

    RabbitMQ is good for routing and delivery but less suited for big data storage. Redis Pub/Sub alone cannot store messages. RabbitMQ alone is not optimized for large data streams.
  4. Final Answer:

    Use Kafka for event storage and Redis Pub/Sub for real-time notifications. -> Option A
  5. Quick Check:

    Kafka stores history + Redis Pub/Sub fast notifications [OK]
Hint: Combine Kafka storage with Redis Pub/Sub speed [OK]
Common Mistakes:
  • Using Redis Pub/Sub alone for storage
  • Assuming RabbitMQ handles big data storage well
  • Ignoring Kafka's strength in event history
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard