Your company ingests millions of events per second into a Pub/Sub topic. The downstream consumer must process events with minimal latency and high throughput. However, the consumer occasionally falls behind during traffic spikes, and you need to ensure no data loss while minimizing costs. Which subscription type and configuration should you choose?
Trap 1: Push subscription with a load balancer
Push subscriptions have a fixed rate limit and cannot scale to handle millions of events per second effectively.
Trap 2: Push subscription with endpoint on Cloud Run
Push subscriptions are not designed for high throughput (millions of events/sec) and can cause backlogs.
Trap 3: Pull subscription with exactly-once delivery disabled
Disabling exactly-once delivery may lead to duplicates; but even with exactly-once, pull is still the correct choice for throughput.
- A
Push subscription with a load balancer
Why wrong: Push subscriptions have a fixed rate limit and cannot scale to handle millions of events per second effectively.
- B
Pull subscription with flow control settings
Pull subscriptions allow the subscriber to pull messages at its own pace, and flow control helps prevent overwhelming the consumer. This combination handles high throughput efficiently.
- C
Push subscription with endpoint on Cloud Run
Why wrong: Push subscriptions are not designed for high throughput (millions of events/sec) and can cause backlogs.
- D
Pull subscription with exactly-once delivery disabled
Why wrong: Disabling exactly-once delivery may lead to duplicates; but even with exactly-once, pull is still the correct choice for throughput.