Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure?...

27
Immutable Infrastructure in the Mesos Ecosystem Kevin Sweeney (@kts) Software Engineer Twitter

Transcript of Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure?...

Page 1: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Immutable Infrastructure in the Mesos Ecosystem

Kevin Sweeney (@kts) Software Engineer

Twitter

Page 2: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

What is Immutable Infrastructure?

• Snapshot-equivalent

• Destroy, Recreate and Scale “at-will”

• Single-specification

• Automated

Page 3: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Source: https://flic.kr/p/icxrQ6 - normanack - CC-BY 2.0

Page 4: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Source http://loc.gov/pictures/resource/fsac.1a34221/

Page 5: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Ideal State

• Failure Recovery (Rare)

• Software Deploys (Common)

• Capacity Add/Remove

Page 6: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Packaging• Machine Images

• Flattened Container Images

• Layered Container Images

• App Bundles (WAR, PEX, etc)

• Layered App Bundles (POM, requirements.txt, etc)

Page 7: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Machine Images

• The full machine and all the software on it

• Linux Kernel

• Mesos Agent

• Framework Executors?

Page 8: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Machine Images

• Pretty immutable

• General Purpose

• Slow deploys

• Fully out-of-band of Mesos!

Page 9: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Flattened Container Images

• Contains Executor, Application, all Libraries

• Depends on Kernel and Agent APIs

Page 10: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Flattened Container Images• Mostly immutable except:

• Linux Kernel

• Mesos Agent

• Slow startup

• High Fetch Time

• Not very cacheable

Page 11: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Layered Container Images

• Contains Executor, Application, all Libraries

• Depends on Kernel and Agent APIs

• Depends on Containerizer Runtime

Page 12: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Layered Container Images• Mostly immutable except:

• Linux Kernel

• Mesos Agent

• Containerizer Runtime

• Slow startup

• High Fetch Time

• Sometimes very cacheable

Page 13: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

App Bundles

• Contains Application, all Libraries

• Depends on Kernel and Agent APIs

• Depends on Executor, Language runtime

Page 14: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

App Bundles• Mostly immutable except:

• Linux Kernel

• Mesos Agent

• Containerizer Runtime

• Language Runtime

• Faster startup

• Medium Fetch Time

• Not cacheable (but runtime installed out-of-band)

Page 15: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Layered App Bundles

• Contains Application

• Depends on Kernel and Agent APIs

• Depends on Executor, Language runtime

• Depends on All Libraries

Page 16: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Layered App Bundles• Mostly immutable except:

• Linux Kernel

• Mesos Agent

• Containerizer Runtime

• Language Runtime

• Fetcher Runtime

• Faster startup

• Short Fetch Time

• Very Cacheable (but runtime installed out-of-band)

Page 17: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Pitfalls

• “Configuration Service”

• Mutable labels

• Puppet/Chef/Automatic OS Updates

• Non-concrete dependencies

Page 18: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Improvements

• Command-Line Flags

• Content-Addressed

• Master Organization Image

• Pinned dependencies

Page 19: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Pitfalls

• Combinatorial explosion

• Linux Kernel A -> B

• Mesos Agent C -> D

• Containerizer E -> F

Page 20: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Example - Aurora

• “update” - Move from current config to new config slowly and with health checks

• Creates Mesos tasks from config snapshot.

Page 21: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Example - Aurora

• “Binding helpers” - leave unresolved references in a master config file.

• {{package.version[latest]}}

• {{docker.image[ubuntu][14.04]}}

Page 22: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Example - Aurora

• Optional “compilation” step

• aurora config read < job.aurora > job.json

Page 23: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Conclusions

Page 24: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Tradeoffs

• Startup time!

• VM >> Container >> App Archive >> Native Binary

Page 25: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Tradeoffs

• Generalizability

• Better performance+reliability if you can cache common libraries

Page 26: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Questions

Page 27: Immutable Infrastructure in the Mesos Ecosystem · 2017-12-14 · What is Immutable Infrastructure? • Snapshot-equivalent • Destroy, Recreate and Scale “at-will” • Single-specification

Get Involved

• https://aurora.apache.org

• #aurora on irc.freenode.net

[email protected]

[email protected]