79
Copyright © 2010 Opscode, Inc - All Rights Reserved [email protected] @skeptomai www.opscode.com Christopher Brown VP, Engineering 1 Design for Scale

Design for Scale / Surge 2010

Embed Size (px)

DESCRIPTION

Christopher Brown's surgecon2010 talk on resilient, scalable systems based on his work on Amazon's EC2 and the Opscode Platform.

Citation preview

Page 1: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved

[email protected]‣ @skeptomai‣ www.opscode.com

Christopher Brown VP, Engineering

1

Design for Scale

Page 2: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 2

Who am I?

Page 3: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 2

Who am I?

•Amazon EC2

Page 4: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 2

Who am I?

•Amazon EC2

•Microsoft Edge Computing Network

Page 5: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 2

Who am I?

•Amazon EC2

•Microsoft Edge Computing Network

•Opscode

Page 6: Design for Scale / Surge 2010

Google, Amazon, Microsoftbuilt their own tools

Page 7: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc. – Confidential – Do Not Redistribute

P

almost everyone else is here...

... inexperienced or poorly equipped for the world in which we now operate.

4

Page 8: Design for Scale / Surge 2010

The Method

http://www.flickr.com/photos/wonderlane/2090966628/sizes/l/

Page 9: Design for Scale / Surge 2010

The Method

http://www.flickr.com/photos/wonderlane/2090966628/sizes/l/

Bootstrapping

Page 10: Design for Scale / Surge 2010

The Method

http://www.flickr.com/photos/wonderlane/2090966628/sizes/l/

Bootstrapping

Page 11: Design for Scale / Surge 2010

The Method

http://www.flickr.com/photos/wonderlane/2090966628/sizes/l/

Bootstrapping

Configuration

Page 12: Design for Scale / Surge 2010

The Method

http://www.flickr.com/photos/wonderlane/2090966628/sizes/l/

Bootstrapping

Configuration

Page 13: Design for Scale / Surge 2010

The Method

http://www.flickr.com/photos/wonderlane/2090966628/sizes/l/

Bootstrapping

Configuration

Command & Control

Page 14: Design for Scale / Surge 2010

The Method

http://www.flickr.com/photos/wonderlane/2090966628/sizes/l/

Bootstrapping

Configuration

Command & ControlNanite!

Page 15: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 6

Got it?

Page 16: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 6

Got it?Defining the cloud is like this...

Page 17: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 7

Origin Myth of EC2

Page 18: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 7

Origin Myth of EC2

Page 19: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 7

Origin Myth of EC2

Page 20: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 7

Origin Myth of EC2

Page 21: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 7

Origin Myth of EC2

Page 22: Design for Scale / Surge 2010

Dynamism

Page 23: Design for Scale / Surge 2010

Dynamism...not about excess capacity...

Page 24: Design for Scale / Surge 2010

Dynamism

Page 25: Design for Scale / Surge 2010

Dynamism• Disintermediation• Developers can freely experiment

Page 26: Design for Scale / Surge 2010

Dynamism• Disintermediation• Developers can freely experiment

• Isolation• Applications safely co-exist

Page 27: Design for Scale / Surge 2010

Dynamism• Disintermediation• Developers can freely experiment

• Isolation• Applications safely co-exist

• Utilization• Best use of expensive resources

Page 28: Design for Scale / Surge 2010

Dynamism• Disintermediation• Developers can freely experiment

This is what you are paying for

• Isolation• Applications safely co-exist

• Utilization• Best use of expensive resources

Page 29: Design for Scale / Surge 2010

Scale

Page 30: Design for Scale / Surge 2010

ScaleYou are not this BIG

Page 31: Design for Scale / Surge 2010

ScaleYou are not this BIG

Page 32: Design for Scale / Surge 2010

You are not that BIG

• LAMP can scale on generic architecture

• 2008 - Facebook has over 800 memcached servers, with 28 terabytes of RAM

• 2010 - Github has 16 physical machines, 128 cores, 288 GB RAM

• Don’t design for A Million Users

• Ship early, Ship ugly, Ship often!

Page 33: Design for Scale / Surge 2010

You are not that BIG

• LAMP can scale on generic architecture

• 2008 - Facebook has over 800 memcached servers, with 28 terabytes of RAM

• 2010 - Github has 16 physical machines, 128 cores, 288 GB RAM

• Don’t design for A Million Users

• Ship early, Ship ugly, Ship often!

Page 34: Design for Scale / Surge 2010

EC2 Design Principles• Minimize management footprint

• Run in VMs just like customers.

• Forced to analyze what must run in privileged space

• “Harden everything” means separate network traffic inside the datacenter – customers and management run there

• True multi-tenancy - Customers run side-by-side

• Design by Fight Club

• "You are not a beautiful and unique snowflake“

• “On a large enough time line, the survival rate for everyone will drop to zero.” 

http://www.flickr.com/photos/europedistrict/4058066840/

Page 35: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 13

• Simple API, single unit of work

• think of early Unix tools (MH)

• Can compose with other APIs

• Does not define policy / coupling

• Customers will surprise youPrimitives

Page 36: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 14

APIs, Mashups

Page 37: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 15

http://www.flickr.com/photos/jfseesthings/4293062294/sizes/l/

Simplify

• Move complexity “up the stack”

• Easier to debug

• “Simple and Open” wins

• OAuth, OpenID

• ATOM, REST

• Example: EC2 Metadata - HTTP

Page 38: Design for Scale / Surge 2010

Cost

Page 39: Design for Scale / Surge 2010

Cost• CapEx versus OpEx

Page 40: Design for Scale / Surge 2010

Cost• CapEx versus OpEx

• The Cloud is not “Cheaper”

Page 41: Design for Scale / Surge 2010

Cost• CapEx versus OpEx

• The Cloud is not “Cheaper”

• Do you have money, time, or experience?

Page 42: Design for Scale / Surge 2010

Cost

What are you willing to pay for?

• CapEx versus OpEx

• The Cloud is not “Cheaper”

• Do you have money, time, or experience?

Page 43: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 17

Power

Page 44: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 17

Power

Page 45: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 17

Power

Page 46: Design for Scale / Surge 2010
Page 47: Design for Scale / Surge 2010

Nobody ever imagined a band of Orcs would steal a database table

Charles Stross - Halting State

Page 48: Design for Scale / Surge 2010

MTTF & MTTRUnderstanding how, when and why things fail is great ... but

http://www.flickr.com/photos/dierken/948171048/sizes/z/

Page 49: Design for Scale / Surge 2010

MTTF & MTTRUnderstanding how, when and why things fail is great ... but

If your Mean Time to Recover exceeds the time value of your data, your business is

DEAD

http://www.flickr.com/photos/dierken/948171048/sizes/z/

Page 50: Design for Scale / Surge 2010

Testing

• Test with production-like dataset and performance

• Don’t do “Design by Laptop”

• A/B Testing

• API versioning

Page 51: Design for Scale / Surge 2010

Pull the Plug

•Create test environment

•Pull the plug

•Document

•Pull the plug again!

http://www.flickr.com/photos/rosipaw/5033284534/sizes/m/in/photostream/

Page 52: Design for Scale / Surge 2010

Pull the Plug

•Create test environment

•Pull the plug

•Document

•Pull the plug again!

http://www.flickr.com/photos/rosipaw/5033284534/sizes/m/in/photostream/

Page 53: Design for Scale / Surge 2010

vs

Theo Morpheus

Page 54: Design for Scale / Surge 2010

• Vertical vs Horizontal Scale

• Availability

• Reliability

• 99% vs 99.x% per unit?

vs

Theo Morpheus

Page 55: Design for Scale / Surge 2010

Free your mind...

• Vertical vs Horizontal Scale

• Availability

• Reliability

• 99% vs 99.x% per unit?

vs

Theo Morpheus

Page 56: Design for Scale / Surge 2010

Free your mind...

• Vertical vs Horizontal Scale

• Availability

• Reliability

• 99% vs 99.x% per unit?

vs

Theo Morpheus

You are not Theo

Page 57: Design for Scale / Surge 2010

Free your mind...

• Vertical vs Horizontal Scale

• Availability

• Reliability

• 99% vs 99.x% per unit?

vs

Theo Morpheus

You are not Theo You’re probably not Morpheus either

Page 58: Design for Scale / Surge 2010

Free your mind...

• Vertical vs Horizontal Scale

• Availability

• Reliability

• 99% vs 99.x% per unit?

vs

Theo Morpheus

You are not Theo You’re probably not Morpheus either

Page 59: Design for Scale / Surge 2010

Availability• For a distributed system to be continuously

available, every request received by a non-failing node in the system must result in a response.

• “Read globally, Write locally" with inconsistent cache

• Service Level Agreements, even (especially?) internally

Page 60: Design for Scale / Surge 2010

Think Globally, Act Locally

• Global but inconsistent aggregate view

• Local action where data is authoritative

• Autonomy

• “Rightsizing” your failure domain

http://www.flickr.com/photos/28634332@N05/3872137437/sizes/m/in/photostream/

Page 61: Design for Scale / Surge 2010

Distributed Systems Design• Avoid execution caching

• “Don’t lie, don’t retry”

• Embrace failure

• Don’t block the client

• Avoid internal policy

• Ensure the system makes forward progress

Page 62: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 26

• It’s OK to apologize

• It’s better to completely fail for some users than penalize all of them

• The Web is all about “Hit Refresh”

Embrace Failure

Page 63: Design for Scale / Surge 2010

Apologize...to Pat Helland

Page 64: Design for Scale / Surge 2010

• Distributed Throttling

• Staged / Pipeline with back pressure

• Measure scalability at each stage

• Degraded performance

• Make progress for admitted requests

• At odds with “stateless” / session-less

Admission Control

http://www.flickr.com/photos/jayneandd/4450623309/sizes/m/in/photostream/

Page 65: Design for Scale / Surge 2010

• Distributed Throttling

• Staged / Pipeline with back pressure

• Measure scalability at each stage

• Degraded performance

• Make progress for admitted requests

• At odds with “stateless” / session-less

Admission Control

http://www.flickr.com/photos/jayneandd/4450623309/sizes/m/in/photostream/

Page 66: Design for Scale / Surge 2010

Make Forward Progress• MVCC, vector clocks, & reconciliation

• Don’t resurrect objects

• always go forward, never go back

• "name" is a property of an object, not its unique key

• Break the link, garbage collect later

• Model “degraded service” performance

Page 67: Design for Scale / Surge 2010

Request Signing

• Stateless - no session tracking to lose or to purge later

• X509 - only public information on front-end boxes. More secure against exploit

• Shared secret - faster, smaller signature but requires secret info close to request front-end

Page 68: Design for Scale / Surge 2010

Measure Monitor

Respond• Save *everything* *forever*

• Histograms / Pareto Chart

• tp99.9, tp99, and tp90

• ignore tp50, “average”

• http://en.wikipedia.org/wiki/Control_chart

• http://www.newrelic.com/

• http://www.splunk.com/

• skewness, kurtosis

Page 69: Design for Scale / Surge 2010

Control Chart

• Day over Day

• Same Day, Year over Year

• Confidence Intervals

“Shewhart stressed that bringing a production process into a state of statistical control, where there is only common-cause variation, and keeping it in control, is necessary to predict future output and to manage a process economically.”

• http://en.wikipedia.org/wiki/Control_chart

Page 70: Design for Scale / Surge 2010

Characteristic Curves

Page 71: Design for Scale / Surge 2010

Periodicity

SLA, Variance, Troubleshooting

Page 72: Design for Scale / Surge 2010

Data Taxonomy

• Precious

• Cachable

• Expensive

• Cheap

Page 73: Design for Scale / Surge 2010

Consistency

• Authoritative vs. Consultative

• is_authorized? vs list group

Page 74: Design for Scale / Surge 2010

Performance

• Call length

• Cyclomatic Complexity

• Request ID flow

• Vertical vs Horizontal Scale

• tension between unit performance and scalability

Page 75: Design for Scale / Surge 2010

Failure Domains

• EC2 “droplets”

• EC2 DNS

• Coordinator zones

Page 76: Design for Scale / Surge 2010

Copyright © 2010 Opscode, Inc - All Rights Reserved 39

Still with me?

Page 77: Design for Scale / Surge 2010

Successes

•Sharable “AMI”s•Metadata (Simple and open again)•Open API ( think Eucalyptus)•No API throttling•Primitives•Pay-as you go•Free traffic between S3 and EC2•Data and Compute together

Page 78: Design for Scale / Surge 2010

Failures• SOAP makes little girls cry

• Amazon Web Services, circa 2006 was > 75% REST or Query

• SOAP well supported by commercial vendors, with their libraries

• Still *Way* too hard to use.

• Commodity business. Driving the bottom out of cost causes quality to suffer.

• API vs UI?, User Experience in general

• IaaS (Infrastructure as a Service) is insufficient by itself

• a hangman's noose. EC2, and the other offerings,

Page 79: Design for Scale / Surge 2010

Where are we going?