+ All Categories
Home > Technology > Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Date post: 03-Mar-2017
Category:
Upload: amazon-web-services
View: 226 times
Download: 2 times
Share this document with a friend
33
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Vivek R – AWS Solutions Architect Ricky Chang – AWS Professional Services February 23, 2017 Optimize MySQL Workloads with Amazon Elastic Block Store
Transcript
Page 1: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Vivek R – AWS Solutions ArchitectRicky Chang – AWS Professional Services

February 23, 2017

Optimize MySQL Workloads with Amazon Elastic Block Store

Page 2: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Agenda

• MySQL Deployment Options on AWS• Why use Elastic Block Store (EBS)?• Optimizing MySQL with EBS• Testing for Performance• Best Practices

Page 3: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

MySQL Deployment Options

Page 4: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

RDS and MySQL on EC2

MySQL on EC2 instance

• Flexible• Deployment Options

- Infrastructure- Storage

• Access to the OS• MySQL plugins support

RDS for MySQL

• No Infrastructure Management• Instant provisioning• Application Compatibility• HA and Read Replica• Managed Patching, Maintenance, Backup and Restore

Page 5: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Why Storage?

Page 6: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Durability and Monitoring

MonitoringCloudWatch

• 5 min or 1 min polling interval• Setup alarms and actions• Integrate with MySQL Monitoring

Tools

Durability• Data Persistence vs. Instance

Store• Decouple Storage from Compute• Redundancy within the AZ

Page 7: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Provisioned IOPS SSDHighest Performance

Volume Size: 4 GiB to 16 TiBMax IOPS/Volume: 20,000Max Throughput/Volume: 320 MiB/s

General Purpose SSDPrice and Performance

Volume Size: 1 GiB to 16 TiBMax IOPS/Volume: 10,000Max Throughput/Volume: 160 MiB/s

Primer - Storage Options

Page 8: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Snapshots and Security

Security• IAM Resource Level Permissions• Data at Rest Encryption

Snapshots• Entire MySQL Database Backup• Scheduled snapshots using

CloudWatch Events• Use for DR, Storage Resize,

Sharing Environment

Page 9: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Elastic Volumesaws ec2 modify-volume --region us-east-1 --volume-id vol-11111111111111111 --size 200 --volume-type io1 --iops 10000{ "VolumeModification": { "TargetSize": 200, "TargetVolumeType": "io1", "ModificationState": "modifying", "VolumeId": "vol-11111111111111111", "TargetIops": 10000, "StartTime": "2017-01-19T22:21:02.959Z", "Progress": 0, "OriginalVolumeType": "gp2", "OriginalIops": 300, "OriginalSize": 100 }}

Elastic Volumes• Ease of Administration• Change while online

• Change Volume Type• Change Provisioned

IOPS• Increase volume size

Page 10: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Optimization

Page 11: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

© 2016, Amazon Web Services, Inc. or its Affiliates. | Amazon Confidential

Making the most out of (GP2)

Max I/O credit per bucket is 5.4M

You can spend up to 3000 IOPS per second

Baseline performance = 3 IOPS per GiB or 100 IOPS

Always accumulating3 IOPS per GiB per second

gp2

Page 12: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

© 2016, Amazon Web Services, Inc. or its Affiliates. | Amazon Confidential

Burst & Baseline: General Purpose SSD (GP2)IO

PS

0 1 16

1,000

2,000

3,000

8,000

10,000

BASELINE IOPS(Baseline of 3 IOPS/GiB)

Burstable to 3,000 IOPS

3 90.5

Volume Size (TiB)

~ 3334 GB

Page 13: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

© 2016, Amazon Web Services, Inc. or its Affiliates. | Amazon Confidential

Time to Deplete a Full GP2 Credit Bucket

1 8 30 100 150 200 250 300 350 400 450 500 550 600 650 700 750 800 850 900 9500

100

200

300

400

500

600

700

Volume Size in GiB

Min

utes

of B

urst

43 Min 1 Hour

10 Hours

Page 14: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Monitor your Burst usage

Typically, Burst IOPS are consumed by: Performing MySQL Backups Restarting MySQL or EC2 Large import and export of MySQL data Additional traffic to the MySQL database

coming from the application

Page 15: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Making the most out of io1

EBS Optimized Instances• Dedicated Bandwidth to EBS 500 Mbps to 12,000 Mbps• Increase Throughput and IOPS

Page 16: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Making the most out of Replication

Page 17: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Need more IOPS and Throughput?

RAID 0 - Considerations• Use EBS optimized instance• Fault tolerance, MySQL Slave• Use the same EBS volume typeand size• Ensure all volumes are quiescedwhen performing EBS snapshots

Page 18: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Caching and Writes

Page 19: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

MySQL ConfigurationParameters  Default Tuned* Description

innodb_buffer_pool_size 128MB 70-80% % of Memory or large enough for “Hot” data set

innodb_flush_neighbors 1 0 Spreads write operations over your EBS volumes

innodb_log_file_size 50MB * Large enough to spread-out the checkpoint flush activity

* Based on your write workloads

Page 20: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

MySQL Master/Slave

Page 21: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Switching from a Physical Server to EC2

sync_binlog

sync_master_info

sync_relay_log

sync_relay_log_info

Page 22: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Improve IO and Throughput

• Separate the logs and data files into different EBS volumes

• Use io1 for bin and relay logs

• RAID 0 – Stripe EBS Volumes

• Extreme cases – use local SSD for Slave or read replica

Page 23: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Backup Server as target

Page 24: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

EFS and S3 as Target

Page 25: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

EBS Snapshots – best practices

1. Quiesce data before taking snapshotsflush tables with read locksync and fsfreeze

2. Warm up data during the restoreParallel dd, fio, robocopyScan largest table

3. Automate and Manage Snapshotshttp://docs.aws.amazon.com/AmazonCloudWatch/latest/events/TakeScheduledSnapshot.htmlhttps://github.com/awslabs/aws-ebs-custodian

Page 26: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Performance Testing

Page 27: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Latency

• Check for available IOPS

• Verify burst credits for gp2

• Watch out for high disk queue length

Page 28: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

ThroughputIssues:• Database replication• Backup and Restore• Import/Export• Index Creation

Increase Throughput by:• RAID 0• Amazon Provisioned IOPS SSD

320 MiB/s• EBS Optimized Instance

Page 29: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Benchmarking Tools• Tools from MySQL such as

MySQL Enterprise Monitor MySQL Workbench Performance MySQL Query Analyzer

• MySQL Monitoring tools at the AWS Marketplace

• Amazon CloudWatch

• MySQL performance Schema

Page 30: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Demo

Page 31: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Best Practices

Page 32: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Best Practices

• Evaluate use case for Amazon RDS or MySQL on EC2• Monitor burst metrics for gp2• Use EBS optimized EC2 instances for io1• Use EC2 placement groups for replication• Test your MySQL workloads• Verify MySQL parameters• Monitor service limits

Page 33: Optimize MySQL Workloads with Amazon Elastic Block Store - February 2017 AWS Online Tech Talks

Thank you!


Recommended