46
Continuous Deployment at March 9, 2013 Ross Snyder [email protected] @beamrider9 : A Tale of Two Approaches

Ross Snyder, Etsy, SXSW Lean Startup 2013

Embed Size (px)

DESCRIPTION

Ross Snyder, Etsy, SXSW Lean Startup 2013

Citation preview

Page 1: Ross Snyder, Etsy, SXSW Lean Startup 2013

Continuous Deployment at

March 9, 2013

Ross [email protected]@beamrider9

:A Tale of Two Approaches

Page 2: Ross Snyder, Etsy, SXSW Lean Startup 2013

A quick primer on

Page 3: Ross Snyder, Etsy, SXSW Lean Startup 2013

is:The global marketplace we make together.

Page 4: Ross Snyder, Etsy, SXSW Lean Startup 2013

is:The premier destination for handmade goods,

vintage items, and craft supplies.

simplertimestoys lacklusterco norwesterseaglass

Page 5: Ross Snyder, Etsy, SXSW Lean Startup 2013

quick facts:

• 22+ million members

• 800,000+ active shops

• 18+ million items currently for sale

• 20 cents to list item, 3.5% transaction fee

• 400+ employees (majority in Brooklyn)

(as of March 2013)

Page 6: Ross Snyder, Etsy, SXSW Lean Startup 2013

$0

$200

$400

$600

$800

$1,000

2005 2006 2007 2008 2009 2010 2011 2012

Gross Merchandise Sales ($MM)

Since opening its doors in June 2005, Etsy has grown virtually non-stop.

Page 7: Ross Snyder, Etsy, SXSW Lean Startup 2013

A nice problem to have:

“Our site is so successful, how can we

move fast enough to keep up with demand?”

Page 8: Ross Snyder, Etsy, SXSW Lean Startup 2013

CONTINUOUSDEPLOYMENT

Page 9: Ross Snyder, Etsy, SXSW Lean Startup 2013

:The Early Years

(2005 - 2008)

Page 10: Ross Snyder, Etsy, SXSW Lean Startup 2013

: The Early Years

1. Spend significant time writing code

Page 11: Ross Snyder, Etsy, SXSW Lean Startup 2013

: The Early Years

2. Painful source control merge

1. Weeks writing code

Page 12: Ross Snyder, Etsy, SXSW Lean Startup 2013

: The Early Years

3. Hand off to someone else to deploy

1. Weeks writing code2. Painful merge

Page 13: Ross Snyder, Etsy, SXSW Lean Startup 2013

: The Early Years

4. Deploy, site goes down

1. Weeks writing code2. Painful merge3. Hand off to deployers

Page 14: Ross Snyder, Etsy, SXSW Lean Startup 2013

: The Early Years

5. Roll back deploy

1. Weeks writing code2. Painful merge3. Hand off to deployers

4. Deploy, site down

Page 15: Ross Snyder, Etsy, SXSW Lean Startup 2013

: The Early Years

6. Spend hours (days?) fixing bugs

1. Weeks writing code2. Painful merge3. Hand off to deployers

4. Deploy, site down5. Roll back deploy

Page 16: Ross Snyder, Etsy, SXSW Lean Startup 2013

: The Early Years

7. Go back to step 2

1. Weeks writing code2. Painful merge3. Hand off to deployers

4. Deploy, site down5. Roll back deploy6. Fix bugs

Page 17: Ross Snyder, Etsy, SXSW Lean Startup 2013

: The Early Years

WATERFALL!

Page 18: Ross Snyder, Etsy, SXSW Lean Startup 2013

: The Early YearsPros:

Early Etsy engineers used this release cycle to bootstrap the marketplace from nothing.

Forever grateful.

Page 19: Ross Snyder, Etsy, SXSW Lean Startup 2013

: The Early Years

• Large changesets• Infrequent deploys• Weak confidence in deploy success• Significant time spent deploying• Low ability to experiment/iterate/react• Developer stress/unhappiness

Cons:

Page 20: Ross Snyder, Etsy, SXSW Lean Startup 2013

: The Early YearsBy late 2008, Etsy is still a startup, but has the

deploy process of a much bulkier company.

Popularity is on the verge of outpacing capacity.

Page 21: Ross Snyder, Etsy, SXSW Lean Startup 2013

:Today

Page 22: Ross Snyder, Etsy, SXSW Lean Startup 2013

: Today

1. Small changesets, deployed frequently

Page 23: Ross Snyder, Etsy, SXSW Lean Startup 2013

: Today

2. Engineers deploy the site

1. Small changesets

Page 24: Ross Snyder, Etsy, SXSW Lean Startup 2013

: TodayAnd not just engineers, but also:

• Designers• Product Folks• Upper Management• Board Members• Dogs

Page 25: Ross Snyder, Etsy, SXSW Lean Startup 2013

: Today

3. Deploys are fast and near-effortless

1. Small changesets2. Engineers deploy

Page 26: Ross Snyder, Etsy, SXSW Lean Startup 2013

: Today

4. Most changes behind config flags(safer deploys)

1. Small changesets2. Engineers deploy3. Deploys are fast

Page 27: Ross Snyder, Etsy, SXSW Lean Startup 2013

: Today

5. Graphs/metrics to assess deploy

1. Small changesets2. Engineers deploy3. Deploys are fast

4. Changes behind flags

Page 28: Ross Snyder, Etsy, SXSW Lean Startup 2013

: Today

6. If issues, fix immediately & roll forward

1. Small changesets2. Engineers deploy3. Deploys are fast

4. Changes behind flags5. Copious graphs/metrics

Page 29: Ross Snyder, Etsy, SXSW Lean Startup 2013

This isn’t license to break stuff, quickly.

Engineer-driven QA and solid unit testing are integral parts of the process.

: Today

Page 30: Ross Snyder, Etsy, SXSW Lean Startup 2013

: Today

7. Repeat 25+ times per day, every day

1. Small changesets2. Engineers deploy3. Deploys are fast

4. Changes behind flags5. Copious graphs/metrics6. Fix fast & roll forward

Page 31: Ross Snyder, Etsy, SXSW Lean Startup 2013

Then:

1. Small changesets2. Engineers deploy3. Deploys are fast4. Changes behind flags5. Copious graphs/metrics6. Fix fast & roll forward

1. Weeks writing code2. Painful merge3. Hand off to deployers4. Deploy, site down5. Roll back deploy6. Fix bugs, go to step 2

Now:

Page 32: Ross Snyder, Etsy, SXSW Lean Startup 2013

Etsy Deploy Stats: 2012

• Deployed to production 6,419 times

• On average, 535/month, 25/day

• Additional 3,851 config-only deploys

• 196 different people deployed to prod

• Nov/Dec 2012: deployed 752 times

Page 33: Ross Snyder, Etsy, SXSW Lean Startup 2013

Why does it work?

Page 34: Ross Snyder, Etsy, SXSW Lean Startup 2013

• N = # of deploys• P = probability of site degradation• S = average severity of degradation• T = time to detect/resolve

= N * P * S * TExpectedDowntime

Continuous Deployment Math

Page 35: Ross Snyder, Etsy, SXSW Lean Startup 2013

• N = 1• P = 0.5• S = 0.7• T = 100

Before:

E.D. = 35

• N = 250 ↑↑↑↑• P = 0.1 ↓• S = 0.05 ↓↓• T = 5 ↓↓↓

Now:

E.D. = 6.25

N = # of deploys P = prob. of degradation

S = avg. severity of degradation T = time to detect/resolve

(all numbers completely arbitrary)

Continuous Deployment Math

Page 36: Ross Snyder, Etsy, SXSW Lean Startup 2013

Etsy circa 2013 (400+ employees)acts, in some ways, more like a startup than

Etsy circa 2008 (40+ employees).

Big Takeaway

Page 37: Ross Snyder, Etsy, SXSW Lean Startup 2013

Continuous Deployment makes possible: “Continuous Experimentation”

http://etsy.me/continuous-experimentation

Page 38: Ross Snyder, Etsy, SXSW Lean Startup 2013

Continuous Experimentation

1. Small changes2. Run experiment (A/B test)3. Analyze data4. Re-examine assumptions

Repeat continuously in pursuit of larger goals.

Page 39: Ross Snyder, Etsy, SXSW Lean Startup 2013

Heard since 2010: “Neat experiment, but this will never scale.”

As of 2013, Etsy has 100+ engineers -still going strong.

Page 40: Ross Snyder, Etsy, SXSW Lean Startup 2013

Some Etsy Customizations

Deploying is a first-class feature. Inability to deploy is a P1 incident (same as site down).

Page 41: Ross Snyder, Etsy, SXSW Lean Startup 2013

Some Etsy Customizations

• Internal admin site• API • Big data• Search• Blog• Deployinator itself

We continuously deploy not just the main Etsy website, but as much as possible:

Page 42: Ross Snyder, Etsy, SXSW Lean Startup 2013

Some Etsy Customizations

• Database schema changes• PCI-DSS environment (credit cards)

In the rare case we can’t continuously deploy, we create alternative tools:

We do continuously deploy as much of our payment processing as is safe & legal (98%).

Page 43: Ross Snyder, Etsy, SXSW Lean Startup 2013

Some Etsy Customizations

Keeping deploys fast is paramount and worth the investment in manpower & hardware.

Page 44: Ross Snyder, Etsy, SXSW Lean Startup 2013

Some Etsy CustomizationsContinuous deployment is all about moving

forward, sometimes at the expense of the past.

Our solution: engineering-wide bug rotation, one day a month, every engineer participates.

Page 45: Ross Snyder, Etsy, SXSW Lean Startup 2013

Continuous Deployment is a fantastic recruitment tool for attracting engineers who like to move fast and get stuff done.

Fun Fact:

Page 46: Ross Snyder, Etsy, SXSW Lean Startup 2013

Learn more:http://codeascraft.etsy.com/

Join the fun:http://www.etsy.com/careers

Etsy open source (Deployinator, StatsD)http://etsy.github.com/