87
Continuous Deployment of Architectural Change Matt Graham Core Engineer @ Etsy Continuous Deployer #iasany September 27, 2011

Continuous Deployment of Architectural Change

Embed Size (px)

DESCRIPTION

Continuous deployment has proven to be a successful and even addicting part of Etsy's engineering culture. See where it's applicable, some of the tools that make it easy, and the kind of architectural change that it makes possible.

Citation preview

Page 1: Continuous Deployment of Architectural Change

Continuous Deploymentof Architectural Change

Matt GrahamCore Engineer @ EtsyContinuous Deployer

#iasanySeptember 27, 2011

Page 2: Continuous Deployment of Architectural Change

A Brief History of Deployment

Page 3: Continuous Deployment of Architectural Change

The Internet

Page 4: Continuous Deployment of Architectural Change

Web Applications

Page 5: Continuous Deployment of Architectural Change

Agility

Page 6: Continuous Deployment of Architectural Change

Continuous

Page 7: Continuous Deployment of Architectural Change

Database Deployment @ Etsy

Thursday

Page 8: Continuous Deployment of Architectural Change

What it's all about

● Broadly Applicable● Tools Help● Enables the Unfeasible

Page 9: Continuous Deployment of Architectural Change

MTTR vs MTTF

Page 10: Continuous Deployment of Architectural Change

MTTR vs MTTF

● Cheaper for electrons

Page 11: Continuous Deployment of Architectural Change

MTTR vs MTTF

● Cheaper for electrons

● Cheaper for protons & neutrons

Page 12: Continuous Deployment of Architectural Change

MTTR vs MTTF

● Cheaper for electrons

● Cost prohibitive for humans

● Cheaper for protons & neutrons

Page 13: Continuous Deployment of Architectural Change

MTTR vs MTTF

● Cheaper for electrons

● Cost prohibitive for humans

● Necessitates low MTTD

● Cheaper for protons & neutrons

Page 14: Continuous Deployment of Architectural Change

The Case of Electrons

● Consider a project that has 6 bugs● continuous deployment testing misses 4& deploys fixes in 4 hours

● monthly release testing misses only 2& deploys fixes in 24 hours

● 16 hours of broken < 48 hours of broken

Page 15: Continuous Deployment of Architectural Change

Good Excuses

● Infrequent Changes

Page 16: Continuous Deployment of Architectural Change

Good Excuses

● Infrequent Changes● Infrequent Executions

Page 17: Continuous Deployment of Architectural Change

Good Excuses

● Infrequent Changes● Infrequent Executions● Life and Death

Page 18: Continuous Deployment of Architectural Change

Good Excuses

● Infrequent Changes● Infrequent Executions● Life and Death● Physical Investment

Page 19: Continuous Deployment of Architectural Change
Page 20: Continuous Deployment of Architectural Change
Page 21: Continuous Deployment of Architectural Change
Page 22: Continuous Deployment of Architectural Change
Page 23: Continuous Deployment of Architectural Change
Page 24: Continuous Deployment of Architectural Change
Page 25: Continuous Deployment of Architectural Change
Page 26: Continuous Deployment of Architectural Change

Deployment Tools @ Etsy

Page 27: Continuous Deployment of Architectural Change

Culture Before Tools

● No planned deploys; only on demand

Page 28: Continuous Deployment of Architectural Change

Culture Before Tools

● No planned deploys; only on demand

● A positive change is ready & tested

Page 29: Continuous Deployment of Architectural Change

Culture Before Tools

● No planned deploys; only on demand

● A positive change is ready & tested

● Software is stable & supported

Page 30: Continuous Deployment of Architectural Change

Jenkins

● Unit Tests

Page 31: Continuous Deployment of Architectural Change

Jenkins

● Unit Tests● Functional Tests

Page 32: Continuous Deployment of Architectural Change

Jenkins

● Unit Tests● Functional Tests● Manual Testing

Page 33: Continuous Deployment of Architectural Change

Nagios & Naglite2

github.com/lozzd/Naglite2

Page 34: Continuous Deployment of Architectural Change

tail -f | grep

Page 35: Continuous Deployment of Architectural Change

github.com/etsy/deployinator

Page 36: Continuous Deployment of Architectural Change

IRC

Page 37: Continuous Deployment of Architectural Change

Key Tools

Communication Tools

Graphs

Feature Flags

Page 38: Continuous Deployment of Architectural Change

Feature Flags

Deploy != Product Launch

Page 39: Continuous Deployment of Architectural Change

Dark Launch

def get_feature_a_link():

return ...

Page 40: Continuous Deployment of Architectural Change

Dark Launch

def get_feature_a_link():

if enabled('NewFeatureA'):

return new_feature_a_link()

else:

return old_feature_a_link()

Page 41: Continuous Deployment of Architectural Change

Dark Launch

application_config - NewFeatureA: admin - NewFeatureB: off - NewFeatureC: on

Page 42: Continuous Deployment of Architectural Change

Ramp Up

application_config - NewFeatureA: 1% - NewFeatureB: off - NewFeatureC: on

Page 43: Continuous Deployment of Architectural Change

Ramp Up

application_config - NewFeatureA: 5% - NewFeatureB: off - NewFeatureC: on

Page 44: Continuous Deployment of Architectural Change

Ramp Up

application_config - NewFeatureA: 25% - NewFeatureB: off - NewFeatureC: on

Page 45: Continuous Deployment of Architectural Change

Ramp Up

application_config - NewFeatureA: 100% - NewFeatureB: off - NewFeatureC: on

Page 46: Continuous Deployment of Architectural Change

AB Testing

● Prove success of interface changes

● Prove interest in new features

Page 47: Continuous Deployment of Architectural Change

Graphs!!!

Page 48: Continuous Deployment of Architectural Change

Ganglia

Page 49: Continuous Deployment of Architectural Change

Graphite

Page 50: Continuous Deployment of Architectural Change

Event Overlay

Page 51: Continuous Deployment of Architectural Change

StatsD

github.com/etsy/statsd

if ($success) { StatsD::timing('feature.runtime', $time);} else { StatsD::increment('feature.failure');}

Page 52: Continuous Deployment of Architectural Change

github.com/etsy/logster

Page 53: Continuous Deployment of Architectural Change

github.com/etsy/logster

Page 54: Continuous Deployment of Architectural Change

Community Communication

Page 55: Continuous Deployment of Architectural Change

Forums / Message Boards

Page 56: Continuous Deployment of Architectural Change

etsystatus.com

Page 57: Continuous Deployment of Architectural Change

twitter.com/etsystatus

Page 58: Continuous Deployment of Architectural Change

twitter.com/etsystatus

Page 59: Continuous Deployment of Architectural Change

Deployment is First Class

Deployment is aFirst Class Feature

Page 60: Continuous Deployment of Architectural Change

Engineers are Users Too

Page 61: Continuous Deployment of Architectural Change

Enable Architectural Change

Page 62: Continuous Deployment of Architectural Change

Architecture is Relative

Page 63: Continuous Deployment of Architectural Change

Organic Architecture

Page 64: Continuous Deployment of Architectural Change

Premature Architecture

Page 65: Continuous Deployment of Architectural Change

Premature Architecture

What now?

Page 66: Continuous Deployment of Architectural Change

Passing Time => Change

● Scale● Product● Technology● Engineering Team

Page 67: Continuous Deployment of Architectural Change

Passing Time => Change

● Scale● Product● Technology● Engineering Team● The Correct Architecture Changes

Page 68: Continuous Deployment of Architectural Change

Examples

● Images From Twisted to PHP● From PostgreSQL to MySQL Shards

Page 69: Continuous Deployment of Architectural Change

From Twisted to PHP

● Run Apache/PHP on a new port

Page 70: Continuous Deployment of Architectural Change

From Twisted to PHP

● Run Apache/PHP on a new port● Implement one service in PHP

Page 71: Continuous Deployment of Architectural Change

From Twisted to PHP

● Run Apache/PHP on a new port● Implement one service in PHP● Ramp up users on new service

Page 72: Continuous Deployment of Architectural Change

From Twisted to PHP

● Run Apache/PHP on a new port● Implement one service in PHP● Ramp up users on new service● Repeat for remaining services

Page 73: Continuous Deployment of Architectural Change

From Twisted to PHP

● Run Apache/PHP on a new port● Implement one service in PHP● Ramp up users on new service● Repeat for remaining services● Shut down Twisted version

Page 74: Continuous Deployment of Architectural Change

PostgreSQL to MySQL Shards

● Migrate table by table

Page 75: Continuous Deployment of Architectural Change

PostgreSQL to MySQL Shards

● Migrate table by table● Teed writes to MySQL

Page 76: Continuous Deployment of Architectural Change

PostgreSQL to MySQL Shards

● Migrate table by table● Teed writes to MySQL● Backfill old data from PostgreSQL

Page 77: Continuous Deployment of Architectural Change

PostgreSQL to MySQL Shards

● Migrate table by table● Teed writes to MySQL● Backfill old data from PostgreSQL● Verify data matches in both DBs

Page 78: Continuous Deployment of Architectural Change

PostgreSQL to MySQL Shards

● Migrate table by table● Teed writes to MySQL● Backfill old data from PostgreSQL● Verify data matches in both DBs● Ramp up users reading from MySQL

Page 79: Continuous Deployment of Architectural Change

PostgreSQL to MySQL Shards

● Migrate table by table● Teed writes to MySQL● Backfill old data from PostgreSQL● Verify data matches in both DBs● Ramp up users reading from MySQL● Stop Postgres writes & drop tables

Page 80: Continuous Deployment of Architectural Change

Continuous Deploy Pattern

● Change in small steps

Page 81: Continuous Deployment of Architectural Change

Continuous Deploy Pattern

● Change in small steps● Dark launch placeholder via config

Page 82: Continuous Deployment of Architectural Change

Continuous Deploy Pattern

● Change in small steps● Dark launch placeholder via config● Deploy to production while dark

Page 83: Continuous Deployment of Architectural Change

Continuous Deploy Pattern

● Change in small steps● Dark launch placeholder via config● Deploy to production while dark● Maintain old & new in parallel

Page 84: Continuous Deployment of Architectural Change

Continuous Deploy Pattern

● Change in small steps● Dark launch placeholder via config● Deploy to production while dark● Maintain old & new in parallel● Ramp up to new architecture

Page 85: Continuous Deployment of Architectural Change

Continuous Deploy Pattern

● Change in small steps● Dark launch placeholder via config● Deploy to production while dark● Maintain old & new in parallel● Ramp up to new architecture● Remove old architecture

Page 86: Continuous Deployment of Architectural Change

Review

● Broadly applicable● Key Tools: Feature Flags, Graphs, Communication

● Enables Architectural Change● It's really fun!!!

Page 87: Continuous Deployment of Architectural Change

Continuous Deploymentof Architectural Change

Matt Grahamhttp://twitter.com/lapsu

http://lapsu.tv

Core Engineer @ EtsyContinuous Deployer

http://codeascraft.etsy.comWe're Hiring!

http://bit.ly/etsywantsawesome