getting started with amazon aurora

79
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Richard Ainley, Solutions Architect, AWS James Andrews, Systems Architect, FanDuel Max Manders, Operations Engineer, FanDuel 7 th June, 2016 Getting Started with Amazon Aurora

Upload: amazon-web-services

Post on 18-Jan-2017

299 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Getting Started with Amazon Aurora

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

Richard Ainley, Solutions Architect, AWS

James Andrews, Systems Architect, FanDuel

Max Manders, Operations Engineer, FanDuel

7th June, 2016

Getting Started with Amazon Aurora

Page 2: Getting Started with Amazon Aurora

Meet 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

Simple pay as you go pricing

Delivered as a managed service

Page 3: Getting Started with Amazon Aurora

Not much has changed in last 30 years

Even when you scale it out, you’re still replicating the same stack

SQL

Transactions

Caching

Logging

SQL

Transactions

Caching

Logging

Application

SQL

Transactions

Caching

Logging

SQL

Transactions

Caching

Logging

Application

SQL

Transactions

Caching

Logging

SQL

Transactions

Caching

Logging

Storage

Application

Page 4: Getting Started with Amazon Aurora

Reimagining the relational database

What if you were inventing the database today?

You wouldn’t design it the way we did in 1970

You’d build something

that can scale out …

that is self-healing …

that leverages existing AWS services …

Page 5: Getting Started with Amazon Aurora

A service-oriented architecture applied to the database

Moved the logging and storage layer into a

multi-tenant, scale-out database-optimized

storage service

Integrated with other AWS services like

Amazon EC2, Amazon VPC, Amazon

DynamoDB, Amazon SWF, and Amazon

Route 53 for control plane operations

Integrated with Amazon S3 for continuous

backup with 99.999999999% durability

Control planeData plane

Amazon

DynamoDB

Amazon SWF

Amazon Route 53

Logging + Storage

SQL

Transactions

Caching

Amazon S3

1

2

3

Page 6: Getting Started with Amazon Aurora

Rapid adoption of Amazon Aurora

Page 7: Getting Started with Amazon Aurora

Fastest growing service

in AWS history

Aurora customer adoption

Page 8: Getting Started with Amazon Aurora

Expedia: On-line travel marketplace

Real-time business intelligence and analytics on a

growing corpus of on-line travel marketplace data.

Current Microsoft SQL Server–based architecture

is too expensive. Performance degrades as data

volume grows.

Cassandra with Solr index requires large memory

footprint and hundreds of nodes, adding cost.

Aurora benefits:

Aurora meets scale and performance

requirements with much lower cost.

25,000 inserts/sec with peak up to 70,000. 30 ms

average response time for write and 17 ms for

read, with 1 month of data.

World’s leading online travel

company, with a portfolio that

includes 150+ travel sites in 70

countries.

Page 9: Getting Started with Amazon Aurora

Higher performance, lower cost

Safe.com lowered their bill by 40% by switching

from sharded MySQL to a single Aurora instance.

Double Down Interactive (gaming) lowered their

bill by 67% while also achieving better latencies

(most queries ran faster) and lower CPU

utilization.

Aurora benefits:

Due to high performance and large storage

support, sharded MySQL instances can be

consolidated in fewer Aurora instances.

High performance allows for smaller instances.

Automated storage provisioning removes the need

for storage “headroom.”

No additional storage for Read Replicas.

Page 10: Getting Started with Amazon Aurora

“When we ran Alfresco’s workload on Aurora, we were blown away to find that

Aurora was 10x faster than our MySQL environment,” said John Newton,

founder and CTO of Alfresco. “Speed matters in our business, and Aurora has

been faster, cheaper, and considerably easier to use than MySQL.”

Amazon Aurora is fast

Page 11: Getting Started with Amazon Aurora

• Four client machines with 1,000 threads each

WRITE PERFORMANCE READ PERFORMANCE

• Single client with 1,000 threads

• MySQL SysBench

• R3.8XL with 32 cores and 244 GB RAM

SQL benchmark results

Page 12: Getting Started with Amazon Aurora

Consistent performance as table count increases

• Write-only workload

• 1,000 connections

• Query cache (default on for Amazon Aurora, off for MySQL)

• i2.8XL instances for MySQL SSD and RAM

• r3.8XL instances for Aurora and Amazon RDS MySQL

11xU P TO

FA S T E R

Page 13: Getting Started with Amazon Aurora

Writes scale with connection count

• OLTP Workload

• Variable connection count

• 250 tables

• Query cache (default on for Amazon Aurora, off for MySQL)

8xU P TO

FA S T E R

Page 14: Getting Started with Amazon Aurora

Consistent performance with growing dataset

67xU P TO

FA S T E R

• SysBench write-only workload

• Aurora r3.8XL

• Amazon RDS MySQL r3.8XL with 30K IOPS (single AZ)

Page 15: Getting Started with Amazon Aurora

Do fewer I/Os

Minimize network packets

Cache prior results

Offload the database engine

DO LESS WORK

Process asynchronously

Reduce latency path

Use lock-free data structures

Batch operations together

BE MORE EFFICIENT

How do we achieve these results?

Page 16: Getting Started with Amazon Aurora

Aurora requires fewer I/Os

Binlog Data Double-write bufferLog FRM files

T Y P E O F W R I T E S

EBS mirrorEBS mirror

AZ 1 AZ 2

Amazon S3

MYSQL WITH STANDBY

SEQUENTIAL

WRITE

SEQUENTIAL

WRITE

EBSAmazon Elastic

Block Store (EBS)

Primary

Instance

Standby

Instance

AZ 1 AZ 3

Primary

Instance

Amazon S3

AZ 2

Replica

Instance

AMAZON AURORA

ASYNC

4/6 QUORUM

DISTRIBUTED

WRITES

Page 17: Getting Started with Amazon Aurora

Amazon Aurora is highly available

Page 18: Getting Started with Amazon Aurora

Amazon Aurora is highly available

Highly available storage

• Six copies of data across three AZs

• Latency tolerant quorum system for read/write

• Up to 15 replicas with low replication lag

Survivable caches

• Cache remains warm in the event of a database restart

• Lets you resume fully loaded operations much faster

Instant crash recovery

• Underlying storage

replays redo records

on demand as part of a

disk read

• Parallel, distributed,

asynchronous

AZ 1 AZ 2 AZ 3

Amazon

S3

SQL

Transactions

Caching

T0

Page 19: Getting Started with Amazon Aurora

Faster, more predictable failover

AppRunningFailure Detection DNS Propagation

Recovery Recovery

DBFailure

RDS MYSQL

App

Running

Failure Detection DNS Propagation

Recovery

DB

Failure

AURORA WITH MARIADB DRIVER

1 5 – 3 0 s e c

5 – 2 0 s e c

Page 20: Getting Started with Amazon Aurora

Amazon Aurora is easy to use

“Amazon Aurora’s new user-friendly monitoring interface made it

easy to diagnose and address issues. Its performance, reliability, and

monitoring really shows Amazon Aurora is an enterprise-grade AWS

database.” —Mohamad Reza, information systems officer at United

Nations

Page 21: Getting Started with Amazon Aurora

Simplify storage management

• Automatic storage scaling up to 64 TB—no performance impact

• Continuous, incremental backups to Amazon S3

• Instantly create user snapshots—no performance impact

• Automatic restriping, mirror repair, hot spot management, encryption

Up to 64 TB of storage—auto-incremented in 10 GB units

up to 64 TB

Page 22: Getting Started with Amazon Aurora

Simplify monitoring with AWS Management Console

Amazon CloudWatch

metrics for RDS

CPU utilization

Storage

Memory

50+ system/OS metrics

1–60 second granularity

DB connections

Selects per second

Latency (read and write)

Cache hit ratio

Replica lag

CloudWatch alarms

Similar to on-premises custom

monitoring tools

Page 23: Getting Started with Amazon Aurora

Simplify data security

Encryption to secure data at rest

• AES-256; hardware accelerated

• All blocks on disk and in Amazon S3 are encrypted

• Key management by using AWS KMS

SSL to secure data in transit

Network isolation by using Amazon VPC by

default

No direct access to nodes

Supports industry standard security and data

protection certifications

Storage

SQL

Transactions

Caching

Amazon S3

Application

Page 24: Getting Started with Amazon Aurora

Delivered as a managed service

Page 25: Getting Started with Amazon Aurora

If you host your databases on-premises

Power, HVAC, net

Rack and stack

Server maintenance

OS patches

DB software patches

Database backups

Scaling

High availability

DB software installs

OS installation

you

App optimization

Page 26: Getting Started with Amazon Aurora

If you host your databases in Amazon EC2

Power, HVAC, net

Rack and stack

Server maintenance

OS patches

DB software patches

Database backups

Scaling

High availability

DB software installs

OS installation

you

App optimization

Page 27: Getting Started with Amazon Aurora

If you choose Amazon RDS

Power, HVAC, net

Rack and stack

Server maintenance

OS patches

DB software patches

Database backups

App optimization

High availability

DB software installs

OS installation

you

Scaling

Page 28: Getting Started with Amazon Aurora

Amazon Aurora saves you money

Page 29: Getting Started with Amazon Aurora

Simple pricing

No licenses

No lock-in

Pay only for what you use

Discounts

44% with a 1-year Reserved Instance

61% with a 3-year Reserved Instance

vCPU Mem Hourly Price

db.r3.large 2 15.25 $0.32

db.r3.xlarge 4 30.5 $0.64

db.r3.2xlarge 8 61 $1.28

db.r3.4xlarge 16 122 $2.56

db.r3.8xlarge 32 244 $5.12

• Storage consumed, up to 64 TB, is $0.11/GB-month

• IOs consumed are billed at $0.22 per million I/O

• Prices are for EU-West-1 (Ireland) region

Enterprise grade, open source pricing

Page 30: Getting Started with Amazon Aurora

Cost of ownership: Aurora vs. MySQLMySQL configuration hourly cost

Primary

r3.8XL

Standby

r3.8XL

Replica

r3.8XLReplica

r3.8XL

Storage6TB/10K PIOP

Storage6TB/10K PIOP

Storage6TB/5K PIOP

Storage6TB/5K PIOP

$4.22/hr

$4.22/hr

$4.22/hr $4.22/hr

$2.67/hr

$1.92/hr $1.92/hr

Instance cost: $16.88/hr

Storage cost: $9.18/hr

Total cost: $26.06/hr

$2.67/hr

Page 31: Getting Started with Amazon Aurora

Cost of ownership: Aurora vs. MySQLAurora configuration hourly cost

Instance cost: $15.36/hr

Storage cost: $4.87/hr

Total cost: $20.23/hr

Primary

r3.8XL

Replica

r3.8XL

Replica

r3.8XL

Storage/6 TB

$5.12/hr $5.12/hr $5.12/hr

$4.87/hr

*At a macro level, Aurora saves over 50% in

storage cost compared to RDS MySQL.

22.3%

Savings

No idle standby instance

Single shared storage volume

No PIOPS—pay for use IO

Reduction in overall IOP

Page 32: Getting Started with Amazon Aurora

Cost of ownership: Aurora vs. MySQLFurther opportunity for saving

Instance cost: $7.68/hr

Storage cost: $4.87/hr

Total cost: $12.55/hrStorage IOPS assumptions:

1. Average IOPS is 50% of maximum IOPS

2. 50% savings from shipping logs vs. full pages

51%

Savings

Primary

r3.8XL

Replica

r3.8XLReplica

r3.8XL

Storage/6 TB

$2.56/hr $2.56/hr $2.56/hr

$4.87/hr

r3.4XL r3.4XL r3.4XL

Use smaller instance size

Pay-as-you-go storage

Page 33: Getting Started with Amazon Aurora

Migration to Aurora is easy

Page 34: Getting Started with Amazon Aurora

Start your first migration in 10 minutes or less

Keep your apps running during the migration

Replicate within, to, or from Amazon EC2 or RDS

Move data to the same or different database

engine

AWS

Database Migration

Service

Page 35: Getting Started with Amazon Aurora

Customer

premises

Application users

AWS

Internet

VPN

Start a replication instance

Connect to source and target databases

Select tables, schemas, or databases

Let AWS Database Migration Service

create tables, load data, and keep

them in sync

Switch applications over to the target

at your convenience

Keep your apps running during the migration

AWS

Database Migration

Service

Page 36: Getting Started with Amazon Aurora

Migrate from Oracle and SQL Server

Move your tables, views, stored procedures, and data manipulation language (DML) to MySQL, MariaDB, and Amazon Aurora

Know exactly where manual edits are needed

Download at aws.amazon.com/dms

AWS

Schema Conversion

Tool

Page 37: Getting Started with Amazon Aurora

Know exactly where manual edits are needed

Page 38: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

FanDuelAWS Aurora

Page 39: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Where did we come from?

Page 40: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

What is FanDuel?

• HubDub founded 2007

• HubDub pivots in 2009 – FanDuel is born

• Daily Fantasy Sports

• Daily contents informed by real seasonal sports fixtures

• Year-on-year growth

Page 41: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Tech Evolution

Page 42: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Tech Evolution (2009)

• Started as a LAMP stack – don’t they all!?

• Single physical server co-lo hosting

• Monolithic PHP codebase

• Single MySQL host for all reads and writes

• Poorly designed schema

Page 43: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Page 44: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Tech Evolution (2010)

• Scalable? Not so much…• Infrastructure limits

• Application limits

• Network limits

• Migrated to non-AWS cloud hosting• Significant application outages

• Still… dat monolithic database

Page 45: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Page 46: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Tech Evolution (2011)

• Migrated to AWS

• Common growing pains

• Still… dat monolithic database• At least now it’s multi-master with many EC2 read-replicas!

Page 47: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Page 48: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Tech Evolution (2012)

• Elastic all the things!

• Puppet

• Replatforming of core services

• Service Oriented Architecture

• Still… dat monolithic database

Page 49: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Page 50: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Tech Evolution (2013)

• Began work on RESTful API

• iOS app project began

• Numerous scalability and availability issues

• Still… dat monolithic database

Page 51: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Page 52: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Tech Evolution (2014)

• Core internal API service launched

• iOS app released

• Performance issues make scalability and DR top priorities

• Still… dat monolithic database

Page 53: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Page 54: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Tech Evolution (2015)

• More discrete services

• Wide adoption of CloudFormation (via SparkleFormation)

• More service-specific data stores

• Still… dat monolothic database• from multi-master EC2 MySQL + read-replicas

• to HA RDS MySQL + read-replicas

Page 55: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Page 56: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Where are we now?

Page 57: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Tech Evolution (2016)

• Mostly stable

• Rapidly recoverable and scalable

• Outages are rare

• Focus on innovation

• Focus on tech debt

• Focus on informed architecture

• Still… dat monolithic database

Page 58: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

The Problem

Page 59: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

General Traffic

• Seasonal

• Mostly predictable… until it isn’t

• Spikes follow real sporting fixtures

Page 60: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Edit and Entry

• Atomicity is VERY important• Entries cost money

• We cannot over-fill contests

• Hard stop at game-start

• Remember dat monolithic database?• Every change is written back to it (but not forever!)

• 2015 Peak:• ~1000 inserts/sec

• ~200 updates/sec

Page 61: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Modifications / Sec

ENTRIESLINEUPS

Page 62: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Live Scoring

• Starts immediately after enter / edit peak

• Requires immediate consistency

• Not strictly critical – our users may disagree!

• Two main scalability concerns:• Back end load – maintain scoring state

• Front end load – delivery to users

Page 63: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Contests Scores / Sec

Page 64: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Scoring Views / Sec

Page 65: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Settlement

• Tally up the scores and prizes

• Aggregating massive amounts of data

• NFL 2015 – to settle ONE slate:• ~10M reads

• ~55M writes

• Small time window – not fixed – unpredictable

• ~5hrs – before RDS + tuning

• ~1.2 hrs – after RDS + tuning

Page 66: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Data Store

• Consistency, consistency, consistency

• Significant write throughput

• Significant read throughput

• Replication lag• Urrgh…

• Artificial delay

• Non-deterministics, can still miss

Page 67: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

The Solution

Page 68: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Redis!

Page 69: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Just kidding – been there, done that!

Page 70: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

RDS MySQL

• Every journey starts with a first step

• Necessitated by early adoption

• RDS/Aurora migration tools have since greatly improved

• Automated failover!

• Common interface

Page 71: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Migration

• We tested soon after Aurora beta release• You’re welcome

• First attempts uncovered odd edge cases• Disparate MTU on Aurora and EC2 instances

• Discovered by ‘describing’ a table with 78 columns (don’t ask, unless it is your round)

• After minor teething issues - it Just Worked™

Page 72: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Validation

• We still have a large, legacy PHP code base• 3 startups worth of legacy!

• It is disappearing, eventually…

• Effectively an accidental Chaos Monkey• It might actually be sentient

• Automated test suites• Written and maintained by our QA team

• Still a work in progress, but decent coverage

• Performance testing against microservices

Page 73: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Our First ^ Victim

• The ‘action log’

• Append only log of EVERY user action

• Fairly insane insert throughput required

• Rarely read

• Used by customer service, to verify activity• Needs to be consistent

• Usually at time critical points!

Aurora Production

Page 74: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Where are we going?

Page 75: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Preparing for release

• Remember dat monolithic database?• Yep.

• And yes, it is still ‘going to live on a farm’!

• Eventually...

• Aurora buys us headroom

• 3x-5x Improvement

• The core services that replace it?• Also moving their persistence to Aurora

• From Redis… (I wish I was kidding)

Page 76: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Headline Benefits

• No replication lag, massive benefit for edit/entry

• No more interstitial fake ‘please wait’ screen

• Operational benefits include:• Quicker and easier failover

• Managed backups

• Room to breathe!

• DR (Aurora specifically):• RPO = 0

• RTO = ~60 seconds post-failover

Page 77: Getting Started with Amazon Aurora

James AndrewsMax Manders

[email protected]@fanduel.com

Simplicity is good!Thank you for listening!

Page 78: Getting Started with Amazon Aurora

Please remember to rate this

session under My Agenda on

awssummit.london

Page 79: Getting Started with Amazon Aurora