
Answer-first summary for fast verification
Answer: Use a Pub/Sub subscriber in pull mode and use a data store to manage ordering.
The backend can only process one request at a time, and order sequencing is critical. Using Google Pub/Sub decouples the frontend from the backend, handling variable loads. However, Pub/Sub alone does not guarantee strict message ordering. A pull subscriber (C) allows the backend to control the processing rate, ensuring one message is handled at a time. The data store is used to enforce the sequence of requests (e.g., by tracking timestamps or sequence numbers), ensuring they are processed in the correct order even if messages are delivered out of sequence. Push mode (D) risks overwhelming the backend with concurrent requests, while REST (B) or WebSockets (A) lack built-in queuing and ordering mechanisms.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You manage an ecommerce application where customers can place, cancel, or modify orders. The backend order-processing system handles only one request at a time, and order volumes fluctuate significantly. To maintain seamless performance and ensure customer order update requests are executed in the exact sequence they were received, what solution should you implement?
A
Send the purchase and change requests over WebSockets to the backend.
B
Send the purchase and change requests as REST requests to the backend.
C
Use a Pub/Sub subscriber in pull mode and use a data store to manage ordering.
D
Use a Pub/Sub subscriber in push mode and use a data store to manage ordering.
No comments yet.