Try a sample question
This is an original sample question written by itmoshi based on the exam objectives.
In an EC2-based ordering system, the web tier sends each order synchronously to the processing tier's API. During a sale, traffic spiked, the processing tier could not keep up, and orders that timed out were lost. The requirements are that accepted orders must not be lost during sale spikes and that the web and processing tiers can scale independently. Any backlog that builds up during a spike is expected to clear within a few hours. Which design is most appropriate?
- AHave the web tier send orders to an Amazon SQS queue, and have a processing-tier Auto Scaling group consume them, scaling on the number of messages in the queue
- BMove the processing tier to a larger instance type and manually add instances before each sale
- CPut an Application Load Balancer in front of the processing tier to spread the web tier's synchronous calls across instances
- DHave the web tier publish orders to an Amazon SNS topic, with the processing tier's HTTP endpoint subscribed
Show answer and explanation
Answer:A Putting a queue (SQS) between the tiers makes the flow asynchronous, absorbs spikes and lets each tier scale independently.
Why it is correct
With an SQS queue in between, the web tier can confirm an order as soon as it is successfully enqueued, without waiting on the processing tier. Anything that cannot be processed yet stays in the queue as a message (retention defaults to 4 days and can be up to 14, so a backlog of a few hours fits easily), and the processing tier deletes each message only after processing it successfully. The processing tier can scale in and out with Auto Scaling based on queue depth (for example, ApproximateNumberOfMessagesVisible). The tiers become loosely coupled, which satisfies both "no lost orders during spikes" and "scale independently".
The other options
- ✗ B Scaling up or adding instances manually keeps the calls synchronous, so an unexpected spike still causes timeouts and lost orders. It is an option when load is predictable and you want more capacity without changing the architecture.
- ✗ C An ALB only spreads load; it cannot hold requests that exceed the processing tier's total capacity, so synchronous timeouts still happen. Use it in front of web servers or APIs that must respond synchronously.
- ✗ D SNS pushes messages to subscribers and does not act as a buffer the processing tier can pull from at its own pace. Delivery to an HTTP endpoint fails once retries are exhausted, so orders can still be lost. Use SNS to fan out one event to multiple destinations.
Key takeaway
Absorb spikes and process later, decouple tiers → SQS (pull-based queue). Deliver one event to many destinations → SNS (push-based). SNS and SQS can also be combined to get both fan-out and buffering.
Try 100 questions like this for free
itmoshi is an unofficial study service and is not affiliated with AWS or any exam provider.