QuestionQ99

Designing scalable, available, and reliable cloud-native applications

You recently developed an application that monitors a large number of stock prices. You need to configure Pub/Sub to receive a high volume of messages and update the current stock price in one large in-memory database. A downstream service requires the most up-to-date prices in the in-memory database to perform stock-trading transactions. Each message contains three pieces of information:

  • Stock symbol
  • Stock price
  • Timestamp for the update

How should you configure your Pub/Sub subscription?

  • A Create a pull subscription with exactly-once delivery enabled.
  • B Create a push subscription with both ordering and exactly-once delivery turned off.
  • C Create a push subscription with exactly-once delivery enabled.
  • D Create a pull subscription with both ordering and exactly-once delivery turned off.
Explanation

A pull subscription supports high-throughput, batched, massively parallel consumption. The timestamp allows the in-memory database to accept only a price update newer than the currently stored timestamp for that stock symbol, so duplicate or late messages cannot replace the latest price. Ordering and exactly-once delivery are therefore unnecessary; both add coordination that can increase latency and reduce availability.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!