0
0
RabbitMQdevops~20 mins

Consumer prefetch optimization in RabbitMQ - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
RabbitMQ Prefetch Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What does setting the prefetch count in RabbitMQ consumers control?

In RabbitMQ, consumers can set a prefetch count. What does this setting control?

AThe maximum number of messages sent to the consumer without receiving acknowledgments.
BThe total number of messages in the queue at any time.
CThe number of consumers connected to the queue.
DThe maximum size of the message payload the consumer can receive.
Attempts:
2 left
💡 Hint

Think about how many messages a consumer can work on before telling the server it finished.

💻 Command Output
intermediate
1:30remaining
What is the output of setting prefetch count to 1 in RabbitMQ consumer?

Consider a RabbitMQ consumer with prefetch count set to 1. What is the expected behavior?

AThe consumer receives all messages in the queue at once.
BThe consumer receives messages in batches of 10 by default.
CThe consumer receives one message at a time and must acknowledge it before receiving the next.
DThe consumer ignores acknowledgments and receives messages continuously.
Attempts:
2 left
💡 Hint

Prefetch count 1 means the consumer processes messages one by one.

Configuration
advanced
2:00remaining
Which command correctly sets prefetch count to 5 using rabbitmqctl?

You want to limit a consumer's prefetch count to 5 using rabbitmqctl. Which command is correct?

Arabbitmqctl set_prefetch_count 5
Brabbitmqctl set_policy my_policy "^" '{"prefetch-count":5}' --apply-to consumers
Crabbitmqctl set_qos --prefetch-count=5
Drabbitmqctl set_qos -p / my_queue 5
Attempts:
2 left
💡 Hint

Prefetch count is set per channel or queue using set_qos command.

Troubleshoot
advanced
2:00remaining
Why might a consumer with prefetch count 10 still get overwhelmed?

A consumer has prefetch count set to 10 but is still overwhelmed and slow. What could be the reason?

AThe consumer is not acknowledging messages, causing RabbitMQ to resend them.
BPrefetch count only limits messages per queue, not per consumer.
CThe consumer is using automatic acknowledgments, so prefetch count is ignored.
DThe queue has more than 10 messages, so prefetch count is ineffective.
Attempts:
2 left
💡 Hint

Think about what happens if messages are not acknowledged.

🔀 Workflow
expert
3:00remaining
Order the steps to optimize consumer prefetch for a high-throughput RabbitMQ system

Arrange the following steps in the correct order to optimize consumer prefetch settings for better throughput and stability.

A3,1,2,4
B1,3,2,4
C1,2,3,4
D2,1,3,4
Attempts:
2 left
💡 Hint

Start by understanding current performance before changing settings.