Apache ZooKeeper CMSC 491 Hadoop-Based Distributed Computing Spring 2016 Adam Shook.

Slides:



Advertisements
Similar presentations
P. Hunt, M Konar, F. Junqueira, B. Reed Presented by David Stein for ECE598YL SP12.
Advertisements

Apache ZooKeeper By Patrick Hunt, Mahadev Konar
Wait-free coordination for Internet-scale systems
Lecture 10 Sharing Resources. Basics of File Sharing The core component of any server is its ability to share files. In fact, the Server service in all.
Data Structures A data structure is a collection of data organized in some fashion that permits access to individual elements stored in the structure This.
HUG – India Meet November 28, 2009 Noida Apache ZooKeeper Aby Abraham.
Sanjay Ghemawat, Howard Gobioff and Shun-Tak Leung
0 of 37 Stacks and Queues Lecture of 37 Abstract Data Types To use a method, need to know its essentials: signature and return type o additionally,
Fundamentals of Python: From First Programs Through Data Structures
Advanced Database Discussion B Trees. Motivation for B-Trees So far we have assumed that we can store an entire data structure in main memory What if.
Flavio Junqueira, Mahadev Konar, Andrew Kornev, Benjamin Reed
The Google File System. Why? Google has lots of data –Cannot fit in traditional file system –Spans hundreds (thousands) of servers connected to (tens.
Hadoop Ecosystem Overview
ADT Stacks and Queues. Stack: Logical Level “An ordered group of homogeneous items or elements in which items are added and removed from only one end.”
Proxy Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
Deadlocks in Distributed Systems Deadlocks in distributed systems are similar to deadlocks in single processor systems, only worse. –They are harder to.
Distributed Deadlocks and Transaction Recovery.
Version Control with Subversion. What is Version Control Good For? Maintaining project/file history - so you don’t have to worry about it Managing collaboration.
1 The Google File System Reporter: You-Wei Zhang.
Data Structures - Queues
MAHADEV KONAR Apache ZooKeeper. What is ZooKeeper? A highly available, scalable, distributed coordination kernel.
CHAPTER 05 Compiled by: Dr. Mohammad Omar Alhawarat Stacks & Queues.
Robert Fourer, Jun Ma, Kipp Martin Copyright 2006 An Enterprise Computational System Built on the Optimization Services (OS) Framework and Standards Jun.
Overcast: Reliable Multicasting with an Overlay Network CS294 Paul Burstein 9/15/2003.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
October 8, 2015 University of Tulsa - Center for Information Security Microsoft Windows 2000 DNS October 8, 2015.
DCE (distributed computing environment) DCE (distributed computing environment)
Data structures and algorithms in the collection framework 1 Part 2.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Chapter 11 Heap. Overview ● The heap is a special type of binary tree. ● It may be used either as a priority queue or as a tool for sorting.
MapReduce and GFS. Introduction r To understand Google’s file system let us look at the sort of processing that needs to be done r We will look at MapReduce.
GFS. Google r Servers are a mix of commodity machines and machines specifically designed for Google m Not necessarily the fastest m Purchases are based.
A Simple Introduction to Git: a distributed version-control system CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.5 © Mitchell Wand, This.
JINI Coordination-Based System By Anthony Friel * David Kiernan * Jasper Wood.
Introduction to ZooKeeper. Agenda  What is ZooKeeper (ZK)  What ZK can do  How ZK works  ZK interface  What ZK ensures.
Collections Data structures in Java. OBJECTIVE “ WHEN TO USE WHICH DATA STRUCTURE ” D e b u g.
Motivation Large-scale distributed application require different forms of coordination: Configuration Group membership and leader election Synchronization.
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
Spring Routing: Part I Section 4.2 Outline Algorithms Scalability.
Zookeeper Wait-Free Coordination for Internet-Scale Systems.
1 Chapter 4 Unordered List. 2 Learning Objectives ● Describe the properties of an unordered list. ● Study sequential search and analyze its worst- case.
Java Object-Relational Layer Sharon Diskin GUS 3.0 Workshop June 18-21, 2002.
ZOOKEEPER. CONTENTS ZooKeeper Overview ZooKeeper Basics ZooKeeper Architecture Getting Started with ZooKeeper.
Coming up Implementation vs. Interface The Truth about variables Comparing strings HashMaps.
Detour: Distributed Systems Techniques
강호영 Contents ZooKeeper Overview ZooKeeper’s Performance ZooKeeper’s Reliability ZooKeeper’s Architecture Running Replicated ZooKeeper.
Process Management Deadlocks.
Review Array Array Elements Accessing array elements
INTRODUCTION TO PIG, HIVE, HBASE and ZOOKEEPER
Advanced Topics in Distributed and Reactive Programming
Background on the need for Synchronization
ZooKeeper Claudia Hauff.
Processes and Threads Processes and their scheduling
Stacks and Queues.
Google Filesystem Some slides taken from Alan Sussman.
Google File System CSE 454 From paper by Ghemawat, Gobioff & Leung.
Introduction to Apache ZooKeeper™
CMSC 341 Lecture 5 Stacks, Queues
DUCKS – Distributed User-mode Chirp-Knowledgeable Server
Advanced Topics in Distributed and Reactive Programming
GARRETT SINGLETARY.
Wait-free coordination for Internet-scale systems
Technical Capabilities
CS210- Lecture 5 Jun 9, 2005 Agenda Queues
Cloud Computing for Data Analysis Pig|Hive|Hbase|Zookeeper
Stacks, Queues, and Deques
Advanced Topics in Functional and Reactive Programming
ZooKeeper Justin Magnotti 9/19/18.
Java Object-Relational Layer
Pig Hive HBase Zookeeper
Presentation transcript:

Apache ZooKeeper CMSC 491 Hadoop-Based Distributed Computing Spring 2016 Adam Shook

What is it? Apache ZooKeeper is an effort to develop and maintain an open-source server which enables highly reliable distributed coordination. – Simple – Replicated – Ordered – Fast

Provides Configuration Information Distributed Synchronization Group Services Each of these services are used in some by distributed applications

Interface ZooKeeper provides a very simple interface to a highly reliable and distributed service Powerful abstractions can be built from this very simple interface Currently interfaces are in Java and C – Want to expand to Python, Perl, and REST.

The Core Shared hierarchical name space of data registers, called znodes Unlike file systems, provides clients with high throughput, low latency, highly available, and ordered access to znodes

Quorum

Namespace

znodes Meta-information: – Configuration – Status Information – Location Information – Whatever you want (that’s small)

znodes Each node acts as a file and directory 1 MB maximum per znode Persistent vs. Ephemeral Sequential znodes Full paths – An optional “chroot” suffix can be appended to connection string – “ :3000, :3002/app/a”

Watchers Tied to each znode One-time trigger Sent to the client The data for why it was sent

That’s It In a nutshell Very basic service, from which powerful abstractions can be built Let’s talk about how good it is! – That is, if you don’t have any questions right now… You can ask. I don’t bite – Really » Promise

Use Case: Location Data Servers store machine hostname as ephemeral znodes – /app1/machine1 – /app1/machine87 – /app1/machine4 When a server is added, create a new znode When a server is removed, znode is deleted When a server fails, ZK will delete the ephemeral node Allows for dynamic throttling of resources Clients can choose a hostname from children of /app1 to connect to – Set a child watch on /app1, if server goes down it will receive notification and can choose a new server

Use Case: Status Use ZooKeeper as a heartbeat mechanism “Master” service keeps data watches on znodes Servers set the data of their node every 15 seconds If the Master doesn’t receive a notification change within 20 seconds, can assume that server has failed and kill it before bad things happen.

Performance

Command Line Interface Interactive usage of the namespace in a shell – create [path] [data] – delete [path] – get [path] – set [path] – ls [path] – rmr [path] – A number of other commands… Tab completion!

API Current and stable v3.4.6 (March 2014) Requires only a list of ZK servers to connect IMO, good but messy interface Recommend building a nice wrapper API for getting/setting POD types and handling exceptions

Recipes! We are going to talk about these: Configuration Distributed Locks Distributed Queue

Configuration Configuration is often driven through key/value pairs stored in a file – Can get messy when configuration is dynamic Implementation is very straightforward, as it is what ZooKeeper was designed for Each full-pathed znode is the key and the data associated with the znode is the value

Variables Static Variables – Those ones that are probably never going to change (not as much fun) Dynamic Variables – Changed by hand via command line or by the application itself Track status of processes Update historical data

Use of Watchers Applications can change configuration on the fly for some variables Whenever a variable changes, those watching a node can receive the changed variable and make the correct changes Very useful for long-running applications that require the most up to date information

Distributed Locks A means to have distributed processes retrieve a lock for some operation – Throttled updating of database – Your use case here! Exists in ZooKeeper's recipes directory and is distributed with the release -- src/recipes/lock

Algorithm Define a znode to hold the lock, say “/dlock” 1.mypath = create(“/dlock/lock-”), with the sequence and ephemeral flags set 2.children = getChildren(“/dlock”), no watch 3.If mypath has lowest number suffix in chlidren, exit 4.Call exists() on node from children with next lowest sequence number with the watch flag set 1.i.e., if mypath is “/dlock/lock-6” and children contains 3,4,6, 7, call exists on “/dlock/lock-4” 5.If exists is false, go to step 2 6.If true, wait for watch trigger before going to step 2

Distributed Queues A means to allow clients to asynchronously add elements to a queue and have a single processor application dequeue and process them. – I can’t remember the last time I needed a queue – Maybe you have a few

Algorithm Designate a znode to hold the queue, say “/dqueue” Enqueue: create(“/dqueue/queue-”), with sequence and ephemeral flags set. – Returns a real path node /dqueue/queue-X, where X is a monotonic increasing number Dequeue: getChildren(“/dqueue”), watch set to true Process these nodes with the lowest number first – No need to call getChildren() until the current received list is exhausted If no children are in the queue, wait for watch notification before checking again

Priority Queue Extension Two simple modifications to this algorithm! – When enqueuing, pathnames ends with queue-ZZ, where ZZ is the priority of the element Lower the number, higher the priority – When dequeuing, if the watch notification is triggered on the “/dqueue” node, client needs to call getChildren() again and resort by priority.

Other Recipes Group membership Barriers Two-phased commit Leader Election

Apache Curator "Curator n ˈkyoor͝ˌātər: a keeper or custodian of a museum or other collection - A ZooKeeper Keeper.“ Contains: Recipes Framework Utilities Client Errors Extensions

References