In RabbitMQ, consumers can set a prefetch count. What does this setting control?
Think about how many messages a consumer can work on before telling the server it finished.
Prefetch count limits how many messages RabbitMQ will send to a consumer before it must acknowledge some. This helps balance load and avoid overwhelming consumers.
Consider a RabbitMQ consumer with prefetch count set to 1. What is the expected behavior?
Prefetch count 1 means the consumer processes messages one by one.
With prefetch count set to 1, RabbitMQ sends only one message at a time to the consumer. The next message is sent only after the consumer acknowledges the previous one.
You want to limit a consumer's prefetch count to 5 using rabbitmqctl. Which command is correct?
Prefetch count is set per channel or queue using set_qos command.
The rabbitmqctl set_qos -p / my_queue 5 command sets the prefetch count to 5 for the queue my_queue in the default virtual host.
A consumer has prefetch count set to 10 but is still overwhelmed and slow. What could be the reason?
Think about what happens if messages are not acknowledged.
If the consumer does not acknowledge messages, RabbitMQ keeps them unacknowledged and may resend them, causing overload despite prefetch limits.
Arrange the following steps in the correct order to optimize consumer prefetch settings for better throughput and stability.
Start by understanding current performance before changing settings.
First measure processing time, then monitor load, next set prefetch count accordingly, and finally adjust dynamically based on ongoing monitoring.