Google Cloud · Comparison
Pub/Sub vs Cloud Tasks vs Eventarc
How should services on Google Cloud send work and events to each other asynchronously?
Decision summary
Use Pub/Sub when one event should reach many independent consumers or when you stream data at high throughput. Use Cloud Tasks when a producer wants a specific endpoint called later, at a controlled rate, with retries and optional scheduling. Use Eventarc when you want to react to events from Google Cloud services (a new object, an audit-logged API call) or route Pub/Sub events to Cloud Run with filters.
Best fit for each option
Side by side
| Pub/Sub | Cloud Tasks | Eventarc | |
|---|---|---|---|
| Best for | One-to-many messaging | One-to-one controlled delivery | Event routing from services |
| Scaling | Very high throughput, global | Per-queue dispatch rate limits | Scales with event sources |
| Operational complexity | Topics and subscriptions; idempotent consumers | Queues with rate and retry settings | Triggers with filters |
| Availability | At-least-once delivery, retention and replay | Retries with backoff | Delivery through Pub/Sub with retries |
When to avoid each option
Pub/Sub
- Strict per-endpoint rate limiting or scheduled delivery of individual tasks.
Cloud Tasks
- Broadcasting one event to many consumers.
Eventarc
- High-throughput messaging between your own services, where Pub/Sub directly is simpler.
Example scenarios
| Situation | Choose | Why |
|---|---|---|
| An order event must reach billing, email and analytics | Pub/Sub | Each consumer gets its own subscription. |
| Send emails through a provider limited to 50 requests per second | Cloud Tasks | Queue rate limits protect the provider. |
| Generate a thumbnail when an image is uploaded | Eventarc | A Cloud Storage event triggers a Cloud Run service. |
Exam cues
- Decouple and fan out: Pub/Sub. Rate-limited calls to an endpoint: Cloud Tasks.
- React to Cloud Storage or audit-log events: Eventarc.
Service pages
Related
Services, comparisons and patterns
- Pub/Sub · Service
- Eventarc · Service
- Cloud Run · Service
- Cloud Run functions · Service
- Event-driven order processing · Solution pattern
- Event-driven architecture · Architecture style
Sources
Independent study material, not affiliated with or endorsed by Amazon Web Services.