What is an ack timeout, and what goes wrong if it is set too short or too long?
Sketch your own answer first, then compare it with the one below.
A strong answer
It is the time the broker waits for an acknowledgement before it assumes the consumer failed and hands the message to another one. Some brokers call it a visibility timeout.
Too short, and a slow but healthy consumer has its message redelivered while it is still working, so the work is done twice. Too long, and when a consumer really dies its messages sit unclaimed for that whole time.
Set it from the slowest normal processing time plus margin. Some brokers let a consumer extend the timeout while work continues, which avoids one long fixed value.
Sources
- Amazon Web Services documentation (2024). Amazon SQS visibility timeout.
- RabbitMQ documentation (2024). Consumer acknowledgements and publisher confirms.