27
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Ian Robinson Specialist Solutions Architect, Data & Analytics, EMEA 18 May, 2017 Deep Dive on Amazon Aurora

Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

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

Ian RobinsonSpecialist Solutions Architect, Data & Analytics, EMEA

18 May, 2017

Deep Dive on Amazon Aurora

Page 2: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Open source compatible relational database

Performance and availability of commercial databases

Simplicity and cost-effectiveness of open source databases

What is Amazon Aurora?

Page 3: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Fastest growing

service in AWS

history

Business applications

Web and mobile

Content management

E-commerce, retail

Internet of Things

Search, advertising

BI, analytics

Games, media

Aurora Customer Adoption

Page 4: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Performance

Page 5: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

WRITE PERFORMANCE READ PERFORMANCE

Scaling with Instance Sizes

Aurora scales with instance size for both read and write.

Aurora MySQL 5.6 MySQL 5.7

Page 6: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Real-Life Data – Gaming WorkloadAurora vs. RDS MySQL – r3.4XL, MAZ

Aurora 3X faster on r3.4xlarge

Page 7: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

How Did We Achieve This?

I/OPackets/secondContext switching

Page 8: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

A Service-Oriented Architecture Applied to DatabasesControl PlaneData Plane

Amazon DynamoDB

Amazon SWF

Amazon Route 53

Logging + Storage

SQL

Transactions

Caching

Amazon S3

Page 9: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

I/O Traffic in MySQL

BINLOG DATA DOUBLE-WRITELOG FRM FILES

T Y P E O F W R I T E

EBS mirrorEBS mirror

AZ 1 AZ 2

Amazon S3

EBSAmazon Elastic

Block Store (EBS)

PrimaryInstance

ReplicaInstance

1

2

3

4

5

780K transactions7,388K I/Os per million txns (excludes mirroring, standby)Average 7.4 I/Os per transaction

PERFORMANCE

30 minute SysBench writeonly workload, 100GB dataset, RDS MultiAZ, 30K PIOPS

Page 10: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

I/O Traffic in Aurora

AZ 1 AZ 3

PrimaryInstance

Amazon S3

AZ 2

ReplicaInstance

ASYNC4/6 QUORUM

DISTRIBUTED WRITES

BINLOG DATA DOUBLE-WRITELOG FRM FILES

T Y P E O F W R I T E

27,378K transactions 35X MORE950K I/Os per 1M txns (6X amplification) 7.7X LESS

PERFORMANCE

ReplicaInstance

Page 11: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

I/O Traffic in Aurora (Storage Node)

LOG RECORDS

Primary Instance

INCOMING QUEUE

STORAGE NODE

S3 BACKUP

1

2

3

4

5

6

7

8UPDATE QUEUE

ACK

HOTLOG

DATABLOCKS

POINT IN TIMESNAPSHOT

GC

SCRUBCOALESCE

SORTGROUP

PEER TO PEER GOSSIPPeerStorageNodes

All steps are asynchronousOnly steps 1 and 2 are in foreground latency pathInput queue is 46X less than MySQL (unamplified, per node)Favor latency-sensitive operationsUse disk space to buffer against spikes in activity

OBSERVATIONS

Page 12: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Asynchronous Group Commits

Read

Write

Commit

Read

Read

T1

Commit (T1)

Commit (T2)

Commit (T3)

LSN 10

LSN 12

LSN 22

LSN 50

LSN 30 LSN 34LSN 41LSN 47

LSN 20

LSN 49

Commit (T4)Commit (T5)Commit (T6)Commit (T7)

Commit (T8)

LSN GROWTHDurable LSN at head-node

COMMIT QUEUEPending commits in LSN order

TIME

GROUPCOMMIT

TRANSACTIONS

Read

Write

Commit

Read

Read

T2

Read

Write

Commit

Read

Read

Tn

Page 13: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

MySQL Read Scaling

MySQL Master

30% Read

70% Write

MySQL Replica

30% New Reads

70% Write

SINGLE-THREADEDBINLOG APPLY

Data Volume Data Volume

Page 14: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Aurora Read Scaling

PAGE CACHEUPDATEAurora Master

30% Read

70% Write

Aurora Replica

100% New Reads

Shared Multi-AZ Storage

Page 15: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

“In MySQL, we saw replica lag spike to almost 12 minutes which is almost absurd from an application’s perspective. With Aurora, the maximum read replica lag across 4 replicas never exceeded 20 ms.”

Real-Life Data - Read Replica Latency

Page 16: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

CLI

ENT

CO

NN

ECTI

ON

CLI

ENT

CO

NN

ECTI

ON

LATCH FREETASK QUEUE

epol

l()

MYSQL THREAD MODEL AURORA THREAD MODEL

Adaptive Thread Pool

Page 17: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Availability

“Performance only matters if your database is up”

Page 18: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Storage Durability

AZ 1 AZ 2 AZ 3

Amazon S3

Page 19: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

What can fail?Segment failures (disks)Node failures (machines)AZ failures (network or datacenter)

Optimizations4 out of 6 write quorum3 out of 6 read quorumPeer-to-peer replication for repairs

SQL

Transaction

AZ 1 AZ 2 AZ 3

Caching

SQL

Transaction

AZ 1 AZ 2 AZ 3

Caching

Amazon Aurora Storage Engine Fault-Tolerance

Page 20: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Aurora Replicas

AZ 1 AZ 3AZ 2

PrimaryNodePrimaryNodePrimaryNode

PrimaryNodePrimaryNode

SecondaryNode

PrimaryNodePrimaryNode

SecondaryNode

Page 21: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Continuous Backup

Segment snapshot Log records

Recovery point

Segment 1

Segment 2

Segment 3

Time

Page 22: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Checkpointed Data Redo Log

Crash at T0 requiresa re-application of theSQL in the redo log sincelast checkpoint

T0

Traditional Crash Recovery

Page 23: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

T0

Crash at T0 will result in redo logs being applied to each segment on demand, in parallel, asynchronously

Amazon Aurora – Instant Crash Recovery

Page 24: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Survivable Caches

SQLTransactions

Caching

SQL

Transactions

Caching

SQLTransactions

Caching

Caching process is outside the DB process and remains warm across a database restart

Page 25: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Faster Failover

AppRunningFailure Detection DNS Propagation

Recovery Recovery

DBFailure

MYSQL

AppRunning

Failure Detection DNS Propagation

Recovery

DBFailure

AURORA WITH MARIADB DRIVER

1 5 - 2 0 s e c

3 - 2 0 s e c

Page 26: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Database Failover Time

0.00% 5.00%

10.00% 15.00% 20.00% 25.00% 30.00% 35.00%

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35

0 - 5s – 30% of fail-overs

0.00%

10.00%

20.00%

30.00%

40.00%

50.00%

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35

5 - 10s – 40% of fail-overs

0% 10% 20% 30% 40% 50% 60%

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35

10 - 20s – 25% of fail-overs

0%

5%

10%

15%

20%

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35

20 - 30s – 5% of fail-overs

Page 27: Deep Dive on Amazon Aurora - Amazon Web Servicesaws-de-media.s3-eu-west-1.amazonaws.com/images/AWS...Deep Dive on Amazon Aurora Open source compatible relational database Performanceand

Thank You