A local events ticketing company is designing a booking system on AWS. The system receives booking confirmations that must be written to a database. The booking requests are highly spiky, reaching up to writes per second during the first minutes of a popular event launch. For the rest of the week, the booking rate is less than writes per second. The booking confirmations do not need to be processed in real-time but must be saved reliably within a few hours. The company wants to design a cost-optimized database tier. Which database design and capacity configuration is the most cost-effective?
- Deploy an Amazon SQS queue to buffer the incoming booking requests. Implement a fleet of consumer instances to retrieve the messages and write them to a smaller Amazon RDS database with General Purpose SSD (gp3) storage configured for the average write rate.Answer
- BConfigure an Amazon DynamoDB table in Provisioned capacity mode with Auto Scaling enabled, sizing the baseline capacity to write capacity units (WCUs) and the maximum capacity to WCUs.
- CDeploy an Amazon RDS for PostgreSQL database in a Multi-AZ configuration. Create three Read Replicas in different Availability Zones, and configure the application to distribute the write load across the standby instance and the Read Replicas during peak events.
- DDeploy an Amazon RDS for PostgreSQL database sized to handle the peak write load of writes per second, and purchase a Compute Savings Plan to reduce the hourly database instance costs.
Answer
Deploying an Amazon SQS queue to buffer incoming booking requests and writing them to a smaller Amazon RDS database with gp3 storage configured for the average write rate.
Decoupling the database write workload using an Amazon SQS queue allows the application to ingest the peak traffic ( writes per second) immediately without throttling. The messages can then be processed asynchronously over a longer period, enabling the Amazon RDS database instance and its General Purpose SSD (gp3) storage to be provisioned for the average throughput (closer to the writes per second baseline) rather than the peak, resulting in significant cost savings.
Step-by-Step Solution
Key Concept
Decoupling database writes with SQS to optimize database instance sizing and storage costs.
Estimated Time:2m 0s