Cloudflare Queues retry costs: the work your consumer repeats
Queues bill $0.40 per million operations. The real cost of a retry storm is the work your consumer redoes on every attempt.
Cloudflare Queues are cheap: $0.40 per million operations on Workers Paid, after the included usage. A message that fits in one 64 KB chunk is three of them (write, read, delete), and each retry adds a read. A million messages a day is a dollar-ish. Not where your money goes.
Where it goes is the consumer. If the consumer throws, the batch gets retried, and the consumer redoes everything it did before it threw. If that's a Workers AI call, a bunch of D1 writes, or a fetch to a paid API, you pay for it again on every attempt.
What I'd do
- Make the consumer idempotent. Check if the work is already done before doing it.
- Ack messages one at a time with
message.ack(), so one bad message doesn't retry the whole batch. - Set
max_retriesand a dead letter queue, so poison messages land somewhere instead of getting deleted.
workerfuse charges the consumer's CPU to the consumer. Queue operations count against every script bound to the queue, and Workers AI usage against every script with an AI binding. So a retry storm can push the consumer over its limit, and shared bindings can push other Workers over too.