Topic 1 Question 271
You recently developed an application that monitors a large number of stock prices. You need to configure Pub/Sub to receive messages and update the current stock price in an in-memory database. A downstream service needs the most up-to-date prices in the in-memory database to perform stock trading transactions. Each message contains three pieces or information:
• Stock symbol • Stock price • Timestamp for the update
How should you set up your Pub/Sub subscription?
Create a push subscription with exactly-once delivery enabled.
Create a pull subscription with both ordering and exactly-once delivery turned off.
Create a pull subscription with ordering enabled, using the stock symbol as the ordering key.
Create a push subscription with both ordering and exactly-once delivery turned off.
ユーザの投票
コメント(2)
A is correct (I am not a contributor, so unable to vote). Rationale:
The downstream application needs only the most up-to-date value for a stock price. There's no need of historical values from a time series, so "ordering" does not make any sense in this scenario. This eliminates alternatives B, C and D. In addition, in alternative C, "using the stock symbol as the ordering key" has no practical effect, once "ordering" is not necessary.
About "push" and "pull": in a "push" subscription, whenever the topic is fed with a new value, it will keep pushing it to the application until an acknowledgement is received. Latency is lower in this case. In a "pull" subscription, there's an additional burden on the application to keep pulling from the topic. This increases latency. A "push" subscription is recommended in such scenarios.
👍 2pbrvgl2023/12/03- 正解だと思う選択肢: C
Pull Subscription for Controlled Processing: A pull subscription gives you control over when and how messages are processed. This can be particularly important for maintaining the integrity of the in-memory database, as it allows for more deliberate handling of message backlogs and peak loads.
Message Ordering Is Crucial: The ordering of stock price updates is critical. Using the stock symbol as the ordering key ensures that updates for a specific stock are processed in the order they were sent. This is vital to ensure the accuracy of stock price data, as prices must be updated in the sequence they were received to reflect the true market conditions.
No Need for Exactly-Once Delivery: In most financial data scenarios, the latest data supersedes the old. If a message is delivered more than once, the last update for a given timestamp will leave the database in the correct state. Therefore, exactly-once delivery, which can add complexity and overhead, might not be necessary.
👍 1vspringe2023/11/13
シャッフルモード