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
MongoDB Atlas vs EC2 Marketplace MongoDB Atlas EC2 Marketplace ✅ Fully-Managed Service ✅ One-click Scaling & Global Distribution ✅ Built-in Security & Compliance ❌ Higher Cost ❌ Self-managed Operation ❌ Manual Scaling & Deployment ❌ Custom Security Configuration ✅ Cost Optimization Potential Limited Customization Complete Control Both solutions require shard key design consideration

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
Solution Recommendations DocumentDB Instance DocumentDB Elastic MongoDB Atlas Current Solution No Zero-downtime Deployment Performance Issues Spring Integration Problems GC Tuning Required Unpredictable CPU Spikes Serverless Architecture Automatic Scaling Minimal Maintenance Impact Transaction Support (Verify) Requires Shard Key Design Fully-Managed Service No GC (No "Stop the world") One-click Global Deployment Spring Framework Compatible Higher Cost Recommended Options: DocumentDB Elastic or MongoDB Atlas

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