helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject svn commit: r1767604 [9/10] - in /helix/site-content: ./ 0.6.1-incubating-docs/ 0.6.2-incubating-docs/ 0.6.3-docs/ 0.6.4-docs/ 0.6.5-docs/ 0.6.6-docs/ 0.6.6-docs/css/ 0.6.6-docs/images/ 0.6.6-docs/img/ 0.6.6-docs/js/ 0.6.6-docs/recipes/ 0.6.6-docs/rele...
Date Wed, 02 Nov 2016 04:11:37 GMT
Added: helix/site-content/0.6.6-docs/tutorial_rebalance.html
URL: http://svn.apache.org/viewvc/helix/site-content/0.6.6-docs/tutorial_rebalance.html?rev=1767604&view=auto
==============================================================================
--- helix/site-content/0.6.6-docs/tutorial_rebalance.html (added)
+++ helix/site-content/0.6.6-docs/tutorial_rebalance.html Wed Nov  2 04:11:36 2016
@@ -0,0 +1,389 @@
+
+<!DOCTYPE html>
+<!--
+ Generated by Apache Maven Doxia at 2016-11-01
+ Rendered using Maven Reflow Skin 1.0.0 (http://andriusvelykis.github.com/reflow-maven-skin)
+-->
+<html  xml:lang="en" lang="en">
+
+	<head>
+		<meta charset="UTF-8" />
+		<title>Apache Helix -   Tutorial - Rebalancing Algorithms</title>
+		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+		<meta name="description" content="" />
+		<meta http-equiv="content-language" content="en" />
+
+		<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap.min.css" rel="stylesheet" />
+		<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-responsive.min.css" rel="stylesheet" />
+		<link href="./css/docs.css" rel="stylesheet" />
+		<link href="./css/reflow-skin.css" rel="stylesheet" />
+		
+		
+		<link href="./css/lightbox.css" rel="stylesheet" />
+		
+		<link href="./css/site.css" rel="stylesheet" />
+		<link href="./css/print.css" rel="stylesheet" media="print" />
+		
+		<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
+		<!--[if lt IE 9]>
+			<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+		<![endif]-->
+		
+<script type="text/javascript">var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-3211522-12']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+        })();</script>
+	</head>
+
+	<body class="page-tutorial_rebalance project-066-docs" data-spy="scroll" data-offset="60" data-target="#toc-scroll-target">
+
+		<div class="navbar navbar-fixed-top">
+			<div class="navbar-inner">
+				<div class="container">
+					<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+					</a>
+					<a class="brand" href="..">Apache Helix</a>
+					<div class="nav-collapse">
+						<ul class="nav pull-right">
+							<li><a href="index.html" title="Helix 0.6.6">Helix 0.6.6 </a></li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Get Helix <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="download.html" title="Download">Download </a></li>
+									<li><a href="Building.html" title="Building">Building </a></li>
+									<li><a href="releasenotes/release-0.6.6.html" title="Release Notes">Release Notes </a></li>
+								</ul>
+							</li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Hands-On <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="Quickstart.html" title="Quick Start">Quick Start </a></li>
+									<li><a href="Tutorial.html" title="Tutorial">Tutorial </a></li>
+									<li><a href="../javadocs/0.6.6" title="Javadocs">Javadocs </a></li>
+								</ul>
+							</li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Recipes <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="recipes/lock_manager.html" title="Distributed lock manager">Distributed lock manager </a></li>
+									<li><a href="recipes/rabbitmq_consumer_group.html" title="Rabbit MQ consumer group">Rabbit MQ consumer group </a></li>
+									<li><a href="recipes/rsync_replicated_file_store.html" title="Rsync replicated file store">Rsync replicated file store </a></li>
+									<li><a href="recipes/service_discovery.html" title="Service discovery">Service discovery </a></li>
+									<li><a href="recipes/task_dag_execution.html" title="Distributed task DAG execution">Distributed task DAG execution </a></li>
+								</ul>
+							</li>
+						</ul>
+					</div><!--/.nav-collapse -->
+				</div>
+			</div>
+		</div>
+		
+	<div class="container">
+	
+	<!-- Masthead
+	================================================== -->
+	<header class="jumbotron subhead">
+		<div class="row" id="banner">
+			<div class="span12">
+				<div class="pull-left">
+					<a href="../" id="bannerLeft"><img src="../images/helix-logo.jpg" alt='"''"' /></a>
+					<p class="lead">A cluster management framework for partitioned and replicated distributed resources</p>
+				</div>
+				<div class="pull-right">
+					<a href="http://www.apache.org/" id="bannerRight"><img src="../images/feather_small.gif" alt='"''"' /></a>
+				</div>
+			</div>
+		</div>
+		<div>
+			<ul class="breadcrumb">
+				<li><a href="../" title="Apache Helix">Apache Helix </a></li>
+				<li class="divider">/</li>
+				<li><a href="./" title="Release 0.6.6">Release 0.6.6 </a></li>
+				<li class="divider">/</li>
+				<li>  Tutorial - Rebalancing Algorithms</li>
+				<li class="publishDate version-date pull-right">Last Published: 2016-11-01</li>
+			</ul>
+		</div>
+	</header>
+
+	<div class="main-body">
+	<div class="row">
+		<div class="span12">
+			<div class="body-content">
+<!-- -
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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. --> 
+<p></p> 
+<div class="section"> 
+ <div class="page-header">
+  <h2 id="Helix_Tutorial:_Rebalancing_Algorithms"><a href="./Tutorial.html">Helix Tutorial</a>: Rebalancing Algorithms</h2>
+ </div> 
+ <p>The placement of partitions in a distributed system is essential for the reliability and scalability of the system. For example, when a node fails, it is important that the partitions hosted on that node are reallocated evenly among the remaining nodes. Consistent hashing is one such algorithm that can satisfy this guarantee. Helix provides a variant of consistent hashing based on the RUSH algorithm, among others.</p> 
+ <p>This means given a number of partitions, replicas and number of nodes, Helix does the automatic assignment of partition to nodes such that:</p> 
+ <ul> 
+  <li>Each node has the same number of partitions</li> 
+  <li>Replicas of the same partition do not stay on the same node</li> 
+  <li>When a node fails, the partitions will be equally distributed among the remaining nodes</li> 
+  <li>When new nodes are added, the number of partitions moved will be minimized along with satisfying the above criteria</li> 
+ </ul> 
+ <p>Helix employs a rebalancing algorithm to compute the <i>ideal state</i> of the system. When the <i>current state</i> differs from the <i>ideal state</i>, Helix uses it as the target state of the system and computes the appropriate transitions needed to bring it to the <i>ideal state</i>.</p> 
+ <p>Helix makes it easy to perform this operation, while giving you control over the algorithm. In this section, we'll see how to implement the desired behavior.</p> 
+ <p>Helix has four options for rebalancing, in increasing order of customization by the system builder:</p> 
+ <ul> 
+  <li>FULL_AUTO</li> 
+  <li>SEMI_AUTO</li> 
+  <li>CUSTOMIZED</li> 
+  <li>USER_DEFINED</li> 
+ </ul> 
+ <div class="source"> 
+  <pre>            |FULL_AUTO     |  SEMI_AUTO | CUSTOMIZED|  USER_DEFINED  |
+            ---------------------------------------------------------|
+   LOCATION | HELIX        |  APP       |  APP      |      APP       |
+            ---------------------------------------------------------|
+      STATE | HELIX        |  HELIX     |  APP      |      APP       |
+            ----------------------------------------------------------
+</pre> 
+ </div> 
+ <div class="section"> 
+  <h3 id="FULL_AUTO">FULL_AUTO</h3> 
+  <p>When the rebalance mode is set to FULL_AUTO, Helix controls both the location of the replica along with the state. This option is useful for applications where creation of a replica is not expensive.</p> 
+  <p>For example, consider this system that uses a MasterSlave state model, with 3 partitions and 2 replicas in the ideal state.</p> 
+  <div class="source"> 
+   <pre>{
+  &quot;id&quot; : &quot;MyResource&quot;,
+  &quot;simpleFields&quot; : {
+    &quot;REBALANCE_MODE&quot; : &quot;FULL_AUTO&quot;,
+    &quot;NUM_PARTITIONS&quot; : &quot;3&quot;,
+    &quot;REPLICAS&quot; : &quot;2&quot;,
+    &quot;STATE_MODEL_DEF_REF&quot; : &quot;MasterSlave&quot;,
+  }
+  &quot;listFields&quot; : {
+    &quot;MyResource_0&quot; : [],
+    &quot;MyResource_1&quot; : [],
+    &quot;MyResource_2&quot; : []
+  },
+  &quot;mapFields&quot; : {
+  }
+}
+</pre> 
+  </div> 
+  <p>If there are 3 nodes in the cluster, then Helix will balance the masters and slaves equally. The ideal state is therefore:</p> 
+  <div class="source"> 
+   <pre>{
+  &quot;id&quot; : &quot;MyResource&quot;,
+  &quot;simpleFields&quot; : {
+    &quot;NUM_PARTITIONS&quot; : &quot;3&quot;,
+    &quot;REPLICAS&quot; : &quot;2&quot;,
+    &quot;STATE_MODEL_DEF_REF&quot; : &quot;MasterSlave&quot;,
+  },
+  &quot;mapFields&quot; : {
+    &quot;MyResource_0&quot; : {
+      &quot;N1&quot; : &quot;MASTER&quot;,
+      &quot;N2&quot; : &quot;SLAVE&quot;,
+    },
+    &quot;MyResource_1&quot; : {
+      &quot;N2&quot; : &quot;MASTER&quot;,
+      &quot;N3&quot; : &quot;SLAVE&quot;,
+    },
+    &quot;MyResource_2&quot; : {
+      &quot;N3&quot; : &quot;MASTER&quot;,
+      &quot;N1&quot; : &quot;SLAVE&quot;,
+    }
+  }
+}
+</pre> 
+  </div> 
+  <p>Another typical example is evenly distributing a group of tasks among the currently healthy processes. For example, if there are 60 tasks and 4 nodes, Helix assigns 15 tasks to each node. When one node fails, Helix redistributes its 15 tasks to the remaining 3 nodes, resulting in a balanced 20 tasks per node. Similarly, if a node is added, Helix re-allocates 3 tasks from each of the 4 nodes to the 5th node, resulting in a balanced distribution of 12 tasks per node..</p> 
+ </div> 
+ <div class="section"> 
+  <h3 id="SEMI_AUTO">SEMI_AUTO</h3> 
+  <p>When the application needs to control the placement of the replicas, use the SEMI_AUTO rebalance mode.</p> 
+  <p>Example: In the ideal state below, the partition 'MyResource_0' is constrained to be placed only on node1 or node2. The choice of <i>state</i> is still controlled by Helix. That means MyResource_0.MASTER could be on node1 and MyResource_0.SLAVE on node2, or vice-versa but neither would be placed on node3.</p> 
+  <div class="source"> 
+   <pre>{
+  &quot;id&quot; : &quot;MyResource&quot;,
+  &quot;simpleFields&quot; : {
+    &quot;REBALANCE_MODE&quot; : &quot;SEMI_AUTO&quot;,
+    &quot;NUM_PARTITIONS&quot; : &quot;3&quot;,
+    &quot;REPLICAS&quot; : &quot;2&quot;,
+    &quot;STATE_MODEL_DEF_REF&quot; : &quot;MasterSlave&quot;,
+  }
+  &quot;listFields&quot; : {
+    &quot;MyResource_0&quot; : [node1, node2],
+    &quot;MyResource_1&quot; : [node2, node3],
+    &quot;MyResource_2&quot; : [node3, node1]
+  },
+  &quot;mapFields&quot; : {
+  }
+}
+</pre> 
+  </div> 
+  <p>The MasterSlave state model requires that a partition has exactly one MASTER at all times, and the other replicas should be SLAVEs. In this simple example with 2 replicas per partition, there would be one MASTER and one SLAVE. Upon failover, a SLAVE has to assume mastership, and a new SLAVE will be generated.</p> 
+  <p>In this mode when node1 fails, unlike in FULL_AUTO mode the partition is <i>not</i> moved from node1 to node3. Instead, Helix will decide to change the state of MyResource_0 on node2 from SLAVE to MASTER, based on the system constraints.</p> 
+ </div> 
+ <div class="section"> 
+  <h3 id="CUSTOMIZED">CUSTOMIZED</h3> 
+  <p>Helix offers a third mode called CUSTOMIZED, in which the application controls the placement <i>and</i> state of each replica. The application needs to implement a callback interface that Helix invokes when the cluster state changes. Within this callback, the application can recompute the idealstate. Helix will then issue appropriate transitions such that <i>Idealstate</i> and <i>Currentstate</i> converges.</p> 
+  <p>Here's an example, again with 3 partitions, 2 replicas per partition, and the MasterSlave state model:</p> 
+  <div class="source"> 
+   <pre>{
+  &quot;id&quot; : &quot;MyResource&quot;,
+  &quot;simpleFields&quot; : {
+    &quot;REBALANCE_MODE&quot; : &quot;CUSTOMIZED&quot;,
+    &quot;NUM_PARTITIONS&quot; : &quot;3&quot;,
+    &quot;REPLICAS&quot; : &quot;2&quot;,
+    &quot;STATE_MODEL_DEF_REF&quot; : &quot;MasterSlave&quot;,
+  },
+  &quot;mapFields&quot; : {
+    &quot;MyResource_0&quot; : {
+      &quot;N1&quot; : &quot;MASTER&quot;,
+      &quot;N2&quot; : &quot;SLAVE&quot;,
+    },
+    &quot;MyResource_1&quot; : {
+      &quot;N2&quot; : &quot;MASTER&quot;,
+      &quot;N3&quot; : &quot;SLAVE&quot;,
+    },
+    &quot;MyResource_2&quot; : {
+      &quot;N3&quot; : &quot;MASTER&quot;,
+      &quot;N1&quot; : &quot;SLAVE&quot;,
+    }
+  }
+}
+</pre> 
+  </div> 
+  <p>Suppose the current state of the system is ‘MyResource_0’ -&gt; {N1:MASTER, N2:SLAVE} and the application changes the ideal state to ‘MyResource_0’ -&gt; {N1:SLAVE,N2:MASTER}. While the application decides which node is MASTER and which is SLAVE, Helix will not blindly issue MASTER--&gt;SLAVE to N1 and SLAVE--&gt;MASTER to N2 in parallel, since that might result in a transient state where both N1 and N2 are masters, which violates the MasterSlave constraint that there is exactly one MASTER at a time. Helix will first issue MASTER--&gt;SLAVE to N1 and after it is completed, it will issue SLAVE--&gt;MASTER to N2.</p> 
+ </div> 
+ <div class="section"> 
+  <h3 id="USER_DEFINED">USER_DEFINED</h3> 
+  <p>For maximum flexibility, Helix exposes an interface that can allow applications to plug in custom rebalancing logic. By providing the name of a class that implements the Rebalancer interface, Helix will automatically call the contained method whenever there is a change to the live participants in the cluster. For more, see <a href="./tutorial_user_def_rebalancer.html">User-Defined Rebalancer</a>.</p> 
+ </div> 
+ <div class="section"> 
+  <h3 id="Backwards_Compatibility">Backwards Compatibility</h3> 
+  <p>In previous versions, FULL_AUTO was called AUTO_REBALANCE and SEMI_AUTO was called AUTO. Furthermore, they were presented as the IDEAL_STATE_MODE. Helix supports both IDEAL_STATE_MODE and REBALANCE_MODE, but IDEAL_STATE_MODE is now deprecated and may be phased out in future versions.</p> 
+ </div> 
+</div>
+			</div>
+		</div>
+	</div>
+	</div>
+
+	</div><!-- /container -->
+	
+	<!-- Footer
+	================================================== -->
+	<footer class="well">
+		<div class="container">
+			<div class="row">
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Get Helix</li>
+						<li>
+							<a href="download.html" title="Download">Download </a>
+						</li>
+						<li>
+							<a href="Building.html" title="Building">Building </a>
+						</li>
+						<li>
+							<a href="releasenotes/release-0.6.6.html" title="Release Notes">Release Notes </a>
+						</li>
+					</ul>
+				</div>
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Hands-On</li>
+						<li>
+							<a href="Quickstart.html" title="Quick Start">Quick Start </a>
+						</li>
+						<li>
+							<a href="Tutorial.html" title="Tutorial">Tutorial </a>
+						</li>
+						<li>
+							<a href="../javadocs/0.6.6" title="Javadocs">Javadocs </a>
+						</li>
+					</ul>
+				</div>
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Recipes</li>
+						<li>
+							<a href="recipes/lock_manager.html" title="Distributed lock manager">Distributed lock manager </a>
+						</li>
+						<li>
+							<a href="recipes/rabbitmq_consumer_group.html" title="Rabbit MQ consumer group">Rabbit MQ consumer group </a>
+						</li>
+						<li>
+							<a href="recipes/rsync_replicated_file_store.html" title="Rsync replicated file store">Rsync replicated file store </a>
+						</li>
+						<li>
+							<a href="recipes/service_discovery.html" title="Service discovery">Service discovery </a>
+						</li>
+						<li>
+							<a href="recipes/task_dag_execution.html" title="Distributed task DAG execution">Distributed task DAG execution </a>
+						</li>
+					</ul>
+				</div>
+			</div>
+		</div>
+	</footer>
+		
+	<div class="container subfooter">
+		<div class="row">
+			<div class="span12">
+				<p class="pull-right"><a href="#">Back to top</a></p>
+				<p class="copyright">Copyright &copy;2016 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.</p>
+				<p><a href="http://github.com/andriusvelykis/reflow-maven-skin" title="Reflow Maven skin">Reflow Maven skin</a> by <a href="http://andrius.velykis.lt" target="_blank" title="Andrius Velykis">Andrius Velykis</a>.</p>
+		
+<div class="row span16">
+  <div>Apache Helix, Apache, the Apache feather logo, and the Apache Helix project logos are trademarks of The Apache Software Foundation.
+        All other marks mentioned may be trademarks or registered trademarks of their respective owners.</div>
+  <a href="http://helix.apache.org/0.6.6-docs/privacy-policy.html">Privacy Policy</a>
+</div>			</div>
+		</div>
+	</div>
+
+	<!-- Le javascript
+	================================================== -->
+	<!-- Placed at the end of the document so the pages load faster -->
+
+	<!-- Fallback jQuery loading from Google CDN:
+	     http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go -->
+	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
+	<script type="text/javascript">
+		if (typeof jQuery == 'undefined')
+		{
+			document.write(unescape("%3Cscript src='./js/jquery-1.8.3.min.js' type='text/javascript'%3E%3C/script%3E"));
+		}
+	</script>
+	
+	<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script>
+	<script src="./js/lightbox.js"></script>
+	<script src="./js/jquery.smooth-scroll.min.js"></script>
+	<!-- back button support for smooth scroll -->
+	<script src="./js/jquery.ba-bbq.min.js"></script>
+
+	<script src="./js/reflow-skin.js"></script>
+	
+	</body>
+</html>
\ No newline at end of file

Added: helix/site-content/0.6.6-docs/tutorial_spectator.html
URL: http://svn.apache.org/viewvc/helix/site-content/0.6.6-docs/tutorial_spectator.html?rev=1767604&view=auto
==============================================================================
--- helix/site-content/0.6.6-docs/tutorial_spectator.html (added)
+++ helix/site-content/0.6.6-docs/tutorial_spectator.html Wed Nov  2 04:11:36 2016
@@ -0,0 +1,294 @@
+
+<!DOCTYPE html>
+<!--
+ Generated by Apache Maven Doxia at 2016-11-01
+ Rendered using Maven Reflow Skin 1.0.0 (http://andriusvelykis.github.com/reflow-maven-skin)
+-->
+<html  xml:lang="en" lang="en">
+
+	<head>
+		<meta charset="UTF-8" />
+		<title>Apache Helix -   Tutorial - Spectator</title>
+		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+		<meta name="description" content="" />
+		<meta http-equiv="content-language" content="en" />
+
+		<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap.min.css" rel="stylesheet" />
+		<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-responsive.min.css" rel="stylesheet" />
+		<link href="./css/docs.css" rel="stylesheet" />
+		<link href="./css/reflow-skin.css" rel="stylesheet" />
+		
+		
+		<link href="./css/lightbox.css" rel="stylesheet" />
+		
+		<link href="./css/site.css" rel="stylesheet" />
+		<link href="./css/print.css" rel="stylesheet" media="print" />
+		
+		<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
+		<!--[if lt IE 9]>
+			<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+		<![endif]-->
+		
+<script type="text/javascript">var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-3211522-12']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+        })();</script>
+	</head>
+
+	<body class="page-tutorial_spectator project-066-docs" data-spy="scroll" data-offset="60" data-target="#toc-scroll-target">
+
+		<div class="navbar navbar-fixed-top">
+			<div class="navbar-inner">
+				<div class="container">
+					<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+					</a>
+					<a class="brand" href="..">Apache Helix</a>
+					<div class="nav-collapse">
+						<ul class="nav pull-right">
+							<li><a href="index.html" title="Helix 0.6.6">Helix 0.6.6 </a></li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Get Helix <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="download.html" title="Download">Download </a></li>
+									<li><a href="Building.html" title="Building">Building </a></li>
+									<li><a href="releasenotes/release-0.6.6.html" title="Release Notes">Release Notes </a></li>
+								</ul>
+							</li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Hands-On <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="Quickstart.html" title="Quick Start">Quick Start </a></li>
+									<li><a href="Tutorial.html" title="Tutorial">Tutorial </a></li>
+									<li><a href="../javadocs/0.6.6" title="Javadocs">Javadocs </a></li>
+								</ul>
+							</li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Recipes <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="recipes/lock_manager.html" title="Distributed lock manager">Distributed lock manager </a></li>
+									<li><a href="recipes/rabbitmq_consumer_group.html" title="Rabbit MQ consumer group">Rabbit MQ consumer group </a></li>
+									<li><a href="recipes/rsync_replicated_file_store.html" title="Rsync replicated file store">Rsync replicated file store </a></li>
+									<li><a href="recipes/service_discovery.html" title="Service discovery">Service discovery </a></li>
+									<li><a href="recipes/task_dag_execution.html" title="Distributed task DAG execution">Distributed task DAG execution </a></li>
+								</ul>
+							</li>
+						</ul>
+					</div><!--/.nav-collapse -->
+				</div>
+			</div>
+		</div>
+		
+	<div class="container">
+	
+	<!-- Masthead
+	================================================== -->
+	<header class="jumbotron subhead">
+		<div class="row" id="banner">
+			<div class="span12">
+				<div class="pull-left">
+					<a href="../" id="bannerLeft"><img src="../images/helix-logo.jpg" alt='"''"' /></a>
+					<p class="lead">A cluster management framework for partitioned and replicated distributed resources</p>
+				</div>
+				<div class="pull-right">
+					<a href="http://www.apache.org/" id="bannerRight"><img src="../images/feather_small.gif" alt='"''"' /></a>
+				</div>
+			</div>
+		</div>
+		<div>
+			<ul class="breadcrumb">
+				<li><a href="../" title="Apache Helix">Apache Helix </a></li>
+				<li class="divider">/</li>
+				<li><a href="./" title="Release 0.6.6">Release 0.6.6 </a></li>
+				<li class="divider">/</li>
+				<li>  Tutorial - Spectator</li>
+				<li class="publishDate version-date pull-right">Last Published: 2016-11-01</li>
+			</ul>
+		</div>
+	</header>
+
+	<div class="main-body">
+	<div class="row">
+		<div class="span12">
+			<div class="body-content">
+<!-- -
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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. --> 
+<p></p> 
+<div class="section"> 
+ <div class="page-header">
+  <h2 id="Helix_Tutorial:_Spectator"><a href="./Tutorial.html">Helix Tutorial</a>: Spectator</h2>
+ </div> 
+ <p>Next, we'll learn how to implement a <b>spectator</b>. Typically, a spectator needs to react to changes within the distributed system. Examples: a client that needs to know where to send a request, a topic consumer in a consumer group. The spectator is automatically informed of changes in the <i>external state</i> of the cluster, but it does not have to add any code to keep track of other components in the system.</p> 
+ <div class="section"> 
+  <h3 id="Start_a_Connection">Start a Connection</h3> 
+  <p>Same as for a participant, The Helix manager is the common component that connects each system component with the cluster.</p> 
+  <p>It requires the following parameters:</p> 
+  <ul> 
+   <li>clusterName: A logical name to represent the group of nodes</li> 
+   <li>instanceName: A logical name of the process creating the manager instance. Generally this is host:port</li> 
+   <li>instanceType: Type of the process. This can be one of the following types, in this case, use SPECTATOR: 
+    <ul> 
+     <li>CONTROLLER: Process that controls the cluster, any number of controllers can be started but only one will be active at any given time</li> 
+     <li>PARTICIPANT: Process that performs the actual task in the distributed system</li> 
+     <li>SPECTATOR: Process that observes the changes in the cluster</li> 
+     <li>ADMIN: To carry out system admin actions</li> 
+    </ul></li> 
+   <li>zkConnectString: Connection string to ZooKeeper. This is of the form host1:port1,host2:port2,host3:port3</li> 
+  </ul> 
+  <p>After the Helix manager instance is created, the only thing that needs to be registered is the listener. When the ExternalView changes, the listener is notified.</p> 
+  <p>A spectator observes the cluster and is notified when the state of the system changes. Helix consolidates the state of entire cluster in one Znode called ExternalView. Helix provides a default implementation RoutingTableProvider that caches the cluster state and updates it when there is a change in the cluster.</p> 
+  <div class="source"> 
+   <pre>manager = HelixManagerFactory.getZKHelixManager(clusterName,
+                                                instanceName,
+                                                InstanceType.SPECTATOR,
+                                                zkConnectString);
+manager.connect();
+RoutingTableProvider routingTableProvider = new RoutingTableProvider();
+manager.addExternalViewChangeListener(routingTableProvider);
+</pre> 
+  </div> 
+ </div> 
+ <div class="section"> 
+  <h3 id="Spectator_Code">Spectator Code</h3> 
+  <p>In the following code snippet, the application sends the request to a valid instance by interrogating the external view. Suppose the desired resource for this request is in the partition myDB_1.</p> 
+  <div class="source"> 
+   <pre>// instances = routingTableProvider.getInstances(, &quot;PARTITION_NAME&quot;, &quot;PARTITION_STATE&quot;);
+instances = routingTableProvider.getInstances(&quot;myDB&quot;, &quot;myDB_1&quot;, &quot;ONLINE&quot;);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+// Application-specific code to send a request to one of the instances                        //
+////////////////////////////////////////////////////////////////////////////////////////////////
+
+theInstance = instances.get(0);  // should choose an instance and throw an exception if none are available
+result = theInstance.sendRequest(yourApplicationRequest, responseObject);
+
+</pre> 
+  </div> 
+  <p>When the external view changes, the application needs to react by sending requests to a different instance.</p> 
+ </div> 
+</div>
+			</div>
+		</div>
+	</div>
+	</div>
+
+	</div><!-- /container -->
+	
+	<!-- Footer
+	================================================== -->
+	<footer class="well">
+		<div class="container">
+			<div class="row">
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Get Helix</li>
+						<li>
+							<a href="download.html" title="Download">Download </a>
+						</li>
+						<li>
+							<a href="Building.html" title="Building">Building </a>
+						</li>
+						<li>
+							<a href="releasenotes/release-0.6.6.html" title="Release Notes">Release Notes </a>
+						</li>
+					</ul>
+				</div>
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Hands-On</li>
+						<li>
+							<a href="Quickstart.html" title="Quick Start">Quick Start </a>
+						</li>
+						<li>
+							<a href="Tutorial.html" title="Tutorial">Tutorial </a>
+						</li>
+						<li>
+							<a href="../javadocs/0.6.6" title="Javadocs">Javadocs </a>
+						</li>
+					</ul>
+				</div>
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Recipes</li>
+						<li>
+							<a href="recipes/lock_manager.html" title="Distributed lock manager">Distributed lock manager </a>
+						</li>
+						<li>
+							<a href="recipes/rabbitmq_consumer_group.html" title="Rabbit MQ consumer group">Rabbit MQ consumer group </a>
+						</li>
+						<li>
+							<a href="recipes/rsync_replicated_file_store.html" title="Rsync replicated file store">Rsync replicated file store </a>
+						</li>
+						<li>
+							<a href="recipes/service_discovery.html" title="Service discovery">Service discovery </a>
+						</li>
+						<li>
+							<a href="recipes/task_dag_execution.html" title="Distributed task DAG execution">Distributed task DAG execution </a>
+						</li>
+					</ul>
+				</div>
+			</div>
+		</div>
+	</footer>
+		
+	<div class="container subfooter">
+		<div class="row">
+			<div class="span12">
+				<p class="pull-right"><a href="#">Back to top</a></p>
+				<p class="copyright">Copyright &copy;2016 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.</p>
+				<p><a href="http://github.com/andriusvelykis/reflow-maven-skin" title="Reflow Maven skin">Reflow Maven skin</a> by <a href="http://andrius.velykis.lt" target="_blank" title="Andrius Velykis">Andrius Velykis</a>.</p>
+		
+<div class="row span16">
+  <div>Apache Helix, Apache, the Apache feather logo, and the Apache Helix project logos are trademarks of The Apache Software Foundation.
+        All other marks mentioned may be trademarks or registered trademarks of their respective owners.</div>
+  <a href="http://helix.apache.org/0.6.6-docs/privacy-policy.html">Privacy Policy</a>
+</div>			</div>
+		</div>
+	</div>
+
+	<!-- Le javascript
+	================================================== -->
+	<!-- Placed at the end of the document so the pages load faster -->
+
+	<!-- Fallback jQuery loading from Google CDN:
+	     http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go -->
+	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
+	<script type="text/javascript">
+		if (typeof jQuery == 'undefined')
+		{
+			document.write(unescape("%3Cscript src='./js/jquery-1.8.3.min.js' type='text/javascript'%3E%3C/script%3E"));
+		}
+	</script>
+	
+	<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script>
+	<script src="./js/lightbox.js"></script>
+	<script src="./js/jquery.smooth-scroll.min.js"></script>
+	<!-- back button support for smooth scroll -->
+	<script src="./js/jquery.ba-bbq.min.js"></script>
+
+	<script src="./js/reflow-skin.js"></script>
+	
+	</body>
+</html>
\ No newline at end of file

Added: helix/site-content/0.6.6-docs/tutorial_state.html
URL: http://svn.apache.org/viewvc/helix/site-content/0.6.6-docs/tutorial_state.html?rev=1767604&view=auto
==============================================================================
--- helix/site-content/0.6.6-docs/tutorial_state.html (added)
+++ helix/site-content/0.6.6-docs/tutorial_state.html Wed Nov  2 04:11:36 2016
@@ -0,0 +1,355 @@
+
+<!DOCTYPE html>
+<!--
+ Generated by Apache Maven Doxia at 2016-11-01
+ Rendered using Maven Reflow Skin 1.0.0 (http://andriusvelykis.github.com/reflow-maven-skin)
+-->
+<html  xml:lang="en" lang="en">
+
+	<head>
+		<meta charset="UTF-8" />
+		<title>Apache Helix -   Tutorial - State Machine Configuration</title>
+		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+		<meta name="description" content="" />
+		<meta http-equiv="content-language" content="en" />
+
+		<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap.min.css" rel="stylesheet" />
+		<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-responsive.min.css" rel="stylesheet" />
+		<link href="./css/docs.css" rel="stylesheet" />
+		<link href="./css/reflow-skin.css" rel="stylesheet" />
+		
+		
+		<link href="./css/lightbox.css" rel="stylesheet" />
+		
+		<link href="./css/site.css" rel="stylesheet" />
+		<link href="./css/print.css" rel="stylesheet" media="print" />
+		
+		<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
+		<!--[if lt IE 9]>
+			<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+		<![endif]-->
+		
+<script type="text/javascript">var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-3211522-12']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+        })();</script>
+	</head>
+
+	<body class="page-tutorial_state project-066-docs" data-spy="scroll" data-offset="60" data-target="#toc-scroll-target">
+
+		<div class="navbar navbar-fixed-top">
+			<div class="navbar-inner">
+				<div class="container">
+					<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+					</a>
+					<a class="brand" href="..">Apache Helix</a>
+					<div class="nav-collapse">
+						<ul class="nav pull-right">
+							<li><a href="index.html" title="Helix 0.6.6">Helix 0.6.6 </a></li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Get Helix <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="download.html" title="Download">Download </a></li>
+									<li><a href="Building.html" title="Building">Building </a></li>
+									<li><a href="releasenotes/release-0.6.6.html" title="Release Notes">Release Notes </a></li>
+								</ul>
+							</li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Hands-On <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="Quickstart.html" title="Quick Start">Quick Start </a></li>
+									<li><a href="Tutorial.html" title="Tutorial">Tutorial </a></li>
+									<li><a href="../javadocs/0.6.6" title="Javadocs">Javadocs </a></li>
+								</ul>
+							</li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Recipes <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="recipes/lock_manager.html" title="Distributed lock manager">Distributed lock manager </a></li>
+									<li><a href="recipes/rabbitmq_consumer_group.html" title="Rabbit MQ consumer group">Rabbit MQ consumer group </a></li>
+									<li><a href="recipes/rsync_replicated_file_store.html" title="Rsync replicated file store">Rsync replicated file store </a></li>
+									<li><a href="recipes/service_discovery.html" title="Service discovery">Service discovery </a></li>
+									<li><a href="recipes/task_dag_execution.html" title="Distributed task DAG execution">Distributed task DAG execution </a></li>
+								</ul>
+							</li>
+						</ul>
+					</div><!--/.nav-collapse -->
+				</div>
+			</div>
+		</div>
+		
+	<div class="container">
+	
+	<!-- Masthead
+	================================================== -->
+	<header class="jumbotron subhead">
+		<div class="row" id="banner">
+			<div class="span12">
+				<div class="pull-left">
+					<a href="../" id="bannerLeft"><img src="../images/helix-logo.jpg" alt='"''"' /></a>
+					<p class="lead">A cluster management framework for partitioned and replicated distributed resources</p>
+				</div>
+				<div class="pull-right">
+					<a href="http://www.apache.org/" id="bannerRight"><img src="../images/feather_small.gif" alt='"''"' /></a>
+				</div>
+			</div>
+		</div>
+		<div>
+			<ul class="breadcrumb">
+				<li><a href="../" title="Apache Helix">Apache Helix </a></li>
+				<li class="divider">/</li>
+				<li><a href="./" title="Release 0.6.6">Release 0.6.6 </a></li>
+				<li class="divider">/</li>
+				<li>  Tutorial - State Machine Configuration</li>
+				<li class="publishDate version-date pull-right">Last Published: 2016-11-01</li>
+			</ul>
+		</div>
+	</header>
+
+	<div class="main-body">
+	<div class="row">
+		<div class="span12">
+			<div class="body-content">
+<!-- -
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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. --> 
+<p></p> 
+<div class="section"> 
+ <div class="page-header">
+  <h2 id="Helix_Tutorial:_State_Machine_Configuration"><a href="./Tutorial.html">Helix Tutorial</a>: State Machine Configuration</h2>
+ </div> 
+ <p>In this chapter, we'll learn about the state models provided by Helix, and how to create your own custom state model.</p> 
+ <div class="section"> 
+  <h3 id="State_Models">State Models</h3> 
+  <p>Helix comes with 3 default state models that are commonly used. It is possible to have multiple state models in a cluster. Every resource that is added should be configured to use a state model that govern its <i>ideal state</i>.</p> 
+  <div class="section"> 
+   <h4 id="MASTER-SLAVE">MASTER-SLAVE</h4> 
+   <ul> 
+    <li>3 states: OFFLINE, SLAVE, MASTER</li> 
+    <li>Maximum number of masters: 1</li> 
+    <li>Slaves are based on the replication factor. The replication factor can be specified while adding the resource.</li> 
+   </ul> 
+  </div> 
+  <div class="section"> 
+   <h4 id="ONLINE-OFFLINE">ONLINE-OFFLINE</h4> 
+   <ul> 
+    <li>Has 2 states: OFFLINE and ONLINE. This simple state model is a good starting point for most applications.</li> 
+   </ul> 
+  </div> 
+  <div class="section"> 
+   <h4 id="LEADER-STANDBY">LEADER-STANDBY</h4> 
+   <ul> 
+    <li>1 Leader and multiple stand-bys. The idea is that exactly one leader accomplishes a designated task, the stand-bys are ready to take over if the leader fails.</li> 
+   </ul> 
+  </div> 
+ </div> 
+ <div class="section"> 
+  <h3 id="Constraints">Constraints</h3> 
+  <p>In addition to the state machine configuration, one can specify the constraints of states and transitions.</p> 
+  <p>For example, one can say:</p> 
+  <ul> 
+   <li> <p>MASTER:1 <br />Maximum number of replicas in MASTER state at any time is 1</p></li> 
+   <li> <p>OFFLINE-SLAVE:5 <br />Maximum number of OFFLINE-SLAVE transitions that can happen concurrently in the system is 5 in this example.</p></li> 
+  </ul> 
+  <div class="section"> 
+   <h4 id="Dynamic_State_Constraints">Dynamic State Constraints</h4> 
+   <p>We also support two dynamic upper bounds for the number of replicas in each state:</p> 
+   <ul> 
+    <li>N: The number of replicas in the state is at most the number of live participants in the cluster</li> 
+    <li>R: The number of replicas in the state is at most the specified replica count for the partition</li> 
+   </ul> 
+  </div> 
+  <div class="section"> 
+   <h4 id="State_Priority">State Priority</h4> 
+   <p>Helix uses a greedy approach to satisfy the state constraints. For example, if the state machine configuration says it needs 1 MASTER and 2 SLAVES, but only 1 node is active, Helix must promote it to MASTER. This behavior is achieved by providing the state priority list as [MASTER, SLAVE].</p> 
+  </div> 
+  <div class="section"> 
+   <h4 id="State_Transition_Priority">State Transition Priority</h4> 
+   <p>Helix tries to fire as many transitions as possible in parallel to reach the stable state without violating constraints. By default, Helix simply sorts the transitions alphabetically and fires as many as it can without violating the constraints. You can control this by overriding the priority order.</p> 
+  </div> 
+ </div> 
+ <div class="section"> 
+  <h3 id="Special_States">Special States</h3> 
+  <p>There are a few Helix-defined states that are important to be aware of.</p> 
+  <div class="section"> 
+   <h4 id="DROPPED">DROPPED</h4> 
+   <p>The DROPPED state is used to signify a replica that was served by a given participant, but is no longer served. This allows Helix and its participants to effectively clean up. There are two requirements that every new state model should follow with respect to the DROPPED state:</p> 
+   <ul> 
+    <li>The DROPPED state must be defined</li> 
+    <li>There must be a path to DROPPED for every state in the model</li> 
+   </ul> 
+  </div> 
+  <div class="section"> 
+   <h4 id="ERROR">ERROR</h4> 
+   <p>The ERROR state is used whenever the participant serving a partition encountered an error and cannot continue to serve the partition. HelixAdmin has &quot;reset&quot; functionality to allow for participants to recover from the ERROR state.</p> 
+  </div> 
+ </div> 
+ <div class="section"> 
+  <h3 id="Annotated_Example">Annotated Example</h3> 
+  <p>Below is a complete definition of a Master-Slave state model. Notice the fields marked REQUIRED; these are essential for any state model definition.</p> 
+  <div class="source"> 
+   <pre>StateModelDefinition stateModel = new StateModelDefinition.Builder(&quot;MasterSlave&quot;)
+  // OFFLINE is the state that the system starts in (initial state is REQUIRED)
+  .initialState(&quot;OFFLINE&quot;)
+
+  // Lowest number here indicates highest priority, no value indicates lowest priority
+  .addState(&quot;MASTER&quot;, 1)
+  .addState(&quot;SLAVE&quot;, 2)
+  .addState(&quot;OFFLINE&quot;)
+
+  // Note the special inclusion of the DROPPED state (REQUIRED)
+  .addState(HelixDefinedState.DROPPED.toString())
+
+  // No more than one master allowed
+  .upperBound(&quot;MASTER&quot;, 1)
+
+  // R indicates an upper bound of number of replicas for each partition
+  .dynamicUpperBound(&quot;SLAVE&quot;, &quot;R&quot;)
+
+  // Add some high-priority transitions
+  .addTransition(&quot;SLAVE&quot;, &quot;MASTER&quot;, 1)
+  .addTransition(&quot;OFFLINE&quot;, &quot;SLAVE&quot;, 2)
+
+  // Using the same priority value indicates that these transitions can fire in any order
+  .addTransition(&quot;MASTER&quot;, &quot;SLAVE&quot;, 3)
+  .addTransition(&quot;SLAVE&quot;, &quot;OFFLINE&quot;, 3)
+
+  // Not specifying a value defaults to lowest priority
+  // Notice the inclusion of the OFFLINE to DROPPED transition
+  // Since every state has a path to OFFLINE, they each now have a path to DROPPED (REQUIRED)
+  .addTransition(&quot;OFFLINE&quot;, HelixDefinedState.DROPPED.toString())
+
+  // Create the StateModelDefinition instance
+  .build();
+
+  // Use the isValid() function to make sure the StateModelDefinition will work without issues
+  Assert.assertTrue(stateModel.isValid());
+</pre> 
+  </div> 
+ </div> 
+</div>
+			</div>
+		</div>
+	</div>
+	</div>
+
+	</div><!-- /container -->
+	
+	<!-- Footer
+	================================================== -->
+	<footer class="well">
+		<div class="container">
+			<div class="row">
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Get Helix</li>
+						<li>
+							<a href="download.html" title="Download">Download </a>
+						</li>
+						<li>
+							<a href="Building.html" title="Building">Building </a>
+						</li>
+						<li>
+							<a href="releasenotes/release-0.6.6.html" title="Release Notes">Release Notes </a>
+						</li>
+					</ul>
+				</div>
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Hands-On</li>
+						<li>
+							<a href="Quickstart.html" title="Quick Start">Quick Start </a>
+						</li>
+						<li>
+							<a href="Tutorial.html" title="Tutorial">Tutorial </a>
+						</li>
+						<li>
+							<a href="../javadocs/0.6.6" title="Javadocs">Javadocs </a>
+						</li>
+					</ul>
+				</div>
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Recipes</li>
+						<li>
+							<a href="recipes/lock_manager.html" title="Distributed lock manager">Distributed lock manager </a>
+						</li>
+						<li>
+							<a href="recipes/rabbitmq_consumer_group.html" title="Rabbit MQ consumer group">Rabbit MQ consumer group </a>
+						</li>
+						<li>
+							<a href="recipes/rsync_replicated_file_store.html" title="Rsync replicated file store">Rsync replicated file store </a>
+						</li>
+						<li>
+							<a href="recipes/service_discovery.html" title="Service discovery">Service discovery </a>
+						</li>
+						<li>
+							<a href="recipes/task_dag_execution.html" title="Distributed task DAG execution">Distributed task DAG execution </a>
+						</li>
+					</ul>
+				</div>
+			</div>
+		</div>
+	</footer>
+		
+	<div class="container subfooter">
+		<div class="row">
+			<div class="span12">
+				<p class="pull-right"><a href="#">Back to top</a></p>
+				<p class="copyright">Copyright &copy;2016 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.</p>
+				<p><a href="http://github.com/andriusvelykis/reflow-maven-skin" title="Reflow Maven skin">Reflow Maven skin</a> by <a href="http://andrius.velykis.lt" target="_blank" title="Andrius Velykis">Andrius Velykis</a>.</p>
+		
+<div class="row span16">
+  <div>Apache Helix, Apache, the Apache feather logo, and the Apache Helix project logos are trademarks of The Apache Software Foundation.
+        All other marks mentioned may be trademarks or registered trademarks of their respective owners.</div>
+  <a href="http://helix.apache.org/0.6.6-docs/privacy-policy.html">Privacy Policy</a>
+</div>			</div>
+		</div>
+	</div>
+
+	<!-- Le javascript
+	================================================== -->
+	<!-- Placed at the end of the document so the pages load faster -->
+
+	<!-- Fallback jQuery loading from Google CDN:
+	     http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go -->
+	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
+	<script type="text/javascript">
+		if (typeof jQuery == 'undefined')
+		{
+			document.write(unescape("%3Cscript src='./js/jquery-1.8.3.min.js' type='text/javascript'%3E%3C/script%3E"));
+		}
+	</script>
+	
+	<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script>
+	<script src="./js/lightbox.js"></script>
+	<script src="./js/jquery.smooth-scroll.min.js"></script>
+	<!-- back button support for smooth scroll -->
+	<script src="./js/jquery.ba-bbq.min.js"></script>
+
+	<script src="./js/reflow-skin.js"></script>
+	
+	</body>
+</html>
\ No newline at end of file

Added: helix/site-content/0.6.6-docs/tutorial_throttling.html
URL: http://svn.apache.org/viewvc/helix/site-content/0.6.6-docs/tutorial_throttling.html?rev=1767604&view=auto
==============================================================================
--- helix/site-content/0.6.6-docs/tutorial_throttling.html (added)
+++ helix/site-content/0.6.6-docs/tutorial_throttling.html Wed Nov  2 04:11:36 2016
@@ -0,0 +1,258 @@
+
+<!DOCTYPE html>
+<!--
+ Generated by Apache Maven Doxia at 2016-11-01
+ Rendered using Maven Reflow Skin 1.0.0 (http://andriusvelykis.github.com/reflow-maven-skin)
+-->
+<html  xml:lang="en" lang="en">
+
+	<head>
+		<meta charset="UTF-8" />
+		<title>Apache Helix -   Tutorial - Throttling</title>
+		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+		<meta name="description" content="" />
+		<meta http-equiv="content-language" content="en" />
+
+		<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap.min.css" rel="stylesheet" />
+		<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-responsive.min.css" rel="stylesheet" />
+		<link href="./css/docs.css" rel="stylesheet" />
+		<link href="./css/reflow-skin.css" rel="stylesheet" />
+		
+		
+		<link href="./css/lightbox.css" rel="stylesheet" />
+		
+		<link href="./css/site.css" rel="stylesheet" />
+		<link href="./css/print.css" rel="stylesheet" media="print" />
+		
+		<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
+		<!--[if lt IE 9]>
+			<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+		<![endif]-->
+		
+<script type="text/javascript">var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-3211522-12']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+        })();</script>
+	</head>
+
+	<body class="page-tutorial_throttling project-066-docs" data-spy="scroll" data-offset="60" data-target="#toc-scroll-target">
+
+		<div class="navbar navbar-fixed-top">
+			<div class="navbar-inner">
+				<div class="container">
+					<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+					</a>
+					<a class="brand" href="..">Apache Helix</a>
+					<div class="nav-collapse">
+						<ul class="nav pull-right">
+							<li><a href="index.html" title="Helix 0.6.6">Helix 0.6.6 </a></li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Get Helix <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="download.html" title="Download">Download </a></li>
+									<li><a href="Building.html" title="Building">Building </a></li>
+									<li><a href="releasenotes/release-0.6.6.html" title="Release Notes">Release Notes </a></li>
+								</ul>
+							</li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Hands-On <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="Quickstart.html" title="Quick Start">Quick Start </a></li>
+									<li><a href="Tutorial.html" title="Tutorial">Tutorial </a></li>
+									<li><a href="../javadocs/0.6.6" title="Javadocs">Javadocs </a></li>
+								</ul>
+							</li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Recipes <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="recipes/lock_manager.html" title="Distributed lock manager">Distributed lock manager </a></li>
+									<li><a href="recipes/rabbitmq_consumer_group.html" title="Rabbit MQ consumer group">Rabbit MQ consumer group </a></li>
+									<li><a href="recipes/rsync_replicated_file_store.html" title="Rsync replicated file store">Rsync replicated file store </a></li>
+									<li><a href="recipes/service_discovery.html" title="Service discovery">Service discovery </a></li>
+									<li><a href="recipes/task_dag_execution.html" title="Distributed task DAG execution">Distributed task DAG execution </a></li>
+								</ul>
+							</li>
+						</ul>
+					</div><!--/.nav-collapse -->
+				</div>
+			</div>
+		</div>
+		
+	<div class="container">
+	
+	<!-- Masthead
+	================================================== -->
+	<header class="jumbotron subhead">
+		<div class="row" id="banner">
+			<div class="span12">
+				<div class="pull-left">
+					<a href="../" id="bannerLeft"><img src="../images/helix-logo.jpg" alt='"''"' /></a>
+					<p class="lead">A cluster management framework for partitioned and replicated distributed resources</p>
+				</div>
+				<div class="pull-right">
+					<a href="http://www.apache.org/" id="bannerRight"><img src="../images/feather_small.gif" alt='"''"' /></a>
+				</div>
+			</div>
+		</div>
+		<div>
+			<ul class="breadcrumb">
+				<li><a href="../" title="Apache Helix">Apache Helix </a></li>
+				<li class="divider">/</li>
+				<li><a href="./" title="Release 0.6.6">Release 0.6.6 </a></li>
+				<li class="divider">/</li>
+				<li>  Tutorial - Throttling</li>
+				<li class="publishDate version-date pull-right">Last Published: 2016-11-01</li>
+			</ul>
+		</div>
+	</header>
+
+	<div class="main-body">
+	<div class="row">
+		<div class="span12">
+			<div class="body-content">
+<!-- -
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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. --> 
+<p></p> 
+<div class="section"> 
+ <div class="page-header">
+  <h2 id="Helix_Tutorial:_Throttling"><a href="./Tutorial.html">Helix Tutorial</a>: Throttling</h2>
+ </div> 
+ <p>In this chapter, we'll learn how to control the parallel execution of cluster tasks. Only a centralized cluster manager with global knowledge (i.e. Helix) is capable of coordinating this decision.</p> 
+ <div class="section"> 
+  <h3 id="Throttling">Throttling</h3> 
+  <p>Since all state changes in the system are triggered through transitions, Helix can control the number of transitions that can happen in parallel. Some of the transitions may be lightweight, but some might involve moving data, which is quite expensive from a network and IOPS perspective.</p> 
+  <p>Helix allows applications to set a threshold on transitions. The threshold can be set at multiple scopes:</p> 
+  <ul> 
+   <li>MessageType e.g STATE_TRANSITION</li> 
+   <li>TransitionType e.g SLAVE-MASTER</li> 
+   <li>Resource e.g database</li> 
+   <li>Node i.e per-node maximum transitions in parallel</li> 
+  </ul> 
+ </div> 
+</div>
+			</div>
+		</div>
+	</div>
+	</div>
+
+	</div><!-- /container -->
+	
+	<!-- Footer
+	================================================== -->
+	<footer class="well">
+		<div class="container">
+			<div class="row">
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Get Helix</li>
+						<li>
+							<a href="download.html" title="Download">Download </a>
+						</li>
+						<li>
+							<a href="Building.html" title="Building">Building </a>
+						</li>
+						<li>
+							<a href="releasenotes/release-0.6.6.html" title="Release Notes">Release Notes </a>
+						</li>
+					</ul>
+				</div>
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Hands-On</li>
+						<li>
+							<a href="Quickstart.html" title="Quick Start">Quick Start </a>
+						</li>
+						<li>
+							<a href="Tutorial.html" title="Tutorial">Tutorial </a>
+						</li>
+						<li>
+							<a href="../javadocs/0.6.6" title="Javadocs">Javadocs </a>
+						</li>
+					</ul>
+				</div>
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Recipes</li>
+						<li>
+							<a href="recipes/lock_manager.html" title="Distributed lock manager">Distributed lock manager </a>
+						</li>
+						<li>
+							<a href="recipes/rabbitmq_consumer_group.html" title="Rabbit MQ consumer group">Rabbit MQ consumer group </a>
+						</li>
+						<li>
+							<a href="recipes/rsync_replicated_file_store.html" title="Rsync replicated file store">Rsync replicated file store </a>
+						</li>
+						<li>
+							<a href="recipes/service_discovery.html" title="Service discovery">Service discovery </a>
+						</li>
+						<li>
+							<a href="recipes/task_dag_execution.html" title="Distributed task DAG execution">Distributed task DAG execution </a>
+						</li>
+					</ul>
+				</div>
+			</div>
+		</div>
+	</footer>
+		
+	<div class="container subfooter">
+		<div class="row">
+			<div class="span12">
+				<p class="pull-right"><a href="#">Back to top</a></p>
+				<p class="copyright">Copyright &copy;2016 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.</p>
+				<p><a href="http://github.com/andriusvelykis/reflow-maven-skin" title="Reflow Maven skin">Reflow Maven skin</a> by <a href="http://andrius.velykis.lt" target="_blank" title="Andrius Velykis">Andrius Velykis</a>.</p>
+		
+<div class="row span16">
+  <div>Apache Helix, Apache, the Apache feather logo, and the Apache Helix project logos are trademarks of The Apache Software Foundation.
+        All other marks mentioned may be trademarks or registered trademarks of their respective owners.</div>
+  <a href="http://helix.apache.org/0.6.6-docs/privacy-policy.html">Privacy Policy</a>
+</div>			</div>
+		</div>
+	</div>
+
+	<!-- Le javascript
+	================================================== -->
+	<!-- Placed at the end of the document so the pages load faster -->
+
+	<!-- Fallback jQuery loading from Google CDN:
+	     http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go -->
+	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
+	<script type="text/javascript">
+		if (typeof jQuery == 'undefined')
+		{
+			document.write(unescape("%3Cscript src='./js/jquery-1.8.3.min.js' type='text/javascript'%3E%3C/script%3E"));
+		}
+	</script>
+	
+	<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script>
+	<script src="./js/lightbox.js"></script>
+	<script src="./js/jquery.smooth-scroll.min.js"></script>
+	<!-- back button support for smooth scroll -->
+	<script src="./js/jquery.ba-bbq.min.js"></script>
+
+	<script src="./js/reflow-skin.js"></script>
+	
+	</body>
+</html>
\ No newline at end of file

Added: helix/site-content/0.6.6-docs/tutorial_user_def_rebalancer.html
URL: http://svn.apache.org/viewvc/helix/site-content/0.6.6-docs/tutorial_user_def_rebalancer.html?rev=1767604&view=auto
==============================================================================
--- helix/site-content/0.6.6-docs/tutorial_user_def_rebalancer.html (added)
+++ helix/site-content/0.6.6-docs/tutorial_user_def_rebalancer.html Wed Nov  2 04:11:36 2016
@@ -0,0 +1,391 @@
+
+<!DOCTYPE html>
+<!--
+ Generated by Apache Maven Doxia at 2016-11-01
+ Rendered using Maven Reflow Skin 1.0.0 (http://andriusvelykis.github.com/reflow-maven-skin)
+-->
+<html  xml:lang="en" lang="en">
+
+	<head>
+		<meta charset="UTF-8" />
+		<title>Apache Helix -   Tutorial - User-Defined Rebalancing</title>
+		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+		<meta name="description" content="" />
+		<meta http-equiv="content-language" content="en" />
+
+		<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap.min.css" rel="stylesheet" />
+		<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-responsive.min.css" rel="stylesheet" />
+		<link href="./css/docs.css" rel="stylesheet" />
+		<link href="./css/reflow-skin.css" rel="stylesheet" />
+		
+		
+		<link href="./css/lightbox.css" rel="stylesheet" />
+		
+		<link href="./css/site.css" rel="stylesheet" />
+		<link href="./css/print.css" rel="stylesheet" media="print" />
+		
+		<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
+		<!--[if lt IE 9]>
+			<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+		<![endif]-->
+		
+<script type="text/javascript">var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-3211522-12']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+        })();</script>
+	</head>
+
+	<body class="page-tutorial_user_def_rebalancer project-066-docs" data-spy="scroll" data-offset="60" data-target="#toc-scroll-target">
+
+		<div class="navbar navbar-fixed-top">
+			<div class="navbar-inner">
+				<div class="container">
+					<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+					</a>
+					<a class="brand" href="..">Apache Helix</a>
+					<div class="nav-collapse">
+						<ul class="nav pull-right">
+							<li><a href="index.html" title="Helix 0.6.6">Helix 0.6.6 </a></li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Get Helix <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="download.html" title="Download">Download </a></li>
+									<li><a href="Building.html" title="Building">Building </a></li>
+									<li><a href="releasenotes/release-0.6.6.html" title="Release Notes">Release Notes </a></li>
+								</ul>
+							</li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Hands-On <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="Quickstart.html" title="Quick Start">Quick Start </a></li>
+									<li><a href="Tutorial.html" title="Tutorial">Tutorial </a></li>
+									<li><a href="../javadocs/0.6.6" title="Javadocs">Javadocs </a></li>
+								</ul>
+							</li>
+							<li class="dropdown">
+								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Recipes <b class="caret"></b></a>
+								<ul class="dropdown-menu">
+									<li><a href="recipes/lock_manager.html" title="Distributed lock manager">Distributed lock manager </a></li>
+									<li><a href="recipes/rabbitmq_consumer_group.html" title="Rabbit MQ consumer group">Rabbit MQ consumer group </a></li>
+									<li><a href="recipes/rsync_replicated_file_store.html" title="Rsync replicated file store">Rsync replicated file store </a></li>
+									<li><a href="recipes/service_discovery.html" title="Service discovery">Service discovery </a></li>
+									<li><a href="recipes/task_dag_execution.html" title="Distributed task DAG execution">Distributed task DAG execution </a></li>
+								</ul>
+							</li>
+						</ul>
+					</div><!--/.nav-collapse -->
+				</div>
+			</div>
+		</div>
+		
+	<div class="container">
+	
+	<!-- Masthead
+	================================================== -->
+	<header class="jumbotron subhead">
+		<div class="row" id="banner">
+			<div class="span12">
+				<div class="pull-left">
+					<a href="../" id="bannerLeft"><img src="../images/helix-logo.jpg" alt='"''"' /></a>
+					<p class="lead">A cluster management framework for partitioned and replicated distributed resources</p>
+				</div>
+				<div class="pull-right">
+					<a href="http://www.apache.org/" id="bannerRight"><img src="../images/feather_small.gif" alt='"''"' /></a>
+				</div>
+			</div>
+		</div>
+		<div>
+			<ul class="breadcrumb">
+				<li><a href="../" title="Apache Helix">Apache Helix </a></li>
+				<li class="divider">/</li>
+				<li><a href="./" title="Release 0.6.6">Release 0.6.6 </a></li>
+				<li class="divider">/</li>
+				<li>  Tutorial - User-Defined Rebalancing</li>
+				<li class="publishDate version-date pull-right">Last Published: 2016-11-01</li>
+			</ul>
+		</div>
+	</header>
+
+	<div class="main-body">
+	<div class="row">
+		<div class="span12">
+			<div class="body-content">
+<!-- -
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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. --> 
+<p></p> 
+<div class="section"> 
+ <div class="page-header">
+  <h2 id="Helix_Tutorial:_User-Defined_Rebalancing"><a href="./Tutorial.html">Helix Tutorial</a>: User-Defined Rebalancing</h2>
+ </div> 
+ <p>Even though Helix can compute both the location and the state of replicas internally using a default fully-automatic rebalancer, specific applications may require rebalancing strategies that optimize for different requirements. Thus, Helix allows applications to plug in arbitrary rebalancer algorithms that implement a provided interface. One of the main design goals of Helix is to provide maximum flexibility to any distributed application. Thus, it allows applications to fully implement the rebalancer, which is the core constraint solver in the system, if the application developer so chooses.</p> 
+ <p>Whenever the state of the cluster changes, as is the case when participants join or leave the cluster, Helix automatically calls the rebalancer to compute a new mapping of all the replicas in the resource. When using a pluggable rebalancer, the only required step is to register it with Helix. Subsequently, no additional bootstrapping steps are necessary. Helix uses reflection to look up and load the class dynamically at runtime. As a result, it is also technically possible to change the rebalancing strategy used at any time.</p> 
+ <p>The Rebalancer interface is as follows:</p> 
+ <div class="source"> 
+  <pre>void init(HelixManager manager);
+
+IdealState computeNewIdealState(String resourceName, IdealState currentIdealState,
+    final CurrentStateOutput currentStateOutput, final ClusterDataCache clusterData);
+</pre> 
+ </div> 
+ <p>The first parameter is the resource to rebalance, the second is pre-existing ideal mappings, the third is a snapshot of the actual placements and state assignments, and the fourth is a full cache of all of the cluster data available to Helix. Internally, Helix implements the same interface for its own rebalancing routines, so a user-defined rebalancer will be cognizant of the same information about the cluster as an internal implementation. Helix strives to provide applications the ability to implement algorithms that may require a large portion of the entire state of the cluster to make the best placement and state assignment decisions possible.</p> 
+ <p>An IdealState is a full representation of the location of each replica of each partition of a given resource. This is a simple representation of the placement that the algorithm believes is the best possible. If the placement meets all defined constraints, this is what will become the actual state of the distributed system.</p> 
+ <div class="section"> 
+  <h3 id="Specifying_a_Rebalancer">Specifying a Rebalancer</h3> 
+  <p>For implementations that set up the cluster through existing code, the following HelixAdmin calls will update the Rebalancer class:</p> 
+  <div class="source"> 
+   <pre>IdealState idealState = helixAdmin.getResourceIdealState(clusterName, resourceName);
+idealState.setRebalanceMode(RebalanceMode.USER_DEFINED);
+idealState.setRebalancerClassName(className);
+helixAdmin.setResourceIdealState(clusterName, resourceName, idealState);
+</pre> 
+  </div> 
+  <p>There are two key fields to set to specify that a pluggable rebalancer should be used. First, the rebalance mode should be set to USER_DEFINED, and second the rebalancer class name should be set to a class that implements Rebalancer and is within the scope of the project. The class name is a fully-qualified class name consisting of its package and its name. Without specification of the USER_DEFINED mode, the user-defined rebalancer class will not be used even if specified. Furthermore, Helix will not attempt to rebalance the resources through its standard routines if its mode is USER_DEFINED, regardless of whether or not a rebalancer class is registered.</p> 
+ </div> 
+ <div class="section"> 
+  <h3 id="Example">Example</h3> 
+  <p>In the next release (0.7.0), we will provide a full recipe of a user-defined rebalancer in action.</p> 
+  <p>Consider the case where partitions are locks in a lock manager and 6 locks are to be distributed evenly to a set of participants, and only one participant can hold each lock. We can define a rebalancing algorithm that simply takes the modulus of the lock number and the number of participants to evenly distribute the locks across participants. Helix allows capping the number of partitions a participant can accept, but since locks are lightweight, we do not need to define a restriction in this case. The following is a succinct implementation of this algorithm.</p> 
+  <div class="source"> 
+   <pre>@Override
+IdealState computeNewIdealState(String resourceName, IdealState currentIdealState,
+    final CurrentStateOutput currentStateOutput, final ClusterDataCache clusterData) {
+  // Get the list of live participants in the cluster
+  List&lt;String&gt; liveParticipants = new ArrayList&lt;String&gt;(clusterData.getLiveInstances().keySet());
+
+  // Count the number of participants allowed to lock each lock (in this example, this is 1)
+  int lockHolders = Integer.parseInt(currentIdealState.getReplicas());
+
+  // Fairly assign the lock state to the participants using a simple mod-based sequential
+  // assignment. For instance, if each lock can be held by 3 participants, lock 0 would be held
+  // by participants (0, 1, 2), lock 1 would be held by (1, 2, 3), and so on, wrapping around the
+  // number of participants as necessary.
+  int i = 0;
+  for (String partition : currentIdealState.getPartitionSet()) {
+    List&lt;String&gt; preferenceList = new ArrayList&lt;String&gt;();
+    for (int j = i; j &lt; i + lockHolders; j++) {
+      int participantIndex = j % liveParticipants.size();
+      String participant = liveParticipants.get(participantIndex);
+      // enforce that a participant can only have one instance of a given lock
+      if (!preferenceList.contains(participant)) {
+        preferenceList.add(participant);
+      }
+    }
+    currentIdealState.setPreferenceList(partition, preferenceList);
+    i++;
+  }
+  return assignment;
+}
+</pre> 
+  </div> 
+  <p>Here are the IdealState preference lists emitted by the user-defined rebalancer for a 3-participant system whenever there is a change to the set of participants.</p> 
+  <ul> 
+   <li>Participant_A joins</li> 
+  </ul> 
+  <div class="source"> 
+   <pre>{
+  &quot;lock_0&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_1&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_2&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_3&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_4&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_5&quot;: [&quot;Participant_A&quot;],
+}
+</pre> 
+  </div> 
+  <p>A preference list is a mapping for each resource of partition to the participants serving each replica. The state model is a simple LOCKED/RELEASED model, so participant A holds all lock partitions in the LOCKED state.</p> 
+  <ul> 
+   <li>Participant_B joins</li> 
+  </ul> 
+  <div class="source"> 
+   <pre>{
+  &quot;lock_0&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_1&quot;: [&quot;Participant_B&quot;],
+  &quot;lock_2&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_3&quot;: [&quot;Participant_B&quot;],
+  &quot;lock_4&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_5&quot;: [&quot;Participant_B&quot;],
+}
+</pre> 
+  </div> 
+  <p>Now that there are two participants, the simple mod-based function assigns every other lock to the second participant. On any system change, the rebalancer is invoked so that the application can define how to redistribute its resources.</p> 
+  <ul> 
+   <li>Participant_C joins (steady state)</li> 
+  </ul> 
+  <div class="source"> 
+   <pre>{
+  &quot;lock_0&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_1&quot;: [&quot;Participant_B&quot;],
+  &quot;lock_2&quot;: [&quot;Participant_C&quot;],
+  &quot;lock_3&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_4&quot;: [&quot;Participant_B&quot;],
+  &quot;lock_5&quot;: [&quot;Participant_C&quot;],
+}
+</pre> 
+  </div> 
+  <p>This is the steady state of the system. Notice that four of the six locks now have a different owner. That is because of the na&iuml;ve modulus-based assignmemt approach used by the user-defined rebalancer. However, the interface is flexible enough to allow you to employ consistent hashing or any other scheme if minimal movement is a system requirement.</p> 
+  <ul> 
+   <li>Participant_B fails</li> 
+  </ul> 
+  <div class="source"> 
+   <pre>{
+  &quot;lock_0&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_1&quot;: [&quot;Participant_C&quot;],
+  &quot;lock_2&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_3&quot;: [&quot;Participant_C&quot;],
+  &quot;lock_4&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_5&quot;: [&quot;Participant_C&quot;],
+}
+</pre> 
+  </div> 
+  <p>On any node failure, as in the case of node addition, the rebalancer is invoked automatically so that it can generate a new mapping as a response to the change. Helix ensures that the Rebalancer has the opportunity to reassign locks as required by the application.</p> 
+  <ul> 
+   <li>Participant_B (or the replacement for the original Participant_B) rejoins</li> 
+  </ul> 
+  <div class="source"> 
+   <pre>{
+  &quot;lock_0&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_1&quot;: [&quot;Participant_B&quot;],
+  &quot;lock_2&quot;: [&quot;Participant_C&quot;],
+  &quot;lock_3&quot;: [&quot;Participant_A&quot;],
+  &quot;lock_4&quot;: [&quot;Participant_B&quot;],
+  &quot;lock_5&quot;: [&quot;Participant_C&quot;],
+}
+</pre> 
+  </div> 
+  <p>The rebalancer was invoked once again and the resulting IdealState preference lists reflect the steady state.</p> 
+ </div> 
+ <div class="section"> 
+  <h3 id="Caveats">Caveats</h3> 
+  <ul> 
+   <li>The rebalancer class must be available at runtime, or else Helix will not attempt to rebalance at all</li> 
+   <li>The Helix controller will only take into account the preference lists in the new IdealState for this release. In 0.7.0, Helix rebalancers will be able to compute the full resource assignment, including the states.</li> 
+   <li>Helix does not currently persist the new IdealState computed by the user-defined rebalancer. However, the Helix property store is available for saving any computed state. In 0.7.0, Helix will persist the result of running the rebalancer.</li> 
+  </ul> 
+ </div> 
+</div>
+			</div>
+		</div>
+	</div>
+	</div>
+
+	</div><!-- /container -->
+	
+	<!-- Footer
+	================================================== -->
+	<footer class="well">
+		<div class="container">
+			<div class="row">
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Get Helix</li>
+						<li>
+							<a href="download.html" title="Download">Download </a>
+						</li>
+						<li>
+							<a href="Building.html" title="Building">Building </a>
+						</li>
+						<li>
+							<a href="releasenotes/release-0.6.6.html" title="Release Notes">Release Notes </a>
+						</li>
+					</ul>
+				</div>
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Hands-On</li>
+						<li>
+							<a href="Quickstart.html" title="Quick Start">Quick Start </a>
+						</li>
+						<li>
+							<a href="Tutorial.html" title="Tutorial">Tutorial </a>
+						</li>
+						<li>
+							<a href="../javadocs/0.6.6" title="Javadocs">Javadocs </a>
+						</li>
+					</ul>
+				</div>
+				<div class="span3 bottom-nav">
+					<ul class="nav nav-list">
+						<li class="nav-header">Recipes</li>
+						<li>
+							<a href="recipes/lock_manager.html" title="Distributed lock manager">Distributed lock manager </a>
+						</li>
+						<li>
+							<a href="recipes/rabbitmq_consumer_group.html" title="Rabbit MQ consumer group">Rabbit MQ consumer group </a>
+						</li>
+						<li>
+							<a href="recipes/rsync_replicated_file_store.html" title="Rsync replicated file store">Rsync replicated file store </a>
+						</li>
+						<li>
+							<a href="recipes/service_discovery.html" title="Service discovery">Service discovery </a>
+						</li>
+						<li>
+							<a href="recipes/task_dag_execution.html" title="Distributed task DAG execution">Distributed task DAG execution </a>
+						</li>
+					</ul>
+				</div>
+			</div>
+		</div>
+	</footer>
+		
+	<div class="container subfooter">
+		<div class="row">
+			<div class="span12">
+				<p class="pull-right"><a href="#">Back to top</a></p>
+				<p class="copyright">Copyright &copy;2016 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.</p>
+				<p><a href="http://github.com/andriusvelykis/reflow-maven-skin" title="Reflow Maven skin">Reflow Maven skin</a> by <a href="http://andrius.velykis.lt" target="_blank" title="Andrius Velykis">Andrius Velykis</a>.</p>
+		
+<div class="row span16">
+  <div>Apache Helix, Apache, the Apache feather logo, and the Apache Helix project logos are trademarks of The Apache Software Foundation.
+        All other marks mentioned may be trademarks or registered trademarks of their respective owners.</div>
+  <a href="http://helix.apache.org/0.6.6-docs/privacy-policy.html">Privacy Policy</a>
+</div>			</div>
+		</div>
+	</div>
+
+	<!-- Le javascript
+	================================================== -->
+	<!-- Placed at the end of the document so the pages load faster -->
+
+	<!-- Fallback jQuery loading from Google CDN:
+	     http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go -->
+	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
+	<script type="text/javascript">
+		if (typeof jQuery == 'undefined')
+		{
+			document.write(unescape("%3Cscript src='./js/jquery-1.8.3.min.js' type='text/javascript'%3E%3C/script%3E"));
+		}
+	</script>
+	
+	<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script>
+	<script src="./js/lightbox.js"></script>
+	<script src="./js/jquery.smooth-scroll.min.js"></script>
+	<!-- back button support for smooth scroll -->
+	<script src="./js/jquery.ba-bbq.min.js"></script>
+
+	<script src="./js/reflow-skin.js"></script>
+	
+	</body>
+</html>
\ No newline at end of file



Mime
View raw message