Learn tips and techniques that will improve the performance of your applications and databases running on Amazon EC2 instance storage and/or Amazon Elastic Block Store (EBS). This advanced session discusses when to use HI1, HS1, and Amazon EBS. We will share an "under the hood" view to tune the performance of your Elastic Block Store and best practices for running workloads on Amazon EBS, such as relational databases (MySQL, Oracle, SQL Server, postgres) and NoSQL data stores, such as MongoDB and Riak.
4. What is Amazon EBS?
• Network block storage
• Designed for five nines of availability
• Attach to EC2 within the same AZ
• Point-in-time snapshots to S3
• Provision and pay just for what you need
5. EBS Volume Types
• General Purpose (SSD)
• Provisioned IOPS (SSD)
• Magnetic
When performance matters, use SSD-backed volumes
6. Amazon EBS General Purpose(SSD)
• New default volume type for EBS
• Every volume can burst up to 3,000 IOPS
• Larger volumes can burst for longer periods
• 3 IOPS per GB baseline performance
• Maximum of 3,000 on a 1TB volume
• Throughput bursts up to 128MB/s per volume
• 99% performance consistency
• Latency: Single digit milliseconds
7. Sizing General Purpose (SSD)
• For generic boot, developer, test/dev and web apps
– Just provision GB’s required for your applications
• For database apps
– Calculate your required IOPS needed in steady state
– Provision the GB = (Steady state IOPS) ÷ 3
• For example, customer requiring1500 steady state IOPS, provision 1500
÷ 3 = 500 GB
– IO bursts will support
• Database load or table scan operations
• Spike in IO workload
7
8. Amazon EBS PIOPS (SSD)
• Provision up to 4,000 IOPS per volume
• Supports IOPS to GB ratio of 30
• Designed to offers 99.9% consistency
• Throughput: up to 128MB/s per volume
• Latency: Single digit millisecond
• Best for IO intensive databases that require highest consistency
NEW
9. Amazon EBS Magnetic
• IOPS: ~100 IOPS steady-state, with best-effort bursts
• Throughput: variable by workload, best effort to 10s of MB/s.
• Latency: Varies, reads typically ~20-40 ms, writes typically ~2-10ms
• Best for cold workloads
10. EBS Volume Types (Cheat Sheet)
General Purpose (SSD) Provisioned IOPS (SSD) Magnetic
Recommend Use Cases
Boot Volumes
Small to Med DBs
Dev and test
I/O intensive
Large DBs
Cold Storage
Storage Media SSD-backed SSD-backed Magnetic-backed
Volume Size 1GB- 1TB 1GB- 1TB 1GB- 1TB
Max IOPS per volume
3 IOPS/GB Burst up to 3000
IOPS
4,000 IOPS ~100 IOPS
Read and Write Peak
Throughput
128 MB/s 128 MB/s ~50-90 MBps
Max I/O per node 48,000 48,000 ~ 1000-5000
Peak Throughput Node 800 MB/s 800 MB/s ~800MB/s
Latency (random read) 1-2ms 1-2 ms 20-40 ms
API Name gp2 io1 standard
Price* $.10/GB-Month
$.125/GB-Month
$.065/provisioned IOPS
$.05/GB-Month $.05/ 1M
I/O
18. 3. Workload
• I/O size
– 4 KB to 64 MB
• I/O pattern
– Sequential and random
EBS SSD-backed volumes measure IO size up to 256KB
EBS SSD-backed delivers same performance for read and write
• I/O type
– Read and write
• I/O concurrency
– Number of concurrent IO
NEW
19. IOPS and Throughput limits on EBS
4,000 IOPS
PIOPS volume
4,000 IOPS
128MB/s throughput
You can achieve 4,000 IOPS
when driving smaller IO
You can achieve up to 128MB/s
when driving larger IO
20. IOPS and Throughput limits on EBS
4,000 IOPS
PIOPS volume
4,000 IOPS
128MB/s throughput
4,000 X 4KB = 16MB/s
4,000 X 32KB =128MB/s
8,000 x 8KB = 64MB/s
4,000 x 8KB = 32MB/s
2,000 x 128KB=256MB/s
1,000 x 128KB =128MB/s
21. Block (IO) size determines whether your application is IOPS bound or
throughput bound
22. 4. Queue Depth
An I/O
Amazon
EBS
After it’s gone, it’s gone
Amazon
EC2
Queue depth is the pending IO in flight.
23. IO Latency
• Elapsed time between IO submission and it’s completion
time
• Performance requirements may be driven by IOPS or
latency or both
• There is an interdependency among IOPS, queue depth,
and latency
31. Maximum performance per instance
• How should you think about taking snapshots on a striped volume?
– Quiesce file systems and take snapshot
– Unmount file system and take snapshot
– Use OS-specific tools
12×400 GB PIOPS, pre-warmed, RAID 0 LVM, Stripe size 64 KB, attached to CR1 instance
33. 6. Pre-warming
• First write penalty for new volumes
• Lazy loading for volumes created from snapshots
• Typically 5%, extreme worst case of 50% performance reduction in IOPS and
latency when volumes are used without pre-warming
– Performance is as provisioned when all the chunks are accessed
• Recommendation if testing or you have spare setup time:
– For new volumes
• Linux: DD write
• Windows: NTFS Full format
– Takes roughly an hour to pre-warm 1 TB 4 KB PIOPS/General Purpose (SSD) volumes
– Be warned, can take up to a day for a 1 TB standard Amazon EBS volume
34. Use large block size to speed up your pre-warming.
Ex: sudo dd if=/dev/xvdf of=/dev/xvdf conv=notrunc bs=1M
35. Performance / Stability Tips
• Ext4 or XFS (understand journal impact!)
• EBS encryption has no visible IOPS
performance impact for many EC2 instances