Getting Rid of Zookeeper
MesosCon Asia 2016
1
Jay Guo
Software Developer @IBM guojiannan@cn.ibm.com
Kapil Arya
Mesos Committer @Mesosphere kapil@mesosphere.io
Getting Rid of Zookeeper Jay Guo Kapil Arya Software Developer - - PowerPoint PPT Presentation
MesosCon Asia 2016 Getting Rid of Zookeeper Jay Guo Kapil Arya Software Developer @IBM Mesos Committer @Mesosphere guojiannan@cn.ibm.com kapil@mesosphere.io 1 Motivation 2 Zookeeper is... Mature Feature-rich ... 3
MesosCon Asia 2016
1
Jay Guo
Software Developer @IBM guojiannan@cn.ibm.com
Kapil Arya
Mesos Committer @Mesosphere kapil@mesosphere.io
2
3
○ Provide your own tooling for other abstractions!
4
5
6
First of all, we need a Distributed Key-Value storage...
7
○ Leader election ○ Leader detection
Zookeeper as the distributed key-value store
8
ZK ZK ZK Mesos Master Mesos Master Mesos Master leader Zookeeper cluster Mesos Agents / Frameworks
the leader!
9
ZK ZK ZK Mesos Master Mesos Master Mesos Master Contend Contend Contend
the leader!
10
ZK ZK ZK Mesos Master Mesos Master Mesos Master Fail Fail Success
the leader!
11
ZK ZK ZK Mesos Master Mesos Master Mesos Master Watch Watch Hold
“lost”
12
ZK ZK ZK Mesos Master Mesos Master Mesos Master Watch Watch Master connection lost
“lost”
13
ZK ZK ZK Mesos Master Mesos Master Mesos Master Notify Notify Master connection lost
“lost”
contend again
14
ZK ZK ZK Mesos Master Mesos Master Contend Contend Mesos Master
“lost”
contend again
15
ZK ZK ZK Mesos Master Mesos Master Success Fail Mesos Master
“lost”
contend again
16
ZK ZK ZK Mesos Master Mesos Master Watch Hold Mesos Master
17
Zookeeper to “detect” about the current leading Master
18
ZK ZK ZK Mesos Master Mesos Master Mesos Master Watch Watch Hold Mesos Agents / Frameworks Detect
Zookeeper to “detect” about the current leading Master
location
○ I.e. IP:Port
19
ZK ZK ZK Mesos Master Mesos Master Mesos Master Watch Watch Hold IP:Port Mesos Agents / Frameworks
Zookeeper to “detect” the current leading Master
location
to the “leader”
20
ZK ZK ZK Mesos Master Mesos Master Mesos Master Watch Watch Hold Connect Mesos Agents / Frameworks
Replicated Log lets you create replicated fault-tolerant append-only logs. The Mesos master uses Replicated Log to store cluster state in a replicated, durable way.
21
into ZK and maintain the presence.
22
ZK ZK ZK Replica Replica Register & hold Register & hold
23
into ZK and maintain the presence.
cluster, existing ones get notified and get to know the pid of new replica.
ZK ZK ZK Replica Replica Replica Notified with info
register Notified with info
24
pid into ZK and maintain the presence.
cluster, existing ones get notified and get to know the pid of new replica.
in the cluster and do Paxos.
ZK ZK ZK Replica Replica Replica Paxos Paxos Paxos
25
ZK
Etcd Consul
|| ||
ZK ZK
Mesos Master Mesos Master Mesos Master leader Distributed KV Store
26
ZK ZK
Mesos Master
Contender
Distributed KV Store
bool contend();
27
ZK ZK
Mesos Master
Contender
Detector Distributed KV Store
bool contend(); MasterInfo detect(MasterInfo previous);
28
bool contend(); MasterInfo detect(MasterInfo previous); void initialize(pid_t pid);
ZK ZK
Mesos Master
Contender
Detector
PIDGroup
Distributed KV Store
29
○ Master and Contender ○ Agent and Detector ○ Framework and Detector
implementation, we just write the module without having to modify Mesos itself!
ZK ZK
Mesos Master
Contender
Detector
PIDGroup
Distributed KV Store
30
○ Isolators ○ Authenticators ○ …
○ Listen to interesting events ○ Modify/enhance certain code paths ○ Prepare/enhance task environment ○ ...
31
○ E.g., libmesos_network_overlay.so
mesos-agent.sh <master-parameters>
○ E.g., the ”my_isolator” isolator will be loaded into the Agent to provide task isolation
32
33
I just wrote a Mesos module that provides a really cute feature. How do I make it useful for others!
34
○ Just the details of the subsystem being implemented (e.g., Isolators)
○ E.g., libprocess, events, futures and promises, etc.
○ To ensure mutual compatibility
35
○ Install all Mesos dependencies ○ Takes a long time to build ○ Version dependencies
36
contain everything needed to build modules
37
38
I just wrote a simple Mesos module that provide a cute feature and I know how to build it! Can I write unit tests for it?
○ How to get good test coverage? ○ How can we solicit help from community?
○ Efforts on the way to create a “libmesos_test” library that can be used to create/run gmock style tests just like with Mesos itself.
39
How do we, as a community, make third-party modules available for general consumption? While making sure the developers and consumers can seamlessly test/integrate into their environments!
40
○ E.g., github.com/mesos/modules ○ Each module (or a set of related modules) in its own repository
○ E.g., lib_my_module_<module-version>_<mesos_version>.so
41
○ Across a given set of Mesos versions ○ Work-in-progress!
○ Catch incompatibilities sooner!
42
43
44
45
○ Master detector ○ Master Contender ○ PIDGroup
ZK ZK Mesos Master
Contender
Detector
PIDGroup
Distributed KV Store
Etcd
46
47
Zookeeper
Etcd
Consul
48
49
50
51
○ https://github.com/guoger/mesos-etcd-module/tree/1.1.x ○ https://github.com/guoger/mesos/tree/pid-group-on-1.1.x