CompTIA Cloud+ (CV0-004)TroubleshootingMedium
A cloud architect is designing a new highly available web application. During a load test, the database tier, consisting of a managed relational database service, experiences significant read replica lag and occasional primary instance connection timeouts, despite having ample CPU and memory resources. The application is write-heavy. What is the MOST effective strategy to mitigate these performance issues?
- AImplement database connection pooling on the application servers.
- BOptimizing SQL queries to reduce their execution time.
- CIncrease the network bandwidth provisioned for the database instances.
- DSharding the database to distribute the write workload.
Show answer & explanationAnswer & explanation
Correct answer: D. Sharding the database to distribute the write workload.
Given a write-heavy application causing read replica lag and primary connection timeouts, the database is likely overwhelmed by writes. Sharding distributes the write workload across multiple database instances, directly addressing the bottleneck caused by write contention.
Why the other options are wrong
- A. Connection pooling helps manage connections more efficiently, reducing overhead and improving application responsiveness, but it does not directly address underlying database write contention or replica lag caused by high write volume.
- B. Optimizing SQL queries is always good practice, but if the issue is high *write volume* causing contention and replica lag, optimizing individual query execution might not be sufficient to address the overall write throughput limitations.
- C. While network bandwidth can be a factor, `read replica lag` and `connection timeouts` on a write-heavy application, especially with sufficient CPU/memory, points more to I/O contention or write throughput limits rather than just network capacity.
Database Sharding
A type of horizontal partitioning that divides a large database into smaller, more manageable parts called 'shards', which are spread across multiple database servers to distribute workload and improve scalability.
- Distributes data and workload across multiple database instances.
- Primarily used to scale write-heavy applications.
- Reduces I/O contention and improves overall database performance.
Memory trick: To write more, slice the cake into smaller, shareable pieces.