Sie sind auf Seite 1von 61

DAT336

Aurora Serverless

Sandor Maurice Joshua Eichorn


Sr. Engineering Manager CTO
Amazon RDS Pagely

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Related breakouts
Tuesday, November 27
What’s New in Amazon Aurora
1:00 PM - 2:00 PM | Venetian, Level 2, Titian 2202

Tuesday, November 27
DAT304 - Deep Dive on Amazon Aurora with MySQL Compatibility
6:15 PM – 7:15 PM | Venetian, Level 4, Marcello 4505

Thursday, November 29
Amazon Aurora Storage Demystified: How It All Works
2:30 PM - 3:30 PM | Venetian, Level 4, Lando 4305

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
• RDS & Aurora fundamentals

• Aurora Serverless

• How it works

• What’s new?

• Case Study - Pagely

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon RDS is . . .
Cloud native engine Open source engines Commercial engines

RDS platform
• Automatic fail-over • Isolation & security • Advanced monitoring
• Backup & recovery • Industry compliance • Routine maintenance
• X-region replication • Automated patching • Push-button scaling

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Image credit: By Mackphillips - Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=55946550


Amazon Aurora is . . .. . .
Cloud native engine Open source engines Commercial engines

RDS platform
• Automatic fail-over • Isolation & security • Advanced monitoring
• Backup & recovery • Industry compliance • Routine maintenance
• X-region replication • Automated patching • Push-button scaling

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Image credit: By Mackphillips - Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=55946550


Amazon Aurora - databases reimagined for the cloud

Speed and availability of high-end commercial databases

Simplicity and cost-effectiveness of open source databases

Drop-in compatibility with MySQL and PostgreSQL

Simple pay as you go pricing

Delivered as a fully managed service

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Scale-out, distributed, multi-tenant design . . .
Region

Purpose-built log-structured, Availability zone 1 Availability zone 2 Availability zone 3


distributed storage Master Reader Reader Reader Reader Reader
1 5 8 9 15
SQL SQL SQL SQL SQL SQL

10GiB stripes Transactions

Caching
Transactions

Caching
… Transactions

Caching
… Transactions

Caching
Transactions

Caching
… Transactions

Caching

6-way replication, 2 per AZ


Shared storage volume

Quorums survive AZ+1 failure

Master and up to 15 Readers


all point to the same storage Storage nodes with SSDs

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
With provisioned Aurora, you size the master yourself
Region

Availability zone 1 Availability zone 2 Availability zone 3


Size for the peak load
Master

-or- SQL

Transactions

Caching

Continuously monitor and


manually scale up/down Shared storage volume

Storage nodes with SSDs

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Aurora Serverless . . .

Responds to your application automatically

• Scale capacity

• Shut down

• Start up

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Example #1 – episodic dev-test workload
VolumeWriteIOPs, 120-hour window

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Example #2 – mostly idle dev-test workload
VolumeWriteIOPs, 120-hour window

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Example #3 – spiky gaming workload
VolumeWriteIOPs, 120-hour window

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Example #4 – ecommerce production workload
VolumeWriteIOPs, 24-hour window

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You have some choices to make . . .
Provision for peak Expensive

-or-

Provision less than peak End-user (business) impact

-or-

Hard
Continuously monitor and
• Requires experts
manually scale up/down
• Risks outages

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Database capacity management
Region

Availability zone 1

App

Master

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Database capacity management
Region

Availability zone 1

App

Add a scale-up target


Original master Scale-up target

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Database capacity management
Region

Availability zone 1

App

Cutover

Original master New master

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Database capacity management
Region

Availability zone 1

App

Original master New master

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Database capacity management
Region

Availability zone 1

App

Add a proxy, shield the application


Proxy from connection changes

Original master Scale-up target

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Database capacity management
Region

Availability zone 1

App

Proxy

Cutover

New scale-up target New master

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Database capacity management – is hard
Region

Availability zone 1

App

Proxy

New scale-up target New master

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Aurora Serverless . . .

Responds to your application load automatically

• Scale capacity with no downtime

• Multi-tenant proxy is highly available

• Scale target has warm buffer pool

• Shuts down when not in use

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How does it work . . .
Region

Availability zone 1
App

Multi-tenant proxy layer

Monitoring service
Warm-pool of Aurora instances

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How does it work . . .
Region

Availability zone 1
App

Multi-tenant proxy layer

Monitoring service
Warm-pool of Aurora instances

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How does it work . . .
Region

Availability zone 1
App

Multi-tenant proxy layer

Monitoring service
Warm-pool of Aurora instances

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How does it work . . .
Region

Availability zone 1
App

Multi-tenant proxy layer

Monitoring service
Warm-pool of Aurora instances

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How does it work . . .
Region

Availability zone 1
App

Multi-tenant proxy layer

Monitoring service
Warm-pool of Aurora instances

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How does it work . . .
Region

Availability zone 1
App

Multi-tenant proxy layer

Monitoring service
Warm-pool of Aurora instances

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How does it work . . .
Region

Availability zone 1
App

Multi-tenant proxy layer

Monitoring service
Warm-pool of Aurora instances

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How does it work . . .
Region

Availability zone 1
App

Multi-tenant proxy layer

Monitoring service
Warm-pool of Aurora instances

Shared distributed storage volume

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
1000
1500
2000
2500
3000

0
500
tps
1
12
23
34
45
56
67
78
89
100
111
122
133
144
155
166
177
188
199
210
221
232
243
254
265
276
287
298
309
320
331
342
353
364
375
How does it work in practice?

386
397
408
419
430
441
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

452
463
474
485
496
507
518
529
540
551
562
573
584
595
606
617
628
639
650
661
672
683
694
705
716
727
1000
1500
2000
2500
3000

0
500
tps
1
12
23
34
45
56
67
78
89
100
111
122
133
144
155
166
177
188
199
210
221
232
243
254
265
276
287
298
309
320
331
342
353
364
375
386
How does it work in practice?

397
408
419
430
441
452
463
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

474
485
496
507
518
529
540
551
562
573
584
595
606
617
628
639
650
661
672
683
694
705
716
727
738
1
2
4
8
16
32
64
ACU
128
50
100
150
200
250
300
350
400
450
500

0
ms
1
12
23
34
45
56
67
78
89
100
111
122
133
144
155
166
177
188
199
210
221
232
243
254
265
276
287
298
309
320
331
342
353
364
375
386
How does it work in practice?

397
408
419
430
441
452
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

463
474
485
496
507
518
529
540
551
562
573
584
595
606
617
628
639
650
661
672
683
694
705
716
727
0
ACU

10
20
30
40
50
60
70
1000
1500
2000
2500
3000

0
500
tps
1
12
23
34
45
56
67
78
89
100
111
122
133
144
155
166
177
188
199
210
221
232
243
254
265
276
287
298
309
320
331
342
353
364
375
386
How does it work in practice?

397
408
419
430
441
452
463
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

474
485
496
507
518
529
540
551
562
573
584
595
606
617
628
639
650
661
672
683
694
705
716
727
738
0
50
ms

100
150
200
250
300
350
400
450
500
That said . . .

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Introducing RDS Data API

• Simple web service protocol for database access

• SQL statements packaged as HTTP requests Data API Service

• Access your database from AWS Lambda and AWS AppSync

• Access your database from the AWS SDK & CLI


Aurora Serverless

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Introducing RDS Console Query Editor

• Access your database from


AWS Management Console

• No database client application


or terminal required

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Aurora Serverless – for PostgreSQL

Now in preview, sign-up today:


https://pages.awscloud.com/amazon-
aurora-postgresql-serverless-
preview.html

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Aurora Serverless – more regions
• Aurora Serverless newly available in:
• Seoul
• Singapore
• Sydney
• Mumbai
• N. California
• London, Paris
• Frankfurt
• Central Canada

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Invoking Data API from Lambda
ExecuteSqlRequest sqlRequest = new ExecuteSqlRequest();

sqlRequest.setSqlStatements(String.format("Select count(*) from


Demo.Cities where City = \'%s\' group by City;", city));

ExecuteSqlResult result = awsRDSDataAPI.executeSql(sqlRequest);

Long peopleFromCityCount =
result.getSqlStatementResults().get(0).getResultFrame().getRecords()
.get(0).getValues().get(0).getBigIntValue();

https://github.com/aws-samples/amazon-rds-data-api-demo

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Joshua Eichorn
CTO
Pagely

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
WordPress powers 32% of the Web
• More than blogs and CMS
• Ecommerce
• Membership sites
• Custom Apps

• Pagely brings
• Devops
• Scale
• Piece of mind

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• Serverless Application Hosting
• Autoscaling
• Workflow

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Northstack High Level Architecture

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Details
• Using ECS for compute
• App gateway + workers can stop
• Each production app gets its own
Aurora Serverless
• For cacheable sites only the
gateway is running
Picture: Aurora 2010 / Michael R. P. Ragazzon / Creative Commons

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Elastic Database is Hard
• WordPress read after write limits slave usefulness
• Single tenant option
• Resizing a master means failover
• Failover = outage
• Multi-tenant option
• Constant balancing chore
• Noisy neighbors

Picture: Elastic Close-Up / Marco Verch / Creative Commons

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Aurora Serverless a perfect fit
• Scales the master
• Scaling without downtime
• Less work needed from my team
• Pausing

Picture: Perfect. / taraesque / Creative Commons

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Things to watch out for
• Resume from pause time is
inconsistent
• Aurora needs a place to
scale
• MySQL server has gone
away errors

Picture: ShelbyPeek / josephdepalma / Creative Commons

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Managing timeouts around pause
• Biggest cost savings come from pause
• Resume is high time variance

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
A WordPress Slow query Story
• Full table scans of meta_value are common
• 2 ACU query takes 10 minutes
• 8 ACU query takes < 2 seconds

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Giving Aurora a place to scale
• Add query timeouts
• Be careful about global timeouts
• Not always easy Picture: Waimea expanse / Alex Schwab / Creative Commons

• SET SESSION MAX_EXECUTION_TIME=2000; <- Mysql 5.7 only 


• Sysown Proxysql mysql-default_query_timeout 
• For PHP use mysqlnd + mysqlnd.net_read_timeout 

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
MySQL server has gone away errors
• More common with Aurora • Enable auto reconnect if possible
Serverless • Custom DB driver in WordPress to
• Timeouts increase occurrence catch and reconnect
• Sysown Proxysql

Picture: Gone / Marina del Castell / Creative Commons


© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you!
Sandor Maurice Joshua Eichorn
samauri@amazon.com joshua.eichorn@pagely.com

© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Das könnte Ihnen auch gefallen