Apache ZooKeeper 1

14 Slides1.28 MB

Apache ZooKeeper 1

Why Needed ? 1)Distributed systems always need some form of coordination 2)Programmers cannot use locks correctly 3)Message based coordination can be hard to use in some applications 2

Why Not Needed in Hadoop & DDBMSs Already has built-in Concurrency Control Read-Only and no need for CC or Synchronization 3

Objectives Simple, Robust, Good Performance High Availability, High throughput, Low Latency Tuned for Read dominant workloads Familiar models and interfaces Wait-Free: A slow/failed client will not interfere with the requests of a fast client 4

Data Model One znode 1)Hierarchal namespace (like a file / system) services YaView servers 2)Each node is called “znode” stupidname morestupidity locks 3)Each znode has data and children read-1 apps The entire Zookeeper tree is kept in main memory users 5

What is stored in ZNodes Configurations Status Counters Parameters Location information Keeps metadata information Does not store big datasets 6

ZooKeeper Servers ZooKeeper Service Leader Server Client Client Server Client Server Client Server Client Client Server Client Client 1)All servers store a copy of the data tree (in memory) 2)A leader is elected at startup 3)Followers service clients 4)A client establish a connection with one server 7

ZooKeeper Servers / / services / / services YaView servers read-1 apps users locks read-1 read-1 read-1 apps apps users users apps users Server Client morestupidity locks locks Leader stupidname morestupidity morestupidity locks read-1 apps servers stupidname stupidname morestupidity locks YaView servers servers stupidname morestupidity services YaView YaView servers stupidname / services services YaView Client Server Client users Server Client Server Client Client Server Client Client Simple, Robust, Good Performance High Availability, High throughput, Low Latency Tuned for Read dominant workloads Familiar models and interfaces Wait-Free: A slow/failed client will not interfere with the requests of a fast client 8

ZooKeeper Reads/Writes/Watches ZooKeeper Service Leader Server Client Client Server Client Server Client Server Client Client Server Client Client 1)Reads: between the client and single server 2)Writes: sent between servers first, get consensus, then respond back 3)Watches: between the client and single server A watch on a znode basically means “monitoring it” 9

ZooKeeper API String create(path, data, ACL, flags) void delete(path, expectedVersion) Stat setData(path, data, expectedVersion) / (data, Stat) getData(path, watch) services YaView servers Stat exists(path, watch) stupidname morestupidity String[] getChildren(path, watch) locks read-1 apps 10 users

ZooKeeper Servers / / services / / services YaView servers read-1 apps users locks read-1 read-1 read-1 apps apps users users apps users Server Client morestupidity locks locks Leader stupidname morestupidity morestupidity locks read-1 apps servers stupidname stupidname morestupidity locks YaView servers servers stupidname morestupidity services YaView YaView servers stupidname / services services YaView Client Server Client users Server Client Server Client Client Server Client Client Simple, Robust, Good Performance High Availability, High throughput, Low Latency Tuned for Read dominant workloads Familiar models and interfaces Wait-Free: A slow/failed client will not interfere with the requests of a fast client 11

Example 1)A client submits a request to start jobtracker and a set of tasktrackers to torque 2)The ip address and the ports that the jobtracker will bind to is not known apriori Torque 3)The tasktrackers need to find the jobtracker 4)The client needs to find the jobtracker Client JT TT TT TT 12

with ZooKeeper Torque Client JT ZooKeeper create /hod/jt- Ephemeral Sequence TT / TT /hod/jt-1 TT hod 13

HOD with ZooKeeper When the client spawns the TT and JT tasks in torque, it passes the path of the newly create znode (/hod/jt-1) as a startup parameter. The client and TT watch the znode for data populated by JT. JT and TT watch the existence of the znode and exit if it goes away. TT TT Torque JT TT setData /hod/jt-1 contact info Client ZooKeeper getData /hod/jt-1 true / hod jt-1 14

Related Articles

Back to top button