Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
High Performance MongoDB on Storage-Optimized AWS EC2
1. Partner Technical Solutions, MongoDB
Sandeep Parikh
#MongoDBWorld
High Performance MongoDB
on Amazon EC2
Solutions Architect, Amazon Web Services
Kyle Lichtenberg
2. Wait, isn’t there a whitepaper on
this?
• Much has changed since March 2013!
– (and an update is in the works!)
3. New EC2 Instances Types
• I2 released in December 2013
– Next generation High I/O Instance Family
– 4-32 vCPUs
– 30-244 GiB of Memory
– 800-6,400 GB of SSD Storage (up to 315,000+ IOPS)
• R3 released in April 2014
– Next Generation Memory Optimized Instance Family
– 2-32 vCPUs
– 15-244 GiB of Memory
4. Latest Generation Instance
Features
• Enhanced Networking (SR-IOV)
– Improved packet per second (PPS) performance
– Lower inter-instance latencies
– Very low network jitter
• SSDs
– No mechanical seeking!
– Higher I/O than magnetic
• Updated Hardware Architecture
– Ivy Bridge Intel Xeon E5-2670 v2
– Higher sustained memory bandwidth (up to 63,000 MB/s)
7. AWS Block Storage Review
• Amazon Elastic Block Store (“EBS”)
– Network attached
– Durable
– Snapshot backups to S3
• Amazon EBS Provisioned IOPS (“PIOPS”)
– Standard EBS + definable, consistent performance
• Instance Storage (“Ephemeral Storage”)
– Lowest latency
– Included in instance cost
– Volatile!
8. Storage Considerations
EBS EBS PIOPS Instance Store
~100 IOPS Magnetic
3 IOPS/GB General
Purpose (SSD)
Up to 1TB/Volume
Linear performance
increases up to 12
volumes on 8xlarge
instances
Max 36,000
IOPS/Instance
Snapshots!
Up to 30 IOPS/GB
(max 4,000/volume)
Up to 1TB/Volume
Linear performance
increases up to 12
volumes on 8xlarge
instances
Max 48,000
IOPS/Instance
Snapshots!
Up to 365,000
IOPS/instance
Up to 6.4TB
Fewer IOPS on
smaller instance sizes
Max 365,000
IOPS/Instance
No built-in backup
functionality
9. Storage Considerations
• When using EBS
– Use EBS Optimized Instances!
– Use PIOPS for consistent performance
– Use snapshots for backups
• When using Instance Storage
– Replicate! Replicate! Replicate!
– Use a replica with EBS volumes for backups
10. Cost Considerations
All EBS All EBS PIOPS Hybrid Instance
Store
47x 1TB General
Purpose (SSD)
6x r3.2xlarge
(EBS Optimized)
Volumes: $4,700.00
Compute: $3,294.00
Total: $7,994.00/mo
35x 134GB @ 4K
IOPS
6 r3.2xlarge
(EBS Optimized)
Volumes: $586.25
EBS IOPS: $9,100.00
Compute: $3,294.00
Total: $12,394.25/mo
4x 800GB SSD
2x i2.2xlarge
4x 1TB General
Purpose (SSD)
1x i2.2xlarge
(EBS Optimized)
Volumes: $400.00
Compute: $3780.78
Total: $4,180.78/mo
Assuming a performance target of 140,000 IOPS:
All costs are estimations and are based on published pricing as of 6/18/2014.
11. Cost is an important performance
metric!
• Reserved Instances
– Pricing model designed for steady state workloads
– Pay a small upfront fee for a reduced hourly rate
– Light, Medium, and Heavy utilization
– 1 and 3 year terms
12. Pricing Models
Hybrid Instance
Store
4x 800GB SSD
2x i2.2xlarge
4x 1TB General SSD
1x i2.2xlarge
(EBS Optimized)
Volumes: $400.00
• On-Demand
– One-time fee: $0.00
– Monthly Cost: $4,180.78
– Annual Cost: $50,169.36
• 1 YR Heavy Reserved
– One-time fee: $10,920
– Monthly Cost: $1,119.58
– Annual Cost: $13,434.96 ($24,354.96)
• 3 YR Heavy Reserved
– One-time fee: $16,440.00
– Monthly Cost: $965.86
– Annual Cost: $11,590.32 ($17,070.32)
All costs are estimations and are based on published pricing as of 6/18/2014.
13. Functional Deployment Patterns
• Proper instance type and storage selections play a
huge part in price and performance.
• Not all storage architectures are created equal, but
neither are all environments!
15. Instance Storage
Ephemeral
Set number of volumes
per instance
RAID with LVM
Snapshots via LVM
EBS Volumes
Persistent
Multiple volumes per
instance
RAID with LVM or MD
Snapshots
MongoDB Storage Considerations
16. Storage Differences
PIOPS EBS Instance SSDs
Highest durability Highest performance
Requires EBS-optimized instances Available on new generation
instances
Higher price per IOP Included in instance pricing
21. Deployment Strategies: Hybrid
Mixed SSD/EBS deployment
Secondary
with PIOPS
EBS
Powerful, high-bandwidth
instance
Aggregate
multiple
volumes for
max IOPS
ex. r3.8xlarge
with 12
PIOPS EBS
volumes
Key is
avoiding
replication
lag
Monitor with
MMS
General instance features that are relevant to the MongoDB crowd.
From a single option to many!
Talk through network differences.
Even more choices!
Network interface is why the 8xl’s stay together.
Review of storage flavors to make sure there are not confused customers in the crowd.
Push that EBS is a network based service and will be limited by interface size and type.
This is only one dimension to consider! (I know, but time is short, and this is a big one.) Extreme example to hammer in the importance of understanding your storage!
EBS Optimized can handle about 24K IOPS
8 drives at 3K IOPS for standard. This will saturate the EBS Optimized instanes.
6 drives at 4K IOPS will saturate the EBS Optimized instance. Still need 6 of them.
4 1TB General SSDs will catch the data for backup.on a low priority replica. This is the general architecture recommended in the whitepaper.
Calc is wrong right now. 35% IOP reduction