Database Analysis
AWS DocumentDB Comparison Analysis
Updated: April 13, 2025
Current Issues with AWS DocumentDB (Instance-Based Cluster)
- Does not support zero-downtime deployments during bug fixes, increasing code-level management points
- Only shares the MongoDB interface, creating inconvenience of having to monitor both MongoDB and DocumentDB:
- Uncertainty about feature support
- Differences in operational behavior
- Various other inconsistencies
- Performance is significantly worse than MongoDB (partly due to lower specs of current DocumentDB instances, but also underperforms compared to MongoDB at equivalent specs)
- Write operations are slower
- Read operations are slower
- Spring Data MongoDB framework cannot be applied directly, requiring tricky workarounds
- Spring Batch MongoCursorItemReader and MongoPagingItemReader throw exceptions
- Different SSL implementation methods
- Requires DocumentDB GC tuning (DBA domain)
- Unpredictable CPU spikes
Alternative Solutions:
- MongoDB Atlas
- No GC → No "Stop the world" pauses
- WiredTiger engine reuses deleted space efficiently
- EC2 Marketplace
AWS DocumentDB Elastic Cluster
Amazon DocumentDB Elastic Cluster is based on a serverless architecture that automatically scales up and down, with a different maintenance approach than instance-based clusters.
Key considerations:
- Elastic Cluster is managed by AWS to minimize availability impact during maintenance
- Using Elastic Cluster minimizes operational disruptions from regular maintenance
- Official documentation states it doesn't support transactions, but need to verify if this applies to multi-shard transactions or transactions within a single shard
- Supports MongoDB 5.0 version currently in use
- Performance improvements expected with a minimum of 2 shards
- Requires shard key design
Documentation reference:
https://docs.aws.amazon.com/documentdb/latest/developerguide/elastic-best-practices.html#scaling
Solution Comparison Matrix
The table below provides a comprehensive comparison of the different MongoDB deployment options.
Comparison Criteria:
- Full control and custom configuration
- Operational overhead minimization
- Security and compliance
- Global deployment and auto-scaling
- Rapid deployment and development environment
- Cost optimization
Atlas vs EC2 Marketplace Summary
MongoDB Atlas:
✅ Fully-Managed
✅ Automatic scaling
✅ Built-in security
✅ No GC (no "Stop the world" pauses)
❌ Higher cost
❌ Limited customization
EC2 Marketplace:
✅ Complete control
✅ Custom configuration
✅ Potential cost savings
❌ Self-managed operation
❌ Manual security configuration
❌ Manual scaling
DocumentDB Elastic Cluster advantages:
Advantages:
- Serverless architecture
- Automatic scaling
- Minimized maintenance impact
- MongoDB 5.0 support
Limitations:
- Transaction support needs verification
- Requires shard key design
- Minimum 2 shards required
Conclusion and Next Steps
Based on the analysis of the current issues with DocumentDB instance-based clusters and the evaluation of alternatives, two main options emerge as viable solutions to address the existing challenges.
Recommended options:
- AWS DocumentDB Elastic Cluster
- Remains within AWS ecosystem
- Addresses maintenance and scaling issues
- Need to verify transaction support requirements
- Requires shard key design
- MongoDB Atlas
- Best performance and compatibility
- Eliminates GC-related issues
- Spring framework compatibility
- Higher cost structure
Required Actions:
- Evaluate transaction usage in current application to determine compatibility with Elastic Cluster
- Design shard key strategy for both options
- Conduct cost analysis comparing both solutions
- Test performance with representative workloads
Advertisement