Google Cloud Associate Cloud Engineer — Question 260
Your team is building a website that handles votes from a large user population. The incoming votes will arrive at various rates. You want to optimize the storage and processing of the votes. What should you do?
Answer options
- A. Save the incoming votes to Firestore. Use Cloud Scheduler to trigger a Cloud Functions instance to periodically process the votes.
- B. Use a dedicated instance to process the incoming votes. Send the votes directly to this instance.
- C. Save the incoming votes to a JSON file on Cloud Storage. Process the votes in a batch at the end of the day.
- D. Save the incoming votes to Pub/Sub. Use the Pub/Sub topic to trigger a Cloud Functions instance to process the votes.
Correct answer: D
Explanation
The correct answer is D because using Pub/Sub allows for scalable, asynchronous processing of incoming votes, which is ideal for varying rates of incoming data. Option A is less efficient as it relies on scheduled processing, which may not handle real-time needs well. Option B does not utilize the benefits of cloud scalability, and option C introduces delays by processing votes only at the end of the day, which is not optimal for timely voting results.