Added: dev/zookeeper/zookeeper-3.9.2-candidate-0/website/zookeeperTutorial.html
==============================================================================
--- dev/zookeeper/zookeeper-3.9.2-candidate-0/website/zookeeperTutorial.html 
(added)
+++ dev/zookeeper/zookeeper-3.9.2-candidate-0/website/zookeeperTutorial.html 
Mon Feb 12 21:24:47 2024
@@ -0,0 +1,736 @@
+
+<!DOCTYPE html>
+<html>
+<head>
+    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <title>ZooKeeper: Because Coordinating Distributed Systems is a Zoo</title>
+    <link type="text/css" href="skin/basic.css" rel="stylesheet">
+    <link media="screen" type="text/css" href="skin/screen.css" 
rel="stylesheet">
+    <link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
+    <link type="text/css" href="skin/profile.css" rel="stylesheet">
+    <script src="skin/getBlank.js" language="javascript" 
type="text/javascript"></script>
+    <script src="skin/getMenu.js" language="javascript" 
type="text/javascript"></script>
+    <script src="skin/init.js" language="javascript" 
type="text/javascript"></script>
+    <link rel="shortcut icon" href="images/favicon.ico">
+</head>
+<body onload="init();">
+<div id="top">
+    <div class="breadtrail">
+        <a href="http://www.apache.org/";>Apache</a> &gt; <a 
href="http://zookeeper.apache.org/";>ZooKeeper</a>
+    </div>
+    <div class="header">
+        <div class="projectlogo">
+            <a href="http://zookeeper.apache.org/";><img class="logoImage" 
alt="ZooKeeper" src="images/zookeeper_small.gif" title="ZooKeeper: distributed 
coordination"></a>
+        </div>
+        <div class="searchbox">
+            <form action="http://www.google.com/search"; method="get">
+                <input value="zookeeper.apache.org" name="sitesearch" 
type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" 
size="25" name="q" id="query" type="text" value="Search the site with 
google">&nbsp;
+                <input name="Search" value="Search" type="submit">
+            </form>
+        </div>
+        <ul id="tabs">
+            <li>
+                <a class="unselected" 
href="http://zookeeper.apache.org/";>Project</a>
+            </li>
+            <li>
+                <a class="unselected" 
href="https://cwiki.apache.org/confluence/display/ZOOKEEPER/";>Wiki</a>
+            </li>
+            <li class="current">
+                <a class="selected" href="index.html">ZooKeeper 3.9 
Documentation</a>
+            </li>
+        </ul>
+    </div>
+</div>
+<div id="main">
+    <div id="publishedStrip">
+        <div id="level2tabs"></div>
+        <script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+    </div>
+    <div class="breadtrail">
+        &nbsp;
+    </div>
+    <div id="menu">
+        <div onclick="SwitchMenu('menu_1', 'skin/')" id="menu_1Title" 
class="menutitle">Overview</div>
+        <div id="menu_1" class="menuitemgroup">
+            <div class="menuitem">
+                <a href="index.html">Welcome</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperOver.html">Overview</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperStarted.html">Getting Started</a>
+            </div>
+            <div class="menuitem">
+                <a href="releasenotes.html">Release Notes</a>
+            </div>
+        </div>
+        <div onclick="SwitchMenu('menu_2', 'skin/')" id="menu_2Title" 
class="menutitle">Developer</div>
+        <div id="menu_2" class="menuitemgroup">
+            <div class="menuitem">
+                <a href="apidocs/zookeeper-server/index.html">API Docs</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperProgrammers.html">Programmer's Guide</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperUseCases.html">Use Cases</a>
+            </div>
+            <div class="menuitem">
+                <a href="javaExample.html">Java Example</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperTutorial.html">Barrier and Queue Tutorial</a>
+            </div>
+            <div class="menuitem">
+                <a href="recipes.html">Recipes</a>
+            </div>
+        </div>
+        <div onclick="SwitchMenu('menu_3', 'skin/')" id="menu_3Title" 
class="menutitle">Admin &amp; Ops</div>
+        <div id="menu_3" class="menuitemgroup">
+            <div class="menuitem">
+                <a href="zookeeperAdmin.html">Administrator's Guide</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperQuotas.html">Quota Guide</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperSnapshotAndRestore.html">Snapshot and 
Restore Guide</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperJMX.html">JMX</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperHierarchicalQuorums.html">Hierarchical 
Quorums</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperOracleQuorums.html">Oracle Quorum</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperObservers.html">Observers Guide</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperReconfig.html">Dynamic Reconfiguration</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperCLI.html">ZooKeeper CLI</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperTools.html">ZooKeeper Tools</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperMonitor.html">ZooKeeper Monitor</a>
+            </div>
+                       <div class="menuitem">
+                <a href="zookeeperAuditLogs.html">Audit Logs</a>
+            </div>
+        </div>
+        <div onclick="SwitchMenu('menu_4', 'skin/')" id="menu_4Title" 
class="menutitle">Contributor</div>
+        <div id="menu_4" class="menuitemgroup">
+            <div class="menuitem">
+                <a href="zookeeperInternals.html">ZooKeeper Internals</a>
+            </div>
+        </div>
+        <div onclick="SwitchMenu('menu_5', 'skin/')" id="menu_5Title" 
class="menutitle">Miscellaneous</div>
+        <div id="menu_5" class="menuitemgroup">
+            <div class="menuitem">
+                <a 
href="https://cwiki.apache.org/confluence/display/ZOOKEEPER";>Wiki</a>
+            </div>
+            <div class="menuitem">
+                <a 
href="https://cwiki.apache.org/confluence/display/ZOOKEEPER/FAQ";>FAQ</a>
+            </div>
+            <div class="menuitem">
+                <a 
href="http://zookeeper.apache.org/mailing_lists.html";>Mailing Lists</a>
+            </div>
+        </div>
+    </div>
+    <div id="content">
+<!--
+Copyright 2002-2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+//-->
+<h1>Programming with ZooKeeper - A basic tutorial</h1>
+<ul>
+<li><a href="#ch_Introduction">Introduction</a></li>
+<li><a href="#sc_barriers">Barriers</a></li>
+<li><a href="#sc_producerConsumerQueues">Producer-Consumer Queues</a></li>
+<li><a href="#Complete+example">Complete example</a>
+<ul>
+<li><a href="#Queue+test">Queue test</a></li>
+<li><a href="#Barrier+test">Barrier test</a></li>
+<li><a href="#sc_sourceListing">Source Listing</a></li>
+</ul>
+</li>
+</ul>
+<p><a name="ch_Introduction"></a></p>
+<h2>Introduction</h2>
+<p>In this tutorial, we show simple implementations of barriers and 
producer-consumer queues using ZooKeeper. We call the respective classes 
Barrier and Queue. These examples assume that you have at least one ZooKeeper 
server running.</p>
+<p>Both primitives use the following common excerpt of code:</p>
+<pre><code>static ZooKeeper zk = null;
+static Integer mutex;
+
+String root;
+
+SyncPrimitive(String address) {
+    if(zk == null){
+        try {
+            System.out.println(&quot;Starting ZK:&quot;);
+            zk = new ZooKeeper(address, 3000, this);
+            mutex = new Integer(-1);
+            System.out.println(&quot;Finished starting ZK: &quot; + zk);
+        } catch (IOException e) {
+            System.out.println(e.toString());
+            zk = null;
+        }
+    }
+}
+
+synchronized public void process(WatchedEvent event) {
+    synchronized (mutex) {
+        mutex.notify();
+    }
+}
+</code></pre>
+<p>Both classes extend SyncPrimitive. In this way, we execute steps that are 
common to all primitives in the constructor of SyncPrimitive. To keep the 
examples simple, we create a ZooKeeper object the first time we instantiate 
either a barrier object or a queue object, and we declare a static variable 
that is a reference to this object. The subsequent instances of Barrier and 
Queue check whether a ZooKeeper object exists. Alternatively, we could have the 
application creating a ZooKeeper object and passing it to the constructor of 
Barrier and Queue.</p>
+<p>We use the process() method to process notifications triggered due to 
watches. In the following discussion, we present code that sets watches. A 
watch is internal structure that enables ZooKeeper to notify a client of a 
change to a node. For example, if a client is waiting for other clients to 
leave a barrier, then it can set a watch and wait for modifications to a 
particular node, which can indicate that it is the end of the wait. This point 
becomes clear once we go over the examples.</p>
+<p><a name="sc_barriers"></a></p>
+<h2>Barriers</h2>
+<p>A barrier is a primitive that enables a group of processes to synchronize 
the beginning and the end of a computation. The general idea of this 
implementation is to have a barrier node that serves the purpose of being a 
parent for individual process nodes. Suppose that we call the barrier node 
&quot;/b1&quot;. Each process &quot;p&quot; then creates a node 
&quot;/b1/p&quot;. Once enough processes have created their corresponding 
nodes, joined processes can start the computation.</p>
+<p>In this example, each process instantiates a Barrier object, and its 
constructor takes as parameters:</p>
+<ul>
+<li>the address of a ZooKeeper server (e.g., 
&quot;zoo1.foo.com:2181&quot;)</li>
+<li>the path of the barrier node on ZooKeeper (e.g., &quot;/b1&quot;)</li>
+<li>the size of the group of processes</li>
+</ul>
+<p>The constructor of Barrier passes the address of the Zookeeper server to 
the constructor of the parent class. The parent class creates a ZooKeeper 
instance if one does not exist. The constructor of Barrier then creates a 
barrier node on ZooKeeper, which is the parent node of all process nodes, and 
we call root (<strong>Note:</strong> This is not the ZooKeeper root 
&quot;/&quot;).</p>
+<pre><code>/**
+ * Barrier constructor
+ *
+ * @param address
+ * @param root
+ * @param size
+ */
+Barrier(String address, String root, int size) {
+    super(address);
+    this.root = root;
+    this.size = size;
+    // Create barrier node
+    if (zk != null) {
+        try {
+            Stat s = zk.exists(root, false);
+            if (s == null) {
+                zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE,
+                        CreateMode.PERSISTENT);
+            }
+        } catch (KeeperException e) {
+            System.out
+                    .println(&quot;Keeper exception when instantiating queue: 
&quot;
+                            + e.toString());
+        } catch (InterruptedException e) {
+            System.out.println(&quot;Interrupted exception&quot;);
+        }
+    }
+
+    // My node name
+    try {
+        name = new 
String(InetAddress.getLocalHost().getCanonicalHostName().toString());
+    } catch (UnknownHostException e) {
+        System.out.println(e.toString());
+    }
+}
+</code></pre>
+<p>To enter the barrier, a process calls enter(). The process creates a node 
under the root to represent it, using its host name to form the node name. It 
then wait until enough processes have entered the barrier. A process does it by 
checking the number of children the root node has with 
&quot;getChildren()&quot;, and waiting for notifications in the case it does 
not have enough. To receive a notification when there is a change to the root 
node, a process has to set a watch, and does it through the call to 
&quot;getChildren()&quot;. In the code, we have that &quot;getChildren()&quot; 
has two parameters. The first one states the node to read from, and the second 
is a boolean flag that enables the process to set a watch. In the code the flag 
is true.</p>
+<pre><code>/**
+ * Join barrier
+ *
+ * @return
+ * @throws KeeperException
+ * @throws InterruptedException
+ */
+
+boolean enter() throws KeeperException, InterruptedException{
+    zk.create(root + &quot;/&quot; + name, new byte[0], Ids.OPEN_ACL_UNSAFE,
+            CreateMode.EPHEMERAL);
+    while (true) {
+        synchronized (mutex) {
+            List&lt;String&gt; list = zk.getChildren(root, true);
+
+            if (list.size() &lt; size) {
+                mutex.wait();
+            } else {
+                return true;
+            }
+        }
+    }
+}
+</code></pre>
+<p>Note that enter() throws both KeeperException and InterruptedException, so 
it is the responsibility of the application to catch and handle such 
exceptions.</p>
+<p>Once the computation is finished, a process calls leave() to leave the 
barrier. First it deletes its corresponding node, and then it gets the children 
of the root node. If there is at least one child, then it waits for a 
notification (obs: note that the second parameter of the call to getChildren() 
is true, meaning that ZooKeeper has to set a watch on the root node). Upon 
reception of a notification, it checks once more whether the root node has any 
children.</p>
+<pre><code>/**
+ * Wait until all reach barrier
+ *
+ * @return
+ * @throws KeeperException
+ * @throws InterruptedException
+ */
+
+boolean leave() throws KeeperException, InterruptedException {
+    zk.delete(root + &quot;/&quot; + name, 0);
+    while (true) {
+        synchronized (mutex) {
+            List&lt;String&gt; list = zk.getChildren(root, true);
+                if (list.size() &gt; 0) {
+                    mutex.wait();
+                } else {
+                    return true;
+                }
+            }
+        }
+    }
+</code></pre>
+<p><a name="sc_producerConsumerQueues"></a></p>
+<h2>Producer-Consumer Queues</h2>
+<p>A producer-consumer queue is a distributed data structure that groups of 
processes use to generate and consume items. Producer processes create new 
elements and add them to the queue. Consumer processes remove elements from the 
list, and process them. In this implementation, the elements are simple 
integers. The queue is represented by a root node, and to add an element to the 
queue, a producer process creates a new node, a child of the root node.</p>
+<p>The following excerpt of code corresponds to the constructor of the object. 
As with Barrier objects, it first calls the constructor of the parent class, 
SyncPrimitive, that creates a ZooKeeper object if one doesn't exist. It then 
verifies if the root node of the queue exists, and creates if it doesn't.</p>
+<pre><code>/**
+ * Constructor of producer-consumer queue
+ *
+ * @param address
+ * @param name
+ */
+Queue(String address, String name) {
+    super(address);
+    this.root = name;
+    // Create ZK node name
+    if (zk != null) {
+        try {
+            Stat s = zk.exists(root, false);
+            if (s == null) {
+                zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE,
+                        CreateMode.PERSISTENT);
+            }
+        } catch (KeeperException e) {
+            System.out
+                    .println(&quot;Keeper exception when instantiating queue: 
&quot;
+                            + e.toString());
+        } catch (InterruptedException e) {
+            System.out.println(&quot;Interrupted exception&quot;);
+        }
+    }
+}
+</code></pre>
+<p>A producer process calls &quot;produce()&quot; to add an element to the 
queue, and passes an integer as an argument. To add an element to the queue, 
the method creates a new node using &quot;create()&quot;, and uses the SEQUENCE 
flag to instruct ZooKeeper to append the value of the sequencer counter 
associated to the root node. In this way, we impose a total order on the 
elements of the queue, thus guaranteeing that the oldest element of the queue 
is the next one consumed.</p>
+<pre><code>/**
+ * Add element to the queue.
+ *
+ * @param i
+ * @return
+ */
+
+boolean produce(int i) throws KeeperException, InterruptedException{
+    ByteBuffer b = ByteBuffer.allocate(4);
+    byte[] value;
+
+    // Add child with value i
+    b.putInt(i);
+    value = b.array();
+    zk.create(root + &quot;/element&quot;, value, Ids.OPEN_ACL_UNSAFE,
+                CreateMode.PERSISTENT_SEQUENTIAL);
+
+    return true;
+}
+</code></pre>
+<p>To consume an element, a consumer process obtains the children of the root 
node, reads the node with smallest counter value, and returns the element. Note 
that if there is a conflict, then one of the two contending processes won't be 
able to delete the node and the delete operation will throw an exception.</p>
+<p>A call to getChildren() returns the list of children in lexicographic 
order. As lexicographic order does not necessarily follow the numerical order 
of the counter values, we need to decide which element is the smallest. To 
decide which one has the smallest counter value, we traverse the list, and 
remove the prefix &quot;element&quot; from each one.</p>
+<pre><code>/**
+ * Remove first element from the queue.
+ *
+ * @return
+ * @throws KeeperException
+ * @throws InterruptedException
+ */
+int consume() throws KeeperException, InterruptedException{
+    int retvalue = -1;
+    Stat stat = null;
+
+    // Get the first element available
+    while (true) {
+        synchronized (mutex) {
+            List&lt;String&gt; list = zk.getChildren(root, true);
+            if (list.size() == 0) {
+                System.out.println(&quot;Going to wait&quot;);
+                mutex.wait();
+            } else {
+                Integer min = new Integer(list.get(0).substring(7));
+                for(String s : list){
+                    Integer tempValue = new Integer(s.substring(7));
+                    //System.out.println(&quot;Temporary value: &quot; + 
tempValue);
+                    if(tempValue &lt; min) min = tempValue;
+                }
+                System.out.println(&quot;Temporary value: &quot; + root + 
&quot;/element&quot; + min);
+                byte[] b = zk.getData(root + &quot;/element&quot; + min,
+                            false, stat);
+                zk.delete(root + &quot;/element&quot; + min, 0);
+                ByteBuffer buffer = ByteBuffer.wrap(b);
+                retvalue = buffer.getInt();
+
+                return retvalue;
+                }
+            }
+        }
+    }
+}
+</code></pre>
+<p><a name="Complete+example"></a></p>
+<h2>Complete example</h2>
+<p>In the following section you can find a complete command line application 
to demonstrate the above mentioned recipes. Use the following command to run 
it.</p>
+<pre><code>ZOOBINDIR=&quot;[path_to_distro]/bin&quot;
+. &quot;$ZOOBINDIR&quot;/zkEnv.sh
+java SyncPrimitive [Test Type] [ZK server] [No of elements] [Client type]
+</code></pre>
+<p><a name="Queue+test"></a></p>
+<h3>Queue test</h3>
+<p>Start a producer to create 100 elements</p>
+<pre><code>java SyncPrimitive qTest localhost 100 p
+</code></pre>
+<p>Start a consumer to consume 100 elements</p>
+<pre><code>java SyncPrimitive qTest localhost 100 c
+</code></pre>
+<p><a name="Barrier+test"></a></p>
+<h3>Barrier test</h3>
+<p>Start a barrier with 2 participants (start as many times as many 
participants you'd like to enter)</p>
+<pre><code>java SyncPrimitive bTest localhost 2
+</code></pre>
+<p><a name="sc_sourceListing"></a></p>
+<h3>Source Listing</h3>
+<h4>SyncPrimitive.Java</h4>
+<pre><code>import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.data.Stat;
+
+public class SyncPrimitive implements Watcher {
+
+    static ZooKeeper zk = null;
+    static Integer mutex;
+    String root;
+
+    SyncPrimitive(String address) {
+        if(zk == null){
+            try {
+                System.out.println(&quot;Starting ZK:&quot;);
+                zk = new ZooKeeper(address, 3000, this);
+                mutex = new Integer(-1);
+                System.out.println(&quot;Finished starting ZK: &quot; + zk);
+            } catch (IOException e) {
+                System.out.println(e.toString());
+                zk = null;
+            }
+        }
+        //else mutex = new Integer(-1);
+    }
+
+    synchronized public void process(WatchedEvent event) {
+        synchronized (mutex) {
+            //System.out.println(&quot;Process: &quot; + event.getType());
+            mutex.notify();
+        }
+    }
+
+    /**
+     * Barrier
+     */
+    static public class Barrier extends SyncPrimitive {
+        int size;
+        String name;
+
+        /**
+         * Barrier constructor
+         *
+         * @param address
+         * @param root
+         * @param size
+         */
+        Barrier(String address, String root, int size) {
+            super(address);
+            this.root = root;
+            this.size = size;
+
+            // Create barrier node
+            if (zk != null) {
+                try {
+                    Stat s = zk.exists(root, false);
+                    if (s == null) {
+                        zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE,
+                                CreateMode.PERSISTENT);
+                    }
+                } catch (KeeperException e) {
+                    System.out
+                            .println(&quot;Keeper exception when instantiating 
queue: &quot;
+                                    + e.toString());
+                } catch (InterruptedException e) {
+                    System.out.println(&quot;Interrupted exception&quot;);
+                }
+            }
+
+            // My node name
+            try {
+                name = new 
String(InetAddress.getLocalHost().getCanonicalHostName().toString());
+            } catch (UnknownHostException e) {
+                System.out.println(e.toString());
+            }
+
+        }
+
+        /**
+         * Join barrier
+         *
+         * @return
+         * @throws KeeperException
+         * @throws InterruptedException
+         */
+
+        boolean enter() throws KeeperException, InterruptedException{
+            zk.create(root + &quot;/&quot; + name, new byte[0], 
Ids.OPEN_ACL_UNSAFE,
+                    CreateMode.EPHEMERAL);
+            while (true) {
+                synchronized (mutex) {
+                    List&lt;String&gt; list = zk.getChildren(root, true);
+
+                    if (list.size() &lt; size) {
+                        mutex.wait();
+                    } else {
+                        return true;
+                    }
+                }
+            }
+        }
+
+        /**
+         * Wait until all reach barrier
+         *
+         * @return
+         * @throws KeeperException
+         * @throws InterruptedException
+         */
+        boolean leave() throws KeeperException, InterruptedException{
+            zk.delete(root + &quot;/&quot; + name, 0);
+            while (true) {
+                synchronized (mutex) {
+                    List&lt;String&gt; list = zk.getChildren(root, true);
+                        if (list.size() &gt; 0) {
+                            mutex.wait();
+                        } else {
+                            return true;
+                        }
+                    }
+                }
+            }
+        }
+
+    /**
+     * Producer-Consumer queue
+     */
+    static public class Queue extends SyncPrimitive {
+
+        /**
+         * Constructor of producer-consumer queue
+         *
+         * @param address
+         * @param name
+         */
+        Queue(String address, String name) {
+            super(address);
+            this.root = name;
+            // Create ZK node name
+            if (zk != null) {
+                try {
+                    Stat s = zk.exists(root, false);
+                    if (s == null) {
+                        zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE,
+                                CreateMode.PERSISTENT);
+                    }
+                } catch (KeeperException e) {
+                    System.out
+                            .println(&quot;Keeper exception when instantiating 
queue: &quot;
+                                    + e.toString());
+                } catch (InterruptedException e) {
+                    System.out.println(&quot;Interrupted exception&quot;);
+                }
+            }
+        }
+
+        /**
+         * Add element to the queue.
+         *
+         * @param i
+         * @return
+         */
+
+        boolean produce(int i) throws KeeperException, InterruptedException{
+            ByteBuffer b = ByteBuffer.allocate(4);
+            byte[] value;
+
+            // Add child with value i
+            b.putInt(i);
+            value = b.array();
+            zk.create(root + &quot;/element&quot;, value, Ids.OPEN_ACL_UNSAFE,
+                        CreateMode.PERSISTENT_SEQUENTIAL);
+
+            return true;
+        }
+
+        /**
+         * Remove first element from the queue.
+         *
+         * @return
+         * @throws KeeperException
+         * @throws InterruptedException
+         */
+        int consume() throws KeeperException, InterruptedException{
+            int retvalue = -1;
+            Stat stat = null;
+
+            // Get the first element available
+            while (true) {
+                synchronized (mutex) {
+                    List&lt;String&gt; list = zk.getChildren(root, true);
+                    if (list.size() == 0) {
+                        System.out.println(&quot;Going to wait&quot;);
+                        mutex.wait();
+                    } else {
+                        Integer min = new Integer(list.get(0).substring(7));
+                        String minNode = list.get(0);
+                        for(String s : list){
+                            Integer tempValue = new Integer(s.substring(7));
+                            //System.out.println(&quot;Temporary value: &quot; 
+ tempValue);
+                            if(tempValue &lt; min) {
+                                min = tempValue;
+                                minNode = s;
+                            }
+                        }
+                        System.out.println(&quot;Temporary value: &quot; + 
root + &quot;/&quot; + minNode);
+                        byte[] b = zk.getData(root + &quot;/&quot; + minNode,
+                        false, stat);
+                        zk.delete(root + &quot;/&quot; + minNode, 0);
+                        ByteBuffer buffer = ByteBuffer.wrap(b);
+                        retvalue = buffer.getInt();
+
+                        return retvalue;
+                    }
+                }
+            }
+        }
+    }
+
+    public static void main(String args[]) {
+        if (args[0].equals(&quot;qTest&quot;))
+            queueTest(args);
+        else
+            barrierTest(args);
+    }
+
+    public static void queueTest(String args[]) {
+        Queue q = new Queue(args[1], &quot;/app1&quot;);
+
+        System.out.println(&quot;Input: &quot; + args[1]);
+        int i;
+        Integer max = new Integer(args[2]);
+
+        if (args[3].equals(&quot;p&quot;)) {
+            System.out.println(&quot;Producer&quot;);
+            for (i = 0; i &lt; max; i++)
+                try{
+                    q.produce(10 + i);
+                } catch (KeeperException e){
+
+                } catch (InterruptedException e){
+
+                }
+        } else {
+            System.out.println(&quot;Consumer&quot;);
+
+            for (i = 0; i &lt; max; i++) {
+                try{
+                    int r = q.consume();
+                    System.out.println(&quot;Item: &quot; + r);
+                } catch (KeeperException e){
+                    i--;
+                } catch (InterruptedException e){
+                }
+            }
+        }
+    }
+
+    public static void barrierTest(String args[]) {
+        Barrier b = new Barrier(args[1], &quot;/b1&quot;, new 
Integer(args[2]));
+        try{
+            boolean flag = b.enter();
+            System.out.println(&quot;Entered barrier: &quot; + args[2]);
+            if(!flag) System.out.println(&quot;Error when entering the 
barrier&quot;);
+        } catch (KeeperException e){
+        } catch (InterruptedException e){
+        }
+
+        // Generate random integer
+        Random rand = new Random();
+        int r = rand.nextInt(100);
+        // Loop for rand iterations
+        for (int i = 0; i &lt; r; i++) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+            }
+        }
+        try{
+            b.leave();
+        } catch (KeeperException e){
+
+        } catch (InterruptedException e){
+
+        }
+        System.out.println(&quot;Left barrier&quot;);
+    }
+}
+</code></pre>
+</div>
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+    <div class="lastmodified">
+        <script type="text/javascript">
+        <!--
+            document.write("Last Published: " + document.lastModified);
+        //  -->
+        </script>
+    </div>
+    <div class="copyright">
+        Copyright &copy; <a href="http://www.apache.org/licenses/";>The Apache 
Software Foundation.</a>
+    </div>
+    <div id="logos"></div>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: dev/zookeeper/zookeeper-3.9.2-candidate-0/website/zookeeperUseCases.html
==============================================================================
--- dev/zookeeper/zookeeper-3.9.2-candidate-0/website/zookeeperUseCases.html 
(added)
+++ dev/zookeeper/zookeeper-3.9.2-candidate-0/website/zookeeperUseCases.html 
Mon Feb 12 21:24:47 2024
@@ -0,0 +1,538 @@
+
+<!DOCTYPE html>
+<html>
+<head>
+    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <title>ZooKeeper: Because Coordinating Distributed Systems is a Zoo</title>
+    <link type="text/css" href="skin/basic.css" rel="stylesheet">
+    <link media="screen" type="text/css" href="skin/screen.css" 
rel="stylesheet">
+    <link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
+    <link type="text/css" href="skin/profile.css" rel="stylesheet">
+    <script src="skin/getBlank.js" language="javascript" 
type="text/javascript"></script>
+    <script src="skin/getMenu.js" language="javascript" 
type="text/javascript"></script>
+    <script src="skin/init.js" language="javascript" 
type="text/javascript"></script>
+    <link rel="shortcut icon" href="images/favicon.ico">
+</head>
+<body onload="init();">
+<div id="top">
+    <div class="breadtrail">
+        <a href="http://www.apache.org/";>Apache</a> &gt; <a 
href="http://zookeeper.apache.org/";>ZooKeeper</a>
+    </div>
+    <div class="header">
+        <div class="projectlogo">
+            <a href="http://zookeeper.apache.org/";><img class="logoImage" 
alt="ZooKeeper" src="images/zookeeper_small.gif" title="ZooKeeper: distributed 
coordination"></a>
+        </div>
+        <div class="searchbox">
+            <form action="http://www.google.com/search"; method="get">
+                <input value="zookeeper.apache.org" name="sitesearch" 
type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" 
size="25" name="q" id="query" type="text" value="Search the site with 
google">&nbsp;
+                <input name="Search" value="Search" type="submit">
+            </form>
+        </div>
+        <ul id="tabs">
+            <li>
+                <a class="unselected" 
href="http://zookeeper.apache.org/";>Project</a>
+            </li>
+            <li>
+                <a class="unselected" 
href="https://cwiki.apache.org/confluence/display/ZOOKEEPER/";>Wiki</a>
+            </li>
+            <li class="current">
+                <a class="selected" href="index.html">ZooKeeper 3.9 
Documentation</a>
+            </li>
+        </ul>
+    </div>
+</div>
+<div id="main">
+    <div id="publishedStrip">
+        <div id="level2tabs"></div>
+        <script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+    </div>
+    <div class="breadtrail">
+        &nbsp;
+    </div>
+    <div id="menu">
+        <div onclick="SwitchMenu('menu_1', 'skin/')" id="menu_1Title" 
class="menutitle">Overview</div>
+        <div id="menu_1" class="menuitemgroup">
+            <div class="menuitem">
+                <a href="index.html">Welcome</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperOver.html">Overview</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperStarted.html">Getting Started</a>
+            </div>
+            <div class="menuitem">
+                <a href="releasenotes.html">Release Notes</a>
+            </div>
+        </div>
+        <div onclick="SwitchMenu('menu_2', 'skin/')" id="menu_2Title" 
class="menutitle">Developer</div>
+        <div id="menu_2" class="menuitemgroup">
+            <div class="menuitem">
+                <a href="apidocs/zookeeper-server/index.html">API Docs</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperProgrammers.html">Programmer's Guide</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperUseCases.html">Use Cases</a>
+            </div>
+            <div class="menuitem">
+                <a href="javaExample.html">Java Example</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperTutorial.html">Barrier and Queue Tutorial</a>
+            </div>
+            <div class="menuitem">
+                <a href="recipes.html">Recipes</a>
+            </div>
+        </div>
+        <div onclick="SwitchMenu('menu_3', 'skin/')" id="menu_3Title" 
class="menutitle">Admin &amp; Ops</div>
+        <div id="menu_3" class="menuitemgroup">
+            <div class="menuitem">
+                <a href="zookeeperAdmin.html">Administrator's Guide</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperQuotas.html">Quota Guide</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperSnapshotAndRestore.html">Snapshot and 
Restore Guide</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperJMX.html">JMX</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperHierarchicalQuorums.html">Hierarchical 
Quorums</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperOracleQuorums.html">Oracle Quorum</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperObservers.html">Observers Guide</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperReconfig.html">Dynamic Reconfiguration</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperCLI.html">ZooKeeper CLI</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperTools.html">ZooKeeper Tools</a>
+            </div>
+            <div class="menuitem">
+                <a href="zookeeperMonitor.html">ZooKeeper Monitor</a>
+            </div>
+                       <div class="menuitem">
+                <a href="zookeeperAuditLogs.html">Audit Logs</a>
+            </div>
+        </div>
+        <div onclick="SwitchMenu('menu_4', 'skin/')" id="menu_4Title" 
class="menutitle">Contributor</div>
+        <div id="menu_4" class="menuitemgroup">
+            <div class="menuitem">
+                <a href="zookeeperInternals.html">ZooKeeper Internals</a>
+            </div>
+        </div>
+        <div onclick="SwitchMenu('menu_5', 'skin/')" id="menu_5Title" 
class="menutitle">Miscellaneous</div>
+        <div id="menu_5" class="menuitemgroup">
+            <div class="menuitem">
+                <a 
href="https://cwiki.apache.org/confluence/display/ZOOKEEPER";>Wiki</a>
+            </div>
+            <div class="menuitem">
+                <a 
href="https://cwiki.apache.org/confluence/display/ZOOKEEPER/FAQ";>FAQ</a>
+            </div>
+            <div class="menuitem">
+                <a 
href="http://zookeeper.apache.org/mailing_lists.html";>Mailing Lists</a>
+            </div>
+        </div>
+    </div>
+    <div id="content">
+<!--
+Copyright 2002-2021 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+//-->
+<h1>ZooKeeper Use Cases</h1>
+<ul>
+<li>Applications and organizations using ZooKeeper include (alphabetically) 
[1].</li>
+<li>If your use case wants to be listed here. Please do not hesitate, submit a 
pull request or write an email to <strong>[email protected]</strong>, 
and then, your use case will be included.</li>
+<li>If this documentation has violated your intellectual property rights or 
you and your company's privacy, write an email to 
<strong>[email protected]</strong>, we will handle them in a timely 
manner.</li>
+</ul>
+<h2>Free Software Projects</h2>
+<h3><a href="http://adroitlogic.org/";>AdroitLogic UltraESB</a></h3>
+<ul>
+<li>Uses ZooKeeper to implement node coordination, in clustering support. This 
allows the management of the complete cluster, or any specific node - from any 
other node connected via JMX. A Cluster wide command framework developed on top 
of the ZooKeeper coordination allows commands that fail on some nodes to be 
retried etc. We also support the automated graceful round-robin-restart of a 
complete cluster of nodes using the same framework [1].</li>
+</ul>
+<h3><a href="http://akka.io/";>Akka</a></h3>
+<ul>
+<li>Akka is the platform for the next generation event-driven, scalable and 
fault-tolerant architectures on the JVM. Or: Akka is a toolkit and runtime for 
building highly concurrent, distributed, and fault tolerant event-driven 
applications on the JVM [1].</li>
+</ul>
+<h3><a href="http://www.eclipse.org/ecf";>Eclipse Communication 
Framework</a></h3>
+<ul>
+<li>The Eclipse ECF project provides an implementation of its Abstract 
Discovery services using Zookeeper. ECF itself is used in many projects 
providing base functionallity for communication, all based on OSGi [1].</li>
+</ul>
+<h3><a href="http://www.eclipse.org/gyrex";>Eclipse Gyrex</a></h3>
+<ul>
+<li>The Eclipse Gyrex project provides a platform for building your own Java 
OSGi based clouds.</li>
+<li>ZooKeeper is used as the core cloud component for node membership and 
management, coordination of jobs executing among workers, a lock service and a 
simple queue service and a lot more [1].</li>
+</ul>
+<h3><a href="http://www.goldenorbos.org/";>GoldenOrb</a></h3>
+<ul>
+<li>massive-scale Graph analysis [1].</li>
+</ul>
+<h3><a href="https://juju.ubuntu.com/";>Juju</a></h3>
+<ul>
+<li>Service deployment and orchestration framework, formerly called Ensemble 
[1].</li>
+</ul>
+<h3><a href="http://katta.sourceforge.net/";>Katta</a></h3>
+<ul>
+<li>Katta serves distributed Lucene indexes in a grid environment.</li>
+<li>Zookeeper is used for node, master and index management in the grid 
[1].</li>
+</ul>
+<h3><a 
href="https://github.com/anthonyu/KeptCollections";>KeptCollections</a></h3>
+<ul>
+<li>KeptCollections is a library of drop-in replacements for the data 
structures in the Java Collections framework.</li>
+<li>KeptCollections uses Apache ZooKeeper as a backing store, thus making its 
data structures distributed and scalable [1].</li>
+</ul>
+<h3><a href="https://neo4j.com/";>Neo4j</a></h3>
+<ul>
+<li>Neo4j is a Graph Database. It's a disk based, ACID compliant transactional 
storage engine for big graphs and fast graph traversals, using external 
indicies like Lucene/Solr for global searches.</li>
+<li>We use ZooKeeper in the Neo4j High Availability components for 
write-master election, read slave coordination and other cool stuff. ZooKeeper 
is a great and focused project - we like! [1].</li>
+</ul>
+<h3><a href="http://sna-projects.com/norbert";>Norbert</a></h3>
+<ul>
+<li>Partitioned routing and cluster management [1].</li>
+</ul>
+<h3><a 
href="https://spring.io/projects/spring-cloud-zookeeper";>spring-cloud-zookeeper</a></h3>
+<ul>
+<li>Spring Cloud Zookeeper provides Apache Zookeeper integrations for Spring 
Boot apps through autoconfiguration and binding to the Spring Environment and 
other Spring programming model idioms. With a few simple annotations you can 
quickly enable and configure the common patterns inside your application and 
build large distributed systems with Zookeeper. The patterns provided include 
Service Discovery and Distributed Configuration [38].</li>
+</ul>
+<h3><a 
href="https://projects.spring.io/spring-statemachine/";>spring-statemachine</a></h3>
+<ul>
+<li>Spring Statemachine is a framework for application developers to use state 
machine concepts with Spring applications.</li>
+<li>Spring Statemachine can provide this feature:Distributed state machine 
based on a Zookeeper [31,32].</li>
+</ul>
+<h3><a href="https://projects.spring.io/spring-xd/";>spring-xd</a></h3>
+<ul>
+<li>Spring XD is a unified, distributed, and extensible system for data 
ingestion, real time analytics, batch processing, and data export. The 
project’s goal is to simplify the development of big data applications.</li>
+<li>ZooKeeper - Provides all runtime information for the XD cluster. Tracks 
running containers, in which containers modules and jobs are deployed, stream 
definitions, deployment manifests, and the like [30,31].</li>
+</ul>
+<h3><a 
href="http://www.talend.com/products-application-integration/application-integration-esb-se.php";>Talend
 ESB</a></h3>
+<ul>
+<li>Talend ESB is a versatile and flexible, enterprise service bus.</li>
+<li>It uses ZooKeeper as endpoint repository of both REST and SOAP Web 
services. By using ZooKeeper Talend ESB is able to provide failover and load 
balancing capabilities in a very light-weight manner [1].</li>
+</ul>
+<h3><a 
href="https://github.com/ryanlecompte/redis_failover";>redis_failover</a></h3>
+<ul>
+<li>Redis Failover is a ZooKeeper-based automatic master/slave failover 
solution for Ruby [1].</li>
+</ul>
+<h2>Apache Projects</h2>
+<h3><a href="https://accumulo.apache.org/";>Apache Accumulo</a></h3>
+<ul>
+<li>Accumulo is a distributed key/value store that provides expressive, 
cell-level access labels.</li>
+<li>Apache ZooKeeper plays a central role within the Accumulo architecture. 
Its quorum consistency model supports an overall Accumulo architecture with no 
single points of failure. Beyond that, Accumulo leverages ZooKeeper to store 
and communication configuration information for users and tables, as well as 
operational states of processes and tablets [2].</li>
+</ul>
+<h3><a href="http://atlas.apache.org";>Apache Atlas</a></h3>
+<ul>
+<li>Atlas is a scalable and extensible set of core foundational governance 
services – enabling enterprises to effectively and efficiently meet their 
compliance requirements within Hadoop and allows integration with the whole 
enterprise data ecosystem.</li>
+<li>Atlas uses Zookeeper for coordination to provide redundancy and high 
availability of HBase,Kafka [31,35].</li>
+</ul>
+<h3><a href="https://bookkeeper.apache.org/";>Apache BookKeeper</a></h3>
+<ul>
+<li>A scalable, fault-tolerant, and low-latency storage service optimized for 
real-time workloads.</li>
+<li>BookKeeper requires a metadata storage service to store information 
related to ledgers and available bookies. BookKeeper currently uses ZooKeeper 
for this and other tasks [3].</li>
+</ul>
+<h3><a href="http://cxf.apache.org/distributed-osgi.html";>Apache CXF 
DOSGi</a></h3>
+<ul>
+<li>Apache CXF is an open source services framework. CXF helps you build and 
develop services using frontend programming APIs, like JAX-WS and JAX-RS. These 
services can speak a variety of protocols such as SOAP, XML/HTTP, RESTful HTTP, 
or CORBA and work over a variety of transports such as HTTP, JMS or JBI.</li>
+<li>The Distributed OSGi implementation at Apache CXF uses ZooKeeper for its 
Discovery functionality [4].</li>
+</ul>
+<h3><a href="http://drill.apache.org/";>Apache Drill</a></h3>
+<ul>
+<li>Schema-free SQL Query Engine for Hadoop, NoSQL and Cloud Storage</li>
+<li>ZooKeeper maintains ephemeral cluster membership information. The 
Drillbits use ZooKeeper to find other Drillbits in the cluster, and the client 
uses ZooKeeper to find Drillbits to submit a query [28].</li>
+</ul>
+<h3><a href="https://druid.apache.org/";>Apache Druid</a></h3>
+<ul>
+<li>Apache Druid is a high performance real-time analytics database.</li>
+<li>Apache Druid uses Apache ZooKeeper (ZK) for management of current cluster 
state. The operations that happen over ZK are [27]:
+<ul>
+<li>Coordinator leader election</li>
+<li>Segment &quot;publishing&quot; protocol from Historical and Realtime</li>
+<li>Segment load/drop protocol between Coordinator and Historical</li>
+<li>Overlord leader election</li>
+<li>Overlord and MiddleManager task management</li>
+</ul>
+</li>
+</ul>
+<h3><a href="http://dubbo.apache.org";>Apache Dubbo</a></h3>
+<ul>
+<li>Apache Dubbo is a high-performance, java based open source RPC 
framework.</li>
+<li>Zookeeper is used for service registration discovery and configuration 
management in Dubbo [6].</li>
+</ul>
+<h3><a href="https://flink.apache.org/";>Apache Flink</a></h3>
+<ul>
+<li>Apache Flink is a framework and distributed processing engine for stateful 
computations over unbounded and bounded data streams. Flink has been designed 
to run in all common cluster environments, perform computations at in-memory 
speed and at any scale.</li>
+<li>To enable JobManager High Availability you have to set the 
high-availability mode to zookeeper, configure a ZooKeeper quorum and set up a 
masters file with all JobManagers hosts and their web UI ports. Flink leverages 
ZooKeeper for distributed coordination between all running JobManager 
instances. ZooKeeper is a separate service from Flink, which provides highly 
reliable distributed coordination via leader election and light-weight 
consistent state storage [23].</li>
+</ul>
+<h3><a href="https://flume.apache.org/";>Apache Flume</a></h3>
+<ul>
+<li>Flume is a distributed, reliable, and available service for efficiently 
collecting, aggregating, and moving large amounts of log data. It has a simple 
and flexible architecture based on streaming data flows. It is robust and fault 
tolerant with tunable reliability mechanisms and many failover and recovery 
mechanisms. It uses a simple extensible data model that allows for online 
analytic application.</li>
+<li>Flume supports Agent configurations via Zookeeper. This is an experimental 
feature [5].</li>
+</ul>
+<h3><a href="https://fluo.apache.org/";>Apache Fluo</a></h3>
+<ul>
+<li>Apache Fluo is a distributed processing system that lets users make 
incremental updates to large data sets.</li>
+<li>Apache Fluo is built on Apache Accumulo which uses Apache Zookeeper for 
consensus [31,37].</li>
+</ul>
+<h3><a href="https://griffin.apache.org/";>Apache Griffin</a></h3>
+<ul>
+<li>Big Data Quality Solution For Batch and Streaming.</li>
+<li>Griffin uses Zookeeper for coordination to provide redundancy and high 
availability of Kafka [31,36].</li>
+</ul>
+<h3><a href="http://hadoop.apache.org/";>Apache Hadoop</a></h3>
+<ul>
+<li>The Apache Hadoop software library is a framework that allows for the 
distributed processing of large data sets across clusters of computers using 
simple programming models. It is designed to scale up from single servers to 
thousands of machines, each offering local computation and storage. Rather than 
rely on hardware to deliver high-availability, the library itself is designed 
to detect and handle failures at the application layer, so delivering a 
highly-available service on top of a cluster of computers, each of which may be 
prone to failures.</li>
+<li>The implementation of automatic HDFS failover relies on ZooKeeper for the 
following things:
+<ul>
+<li><strong>Failure detection</strong> - each of the NameNode machines in the 
cluster maintains a persistent session in ZooKeeper. If the machine crashes, 
the ZooKeeper session will expire, notifying the other NameNode that a failover 
should be triggered.</li>
+<li><strong>Active NameNode election</strong> - ZooKeeper provides a simple 
mechanism to exclusively elect a node as active. If the current active NameNode 
crashes, another node may take a special exclusive lock in ZooKeeper indicating 
that it should become the next active.</li>
+</ul>
+</li>
+<li>The ZKFailoverController (ZKFC) is a new component which is a ZooKeeper 
client which also monitors and manages the state of the NameNode. Each of the 
machines which runs a NameNode also runs a ZKFC, and that ZKFC is responsible 
for:
+<ul>
+<li><strong>Health monitoring</strong> - the ZKFC pings its local NameNode on 
a periodic basis with a health-check command. So long as the NameNode responds 
in a timely fashion with a healthy status, the ZKFC considers the node healthy. 
If the node has crashed, frozen, or otherwise entered an unhealthy state, the 
health monitor will mark it as unhealthy.</li>
+<li><strong>ZooKeeper session management</strong> - when the local NameNode is 
healthy, the ZKFC holds a session open in ZooKeeper. If the local NameNode is 
active, it also holds a special “lock” znode. This lock uses ZooKeeper’s 
support for “ephemeral” nodes; if the session expires, the lock node will 
be automatically deleted.</li>
+<li><strong>ZooKeeper-based election</strong> - if the local NameNode is 
healthy, and the ZKFC sees that no other node currently holds the lock znode, 
it will itself try to acquire the lock. If it succeeds, then it has “won the 
election”, and is responsible for running a failover to make its local 
NameNode active. The failover process is similar to the manual failover 
described above: first, the previous active is fenced if necessary, and then 
the local NameNode transitions to active state [7].</li>
+</ul>
+</li>
+</ul>
+<h3><a href="https://hbase.apache.org/";>Apache HBase</a></h3>
+<ul>
+<li>HBase is the Hadoop database. It's an open-source, distributed, 
column-oriented store model.</li>
+<li>HBase uses ZooKeeper for master election, server lease management, 
bootstrapping, and coordination between servers. A distributed Apache HBase 
installation depends on a running ZooKeeper cluster. All participating nodes 
and clients need to be able to access the running ZooKeeper ensemble [8].</li>
+<li>As you can see, ZooKeeper is a fundamental part of HBase. All operations 
that require coordination, such as Regions assignment, Master-Failover, 
replication, and snapshots, are built on ZooKeeper [20].</li>
+</ul>
+<h3><a href="http://helix.apache.org/";>Apache Helix</a></h3>
+<ul>
+<li>A cluster management framework for partitioned and replicated distributed 
resources.</li>
+<li>We need a distributed store to maintain the state of the cluster and a 
notification system to notify if there is any change in the cluster state. 
Helix uses Apache ZooKeeper to achieve this functionality [21]. Zookeeper 
provides:
+<ul>
+<li>A way to represent PERSISTENT state which remains until its deleted</li>
+<li>A way to represent TRANSIENT/EPHEMERAL state which vanishes when the 
process that created the state dies</li>
+<li>A notification mechanism when there is a change in PERSISTENT and 
EPHEMERAL state</li>
+</ul>
+</li>
+</ul>
+<h3><a href="https://hive.apache.org";>Apache Hive</a></h3>
+<ul>
+<li>The Apache Hive data warehouse software facilitates reading, writing, and 
managing large datasets residing in distributed storage using SQL. Structure 
can be projected onto data already in storage. A command line tool and JDBC 
driver are provided to connect users to Hive.</li>
+<li>Hive has been using ZooKeeper as distributed lock manager to support 
concurrency in HiveServer2 [25,26].</li>
+</ul>
+<h3><a href="https://ignite.apache.org/";>Apache Ignite</a></h3>
+<ul>
+<li>Ignite is a memory-centric distributed database, caching, and processing 
platform for transactional, analytical, and streaming workloads delivering 
in-memory speeds at petabyte scale</li>
+<li>Apache Ignite discovery mechanism goes with a ZooKeeper implementations 
which allows scaling Ignite clusters to 100s and 1000s of nodes preserving 
linear scalability and performance [31,34].​</li>
+</ul>
+<h3><a href="http://james.apache.org/mailbox/";>Apache James Mailbox</a></h3>
+<ul>
+<li>The Apache James Mailbox is a library providing a flexible Mailbox storage 
accessible by mail protocols (IMAP4, POP3, SMTP,...) and other protocols.</li>
+<li>Uses Zookeeper and Curator Framework for generating distributed unique 
ID's [31].</li>
+</ul>
+<h3><a href="https://kafka.apache.org/";>Apache Kafka</a></h3>
+<ul>
+<li>Kafka is a distributed publish/subscribe messaging system</li>
+<li>Apache Kafka relies on ZooKeeper for the following things:
+<ul>
+<li><strong>Controller election</strong> The controller is one of the most 
important broking entity in a Kafka ecosystem, and it also has the 
responsibility to maintain the leader-follower relationship across all the 
partitions. If a node by some reason is shutting down, it’s the 
controller’s responsibility to tell all the replicas to act as partition 
leaders in order to fulfill the duties of the partition leaders on the node 
that is about to fail. So, whenever a node shuts down, a new controller can be 
elected and it can also be made sure that at any given time, there is only one 
controller and all the follower nodes have agreed on that.</li>
+<li><strong>Configuration Of Topics</strong> The configuration regarding all 
the topics including the list of existing topics, the number of partitions for 
each topic, the location of all the replicas, list of configuration overrides 
for all topics and which node is the preferred leader, etc.</li>
+<li><strong>Access control lists</strong> Access control lists or ACLs for all 
the topics are also maintained within Zookeeper.</li>
+<li><strong>Membership of the cluster</strong> Zookeeper also maintains a list 
of all the brokers that are functioning at any given moment and are a part of 
the cluster [9].</li>
+</ul>
+</li>
+</ul>
+<h3><a href="http://kylin.apache.org/";>Apache Kylin</a></h3>
+<ul>
+<li>Apache Kylin is an open source Distributed Analytics Engine designed to 
provide SQL interface and multi-dimensional analysis (OLAP) on Hadoop/Spark 
supporting extremely large datasets, original contributed from eBay Inc.</li>
+<li>Apache Kylin leverages Zookeeper for job coordination [31,33].</li>
+</ul>
+<h3><a href="http://mesos.apache.org/";>Apache Mesos</a></h3>
+<ul>
+<li>Apache Mesos abstracts CPU, memory, storage, and other compute resources 
away from machines (physical or virtual), enabling fault-tolerant and elastic 
distributed systems to easily be built and run effectively.</li>
+<li>Mesos has a high-availability mode that uses multiple Mesos masters: one 
active master (called the leader or leading master) and several backups in case 
it fails. The masters elect the leader, with Apache ZooKeeper both coordinating 
the election and handling leader detection by masters, agents, and scheduler 
drivers [10].</li>
+</ul>
+<h3><a href="https://oozie.apache.org";>Apache Oozie</a></h3>
+<ul>
+<li>Oozie is a workflow scheduler system to manage Apache Hadoop jobs.</li>
+<li>the Oozie servers use it for coordinating access to the database and 
communicating with each other. In order to have full HA, there should be at 
least 3 ZooKeeper servers [29].</li>
+</ul>
+<h3><a href="https://pulsar.apache.org";>Apache Pulsar</a></h3>
+<ul>
+<li>Apache Pulsar is an open-source distributed pub-sub messaging system 
originally created at Yahoo and now part of the Apache Software Foundation</li>
+<li>Pulsar uses Apache Zookeeper for metadata storage, cluster configuration, 
and coordination. In a Pulsar instance:
+<ul>
+<li>A configuration store quorum stores configuration for tenants, namespaces, 
and other entities that need to be globally consistent.</li>
+<li>Each cluster has its own local ZooKeeper ensemble that stores 
cluster-specific configuration and coordination such as ownership metadata, 
broker load reports, BookKeeper ledger metadata, and more [24].</li>
+</ul>
+</li>
+</ul>
+<h3><a href="https://lucene.apache.org/solr/";>Apache Solr</a></h3>
+<ul>
+<li>Solr is the popular, blazing-fast, open source enterprise search platform 
built on Apache Lucene.</li>
+<li>In the &quot;Cloud&quot; edition (v4.x and up) of enterprise search engine 
Apache Solr, ZooKeeper is used for configuration, leader election and more 
[12,13].</li>
+</ul>
+<h3><a href="https://spark.apache.org/";>Apache Spark</a></h3>
+<ul>
+<li>Apache Spark is a unified analytics engine for large-scale data 
processing.</li>
+<li>Utilizing ZooKeeper to provide leader election and some state storage, you 
can launch multiple Masters in your cluster connected to the same ZooKeeper 
instance. One will be elected “leader” and the others will remain in 
standby mode. If the current leader dies, another Master will be elected, 
recover the old Master’s state, and then resume scheduling [14].</li>
+</ul>
+<h3><a href="http://storm.apache.org";>Apache Storm</a></h3>
+<ul>
+<li>Apache Storm is a free and open source distributed realtime computation 
system. Apache Storm makes it easy to reliably process unbounded streams of 
data, doing for realtime processing what Hadoop did for batch processing. 
Apache Storm is simple, can be used with any programming language, and is a lot 
of fun to use!</li>
+<li>Storm uses Zookeeper for coordinating the cluster [22].</li>
+</ul>
+<h2>Companies</h2>
+<h3><a href="http://www.ageto.de/";>AGETO</a></h3>
+<ul>
+<li>The AGETO RnD team uses ZooKeeper in a variety of internal as well as 
external consulting projects [1].</li>
+</ul>
+<h3><a href="http://www.benipaltechnologies.com/";>Benipal Technologies</a></h3>
+<ul>
+<li>ZooKeeper is used for internal application development with Solr and 
Hadoop with Hbase [1].</li>
+</ul>
+<h3><a href="http://box.net/";>Box</a></h3>
+<ul>
+<li>Box uses ZooKeeper for service discovery, service coordination, Solr and 
Hadoop support, etc [1].</li>
+</ul>
+<h3><a href="http://www.deepdyve.com/";>Deepdyve</a></h3>
+<ul>
+<li>We do search for research and provide access to high quality content using 
advanced search technologies Zookeeper is used to manage server state, control 
index deployment and a myriad other tasks [1].</li>
+</ul>
+<h3><a href="https://www.facebook.com/";>Facebook</a></h3>
+<ul>
+<li>Facebook uses the Zeus ([17,18]) for configuration management which is a 
forked version of ZooKeeper, with many scalability and performance en- 
hancements in order to work at the Facebook scale. It runs a consensus protocol 
among servers distributed across mul- tiple regions for resilience. If the 
leader fails, a follower is converted into a new leader.</li>
+</ul>
+<h3><a href="http://www.idium.no/no/idium_portal/";>Idium Portal</a></h3>
+<ul>
+<li>Idium Portal is a hosted web-publishing system delivered by Norwegian 
company, Idium AS.</li>
+<li>ZooKeeper is used for cluster messaging, service bootstrapping, and 
service coordination [1].</li>
+</ul>
+<h3><a href="http://www.makara.com/";>Makara</a></h3>
+<ul>
+<li>Using ZooKeeper on 2-node cluster on VMware workstation, Amazon EC2, 
Zen</li>
+<li>Using zkpython</li>
+<li>Looking into expanding into 100 node cluster [1].</li>
+</ul>
+<h3><a href="http://www.midokura.com/";>Midokura</a></h3>
+<ul>
+<li>We do virtualized networking for the cloud computing era. We use ZooKeeper 
for various aspects of our distributed control plane [1].</li>
+</ul>
+<h3><a href="https://www.pinterest.com/";>Pinterest</a></h3>
+<ul>
+<li>Pinterest uses the ZooKeeper for Service discovery and dynamic 
configuration.Like many large scale web sites, Pinterest’s infrastructure 
consists of servers that communicate with backend services composed of a number 
of individual servers for managing load and fault tolerance. Ideally, we’d 
like the configuration to reflect only the active hosts, so clients don’t 
need to deal with bad hosts as often. ZooKeeper provides a well known pattern 
to solve this problem [19].</li>
+</ul>
+<h3><a href="http://www.rackspace.com/email_hosting";>Rackspace</a></h3>
+<ul>
+<li>The Email &amp; Apps team uses ZooKeeper to coordinate sharding and 
responsibility changes in a distributed e-mail client that pulls and indexes 
data for search. ZooKeeper also provides distributed locking for connections to 
prevent a cluster from overwhelming servers [1].</li>
+</ul>
+<h3><a href="http://sematext.com/";>Sematext</a></h3>
+<ul>
+<li>Uses ZooKeeper in SPM (which includes ZooKeeper monitoring component, 
too!), Search Analytics, and Logsene [1].</li>
+</ul>
+<h3><a href="http://tubemogul.com/";>Tubemogul</a></h3>
+<ul>
+<li>Uses ZooKeeper for leader election, configuration management, locking, 
group membership [1].</li>
+</ul>
+<h3><a href="https://twitter.com/";>Twitter</a></h3>
+<ul>
+<li>ZooKeeper is used at Twitter as the source of truth for storing critical 
metadata. It serves as a coordination kernel to provide distributed 
coordination services, such as leader election and distributed locking. Some 
concrete examples of ZooKeeper in action include [15,16]:</li>
+<li>ZooKeeper is used to store service registry, which is used by Twitter’s 
naming service for service discovery.</li>
+<li>Manhattan (Twitter’s in-house key-value database), Nighthawk (sharded 
Redis), and Blobstore (in-house photo and video storage), stores its cluster 
topology information in ZooKeeper.</li>
+<li>EventBus, Twitter’s pub-sub messaging system, stores critical metadata 
in ZooKeeper and uses ZooKeeper for leader election.</li>
+<li>Mesos, Twitter’s compute platform, uses ZooKeeper for leader 
election.</li>
+</ul>
+<h3><a href="http://www.vast.com/";>Vast.com</a></h3>
+<ul>
+<li>Used internally as a part of sharding services, distributed 
synchronization of data/index updates, configuration management and failover 
support [1].</li>
+</ul>
+<h3><a href="http://wealthfront.com/";>Wealthfront</a></h3>
+<ul>
+<li>Wealthfront uses ZooKeeper for service discovery, leader election and 
distributed locking among its many backend services. ZK is an essential part of 
Wealthfront's continuous <a 
href="http://eng.wealthfront.com/2010/05/02/deployment-infrastructure-for-continuous-deployment/";>deployment
 infrastructure</a> [1].</li>
+</ul>
+<h3><a href="http://www.yahoo.com/";>Yahoo!</a></h3>
+<ul>
+<li>ZooKeeper is used for a myriad of services inside Yahoo! for doing leader 
election, configuration management, sharding, locking, group membership etc 
[1].</li>
+</ul>
+<h3><a href="http://www.zynga.com/";>Zynga</a></h3>
+<ul>
+<li>ZooKeeper at Zynga is used for a variety of services including 
configuration management, leader election, sharding and more [1].</li>
+</ul>
+<h4>References</h4>
+<ul>
+<li>[1] https://cwiki.apache.org/confluence/display/ZOOKEEPER/PoweredBy</li>
+<li>[2] https://www.youtube.com/watch?v=Ew53T6h9oRw</li>
+<li>[3] 
https://bookkeeper.apache.org/docs/4.7.3/getting-started/concepts/#ledgers</li>
+<li>[4] http://cxf.apache.org/dosgi-discovery-demo-page.html</li>
+<li>[5] https://flume.apache.org/FlumeUserGuide.html</li>
+<li>[6] http://dubbo.apache.org/en-us/blog/dubbo-zk.html</li>
+<li>[7] 
https://hadoop.apache.org/docs/r2.7.1/hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithQJM.html</li>
+<li>[8] https://hbase.apache.org/book.html#zookeeper</li>
+<li>[9] 
https://www.cloudkarafka.com/blog/2018-07-04-cloudkarafka_what_is_zookeeper.html</li>
+<li>[10] http://mesos.apache.org/documentation/latest/high-availability/</li>
+<li>[11] http://incubator.apache.org/projects/s4.html</li>
+<li>[12] 
https://lucene.apache.org/solr/guide/6_6/using-zookeeper-to-manage-configuration-files.html#UsingZooKeepertoManageConfigurationFiles-StartupBootstrap</li>
+<li>[13] 
https://lucene.apache.org/solr/guide/6_6/setting-up-an-external-zookeeper-ensemble.html</li>
+<li>[14] 
https://spark.apache.org/docs/latest/spark-standalone.html#standby-masters-with-zookeeper</li>
+<li>[15] 
https://blog.twitter.com/engineering/en_us/topics/infrastructure/2018/zookeeper-at-twitter.html</li>
+<li>[16] 
https://blog.twitter.com/engineering/en_us/topics/infrastructure/2018/dynamic-configuration-at-twitter.html</li>
+<li>[17] TANG, C., KOOBURAT, T., VENKATACHALAM, P.,CHANDER, A., WEN, Z., 
NARAYANAN, A., DOWELL,P., AND KARL, R. Holistic Configuration Management at 
Facebook. In Proceedings of the 25th Symposium on Operating System Principles 
(SOSP’15) (Monterey, CA,USA, Oct. 2015).</li>
+<li>[18] https://www.youtube.com/watch?v=SeZV373gUZc</li>
+<li>[19] 
https://medium.com/@Pinterest_Engineering/zookeeper-resilience-at-pinterest-adfd8acf2a6b</li>
+<li>[20] https://blog.cloudera.com/what-are-hbase-znodes/</li>
+<li>[21] https://helix.apache.org/Architecture.html</li>
+<li>[22] 
http://storm.apache.org/releases/current/Setting-up-a-Storm-cluster.html</li>
+<li>[23] 
https://ci.apache.org/projects/flink/flink-docs-release-1.9/ops/jobmanager_high_availability.html</li>
+<li>[24] 
https://pulsar.apache.org/docs/en/concepts-architecture-overview/#metadata-store</li>
+<li>[25] https://cwiki.apache.org/confluence/display/Hive/Locking</li>
+<li>[26] <em>ZooKeeperHiveLockManager</em> implementation in the <a 
href="https://github.com/apache/hive/";>hive</a> code base</li>
+<li>[27] https://druid.apache.org/docs/latest/dependencies/zookeeper.html</li>
+<li>[28] https://mapr.com/blog/apache-drill-architecture-ultimate-guide/</li>
+<li>[29] https://oozie.apache.org/docs/4.1.0/AG_Install.html</li>
+<li>[30] https://docs.spring.io/spring-xd/docs/current/reference/html/</li>
+<li>[31] https://cwiki.apache.org/confluence/display/CURATOR/Powered+By</li>
+<li>[32] https://projects.spring.io/spring-statemachine/</li>
+<li>[33] https://www.tigeranalytics.com/blog/apache-kylin-architecture/</li>
+<li>[34] https://apacheignite.readme.io/docs/cluster-discovery</li>
+<li>[35] http://atlas.apache.org/HighAvailability.html</li>
+<li>[36] http://griffin.apache.org/docs/usecases.html</li>
+<li>[37] https://fluo.apache.org/</li>
+<li>[38] https://spring.io/projects/spring-cloud-zookeeper</li>
+</ul>
+</div>
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+    <div class="lastmodified">
+        <script type="text/javascript">
+        <!--
+            document.write("Last Published: " + document.lastModified);
+        //  -->
+        </script>
+    </div>
+    <div class="copyright">
+        Copyright &copy; <a href="http://www.apache.org/licenses/";>The Apache 
Software Foundation.</a>
+    </div>
+    <div id="logos"></div>
+</div>
+</body>
+</html>
\ No newline at end of file


Reply via email to