+ All Categories
Home > Data & Analytics > Shootout at the AWS Corral

Shootout at the AWS Corral

Date post: 16-Jul-2015
Category:
Upload: postgresql-experts-inc
View: 974 times
Download: 8 times
Share this document with a friend
Popular Tags:
90
Shootout at the AWS Corral EC2 RDS Heroku Josh Berkus PostgreSQL Experts Inc. SCALE 13
Transcript
Page 1: Shootout at the AWS Corral

Shootout at the AWS Corral

EC2

RDS

Heroku

Josh BerkusPostgreSQL Experts Inc.SCALE 13

Page 2: Shootout at the AWS Corral

https://github.com/manageacloud/

cloud-benchmark-postgres

Page 3: Shootout at the AWS Corral

Thanks!Ruben Rubio Rey

Page 4: Shootout at the AWS Corral

Thanks!

Page 5: Shootout at the AWS Corral

What is AmazonWeb Services?

Page 6: Shootout at the AWS Corral

Magic?

Image by Sperlingsmaedchen. Free for non-profit use only.

Page 7: Shootout at the AWS Corral

a bunch of servers

Page 8: Shootout at the AWS Corral

with virtualization

Page 9: Shootout at the AWS Corral

shared storage

Page 10: Shootout at the AWS Corral

… and a great API with stuff

Page 11: Shootout at the AWS Corral

The Good● Fast deployment

– new servers in minutes, with a script

● Easy scale-out– add replicas in minutes

● Minimize ops staff– no HW wranglers

Page 12: Shootout at the AWS Corral

¢heap(at the low end)

Page 13: Shootout at the AWS Corral

ex$pensive(at the high end)

Page 14: Shootout at the AWS Corral

The Bad● Low system resources

– VMs are small/slow

● Security– more attack vectors

Page 15: Shootout at the AWS Corral
Page 16: Shootout at the AWS Corral

The Ugly● Everything is shared

– Network– IO / Storage– CPU (partly)

Your performance depends on somebody else's peak load.

Page 17: Shootout at the AWS Corral

Sharingis

Not Caring

Page 18: Shootout at the AWS Corral
Page 19: Shootout at the AWS Corral

ephemeral cloud● DR is not optional● your virtual DB server will go away● you need replicas & backup

Page 20: Shootout at the AWS Corral

why Postgres?

Page 21: Shootout at the AWS Corral

transactional DB workout● works CPU● works RAM● works IO● works network IO

at the same time, in parallel

Page 22: Shootout at the AWS Corral

Cast of Three

The GunslingerRoll-Your-Own

The RancherRDS

The DandyHeroku

Page 23: Shootout at the AWS Corral

The Gunslinger

The Gunslinger

Roll Your Ownon EC2

Page 24: Shootout at the AWS Corral

Become a Gunslinger

I. Create an EC2 instance

II. Install PostgreSQL on it

III. Configure PostgreSQL

Page 25: Shootout at the AWS Corral

Roll-Your-Own ++● cheapest option● highly configurable● install whatever you want

– version– extensions

Page 26: Shootout at the AWS Corral

Roll-Your-Own --● you still do all the admin

– installation– backup/redundancy– updates – OS updates

● configuration required

Page 27: Shootout at the AWS Corral

A Fistful of Services● AMIs

– “clone” your database server setup

● AWS's other services– caching, queueing, s3 storage, etc.

Page 28: Shootout at the AWS Corral

Instance Types● m3.* general-purpose● c3.* small, CPU-bound DBs $$● r3.* maximize caching $$$● i2.* Data warehousing $$$$

Page 29: Shootout at the AWS Corral

instance tips● Use m3.* if you don't know what to use● Get enough RAM to cache your

database if you can

Page 30: Shootout at the AWS Corral

Storage Types● EBS + Provisioned IOPS

– large size, latency issues– reliable, snapshots– choose “EBS optimized”

● General SSD– better for bursts (about 20% better)– high variability

Page 31: Shootout at the AWS Corral

Storage Types● Instance Storage + SSD option

– low-latency, limited size– risky: data loss, data corruption– just for “running with scissors”

Page 32: Shootout at the AWS Corral

PrIOPS != througput

Page 33: Shootout at the AWS Corral

PrIOPS fallacy● not a guarantee, a limit

– but mostly pretty consistent

● each IOP is no more than 8K● random access → each page is an IOP

– no real prefetch

● PrIOPS ~ rows/second

Page 34: Shootout at the AWS Corral

Stuff to Set Up● Backup: WAL-E to S3● Replication: not optional

– in another Availbility Zone

● Monitoring for instance failure● Secure your instance

– SSL– pg_hba.conf

Page 35: Shootout at the AWS Corral

Configuration Tips● random_page_cost = 1.5● wal_buffers = 32 to 64MB● stats_temp_directory =

/mnt/tmpfs/stats● synchronous_commit = off

– if you can afford it

Page 36: Shootout at the AWS Corral

Junior Gunslinger● “small”

“economical”● m3.medium● 1 core

3.75GB RAM● 40GB

+ 1000 PrIOPS

Page 37: Shootout at the AWS Corral

Senior Gunslinger● “large”

“performance”● r3.2xlarge● 8 cores

61GB RAM● 200GB

+ 4000 PrIOPS

Page 38: Shootout at the AWS Corral

Junior Gunslinger Costinstance: $36.50/month

EBS PrIOPS: $105/month

S3 Archive: $5/month

X2 for replica

== $288.00 a month

(+ misc charges)

Page 39: Shootout at the AWS Corral

Cheaper Gunslingerinstance: $36.50/month

EBS PrIOPS: $105/month

S3 Archive: $5/month

no replica

== $146.50 a month

(+ misc charges)

Page 40: Shootout at the AWS Corral

Senior Gunslingerarchive-only: $760.70/month

with replica: $1509.40/month

(+ misc charges)

Page 41: Shootout at the AWS Corral

The Rancher

The RancherRDS

RelationalDatabaseService

In The

Middle

Page 42: Shootout at the AWS Corral

Ranching 1011. Go to AWS RDS

2. Choose “PostgreSQL”

3. Select instance size and storage

4. Launch

5. Connect over port 5432

Page 43: Shootout at the AWS Corral

RDS ++

● Simpler deployment● AWS manages updates, uptime● Easy replicas● Double redundancy

– multizone warm standbyOR replicas

– regular DB snapshots

Page 44: Shootout at the AWS Corral

RDS --● Limited extensions● 9.3 only

– and not promptly updated

● No shell access● Still might have to configure

Postgres

Page 45: Shootout at the AWS Corral

Rancher equipment● Integration with some AWS sevices

– caching– S3 snapshotting– plus regular access to other services

● 2 dozen extensions available

Page 46: Shootout at the AWS Corral

RDS Options● Instance types:

– same m3.* and r3.* options– no c3 or i3 instances currently

● again, get enough RAM● All storage is EBS

– take PrIOPS storage options

Page 47: Shootout at the AWS Corral

RDS redundancy● Do Multi-AZ instances or replication

– Multi-AZ: automated failover– Replication: better performance

● Set up auto DB snapshots– automatically deleted snapshots?

Page 48: Shootout at the AWS Corral

RDS configuration● Same as Roll-Your-Own

– except: be cautious, defaults are OK

● Except fewer security options

Page 49: Shootout at the AWS Corral

RDS CostSmall, single: $ 184.35Small, redundant: $ 358.70Large, single: $1119.35

Large, redundant: $2342.70

(+ misc charges)

Page 50: Shootout at the AWS Corral

The Dandy

The DandyHeroku

Herokufor

white-gloveservice

Page 51: Shootout at the AWS Corral

Doing the Dandy1. Choose “Create Database”

2. Pick a size

3. Launch

4. Connect using supplied credentials

Page 52: Shootout at the AWS Corral

Heroku ++● Heroku manages everything

– updates, backups, availability, configuration

● really no Ops staff● Heroku-only features● Latest Postgres stuff

– sometimes feature previews

Page 53: Shootout at the AWS Corral

Heroku --● No configurability

– webapp assumed– can't control AZ, etc.

● Limited extensions & versions● Costs escalate● No shell

Page 54: Shootout at the AWS Corral

Dandy Bling● git-based instance management

– works really well with Rails/Django

● Dataclips– web-sharable matviews!

● Followers == replicas

Page 55: Shootout at the AWS Corral

Dandy Bling● About 20 extensions● Heroku addons and apps● encryption● Access all AWS services

Page 56: Shootout at the AWS Corral
Page 57: Shootout at the AWS Corral

Heroku options

● 5 database “sizes”● 3 levels of HA/uptime● that's it

Page 58: Shootout at the AWS Corral

Heroku Sizing● Small

Standard 2: 3.5 GB RAMshared hosting

● LargeStandard 6: 60GB RAMdedicated instance

Page 59: Shootout at the AWS Corral

Heroku Sizing● Small

archive: $200HA: $350

● Largearchive: $2000HA: $3500

Page 60: Shootout at the AWS Corral

the shootout

Page 61: Shootout at the AWS Corral

pgbench++● ships with Postgres● microbenchmark

– very simple “bank trade” workload

● fast to set up and run

Page 62: Shootout at the AWS Corral

pgbench--● doesn't do complex queries● pure random data / access● unrealistic balance of work

– too reliant on single-row write speed

● not very tunable

Page 63: Shootout at the AWS Corral

pgbench sizing1. memory read-write (RW):

– 50% of RAM, write transactions

2. memory read-only (RO):– 50% of RAM, read-only queries

3. disk read-write (RW):– 200% of RAM, write transactions

Page 64: Shootout at the AWS Corral

pgbench small●memory RW

● pgbench -i -s 100 --foreign-keys● pgbench -c 4 -T 900

●memory RO● pgbench -i -s 100 --foreign-keys● pgbench -c 4 -T 900 -S

●disk RW● pgbench -i -s 400 --foreign-keys● pgbench -c 4 -T 900

Page 65: Shootout at the AWS Corral

pgbench large●memory RW

● pgbench -i -s 1000 --foreign-keys● pgbench -c 16 -T 900

●memory RO● pgbench -i -s 1000 --foreign-keys● pgbench -c 16 -T 900 -S

●disk RW● pgbench -i -s 7000 --foreign-keys● pgbench -c 16 -T 900

Page 66: Shootout at the AWS Corral

metrics● TPS: transactions-per-second

– measures multiple things

● Load Time: time to build the database

Page 67: Shootout at the AWS Corral

run many many timesrun many many times

Page 68: Shootout at the AWS Corral

Box PlotBox Plot

Page 69: Shootout at the AWS Corral

495 TPS

587 TPS

1685 TPS

2537 TPS

6156 TPS

50

90

10

Min

Max

Page 70: Shootout at the AWS Corral

0.3X

0.4X

Median

1.7X

4X

50

90

10

Min

Max

Page 71: Shootout at the AWS Corral

when the smoke clears ...

Page 72: Shootout at the AWS Corral

featuresVersions Extensions Superuser Replication

EC2 Any All Yes Yes

RDS 9.3 only Some No Yes

Heroku 9.3, 9.4, betas Some No Yes

Auto-Failover

Snapshots Extras Support

EC2 No DIY DIY No

RDS Yes* Yes No No

Heroku Yes Yes Yes Yes

Page 73: Shootout at the AWS Corral

EC2 RDS Heroku$0.00

$100.00

$200.00

$300.00

$400.00

Small Instance Pricing

Archive

HA

cos

t pe

r m

on

th

Page 74: Shootout at the AWS Corral

EC2 RDS Heroku$0.00

$500.00

$1,000.00

$1,500.00

$2,000.00

$2,500.00

$3,000.00

$3,500.00

$4,000.00

Large Instance Pricing

Archive

HA

cos

t pe

r m

on

th

Page 75: Shootout at the AWS Corral

EC2 Heroku RDS RDS HA0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5

Small Node Load TimeIn-memory DB (smaller is faster)

median

90%

Min

ute

s

Page 76: Shootout at the AWS Corral

EC2 Heroku RDS RDS HA0

5

10

15

20

25

30

Small Node Load TimeOn-Disk DB (smaller is faster)

median

90%

Min

ute

s

Page 77: Shootout at the AWS Corral

EC2 Heroku RDS RDS HA0

5

10

15

20

25

30

Large Node Load TimeIn-Memory DB (smaller is faster)

median

90%

Min

ute

s

Page 78: Shootout at the AWS Corral

EC2 Heroku RDS RDS HA0

20

40

60

80

100

120

140

160

180

Large Node Load TimeOn-Disk DB (smaller is faster)

median

90%

Min

ute

s

Page 79: Shootout at the AWS Corral

EC2 Heroku RDS RDS HA0

100

200

300

400

500

600

700

800

In-Memory RW TestSmall Node (taller is faster)

median

90%

TP

S

Page 80: Shootout at the AWS Corral

EC2 Heroku RDS RDS HA0

500

1000

1500

2000

2500

3000

In-Memory RW TestLarge Node (taller is faster)

median

90%

TP

S

Page 81: Shootout at the AWS Corral

EC2 Heroku RDS RDS HA0

1000

2000

3000

4000

5000

6000

7000

In-Memory RO TestSmall Node (taller is faster)

median

90%

TP

S

Page 82: Shootout at the AWS Corral

EC2 Heroku RDS RDS HA0

5000

10000

15000

20000

25000

30000

In-Memory RO TestLarge Node (taller is faster)

median

90%

TP

S

Page 83: Shootout at the AWS Corral

EC2 Heroku RDS RDS HA0

50

100

150

200

250

300

350

400

On-Disk RW TestSmall Node (taller is faster)

median

90%

TP

S

Page 84: Shootout at the AWS Corral

EC2 Heroku RDS RDS HA0

200

400

600

800

1000

1200

1400

1600

On-Disk RW TestLarge Node (taller is faster)

median

90%

TP

S

Page 85: Shootout at the AWS Corral

What's Next

Page 86: Shootout at the AWS Corral

More Clouds● Rackspace● Digital Ocean● OpenShift● Google Compute Engine

Page 87: Shootout at the AWS Corral

More Benchmarks● OLTPBench?

– Wikipedia, Auctionmark, Epinions

● DVDStore?● New benchmark?

– really need something more “webby”

● NoSQLish benchmark?

Page 88: Shootout at the AWS Corral

Better Visualizations● better graphs● automated graph

generation● detailed response

times and time graphs

Page 89: Shootout at the AWS Corral

“running with scissors”● test for pure ephemeral instances● no transaction log● local SSD● just for RO load-balancing

Page 90: Shootout at the AWS Corral

more shooting● Josh Berkus: [email protected]

– www.pgexperts.com

● More Shootouts– www.databasesoup.com– https://github.com/manageacloud/cloud-

benchmark-postgres/– pgConf.US NYC, pgCon Ottawa

Copyright 2015 PostgreSQL Experts Inc. Released under the Creative Commons Share-Alike 3.0 License. All images and trademarks are the property of their respective owners.


Recommended