PROFESSIONAL-CLOUD-DEVELOPER · Question #111
You need to redesign the ingestion of audit events from your authentication service to allow it to handle a large increase in traffic. Currently, the audit service and the authentication system run in
The correct answer is A. Create one Pub/Sub topic. Create one pull subscription to allow the audit services to share the. Creating one Pub/Sub topic with a single shared pull subscription is the correct pattern for load-balanced message consumption (the competing consumers pattern). When multiple audit service instances share a single subscription, Pub/Sub distributes messages across them - each mes
Question
You need to redesign the ingestion of audit events from your authentication service to allow it to handle a large increase in traffic. Currently, the audit service and the authentication system run in the same Compute Engine virtual machine. You plan to use the following Google Cloud tools in the new architecture:
- Multiple Compute Engine machines, each running an instance of the
authentication service
- Multiple Compute Engine machines, each running an instance of the
audit service
- Pub/Sub to send the events from the authentication services.
How should you set up the topics and subscriptions to ensure that the system can handle a large volume of messages and can scale efficiently?
Options
- ACreate one Pub/Sub topic. Create one pull subscription to allow the audit services to share the
- BCreate one Pub/Sub topic. Create one pull subscription per audit service instance to allow the
- CCreate one Pub/Sub topic. Create one push subscription with the endpoint pointing to a load
- DCreate one Pub/Sub topic per authentication service. Create one pull subscription per topic to be
- ECreate one Pub/Sub topic per authentication service. Create one push subscription per topic, with
How the community answered
(22 responses)- A77% (17)
- B14% (3)
- D5% (1)
- E5% (1)
Explanation
Creating one Pub/Sub topic with a single shared pull subscription is the correct pattern for load-balanced message consumption (the competing consumers pattern). When multiple audit service instances share a single subscription, Pub/Sub distributes messages across them - each message is delivered to exactly one subscriber. This scales efficiently: add more audit service instances and throughput increases automatically. Choice B (one pull subscription per audit instance) is a fan-out pattern - each instance would receive every message, causing duplicate processing. Choice C (push to a load balancer) can work but adds infrastructure complexity unnecessarily when pull-based competing consumers is simpler. Choices D and E (one topic per auth service) unnecessarily fragment the topic and complicate subscription management.
Topics
Community Discussion
No community discussion yet for this question.