Benjamin ¡Hindman ¡ ¡– ¡@benh ¡
Containerization ¡as ¡ the ¡Building ¡Block ¡ for ¡Datacenter ¡ Applications ¡
GOTO ¡Amsterdam ¡ June ¡19, ¡2015 ¡
Containerization as the Building Block for Datacenter - - PowerPoint PPT Presentation
Containerization as the Building Block for Datacenter Applications GOTO Amsterdam June 19, 2015 Benjamin Hindman @benh an emerging trend
Benjamin ¡Hindman ¡ ¡– ¡@benh ¡
GOTO ¡Amsterdam ¡ June ¡19, ¡2015 ¡
microservices ¡ containerization ¡
① do ¡one ¡thing ¡and ¡do ¡it ¡well ¡(UNIX) ¡ ② compose! ¡ ③ build/commit ¡in ¡isolation, ¡test ¡in ¡isolation, ¡ deploy ¡in ¡isolation ¡(with ¡easy ¡rollback) ¡ ④ captures ¡organizational ¡structure ¡(many ¡ teams ¡working ¡in ¡parallel) ¡
now ¡ then ¡
now ¡ then ¡ more ¡moving ¡parts ¡ less ¡moving ¡parts ¡
microservices ¡ containerization ¡ cluster ¡management ¡
(configuration/package ¡management) ¡ (deployment) ¡
(configuration/package ¡management) ¡ (deployment) ¡
(configuration/package ¡management) ¡ (deployment) ¡
MySQL ¡
MySQL ¡ memcached ¡
MySQL ¡ Rails ¡ memcached ¡
MySQL ¡ Cassandra ¡ Rails ¡ memcached ¡
MySQL ¡ Cassandra ¡ Rails ¡ Hadoop ¡ memcached ¡
MySQL ¡ Cassandra ¡ Rails ¡ Hadoop ¡ memcached ¡
MySQL ¡ Cassandra ¡ Rails ¡ Hadoop ¡ memcached ¡
① upgrading ¡software ¡(i.e., ¡the ¡kernel) ¡
developers ¡
① upgrading ¡software ¡(i.e., ¡the ¡kernel) ¡ ② replacing ¡machines, ¡switches, ¡PDUs, ¡etc ¡
MySQL ¡ Cassandra ¡ Rails ¡ Hadoop ¡ memcached ¡
MySQL ¡ Cassandra ¡ Rails ¡ Hadoop ¡ memcached ¡
Rails ¡ Hadoop ¡ memcached ¡
Rails ¡ Hadoop ¡ memcached ¡
Rails ¡ Hadoop ¡ memcached ¡ buy ¡less ¡machines ¡
run ¡more ¡applications! ¡
① failures ¡ ② maintenance ¡ ③ utilization ¡
① failures ¡ ② maintenance ¡ ③ utilization ¡
planning ¡for ¡ failure? ¡
① failures ¡ ② maintenance ¡ ③ utilization ¡
planning ¡for ¡ utilization? ¡
intra-‑machine ¡resource ¡sharing: ¡ share ¡a ¡single ¡machine’s ¡resources ¡between ¡ multiple ¡applications ¡(multi-‑tenancy) ¡ intra-‑datacenter ¡resource ¡sharing: ¡ share ¡multiple ¡machine’s ¡resources ¡between ¡ multiple ¡applications ¡
I ¡want ¡a ¡cluster ¡ manager! ¡
① Treat ¡machines ¡as ¡cattle ¡not ¡pets. ¡
» Keep ¡the ¡base ¡operating ¡system ¡small ¡and ¡simple, ¡ run ¡“containerized” ¡applications. ¡
① Treat ¡machines ¡as ¡cattle ¡not ¡pets. ¡
» Keep ¡the ¡base ¡operating ¡system ¡small ¡and ¡simple, ¡ run ¡“containerized” ¡applications. ¡
② Automate ¡with ¡software ¡not ¡humans. ¡
» Let ¡software ¡schedule ¡software, ¡i.e., ¡handle ¡ failures, ¡improve ¡utilization, ¡and ¡manage ¡
industry ¡ academia ¡
academia ¡ industry ¡
academia ¡ industry ¡
academia ¡ industry ¡
cluster ¡managers ¡
academia ¡ industry ¡
1,000’s ¡of ¡machines ¡
academia ¡ industry ¡
batch ¡computation! ¡
stateless ¡services! ¡
masters ¡ slaves ¡
masters ¡ slaves ¡ schedulers ¡
stateless ¡services! ¡
service ¡scheduler ¡ Mesos ¡
using ¡Mesos ¡
service ¡scheduler ¡ Mesos ¡
schedule ¡
service ¡scheduler ¡ Mesos ¡
schedule ¡
¡
① configuration/package ¡ management ¡ ② deployment ¡
configuration/package ¡management ¡
(1) bundle ¡services ¡as ¡jar, ¡tar/gzip, ¡ ¡
(2) ¡upload ¡to ¡HDFS, ¡S3, ¡ ¡ Docker ¡registry, ¡etc ¡
(1) ¡describe ¡services ¡ using ¡JSON ¡ (2) ¡submit ¡services ¡to ¡ Marathon ¡via ¡REST ¡or ¡CLI ¡
{ "container": { "type": "DOCKER", "docker": { "image": "libmesos/ubuntu" }, "volumes" : [ { "containerPath": "/etc/a", "hostPath": "/var/data/a", "mode": "RO" }, { "containerPath": "/etc/b", "hostPath": "/var/data/b", "mode": "RW" } ] }, "id": "ubuntu", "instances": 1, "cpus": 0.5, "mem": 512, "cmd": "while sleep 10; do date -u +%T; done" }
¡
① configuration/package ¡ management ¡ ② deployment ¡
… ¡
0.8.2 0.9.0
Mesos ¡influenced ¡by ¡multi-‑level ¡scheduling ¡in ¡ traditional ¡operating ¡systems ¡(user-‑space ¡ scheduling ¡and ¡scheduler ¡activations) ¡ ¡ Mesos ¡is ¡designed ¡less ¡like ¡a ¡“cluster ¡manager” ¡ and ¡more ¡like ¡an ¡operating ¡system ¡kernel ¡
Mesos ¡(nodes) ¡
scheduler ¡ Mesos ¡(master) ¡ scheduler ¡ syscall-‑like ¡API ¡ for ¡datacenter ¡
+ ¡enable ¡running ¡multiple ¡distributed ¡systems ¡
dynamically ¡share ¡the ¡resources ¡more ¡ efficiently! ¡
+ ¡enable ¡building ¡new ¡distributed ¡systems ¡by ¡ providing ¡common ¡functionality ¡(primitives) ¡ every ¡new ¡distributed ¡system ¡re-‑implements ¡
allocation ¡algorithms ¡
during ¡upgrades) ¡
static) ¡
① don’t ¡reinvent ¡the ¡wheel: ¡leverage ¡primitives ¡ to ¡implement/automate ¡failures, ¡ maintenance, ¡etc. ¡
② make ¡it ¡easier ¡for ¡your ¡users ¡to ¡use ¡your ¡ software! ¡
② make ¡it ¡easier ¡for ¡your ¡users ¡to ¡use ¡your ¡ software! ¡
2009 ¡ 2010 ¡ 2013 ¡ 2014 ¡
2011 ¡ 2012 ¡ 2013 ¡ 2014 ¡
2010 ¡ 2013 ¡ 2014 ¡ … ¡
masters ¡ scheduler ¡
request ¡ 3 ¡CPUs ¡ 2 ¡GB ¡RAM ¡
a ¡request ¡is ¡purposely ¡simplified ¡ subset ¡of ¡a ¡specification, ¡mainly ¡ including ¡the ¡required ¡resources ¡ at ¡that ¡point ¡in ¡time ¡
masters ¡ scheduler ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
masters ¡ scheduler ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
masters ¡ scheduler ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
scheduler ¡uses ¡the ¡offers ¡to ¡ decide ¡what ¡tasks ¡to ¡run ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
masters ¡ scheduler ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
scheduler ¡uses ¡the ¡offers ¡to ¡ decide ¡what ¡tasks ¡to ¡run ¡ ¡ “two-‑level ¡scheduling” ¡
masters ¡ scheduler ¡
scheduler ¡uses ¡the ¡offers ¡to ¡ decide ¡what ¡tasks ¡to ¡run ¡
task ¡ 3 ¡CPUs ¡ 2 ¡GB ¡RAM ¡
slave ¡
mesos-slave
slave ¡
mesos-slave task
slave ¡
mesos-slave task task
slave ¡
mesos-slave
slave ¡
mesos-slave executor
slave ¡
mesos-slave executor task
slave ¡
mesos-slave executor task task
slave ¡
mesos-slave executor
slave ¡
mesos-slave executor task task task
slave ¡
mesos-slave executor task task
slave ¡
mesos-slave executor task task
containers ¡
slave ¡
mesos-slave executor task task
slave ¡
mesos-slave executor task task
slave ¡
mesos-slave executor task task
slave ¡
mesos-slave executor task task
slave ¡
mesos-slave executor task task
slave ¡
mesos-slave executor task task
slave ¡
mesos-slave executor task task
slave ¡
mesos-slave Docker image
masters ¡
scheduler ¡
after ¡a ¡new ¡master ¡is ¡elected ¡all ¡ schedulers ¡and ¡slaves ¡connect ¡to ¡ the ¡new ¡master ¡ ¡ all ¡tasks ¡keep ¡running ¡across ¡master ¡ failover! ¡
masters ¡
scheduler ¡
scheduler ¡re-‑registers ¡with ¡master ¡ and ¡resumes ¡operation ¡ ¡ all ¡tasks ¡keep ¡running ¡across ¡ framework ¡failover! ¡
scheduler ¡
slave ¡
mesos-slave task task
slave ¡
mesos-slave task task
slave ¡
task task
slave ¡
mesos-slave task task
slave ¡
mesos-slave task task
slave ¡
mesos-slave (large ¡in-‑memory ¡services, ¡ expensive ¡to ¡restart) ¡
datacenter ¡
promotions ¡ trends ¡ recommendations ¡ team ¡
promotions ¡ trends ¡ recommendations ¡ team ¡ fairly ¡shared! ¡
promotions ¡ trends ¡ recommendations ¡ 45% ¡CPU ¡ 100% ¡RAM ¡ 75% ¡CPU ¡ 100% ¡RAM ¡ 100% ¡CPU ¡ 50% ¡RAM ¡ team ¡ utilization ¡
promotions ¡ trends ¡ recommendations ¡ team ¡ utilization ¡ bottleneck ¡ RAM ¡ 45% ¡CPU ¡ 100% ¡RAM ¡ 75% ¡CPU ¡ 100% ¡RAM ¡ 100% ¡CPU ¡ 50% ¡RAM ¡ RAM ¡ CPU ¡
promotions ¡ trends ¡ recommendations ¡ team ¡
promotions ¡ trends ¡ recommendations ¡ team ¡ weight ¡ 0.17 ¡ 0.5 ¡ 0.33 ¡
masters ¡
masters ¡can ¡be ¡configured ¡with ¡ weights ¡per ¡role ¡ ¡ resource ¡allocation ¡decisions ¡ incorporate ¡the ¡weights ¡to ¡ determine ¡dominant ¡fair ¡shares ¡
resources ¡on ¡individual ¡slaves ¡ can ¡be ¡reserved ¡for ¡particular ¡ roles ¡ ¡ resource ¡offers ¡include ¡the ¡ reservation ¡role ¡(if ¡any) ¡
masters ¡ framework ¡(trends) ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡ role: ¡trends ¡
slave ¡
*
role-foo
reservations ¡
mesos-slave
role-bar
reservations ¡available ¡with ¡Mesos ¡using ¡the ¡ ¡ ¡ ¡ ¡
¡
$ mesos-slave --resources=‘cpus(role-foo): 2;mem(role-foo):1024;cpus(role-bar): 2;mem(role-bar):1024;cpus(*):4;mem(*):4096’
+ ¡strong ¡guarantees ¡
¡ ¡
framework ¡scheduler ¡reserves ¡resources ¡at ¡runtime ¡ when ¡it ¡accepts ¡an ¡offer ¡(allocation) ¡ ¡ ¡ ¡
masters ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
slave ¡ (1) ¡ framework ¡ (role-‑baz) ¡
framework ¡scheduler ¡reserves ¡resources ¡at ¡runtime ¡ when ¡it ¡accepts ¡an ¡offer ¡(allocation) ¡ ¡ ¡ ¡
masters ¡ framework ¡ (role-‑baz) ¡
Accept ¡ Launch/ Reserve(4 ¡ CPUs, ¡4 ¡ GB ¡RAM) ¡
slave ¡ (2) ¡
framework ¡scheduler ¡reserves ¡resources ¡at ¡runtime ¡ when ¡it ¡accepts ¡an ¡offer ¡(allocation) ¡ ¡ ¡ ¡
masters ¡
Launch/ Reserve(4 ¡ CPUs, ¡4 ¡ GB ¡RAM) ¡
slave ¡ (3) ¡ framework ¡ (role-‑baz) ¡
promotions ¡ 40% ¡ trends ¡ 20% ¡ used ¡ 10% ¡ unused ¡ 30% ¡ recommendations ¡ 40% ¡
reservations ¡
masters ¡ framework ¡(promotions) ¡
resources ¡that ¡are ¡reserved ¡for ¡ another ¡role ¡and ¡thus ¡may ¡be ¡ revoked ¡at ¡any ¡time ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡ role: ¡trends ¡
¡
… ¡my ¡tasks ¡will ¡not ¡be ¡killed ¡ unless ¡I’m ¡using ¡revocable ¡ resources! ¡
masters ¡ framework ¡(promotions) ¡
allocating ¡unused ¡resources ¡as ¡ revocable! ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡ role: ¡trends ¡
… ¡my ¡tasks ¡will ¡not ¡be ¡killed ¡ unless ¡I’m ¡using ¡revocable ¡ resources! ¡
what ¡about ¡when: ¡ ① want/need ¡to ¡defrag ¡(think ¡page ¡ replacement ¡algorithm!) ¡ ② maintenance ¡
possible ¡solution: ¡introduce ¡failures ¡to ¡ deallocate ¡resources ¡ ¡ but ¡why ¡not ¡communicate ¡explicitly!? ¡
framework ¡scheduler ¡gets ¡deallocation ¡requests ¡in ¡ the ¡form ¡of ¡inverse ¡offers ¡ ¡ ¡ ¡
masters ¡
hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
slave ¡ (1) ¡ framework ¡ (role-‑baz) ¡
framework ¡scheduler ¡can ¡kill ¡tasks ¡and ¡ acknowledge ¡deallocation ¡ ¡ ¡ ¡
masters ¡ framework ¡ (role-‑baz) ¡
Kill/ACK ¡
slave ¡ (2) ¡
① drain ¡machine ¡by ¡sending ¡out ¡inverse ¡offers ¡ ② while ¡draining ¡can ¡still ¡send ¡out ¡offers ¡with ¡ revocable ¡resources ¡ ③ remove ¡machine ¡from ¡allocation ¡once ¡ drained ¡(or ¡at ¡some ¡specific ¡time) ¡
framework ¡scheduler ¡creates ¡volumes ¡for ¡disk ¡ resources ¡at ¡runtime ¡when ¡it ¡accepts ¡an ¡offer ¡ (allocation) ¡ ¡ ¡ ¡
masters ¡
Offer ¡ hostname ¡ 4 ¡CPUs ¡ 4 ¡GB ¡RAM ¡
slave ¡ (1) ¡ scheduler ¡ (role-‑baz) ¡
framework ¡scheduler ¡creates ¡volumes ¡for ¡disk ¡ resources ¡at ¡runtime ¡when ¡it ¡accepts ¡an ¡offer ¡ (allocation) ¡ ¡ ¡ ¡
masters ¡ scheduler ¡ (role-‑baz) ¡
Accept ¡ Launch/ Create(1 ¡ TB ¡DISK) ¡
slave ¡ (2) ¡
framework ¡scheduler ¡reserves ¡resources ¡at ¡runtime ¡ when ¡it ¡accepts ¡an ¡offer ¡(allocation) ¡ ¡ ¡ ¡
masters ¡
Launch/ Create(1 ¡ TB ¡DISK) ¡
slave ¡ (3) ¡ scheduler ¡ (role-‑baz) ¡
volumes ¡are ¡created ¡before ¡launching ¡any ¡tasks ¡or ¡ executors ¡ ¡ ¡ ¡
slave ¡
role-baz role-foo
mesos-slave
role-bar
volumes ¡are ¡mounted ¡into ¡the ¡container ¡when ¡a ¡ task ¡or ¡executor ¡gets ¡launched ¡ ¡ ¡
slave ¡
role-foo
mesos-slave
role-bar
task
volumes ¡persist ¡even ¡after ¡task ¡or ¡executor ¡ terminate! ¡ ¡ ¡
slave ¡
role-foo
mesos-slave
role-bar
task
volumes ¡persist ¡even ¡after ¡task ¡or ¡executor ¡ terminate! ¡ ¡
slave ¡
role-baz role-foo
mesos-slave
role-bar
reservations ¡+ ¡ inverse ¡offers ¡+ ¡ persistent ¡volumes ¡= ¡ long-‑lived ¡stateful ¡frameworks! ¡
* ¡collection ¡of ¡physical ¡and/or ¡virtual ¡machines ¡
desktop server datacenter OS ¡
OS ¡
OS ¡
Marathon, ¡a ¡scheduler ¡for ¡ running ¡stateless ¡services ¡ written ¡in ¡any ¡language ¡
init ¡for ¡the ¡datacenter ¡operating ¡system ¡
Chronos, ¡a ¡scheduler ¡for ¡running ¡ cron ¡jobs ¡with ¡dependencies ¡
cron ¡for ¡the ¡datacenter ¡operating ¡system ¡