PROFESSIONAL-CLOUD-DEVELOPER · Question #152
You manage an ecommerce application that processes purchases from customers who can subsequently cancel or change those purchases. You discover that order volumes are highly variable and the backend o
The correct answer is C. Use a Pub/Sub subscriber in pull mode and use a data store to manage ordering.. The key requirements are: (1) handle highly variable order volumes without dropping requests, (2) backend can only process one request at a time, and (3) requests must be processed in the sequence they were generated. Cloud Pub/Sub in pull mode is the correct solution. Pub/Sub ac
Question
You manage an ecommerce application that processes purchases from customers who can subsequently cancel or change those purchases. You discover that order volumes are highly variable and the backend order-processing system can only process one request at a time. You want to ensure seamless performance for customers regardless of usage volume. It is crucial that customers' order update requests are performed in the sequence in which they were generated. What should you do?
Options
- ASend the purchase and change requests over WebSockets to the backend.
- BSend the purchase and change requests as REST requests to the backend.
- CUse a Pub/Sub subscriber in pull mode and use a data store to manage ordering.
- DUse a Pub/Sub subscriber in push mode and use a data store to manage ordering.
How the community answered
(46 responses)- A11% (5)
- B2% (1)
- C80% (37)
- D7% (3)
Explanation
The key requirements are: (1) handle highly variable order volumes without dropping requests, (2) backend can only process one request at a time, and (3) requests must be processed in the sequence they were generated. Cloud Pub/Sub in pull mode is the correct solution. Pub/Sub acts as a durable, scalable message queue that absorbs traffic spikes - messages are buffered in the queue regardless of backend capacity. Pull mode allows the backend to fetch one message at a time at its own pace, preventing overload. A data store is used alongside Pub/Sub to persist ordering information, since Pub/Sub does not natively guarantee strict message ordering across all scenarios (though ordered delivery can be configured). Option D (push mode) has Pub/Sub push messages to the backend endpoint as fast as they arrive, which would overwhelm a backend that can only handle one request at a time. Options A (WebSockets) and B (REST) send requests directly to the backend with no buffering mechanism for traffic spikes, causing failures under high load.
Topics
Community Discussion
No community discussion yet for this question.