SlideShare a Scribd company logo
1 of 55
aws.amazon.com/webinars/apac/webinar-week | #AWSWebinarWeek
AWS MySQL Relational Database Service
Best Practices for Performance and Scale
Ganesh Raja,
Solutions Architect
Amazon Web Services Pty Ltd.
v
What’s
v
Selected Amazon RDS Customers
v
Why choose Amazon RDS?
• Schema design
• Query construction
• Query optimization
High availability
Backup and recovery
Isolation and security
Industry compliance
Push-button scaling
Automated patching
Advanced monitoring
Routine maintenance
Amazon RDS takes care of your time-consuming database management tasks,
freeing you to focus on your applications and business
You
RDS
v
We made it highly available, secure, easier, and cheaper
Push-button provisioning; automated scaling, patching, security, backups, restores,
and general care and feeding
Lower TCO because we manage the muck
► Get more leverage from your teams
► Focus on the things that differentiate you
Built-in high availability and cross-region replication across multiple data centers
Now even a small startup can leverage multiple data centers to design highly available
apps with over 99.95% availability
v
High availability with Multi-AZ deployments
Enterprise-grade fault tolerance solution for production databases
 An Availability Zone is a physically distinct, independent infrastructure
 Your database is synchronously replicated to another AZ in the same AWS region
 Failover occurs automatically for the most important failure scenarios
v
Customers love Multi-AZ
26%
40%
25%
30%
35%
40%
45%
Oct-12 Jan-13 Apr-13 Jul-13 Oct-13 Jan-14 Apr-14 Jul-14 Oct-14
Multi-AZ instances as a share of all
RDS instances
v
Choose cross-region read replicas for faster disaster
recovery and enhanced data locality
• Promote a read replica to a master
for faster recovery in the event of
disaster
• Bring data close to your customer’s
applications in different regions
• Promote to a master for easy
migration
v
Choose cross-region snapshot copy for even
greater durability, ease of migration
• Copy a database snapshot to a different AWS region
• Warm standby for disaster recovery
• Or use it as a base for migration to a different region
v
Database migration to AWS with minimal
downtime
v
Importing from an external MySQL source
DB Master
App
Backup
AWS Region
Replication
App
scp Load data
Staging server
DB Slave
v
External MySQL source considerations
• Take backup from a replica/slave
• Compress backups for faster transfer
• Use a staging server on Amazon EC2
• Use primary key sort order where possible
v
Target Amazon RDS instance considerations
• Hardware: More memory + IOPS = faster loading
• Amazon RDS configuration
• Disable Multi-AZ
• Disable binary logging – backup_retention=0
• MySQL configuration
• Set innodb_flush_log_at_trx_commit to 0
• Set auto_commit = 0
• Set unique checks and foreign key checks to 0
• Increase innodb_log_file_size (5.6)
Input format
SQL
Std. mysqldump output
Loads schema/data + Auto on/off
indexes & constraints
SQL execution could be slow
Sequential execution
Need to restart after failures
Smaller databases/tables (few GB)
Flat files
mysqldump –fields_terminated_by
Load schema and data separately + split
large tables
Faster if file sizes are small
Can load files in parallel
Can resume each file (checkpointing)
Larger databases/tables
v
Configure external replication source
mysql> GRANT SELECT,REPLICATION USER,REPLICATION CLIENT ON *.* TO repluser@‘<RDS
Endpoint>' IDENTIFIED BY ‘<password>';
Create replication user on the master
Record the “File” and the “Position” in the backup
$ mysqldump --databases sampledb --master-data=2 --single-transaction
-r sampledbdump.sql -u mysqluser –p mysqluserpassword
--
-- Position to start replication or point-in-time recovery from
--
-- CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin-changelog.000031', MASTER_LOG_POS=107;
v
Configure replication target
mysql> call mysql.rds_set_external_master(‘<master
server>',3306,‘<replicationuser>',‘<password>','mysql-bin-changelog.000031',107,0);
mysql> call mysql.rds_start_replication;
Configure the replication target and start replication
Stop the app pointing at the source. Stop replication after target catches up
mysql> call mysql.rds_stop_replication;
Promote target Amazon RDS database instance
mysql> call mysql.rds_reset_external_master;
Point the app at the target Amazon RDS database instance
v
Exporting data to an external source
AWS Region
App
Dump Data
Staging server
scp & load
MasterSlave
mysql> call mysql.rds_set_configuration('binlog retention hours', 48);
v
Synching to Amazon Redshift
Move data to the same or different database engine
Keep your apps running during the migration
Start your first migration in 10 minutes or less
Replicate within, to, or from Amazon EC2 or RDS
AWS Database
Migration Service
Availability and disaster recovery
Multi-AZ deployments
Physical
synchronous
replication
AZ1 AZ2
DNS
cname update
v
Read Replicas and availability
Sync
replication
Async replication
v
MySQL 5.5 – Replication after failover
• MySQL 5.5 – sync_binlog = 0
• Master crash recovery => starts new bin log
• Slave => still processes position from older bin log
• sync_binlog = 1 => 2 to 4x performance hit
[ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log:
‘Client requested master to start replication from impossible position;
v
MySQL 5.6 – Replication after failover
• sync_binlog = 1 by default
• Bin Log Group Commit improves performance
• Crash safe slaves improve replica reliability
Source: https://blogs.oracle.com/MySQL/entry/mysql_5_6_replication_performance
v
Disaster recovery using Read Replicas
AZ1 AZ2 AZ1
Scale and performance
v
Reads10% Reads10% Reads10% Reads10%
Reads10% Reads10% Reads10% Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Writes10%
Reads10%
Reads
90%
Writes10%
Read to write ratio
Primary
Writes10%
Replica1
Writes10%
Replica2
Writes10%
Replica3
Writes10%
Replica4
1X2X3X SCALE
v
Writes 20% Writes 20% Writes 20% Writes 20%
Reads
80%
Reads 20% Reads 20% Reads 20% Reads 20%
Reads 20%
Writes 20%
Reads 20%
Writes 20%
Reads 20%
Writes 20%
Reads 20%
Writes 20%
Writes 20%
Writes20%
Read to write ratio – More writes
Primary Replica1 Replica2 Replica3 Replica4
1X2X SCALE
50%
40%
30%
20%
10%
1
2
3
4
5
6
7
8
1 2 4 8 16 32
Scale
Scale based on % Write
InnoDB cache warming
4x
Load buffer pool
Dump buffer pool
0
5000
10000
15000
20000
25000
30000
10
30
50
70
90
110
130
150
170
190
210
230
250
270
290
310
330
350
370
390
410
430
450
470
490
510
530
550
570
590
610
630
650
670
690
TransactionsperSecond
Time (sec)
Workload with 50/50 R/W ratio
Unwarmed Cache
Warmed Cache
4X
9 min
To enable InnoDB cache warming…
InnoDB cache warming for unplanned failures
mysql> CREATE EVENT ‘evt_dump_innodb_cache’
ON SCHEDULE EVERY 1 HOUR STARTS ‘2014-11-06 01:00:00’
DO BEGIN
CALL mysql.rds_innodb_buffer_pool_dump_now();
END
Schema changes
Considerations
Ease of use
Performance
Time to complete
Options
Read Replicas
Native 5.6 functionality
Third-party tools like
Percona
Read Only
Replica
Read Replicas
Primary R2MasterR/W
mysql> ALTER TABLE customers_address ADD COLUMN province VARCHAR(100);
v
Native MySQL 5.6 feature
• Easy to use – Available by default
• In-place – No blocked DML in most cases
• Performance impact
• Data reorganization still needed in some cases
• No ability to control/throttle CPU or I/O utilization
• Could increase replica lag
• Time to complete
• Relatively less
pt-online-schema-change
pt-online-schema-change --alter
"ADD COLUMN province
VARCHAR(100)" --execute
h=localhost,D=bench,t=customers
_address,u=admin,p=admin
v
Percona vs. Native 5.6
Qualitative comparison of options
v
Burst mode – GP2 & T2
• GP2 – SSD based Amazon EBS storage
• 3 IOPS per GB base performance
• Earn credits when usage below base
• Burst to 3000+ IOPS
• T2 – Amazon EC2 instance with burst capability
• Base performance + burst
• Earn credits per hour when below base performance
• Can store up to 24 hours worth of credits
• Amazon CloudWatch metrics to see credits & usage
v
Burst mode – GP2 & T2
v
T2 – CPU credits
v
Burst mode vs. Standard vs. Provisioned IOPS
0
1000
2000
3000
4000
5000
6000
7000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
TransactionsperSecond(TPS)
Hours
100% Read - 20GB data
db.m1.medium + 200GB standard
$0.575 per hour
v
0
1000
2000
3000
4000
5000
6000
7000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
TransactionsperSecond(TPS)
Hours
100% Read - 20GB data
db.m1.medium + 200GB standard db.m3.medium + 200G + 2000 IOPS
$0.575 per hour
$0.408 per hour
Burst mode vs. Standard vs. Provisioned IOPS
v
0
1000
2000
3000
4000
5000
6000
7000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
TransactionsperSecond(TPS)
Hours
100% Read - 20GB data
db.m1.medium + 200GB standard db.m3.medium + 200G + 2000 IOPS
db.m3.large + 200G + 2000 IOPS
$0.575 per hour
$0.408 per hour
$0.508 per hour
Burst mode vs. Standard vs. Provisioned IOPS
v
0
1000
2000
3000
4000
5000
6000
7000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
TransactionsperSecond(TPS)
Hours
100% Read - 20GB data
db.m1.medium + 200GB standard db.m3.medium + 200G + 2000 IOPS
db.m3.large + 200G + 2000 IOPS db.t2.medium + 200GB gp2
$0.105 per hour
$0.575 per hour
$0.408 per hour
$0.508 per hour
Burst mode vs. Standard vs. Provisioned IOPS
v
0
1000
2000
3000
4000
5000
6000
7000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
TransactionsperSecond(TPS)
Hours
100% Read - 20GB data
db.m1.medium + 200GB standard db.m3.medium + 200G + 2000 IOPS
db.m3.large + 200G + 2000 IOPS db.t2.medium + 200GB gp2
db.t2.medium + 1TB gp2
$0.105 per hour
$0.575 per hour
$0.233 per hour
$0.408 per hour
$0.508 per hour
Burst mode vs. Standard vs. Provisioned IOPS
Let us manage the muck and
keep your databases running
So you can focus on your business
and the things that differentiate you
v
Try Amazon RDS for free
• For your first year, at no charge…
• Enough free instance-hours to run a “micro” instance continuously
• 20 GB of database instance storage
• 20 GB for automated backups
• 10 million I/O operations per month
• Learn more about the AWS free tier:
http://aws.amazon.com/free/
v
Learn more about Amazon RDS
• Amazon RDS home page: http://aws.amazon.com/rds/
• Amazon RDS Frequently Asked Questions:
http://aws.amazon.com/rds/faqs/
• Links to Import Guides for each engine:
http://aws.amazon.com/rds/faqs/#9
Online Labs & Training
Gain confidence and hands-on
experience with AWS.
Watch free Instructional Videos and
explore Self-Paced Labs
Instructor Led Classes
Learn how to design, deploy and
operate highly available, cost-effective
and secure applications on AWS in
courses led by qualified AWS instructors
Validate your technical expertise
with AWS and use practice exams
to help you prepare for AWS
Certification
AWS Certification
More info at http://aws.amazon.com/training

More Related Content

What's hot

Scaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million UsersScaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million Users
Amazon Web Services
 

What's hot (20)

February 2016 Webinar Series - EC2 Container Service Deep Dive
February 2016 Webinar Series - EC2 Container Service Deep Dive February 2016 Webinar Series - EC2 Container Service Deep Dive
February 2016 Webinar Series - EC2 Container Service Deep Dive
 
(ARC302) Running Lean Architectures: Optimizing for Cost Efficiency
(ARC302) Running Lean Architectures: Optimizing for Cost Efficiency(ARC302) Running Lean Architectures: Optimizing for Cost Efficiency
(ARC302) Running Lean Architectures: Optimizing for Cost Efficiency
 
Best Practices with IoT Security - February Online Tech Talks
Best Practices with IoT Security - February Online Tech TalksBest Practices with IoT Security - February Online Tech Talks
Best Practices with IoT Security - February Online Tech Talks
 
SEC303 Automating Security in cloud Workloads with DevSecOps
SEC303 Automating Security in cloud Workloads with DevSecOpsSEC303 Automating Security in cloud Workloads with DevSecOps
SEC303 Automating Security in cloud Workloads with DevSecOps
 
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsDevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
 
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
 
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
 
Getting Started with Amazon Inspector
Getting Started with Amazon InspectorGetting Started with Amazon Inspector
Getting Started with Amazon Inspector
 
Configuration Management with AWS OpsWorks for Chef Automate
Configuration Management with AWS OpsWorks for Chef AutomateConfiguration Management with AWS OpsWorks for Chef Automate
Configuration Management with AWS OpsWorks for Chef Automate
 
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWSAWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
 
RDS for Oracle and SQL Server - November 2016 Webinar Series
RDS for Oracle and SQL Server - November 2016 Webinar SeriesRDS for Oracle and SQL Server - November 2016 Webinar Series
RDS for Oracle and SQL Server - November 2016 Webinar Series
 
(STG406) Using S3 to Build and Scale an Unlimited Storage Service
(STG406) Using S3 to Build and Scale an Unlimited Storage Service(STG406) Using S3 to Build and Scale an Unlimited Storage Service
(STG406) Using S3 to Build and Scale an Unlimited Storage Service
 
Amazon Aurora for the Enterprise - August 2016 Monthly Webinar Series
Amazon Aurora for the Enterprise - August 2016 Monthly Webinar SeriesAmazon Aurora for the Enterprise - August 2016 Monthly Webinar Series
Amazon Aurora for the Enterprise - August 2016 Monthly Webinar Series
 
DevOps on AWS: Deep Dive on Infrastructure as Code - Toronto
DevOps on AWS: Deep Dive on Infrastructure as Code - TorontoDevOps on AWS: Deep Dive on Infrastructure as Code - Toronto
DevOps on AWS: Deep Dive on Infrastructure as Code - Toronto
 
Cost Optimization at Scale
Cost Optimization at ScaleCost Optimization at Scale
Cost Optimization at Scale
 
Hackproof Your Cloud – Responding to 2016 Threats
Hackproof Your Cloud – Responding to 2016 ThreatsHackproof Your Cloud – Responding to 2016 Threats
Hackproof Your Cloud – Responding to 2016 Threats
 
Scaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million UsersScaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million Users
 
AWS re:Invent 2016: Netflix: Using Amazon S3 as the fabric of our big data ec...
AWS re:Invent 2016: Netflix: Using Amazon S3 as the fabric of our big data ec...AWS re:Invent 2016: Netflix: Using Amazon S3 as the fabric of our big data ec...
AWS re:Invent 2016: Netflix: Using Amazon S3 as the fabric of our big data ec...
 
SRV302 Deep Dive on Serverless Application Development
SRV302 Deep Dive on Serverless Application DevelopmentSRV302 Deep Dive on Serverless Application Development
SRV302 Deep Dive on Serverless Application Development
 
Managing Your Infrastructure as Code by Travis Williams, Solutions Architect,...
Managing Your Infrastructure as Code by Travis Williams, Solutions Architect,...Managing Your Infrastructure as Code by Travis Williams, Solutions Architect,...
Managing Your Infrastructure as Code by Travis Williams, Solutions Architect,...
 

Similar to AWS APAC Webinar Week - AWS MySQL Relational Database Services Best Practices for Performance

Similar to AWS APAC Webinar Week - AWS MySQL Relational Database Services Best Practices for Performance (20)

Day 3 - AWS MySQL Relational Database Service Best Practices for Performance ...
Day 3 - AWS MySQL Relational Database Service Best Practices for Performance ...Day 3 - AWS MySQL Relational Database Service Best Practices for Performance ...
Day 3 - AWS MySQL Relational Database Service Best Practices for Performance ...
 
Day 2 - Amazon RDS - Letting AWS run your Low Admin, High Performance Database
Day 2 - Amazon RDS - Letting AWS run your Low Admin, High Performance DatabaseDay 2 - Amazon RDS - Letting AWS run your Low Admin, High Performance Database
Day 2 - Amazon RDS - Letting AWS run your Low Admin, High Performance Database
 
Intro to AWS: Database Services
Intro to AWS: Database ServicesIntro to AWS: Database Services
Intro to AWS: Database Services
 
Intro to AWS: Database Services
Intro to AWS: Database ServicesIntro to AWS: Database Services
Intro to AWS: Database Services
 
Intro to AWS: Database Services
Intro to AWS: Database ServicesIntro to AWS: Database Services
Intro to AWS: Database Services
 
Introduction to Database Services
Introduction to Database ServicesIntroduction to Database Services
Introduction to Database Services
 
AWS Webcast - Understanding database options
AWS Webcast - Understanding database optionsAWS Webcast - Understanding database options
AWS Webcast - Understanding database options
 
Introducing Database Offerings on AWS - Technical 101
Introducing Database Offerings on AWS - Technical 101Introducing Database Offerings on AWS - Technical 101
Introducing Database Offerings on AWS - Technical 101
 
Intro to database_services_fg_aws_summit_2014
Intro to database_services_fg_aws_summit_2014Intro to database_services_fg_aws_summit_2014
Intro to database_services_fg_aws_summit_2014
 
(DAT202) Managed Database Options on AWS
(DAT202) Managed Database Options on AWS(DAT202) Managed Database Options on AWS
(DAT202) Managed Database Options on AWS
 
AWS June Webinar Series - Getting Started: Amazon Redshift
AWS June Webinar Series - Getting Started: Amazon RedshiftAWS June Webinar Series - Getting Started: Amazon Redshift
AWS June Webinar Series - Getting Started: Amazon Redshift
 
MySQL on the Cloud
MySQL on the CloudMySQL on the Cloud
MySQL on the Cloud
 
AWS Webcast - Introduction to RDS Low Admin High Perf DBS
AWS Webcast - Introduction to RDS Low Admin High Perf DBSAWS Webcast - Introduction to RDS Low Admin High Perf DBS
AWS Webcast - Introduction to RDS Low Admin High Perf DBS
 
Amazon Web Services - Relational Database Service Meetup
Amazon Web Services - Relational Database Service MeetupAmazon Web Services - Relational Database Service Meetup
Amazon Web Services - Relational Database Service Meetup
 
RDS for MySQL, No BS Operations and Patterns
RDS for MySQL, No BS Operations and PatternsRDS for MySQL, No BS Operations and Patterns
RDS for MySQL, No BS Operations and Patterns
 
Getting Started with Managed Database Services on AWS - September 2016 Webina...
Getting Started with Managed Database Services on AWS - September 2016 Webina...Getting Started with Managed Database Services on AWS - September 2016 Webina...
Getting Started with Managed Database Services on AWS - September 2016 Webina...
 
Amazon RDS Deep Dive
Amazon RDS Deep DiveAmazon RDS Deep Dive
Amazon RDS Deep Dive
 
Deep Dive on Amazon RDS (May 2016)
Deep Dive on Amazon RDS (May 2016)Deep Dive on Amazon RDS (May 2016)
Deep Dive on Amazon RDS (May 2016)
 
AWS March 2016 Webinar Series - Managed Database Services on Amazon Web Services
AWS March 2016 Webinar Series - Managed Database Services on Amazon Web ServicesAWS March 2016 Webinar Series - Managed Database Services on Amazon Web Services
AWS March 2016 Webinar Series - Managed Database Services on Amazon Web Services
 
Selecting the Right AWS Database Solution - AWS 2017 Online Tech Talks
Selecting the Right AWS Database Solution - AWS 2017 Online Tech TalksSelecting the Right AWS Database Solution - AWS 2017 Online Tech Talks
Selecting the Right AWS Database Solution - AWS 2017 Online Tech Talks
 

More from Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

AWS APAC Webinar Week - AWS MySQL Relational Database Services Best Practices for Performance

  • 1.
  • 3. AWS MySQL Relational Database Service Best Practices for Performance and Scale Ganesh Raja, Solutions Architect Amazon Web Services Pty Ltd.
  • 6. v Why choose Amazon RDS? • Schema design • Query construction • Query optimization High availability Backup and recovery Isolation and security Industry compliance Push-button scaling Automated patching Advanced monitoring Routine maintenance Amazon RDS takes care of your time-consuming database management tasks, freeing you to focus on your applications and business You RDS
  • 7. v We made it highly available, secure, easier, and cheaper Push-button provisioning; automated scaling, patching, security, backups, restores, and general care and feeding Lower TCO because we manage the muck ► Get more leverage from your teams ► Focus on the things that differentiate you Built-in high availability and cross-region replication across multiple data centers Now even a small startup can leverage multiple data centers to design highly available apps with over 99.95% availability
  • 8. v High availability with Multi-AZ deployments Enterprise-grade fault tolerance solution for production databases  An Availability Zone is a physically distinct, independent infrastructure  Your database is synchronously replicated to another AZ in the same AWS region  Failover occurs automatically for the most important failure scenarios
  • 9. v Customers love Multi-AZ 26% 40% 25% 30% 35% 40% 45% Oct-12 Jan-13 Apr-13 Jul-13 Oct-13 Jan-14 Apr-14 Jul-14 Oct-14 Multi-AZ instances as a share of all RDS instances
  • 10. v Choose cross-region read replicas for faster disaster recovery and enhanced data locality • Promote a read replica to a master for faster recovery in the event of disaster • Bring data close to your customer’s applications in different regions • Promote to a master for easy migration
  • 11. v Choose cross-region snapshot copy for even greater durability, ease of migration • Copy a database snapshot to a different AWS region • Warm standby for disaster recovery • Or use it as a base for migration to a different region
  • 12. v Database migration to AWS with minimal downtime
  • 13. v Importing from an external MySQL source DB Master App Backup AWS Region Replication App scp Load data Staging server DB Slave
  • 14. v External MySQL source considerations • Take backup from a replica/slave • Compress backups for faster transfer • Use a staging server on Amazon EC2 • Use primary key sort order where possible
  • 15. v Target Amazon RDS instance considerations • Hardware: More memory + IOPS = faster loading • Amazon RDS configuration • Disable Multi-AZ • Disable binary logging – backup_retention=0 • MySQL configuration • Set innodb_flush_log_at_trx_commit to 0 • Set auto_commit = 0 • Set unique checks and foreign key checks to 0 • Increase innodb_log_file_size (5.6)
  • 16. Input format SQL Std. mysqldump output Loads schema/data + Auto on/off indexes & constraints SQL execution could be slow Sequential execution Need to restart after failures Smaller databases/tables (few GB) Flat files mysqldump –fields_terminated_by Load schema and data separately + split large tables Faster if file sizes are small Can load files in parallel Can resume each file (checkpointing) Larger databases/tables
  • 17. v Configure external replication source mysql> GRANT SELECT,REPLICATION USER,REPLICATION CLIENT ON *.* TO repluser@‘<RDS Endpoint>' IDENTIFIED BY ‘<password>'; Create replication user on the master Record the “File” and the “Position” in the backup $ mysqldump --databases sampledb --master-data=2 --single-transaction -r sampledbdump.sql -u mysqluser –p mysqluserpassword -- -- Position to start replication or point-in-time recovery from -- -- CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin-changelog.000031', MASTER_LOG_POS=107;
  • 18. v Configure replication target mysql> call mysql.rds_set_external_master(‘<master server>',3306,‘<replicationuser>',‘<password>','mysql-bin-changelog.000031',107,0); mysql> call mysql.rds_start_replication; Configure the replication target and start replication Stop the app pointing at the source. Stop replication after target catches up mysql> call mysql.rds_stop_replication; Promote target Amazon RDS database instance mysql> call mysql.rds_reset_external_master; Point the app at the target Amazon RDS database instance
  • 19. v Exporting data to an external source AWS Region App Dump Data Staging server scp & load MasterSlave mysql> call mysql.rds_set_configuration('binlog retention hours', 48);
  • 21. Move data to the same or different database engine Keep your apps running during the migration Start your first migration in 10 minutes or less Replicate within, to, or from Amazon EC2 or RDS AWS Database Migration Service
  • 24. v Read Replicas and availability Sync replication Async replication
  • 25. v MySQL 5.5 – Replication after failover • MySQL 5.5 – sync_binlog = 0 • Master crash recovery => starts new bin log • Slave => still processes position from older bin log • sync_binlog = 1 => 2 to 4x performance hit [ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log: ‘Client requested master to start replication from impossible position;
  • 26. v MySQL 5.6 – Replication after failover • sync_binlog = 1 by default • Bin Log Group Commit improves performance • Crash safe slaves improve replica reliability Source: https://blogs.oracle.com/MySQL/entry/mysql_5_6_replication_performance
  • 27. v Disaster recovery using Read Replicas AZ1 AZ2 AZ1
  • 29. v Reads10% Reads10% Reads10% Reads10% Reads10% Reads10% Reads10% Reads10% Reads10% Writes10% Reads10% Reads10% Writes10% Reads10% Reads10% Writes10% Reads10% Reads10% Writes10% Reads10% Reads10% Writes10% Reads10% Reads10% Writes10% Reads10% Reads10% Writes10% Reads10% Reads10% Writes10% Reads10% Reads10% Writes10% Reads10% Writes10% Reads10% Reads 90% Writes10% Read to write ratio Primary Writes10% Replica1 Writes10% Replica2 Writes10% Replica3 Writes10% Replica4 1X2X3X SCALE
  • 30. v Writes 20% Writes 20% Writes 20% Writes 20% Reads 80% Reads 20% Reads 20% Reads 20% Reads 20% Reads 20% Writes 20% Reads 20% Writes 20% Reads 20% Writes 20% Reads 20% Writes 20% Writes 20% Writes20% Read to write ratio – More writes Primary Replica1 Replica2 Replica3 Replica4 1X2X SCALE
  • 31. 50% 40% 30% 20% 10% 1 2 3 4 5 6 7 8 1 2 4 8 16 32 Scale Scale based on % Write
  • 32. InnoDB cache warming 4x Load buffer pool Dump buffer pool
  • 34. To enable InnoDB cache warming…
  • 35. InnoDB cache warming for unplanned failures mysql> CREATE EVENT ‘evt_dump_innodb_cache’ ON SCHEDULE EVERY 1 HOUR STARTS ‘2014-11-06 01:00:00’ DO BEGIN CALL mysql.rds_innodb_buffer_pool_dump_now(); END
  • 36. Schema changes Considerations Ease of use Performance Time to complete Options Read Replicas Native 5.6 functionality Third-party tools like Percona
  • 37. Read Only Replica Read Replicas Primary R2MasterR/W mysql> ALTER TABLE customers_address ADD COLUMN province VARCHAR(100);
  • 38. v Native MySQL 5.6 feature • Easy to use – Available by default • In-place – No blocked DML in most cases • Performance impact • Data reorganization still needed in some cases • No ability to control/throttle CPU or I/O utilization • Could increase replica lag • Time to complete • Relatively less
  • 39. pt-online-schema-change pt-online-schema-change --alter "ADD COLUMN province VARCHAR(100)" --execute h=localhost,D=bench,t=customers _address,u=admin,p=admin
  • 42. v Burst mode – GP2 & T2 • GP2 – SSD based Amazon EBS storage • 3 IOPS per GB base performance • Earn credits when usage below base • Burst to 3000+ IOPS • T2 – Amazon EC2 instance with burst capability • Base performance + burst • Earn credits per hour when below base performance • Can store up to 24 hours worth of credits • Amazon CloudWatch metrics to see credits & usage
  • 43. v Burst mode – GP2 & T2
  • 44. v T2 – CPU credits
  • 45. v Burst mode vs. Standard vs. Provisioned IOPS 0 1000 2000 3000 4000 5000 6000 7000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 TransactionsperSecond(TPS) Hours 100% Read - 20GB data db.m1.medium + 200GB standard $0.575 per hour
  • 46. v 0 1000 2000 3000 4000 5000 6000 7000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 TransactionsperSecond(TPS) Hours 100% Read - 20GB data db.m1.medium + 200GB standard db.m3.medium + 200G + 2000 IOPS $0.575 per hour $0.408 per hour Burst mode vs. Standard vs. Provisioned IOPS
  • 47. v 0 1000 2000 3000 4000 5000 6000 7000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 TransactionsperSecond(TPS) Hours 100% Read - 20GB data db.m1.medium + 200GB standard db.m3.medium + 200G + 2000 IOPS db.m3.large + 200G + 2000 IOPS $0.575 per hour $0.408 per hour $0.508 per hour Burst mode vs. Standard vs. Provisioned IOPS
  • 48. v 0 1000 2000 3000 4000 5000 6000 7000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 TransactionsperSecond(TPS) Hours 100% Read - 20GB data db.m1.medium + 200GB standard db.m3.medium + 200G + 2000 IOPS db.m3.large + 200G + 2000 IOPS db.t2.medium + 200GB gp2 $0.105 per hour $0.575 per hour $0.408 per hour $0.508 per hour Burst mode vs. Standard vs. Provisioned IOPS
  • 49. v 0 1000 2000 3000 4000 5000 6000 7000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 TransactionsperSecond(TPS) Hours 100% Read - 20GB data db.m1.medium + 200GB standard db.m3.medium + 200G + 2000 IOPS db.m3.large + 200G + 2000 IOPS db.t2.medium + 200GB gp2 db.t2.medium + 1TB gp2 $0.105 per hour $0.575 per hour $0.233 per hour $0.408 per hour $0.508 per hour Burst mode vs. Standard vs. Provisioned IOPS
  • 50. Let us manage the muck and keep your databases running
  • 51. So you can focus on your business and the things that differentiate you
  • 52. v Try Amazon RDS for free • For your first year, at no charge… • Enough free instance-hours to run a “micro” instance continuously • 20 GB of database instance storage • 20 GB for automated backups • 10 million I/O operations per month • Learn more about the AWS free tier: http://aws.amazon.com/free/
  • 53. v Learn more about Amazon RDS • Amazon RDS home page: http://aws.amazon.com/rds/ • Amazon RDS Frequently Asked Questions: http://aws.amazon.com/rds/faqs/ • Links to Import Guides for each engine: http://aws.amazon.com/rds/faqs/#9
  • 54.
  • 55. Online Labs & Training Gain confidence and hands-on experience with AWS. Watch free Instructional Videos and explore Self-Paced Labs Instructor Led Classes Learn how to design, deploy and operate highly available, cost-effective and secure applications on AWS in courses led by qualified AWS instructors Validate your technical expertise with AWS and use practice exams to help you prepare for AWS Certification AWS Certification More info at http://aws.amazon.com/training