When it comes to selecting a database for your application, making assumptions can be costly. A recent experience with migrating a Lambda-based API from DynamoDB to Aurora PostgreSQL highlighted the importance of thorough testing and evaluation. The migration, which seemed smooth in UAT, resulted in a full API outage at 80K RPS due to untested connection behavior.
Understanding the Methodology
A structured simulation comparison was conducted using a pre-deployment canvas to evaluate the performance of DynamoDB and RDS at various RPS levels. The canvas topology included Route 53, CloudFront, API Gateway, Lambda, and either DynamoDB or RDS, along with WAF, SQS, and ElastiCache. RDS Proxy was used to manage connection pools in the RDS configurations.
Key Findings
The study revealed significant differences in performance and cost between DynamoDB and RDS at different RPS levels. At 10K RPS, DynamoDB on-demand was found to be nearly 10 times more expensive than a well-configured RDS instance for sustained traffic. However, at 1M RPS, DynamoDB with provisioned capacity and DAX caching was competitive on cost and superior on latency.
Decision Framework
The study highlights the importance of considering three key factors when selecting a database: access pattern complexity, traffic predictability, and scale trajectory. By evaluating these factors and running simulations at anticipated traffic volumes, developers can make informed decisions about their database selection. Ultimately, the right database choice depends on a thorough understanding of the application's specific needs and requirements.
AI summary
Compare the performance and cost of DynamoDB and RDS at 10K, 100K, and 1M RPS. Learn how to make informed database selection decisions based on access pattern complexity, traffic predictability, and scale trajectory.