Pub/Sub pricing: deliveries, retries, fan-out, and payload transfer (practical estimate)
Pub/Sub estimation is mostly "count the deliveries". The biggest mistakes are underestimating retries and forgetting fan-out: one publish can result in multiple deliveries across subscriptions.
0) What to measure
- Publishes/month: baseline and peak.
- Fan-out: subscriptions per topic (deliveries per publish).
- Attempts: average delivery attempts (retries, redeliveries, replays).
- Payload size: average bytes per message (split large topics separately).
1) Publish volume (baseline and peak)
Start with messages/second (or messages/day) and convert to monthly volume. If traffic is bursty, model peaks separately.
Tool: Rate to monthly volume.
2) Fan-out and delivery attempts (the multiplier)
If a topic has N subscriptions, one publish results in N deliveries. If delivery attempts average 1.2 due to retries, your true deliveries are: publishes x subscriptions x attempts.
- Keep a separate "replay month" scenario if you reprocess history or DLQ messages.
- If you use push delivery, validate HTTP retry/backoff behavior; it can multiply attempts.
3) Payload size and transfer
Payload size matters when you move large messages. Multiply average payload size by deliveries to estimate monthly GB moved. If subscribers are cross-region or external, model egress separately.
Tools: Transfer estimator, Egress cost.
4) Retention, replays, and slow consumers (hidden multipliers)
Retention and replays change the cost shape. If a consumer falls behind, you may see bursts of redelivery, replay jobs, and heavier "catch-up" months that do not look like your steady state.
- DLQ and replay workflows: plan a separate replay month with higher attempts.
- Ordering and exactly-once features can change throughput and retry behavior; validate for your workload.
- Large topic payloads: split them out so a single big producer does not hide inside an average.
Worked estimate template (copy/paste)
- Publishes/month = baseline + peak
- Subscriptions/topic = fan-out
- Avg attempts = 1 + retry factor (include replay months)
- Deliveries/month = publishes x subscriptions x attempts
- GB moved/month = deliveries x avg payload size (split large topics separately)
Common pitfalls
- Counting publishes but not deliveries (fan-out multiplies).
- Ignoring retries and DLQ replays (attempts are the multiplier).
- Assuming all topics have small payloads (split large topics separately).
- Cross-region subscribers creating egress you did not budget.
Validation checklist
- Validate retry rates and DLQ/replay patterns (deliveries, not just publishes).
- Validate fan-out (subscriptions) for each top topic.
- Validate payload size distribution and identify large topics/endpoints.