You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by sr...@apache.org on 2018/05/12 16:06:36 UTC

[49/51] [partial] storm-site git commit: Rebuild content based on new 2.0.0-SNAPSHOT docs

http://git-wip-us.apache.org/repos/asf/storm-site/blob/0183bf7e/content/releases/2.0.0-SNAPSHOT/Joins.html
----------------------------------------------------------------------
diff --git a/content/releases/2.0.0-SNAPSHOT/Joins.html b/content/releases/2.0.0-SNAPSHOT/Joins.html
new file mode 100644
index 0000000..809ab78
--- /dev/null
+++ b/content/releases/2.0.0-SNAPSHOT/Joins.html
@@ -0,0 +1,350 @@
+<!DOCTYPE html>
+<html>
+    <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+
+    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
+    <link rel="icon" href="/favicon.ico" type="image/x-icon">
+
+    <title>Joining Streams in Storm Core</title>
+
+    <!-- Bootstrap core CSS -->
+    <link href="/assets/css/bootstrap.min.css" rel="stylesheet">
+    <!-- Bootstrap theme -->
+    <link href="/assets/css/bootstrap-theme.min.css" rel="stylesheet">
+
+    <!-- Custom styles for this template -->
+    <link rel="stylesheet" href="http://fortawesome.github.io/Font-Awesome/assets/font-awesome/css/font-awesome.css">
+    <link href="/css/style.css" rel="stylesheet">
+    <link href="/assets/css/owl.theme.css" rel="stylesheet">
+    <link href="/assets/css/owl.carousel.css" rel="stylesheet">
+    <script type="text/javascript" src="/assets/js/jquery.min.js"></script>
+    <script type="text/javascript" src="/assets/js/bootstrap.min.js"></script>
+    <script type="text/javascript" src="/assets/js/owl.carousel.min.js"></script>
+    <script type="text/javascript" src="/assets/js/storm.js"></script>
+    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
+    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
+    
+    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
+    <!--[if lt IE 9]>
+      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
+      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
+    <![endif]-->
+  </head>
+
+
+  <body>
+    <header>
+  <div class="container-fluid">
+     <div class="row">
+          <div class="col-md-5">
+            <a href="/index.html"><img src="/images/logo.png" class="logo" /></a>
+          </div>
+          <div class="col-md-5">
+            
+              <h1>Version: 2.0.0-SNAPSHOT</h1>
+            
+          </div>
+          <div class="col-md-2">
+            <a href="/downloads.html" class="btn-std btn-block btn-download">Download</a>
+          </div>
+        </div>
+    </div>
+</header>
+<!--Header End-->
+<!--Navigation Begin-->
+<div class="navbar" role="banner">
+  <div class="container-fluid">
+      <div class="navbar-header">
+          <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse">
+                <span class="icon-bar"></span>
+                <span class="icon-bar"></span>
+                <span class="icon-bar"></span>
+            </button>
+        </div>
+        <nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
+          <ul class="nav navbar-nav">
+              <li><a href="/index.html" id="home">Home</a></li>
+                <li><a href="/getting-help.html" id="getting-help">Getting Help</a></li>
+                <li><a href="/about/integrates.html" id="project-info">Project Information</a></li>
+                <li class="dropdown">
+                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="documentation">Documentation <b class="caret"></b></a>
+                    <ul class="dropdown-menu">
+                      
+                        
+                          <li><a href="/releases/2.0.0-SNAPSHOT/index.html">2.0.0-SNAPSHOT</a></li>
+                        
+                      
+                        
+                          <li><a href="/releases/1.2.1/index.html">1.2.1</a></li>
+                        
+                      
+                        
+                          <li><a href="/releases/1.1.2/index.html">1.1.2</a></li>
+                        
+                      
+                        
+                      
+                        
+                          <li><a href="/releases/1.0.6/index.html">1.0.6</a></li>
+                        
+                      
+                        
+                      
+                        
+                      
+                        
+                      
+                        
+                      
+                        
+                      
+                        
+                      
+                        
+                      
+                        
+                      
+                        
+                      
+                        
+                      
+                        
+                      
+                        
+                      
+                        
+                      
+                    </ul>
+                </li>
+                <li><a href="/talksAndVideos.html">Talks and Slideshows</a></li>
+                <li class="dropdown">
+                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="contribute">Community <b class="caret"></b></a>
+                    <ul class="dropdown-menu">
+                        <li><a href="/contribute/Contributing-to-Storm.html">Contributing</a></li>
+                        <li><a href="/contribute/People.html">People</a></li>
+                        <li><a href="/contribute/BYLAWS.html">ByLaws</a></li>
+                    </ul>
+                </li>
+                <li><a href="/2018/02/19/storm121-released.html" id="news">News</a></li>
+            </ul>
+        </nav>
+    </div>
+</div>
+
+
+
+    <div class="container-fluid">
+    <h1 class="page-title">Joining Streams in Storm Core</h1>
+          <div class="row">
+           	<div class="col-md-12">
+	             <!-- Documentation -->
+
+<p class="post-meta"></p>
+
+<p>Storm core supports joining multiple data streams into one with the help of <code>JoinBolt</code>.
+<code>JoinBolt</code> is a Windowed bolt, i.e. it waits for the configured window duration to match up the
+tuples among the streams being joined. This helps align the streams within a Window boundary.</p>
+
+<p>Each of <code>JoinBolt</code>&#39;s incoming data streams must be Fields Grouped on a single field. A stream 
+should only be joined with the other streams using the field on which it has been FieldsGrouped.<br>
+Knowing this will help understand the join syntax described below.  </p>
+
+<h2 id="performing-joins">Performing Joins</h2>
+
+<p>Consider the following SQL join involving 4 tables:</p>
+<div class="highlight"><pre><code class="language-sql" data-lang="sql"><span class="k">select</span>  <span class="n">userId</span><span class="p">,</span> <span class="n">key4</span><span class="p">,</span> <span class="n">key2</span><span class="p">,</span> <span class="n">key3</span>
+<span class="k">from</span>        <span class="n">table1</span>
+<span class="k">inner</span> <span class="k">join</span>  <span class="n">table2</span>  <span class="k">on</span> <span class="n">table2</span><span class="p">.</span><span class="n">userId</span> <span class="o">=</span>  <span class="n">table1</span><span class="p">.</span><span class="n">key1</span>
+<span class="k">inner</span> <span class="k">join</span>  <span class="n">table3</span>  <span class="k">on</span> <span class="n">table3</span><span class="p">.</span><span class="n">key3</span>   <span class="o">=</span>  <span class="n">table2</span><span class="p">.</span><span class="n">userId</span>
+<span class="k">left</span> <span class="k">join</span>   <span class="n">table4</span>  <span class="k">on</span> <span class="n">table4</span><span class="p">.</span><span class="n">key4</span>   <span class="o">=</span>  <span class="n">table3</span><span class="p">.</span><span class="n">key3</span>
+</code></pre></div>
+<p>Similar joins could be expressed on tuples generated by 4 spouts using <code>JoinBolt</code>:</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="n">JoinBolt</span> <span class="n">jbolt</span> <span class="o">=</span>  <span class="k">new</span> <span class="n">JoinBolt</span><span class="o">(</span><span class="s">"spout1"</span><span class="o">,</span> <span class="s">"key1"</span><span class="o">)</span>                   <span class="c1">// from        spout1  </span>
+                    <span class="o">.</span><span class="na">join</span>     <span class="o">(</span><span class="s">"spout2"</span><span class="o">,</span> <span class="s">"userId"</span><span class="o">,</span>  <span class="s">"spout1"</span><span class="o">)</span>      <span class="c1">// inner join  spout2  on spout2.userId = spout1.key1</span>
+                    <span class="o">.</span><span class="na">join</span>     <span class="o">(</span><span class="s">"spout3"</span><span class="o">,</span> <span class="s">"key3"</span><span class="o">,</span>    <span class="s">"spout2"</span><span class="o">)</span>      <span class="c1">// inner join  spout3  on spout3.key3   = spout2.userId   </span>
+                    <span class="o">.</span><span class="na">leftJoin</span> <span class="o">(</span><span class="s">"spout4"</span><span class="o">,</span> <span class="s">"key4"</span><span class="o">,</span>    <span class="s">"spout3"</span><span class="o">)</span>      <span class="c1">// left join   spout4  on spout4.key4   = spout3.key3</span>
+                    <span class="o">.</span><span class="na">select</span>  <span class="o">(</span><span class="s">"userId, key4, key2, spout3:key3"</span><span class="o">)</span>   <span class="c1">// chose output fields</span>
+                    <span class="o">.</span><span class="na">withTumblingWindow</span><span class="o">(</span> <span class="k">new</span> <span class="n">Duration</span><span class="o">(</span><span class="mi">10</span><span class="o">,</span> <span class="n">TimeUnit</span><span class="o">.</span><span class="na">MINUTES</span><span class="o">)</span> <span class="o">)</span> <span class="o">;</span>
+
+<span class="n">topoBuilder</span><span class="o">.</span><span class="na">setBolt</span><span class="o">(</span><span class="s">"joiner"</span><span class="o">,</span> <span class="n">jbolt</span><span class="o">,</span> <span class="mi">1</span><span class="o">)</span>
+            <span class="o">.</span><span class="na">fieldsGrouping</span><span class="o">(</span><span class="s">"spout1"</span><span class="o">,</span> <span class="k">new</span> <span class="n">Fields</span><span class="o">(</span><span class="s">"key1"</span><span class="o">)</span> <span class="o">)</span>
+            <span class="o">.</span><span class="na">fieldsGrouping</span><span class="o">(</span><span class="s">"spout2"</span><span class="o">,</span> <span class="k">new</span> <span class="n">Fields</span><span class="o">(</span><span class="s">"userId"</span><span class="o">)</span> <span class="o">)</span>
+            <span class="o">.</span><span class="na">fieldsGrouping</span><span class="o">(</span><span class="s">"spout3"</span><span class="o">,</span> <span class="k">new</span> <span class="n">Fields</span><span class="o">(</span><span class="s">"key3"</span><span class="o">)</span> <span class="o">)</span>
+            <span class="o">.</span><span class="na">fieldsGrouping</span><span class="o">(</span><span class="s">"spout4"</span><span class="o">,</span> <span class="k">new</span> <span class="n">Fields</span><span class="o">(</span><span class="s">"key4"</span><span class="o">)</span> <span class="o">);</span>
+</code></pre></div>
+<p>The bolt constructor takes two arguments. The 1st argument introduces the data from <code>spout1</code>
+to be the first stream and specifies that it will always use field <code>key1</code> when joining this with the others streams.
+The name of the component specified must refer to the spout or bolt that is directly connected to the Join bolt. 
+Here data received from <code>spout1</code> must be fields grouped on <code>key1</code>. Similarly, each of the <code>leftJoin()</code> and <code>join()</code> method
+calls introduce a new stream along with the field to use for the join. As seen in above example, the same FieldsGrouping
+requirement applies to these streams as well. The 3rd argument to the join methods refers to another stream with which
+to join.</p>
+
+<p>The <code>select()</code> method is used to specify the output fields. The argument to <code>select</code> is a comma separated list of fields.
+Individual field names can be prefixed with a stream name to disambiguate between the same field name occurring in
+multiple streams as follows:  <code>.select(&quot;spout3:key3, spout4:key3&quot;)</code>. Nested tuple types are supported if the
+nesting has been done using <code>Map</code>s. For example  <code>outer.inner.innermost</code> refers to a field that is nested three levels
+deep where <code>outer</code> and <code>inner</code> are of type <code>Map</code>.   </p>
+
+<p>Stream name prefix is not allowed for the fields in any of the join() arguments, but nested fields are supported. </p>
+
+<p>The call to <code>withTumblingWindow()</code> above, configures the join window to be a 10 minute tumbling window. Since <code>JoinBolt</code> 
+is a Windowed Bolt, we can also use the <code>withWindow</code> method to configure it as a sliding window (see tips section below). </p>
+
+<h2 id="stream-names-and-join-order">Stream names and Join order</h2>
+
+<ul>
+<li>Stream names must be introduced (in constructor or as 1st arg to various join methods) before being referred
+to (in the 3rd argument of the join methods). Forward referencing of stream names, as shown below, is not allowed:</li>
+</ul>
+<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="k">new</span> <span class="n">JoinBolt</span><span class="o">(</span> <span class="s">"spout1"</span><span class="o">,</span> <span class="s">"key1"</span><span class="o">)</span>                 
+  <span class="o">.</span><span class="na">join</span>     <span class="o">(</span> <span class="s">"spout2"</span><span class="o">,</span> <span class="s">"userId"</span><span class="o">,</span>  <span class="s">"spout3"</span><span class="o">)</span> <span class="c1">//not allowed. spout3 not yet introduced</span>
+  <span class="o">.</span><span class="na">join</span>     <span class="o">(</span> <span class="s">"spout3"</span><span class="o">,</span> <span class="s">"key3"</span><span class="o">,</span>    <span class="s">"spout1"</span><span class="o">)</span>
+</code></pre></div>
+<ul>
+<li>Internally, the joins will be performed in the order expressed by the user.</li>
+</ul>
+
+<h2 id="joining-based-on-stream-names">Joining based on Stream names</h2>
+
+<p>For simplicity, Storm topologies often use the <code>default</code> stream. Topologies can also use named streams 
+instead of <code>default</code> streams.  To support such topologies, <code>JoinBolt</code> can be configured to use stream
+names,  instead of source component (spout/bolt) names, via the constructor&#39;s first argument:</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="k">new</span> <span class="n">JoinBolt</span><span class="o">(</span><span class="n">JoinBolt</span><span class="o">.</span><span class="na">Selector</span><span class="o">.</span><span class="na">STREAM</span><span class="o">,</span>  <span class="s">"stream1"</span><span class="o">,</span> <span class="s">"key1"</span><span class="o">)</span>
+                                  <span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">"stream2"</span><span class="o">,</span> <span class="s">"key2"</span><span class="o">)</span>
+    <span class="o">...</span>
+</code></pre></div>
+<p>The first argument <code>JoinBolt.Selector.STREAM</code> informs the bolt that <code>stream1/2/3/4</code> refer to named streams
+(as opposed to names of upstream spouts/bolts).</p>
+
+<p>The below example joins two named streams from four spouts:</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="k">new</span> <span class="n">JoinBolt</span><span class="o">(</span><span class="n">JoinBolt</span><span class="o">.</span><span class="na">Selector</span><span class="o">.</span><span class="na">STREAM</span><span class="o">,</span>  <span class="s">"stream1"</span><span class="o">,</span> <span class="s">"key1"</span><span class="o">)</span> 
+                             <span class="o">.</span><span class="na">join</span>     <span class="o">(</span><span class="s">"stream2"</span><span class="o">,</span> <span class="s">"userId"</span><span class="o">,</span>  <span class="s">"stream1"</span> <span class="o">)</span>
+                             <span class="o">.</span><span class="na">select</span> <span class="o">(</span><span class="s">"userId, key1, key2"</span><span class="o">)</span>
+                             <span class="o">.</span><span class="na">withTumblingWindow</span><span class="o">(</span> <span class="k">new</span> <span class="n">Duration</span><span class="o">(</span><span class="mi">10</span><span class="o">,</span> <span class="n">TimeUnit</span><span class="o">.</span><span class="na">MINUTES</span><span class="o">)</span> <span class="o">)</span> <span class="o">;</span>
+
+<span class="n">topoBuilder</span><span class="o">.</span><span class="na">setBolt</span><span class="o">(</span><span class="s">"joiner"</span><span class="o">,</span> <span class="n">jbolt</span><span class="o">,</span> <span class="mi">1</span><span class="o">)</span>
+            <span class="o">.</span><span class="na">fieldsGrouping</span><span class="o">(</span><span class="s">"bolt1"</span><span class="o">,</span> <span class="s">"stream1"</span><span class="o">,</span> <span class="k">new</span> <span class="n">Fields</span><span class="o">(</span><span class="s">"key1"</span><span class="o">)</span> <span class="o">)</span>
+            <span class="o">.</span><span class="na">fieldsGrouping</span><span class="o">(</span><span class="s">"bolt2"</span><span class="o">,</span> <span class="s">"stream1"</span><span class="o">,</span> <span class="k">new</span> <span class="n">Fields</span><span class="o">(</span><span class="s">"key1"</span><span class="o">)</span> <span class="o">)</span>
+            <span class="o">.</span><span class="na">fieldsGrouping</span><span class="o">(</span><span class="s">"bolt3"</span><span class="o">,</span> <span class="s">"stream2"</span><span class="o">,</span> <span class="k">new</span> <span class="n">Fields</span><span class="o">(</span><span class="s">"userId"</span><span class="o">)</span> <span class="o">)</span>
+            <span class="o">.</span><span class="na">fieldsGrouping</span><span class="o">(</span><span class="s">"bolt4"</span><span class="o">,</span> <span class="s">"stream1"</span><span class="o">,</span> <span class="k">new</span> <span class="n">Fields</span><span class="o">(</span><span class="s">"key1"</span><span class="o">)</span> <span class="o">);</span>
+</code></pre></div>
+<p>In the above example, it is possible that <code>bolt1</code>, for example, is emitting other streams also. But the join bolt 
+is only subscribing to <code>stream1</code> &amp; <code>stream2</code> from the different bolts. <code>stream1</code> from <code>bolt1</code>, <code>bolt2</code> and <code>bolt4</code> 
+is treated as a single stream and joined against <code>stream2</code> from <code>bolt3</code>.</p>
+
+<h2 id="limitations">Limitations:</h2>
+
+<ol>
+<li><p>Currently only INNER and LEFT joins are supported. </p></li>
+<li><p>Unlike SQL, which allows joining the same table on different keys to different tables, here the same one field must be used
+on a stream. Fields Grouping ensures the right tuples are routed to the right instances of a Join Bolt. Consequently the 
+FieldsGrouping field must be same as the join field, for correct results. To perform joins on multiple fields, the fields 
+can be combined into one field and then sent to the Join bolt.  </p></li>
+</ol>
+
+<h2 id="tips">Tips:</h2>
+
+<ol>
+<li><p>Joins can be CPU and memory intensive. The larger the data accumulated in the current window (proportional to window
+length), the longer it takes to do the join. Having a short sliding interval (few seconds for example) triggers frequent
+joins. Consequently performance can suffer if using large window lengths or small sliding intervals or both.</p></li>
+<li><p>Duplication of joined records across windows is possible when using Sliding Windows. This is because the tuples continue to exist
+across multiple windows when using Sliding Windows.</p></li>
+<li><p>If message timeouts are enabled, ensure the timeout setting (topology.message.timeout.secs) is large enough to comfortably
+accommodate the window size, plus the additional processing by other spouts and bolts.</p></li>
+<li><p>Joining a window of two streams with M and N elements each, <em>in the worst case</em>, can produce MxN elements with every output tuple
+anchored to one tuple from each input stream. This can mean a lot of output tuples from JoinBolt and even more ACKs for downstream bolts
+to emit. This can place a substantial pressure on the messaging system and dramatically slowdown the topology if not careful.
+To manage the load on the messaging subsystem, it is advisable to:</p>
+
+<ul>
+<li>Increase the worker&#39;s heap (topology.worker.max.heap.size.mb).</li>
+<li><strong>If</strong> ACKing is not necessary for your topology, disable ACKers (topology.acker.executors=0).</li>
+<li>Disable event logger (topology.eventlogger.executors=0).</li>
+<li>Turn of topology debugging (topology.debug=false).</li>
+<li>Set topology.max.spout.pending to a value large enough to accommodate an estimated full window worth of tuples plus some more for headroom.
+This helps mitigate the possibility of spouts emitting excessive tuples when messaging subsystem is experiencing excessive load. This situation
+can occur when its value is set to null.</li>
+<li>Lastly, keep the window size to the minimum value necessary for solving the problem at hand.</li>
+</ul></li>
+</ol>
+
+
+
+	          </div>
+	       </div>
+	  </div>
+<footer>
+    <div class="container-fluid">
+        <div class="row">
+            <div class="col-md-3">
+                <div class="footer-widget">
+                    <h5>Meetups</h5>
+                    <ul class="latest-news">
+                        
+                        <li><a href="http://www.meetup.com/Apache-Storm-Apache-Kafka/">Apache Storm & Apache Kafka</a> <span class="small">(Sunnyvale, CA)</span></li>
+                        
+                        <li><a href="http://www.meetup.com/Apache-Storm-Kafka-Users/">Apache Storm & Kafka Users</a> <span class="small">(Seattle, WA)</span></li>
+                        
+                        <li><a href="http://www.meetup.com/New-York-City-Storm-User-Group/">NYC Storm User Group</a> <span class="small">(New York, NY)</span></li>
+                        
+                        <li><a href="http://www.meetup.com/Bay-Area-Stream-Processing">Bay Area Stream Processing</a> <span class="small">(Emeryville, CA)</span></li>
+                        
+                        <li><a href="http://www.meetup.com/Boston-Storm-Users/">Boston Realtime Data</a> <span class="small">(Boston, MA)</span></li>
+                        
+                        <li><a href="http://www.meetup.com/storm-london">London Storm User Group</a> <span class="small">(London, UK)</span></li>
+                        
+                        <!-- <li><a href="http://www.meetup.com/Apache-Storm-Kafka-Users/">Seatle, WA</a> <span class="small">(27 Jun 2015)</span></li> -->
+                    </ul>
+                </div>
+            </div>
+            <div class="col-md-3">
+                <div class="footer-widget">
+                    <h5>About Storm</h5>
+                    <p>Storm integrates with any queueing system and any database system. Storm's spout abstraction makes it easy to integrate a new queuing system. Likewise, integrating Storm with database systems is easy.</p>
+               </div>
+            </div>
+            <div class="col-md-3">
+                <div class="footer-widget">
+                    <h5>First Look</h5>
+                    <ul class="footer-list">
+                        <li><a href="/releases/current/Rationale.html">Rationale</a></li>
+                        <li><a href="/releases/current/Tutorial.html">Tutorial</a></li>
+                        <li><a href="/releases/current/Setting-up-development-environment.html">Setting up development environment</a></li>
+                        <li><a href="/releases/current/Creating-a-new-Storm-project.html">Creating a new Storm project</a></li>
+                    </ul>
+                </div>
+            </div>
+            <div class="col-md-3">
+                <div class="footer-widget">
+                    <h5>Documentation</h5>
+                    <ul class="footer-list">
+                        <li><a href="/releases/current/index.html">Index</a></li>
+                        <li><a href="/releases/current/javadocs/index.html">Javadoc</a></li>
+                        <li><a href="/releases/current/FAQ.html">FAQ</a></li>
+                    </ul>
+                </div>
+            </div>
+        </div>
+        <hr/>
+        <div class="row">   
+            <div class="col-md-12">
+                <p align="center">Copyright © 2015 <a href="http://www.apache.org">Apache Software Foundation</a>. All Rights Reserved. 
+                    <br>Apache Storm, Apache, the Apache feather logo, and the Apache Storm project logos are trademarks of The Apache Software Foundation. 
+                    <br>All other marks mentioned may be trademarks or registered trademarks of their respective owners.</p>
+            </div>
+        </div>
+    </div>
+</footer>
+<!--Footer End-->
+<!-- Scroll to top -->
+<span class="totop"><a href="#"><i class="fa fa-angle-up"></i></a></span> 
+
+</body>
+
+</html>
+

http://git-wip-us.apache.org/repos/asf/storm-site/blob/0183bf7e/content/releases/2.0.0-SNAPSHOT/Lifecycle-of-a-topology.html
----------------------------------------------------------------------
diff --git a/content/releases/2.0.0-SNAPSHOT/Lifecycle-of-a-topology.html b/content/releases/2.0.0-SNAPSHOT/Lifecycle-of-a-topology.html
index e650fa3..eebe42d 100644
--- a/content/releases/2.0.0-SNAPSHOT/Lifecycle-of-a-topology.html
+++ b/content/releases/2.0.0-SNAPSHOT/Lifecycle-of-a-topology.html
@@ -144,7 +144,7 @@
 
 <p class="post-meta"></p>
 
-<p>(<strong>NOTE</strong>: this page is based on the 0.7.1 code; many things have changed since then, including a split between tasks and executors, and a reorganization of the code under <code>storm-core/src</code> rather than <code>src/</code>.)</p>
+<p>(<strong>NOTE</strong>: this page is based on the 0.7.1 code; many things have changed since then, including a split between tasks and executors, and a reorganization of the code under <code>storm-client/src</code> rather than <code>src/</code>.)</p>
 
 <p>This page explains in detail the lifecycle of a topology from running the &quot;storm jar&quot; command to uploading the topology to Nimbus to the supervisors starting/stopping workers to workers and tasks setting themselves up. It also explains how Nimbus monitors topologies and how topologies are shutdown when they are killed.</p>
 

http://git-wip-us.apache.org/repos/asf/storm-site/blob/0183bf7e/content/releases/2.0.0-SNAPSHOT/Local-mode.html
----------------------------------------------------------------------
diff --git a/content/releases/2.0.0-SNAPSHOT/Local-mode.html b/content/releases/2.0.0-SNAPSHOT/Local-mode.html
index 8a7caf4..fef6c8b 100644
--- a/content/releases/2.0.0-SNAPSHOT/Local-mode.html
+++ b/content/releases/2.0.0-SNAPSHOT/Local-mode.html
@@ -144,27 +144,76 @@
 
 <p class="post-meta"></p>
 
-<p>Local mode simulates a Storm cluster in process and is useful for developing and testing topologies. Running topologies in local mode is similar to running topologies <a href="Running-topologies-on-a-production-cluster.html">on a cluster</a>. </p>
+<p>Local mode simulates a Storm cluster in process and is useful for developing and testing topologies. Running topologies in local mode is similar to running topologies <a href="Running-topologies-on-a-production-cluster.html">on a cluster</a>.</p>
+
+<p>To run a topology in local mode you have two options.  The most common option is to run your topology with <code>storm local</code> instead of <code>storm jar</code></p>
+
+<p>This will bring up a local simulated cluster and force all interactions with nimbus to go through the simulated cluster instead of going to a separate process.</p>
+
+<p>If you want to do some automated testing but without actually launching a storm cluster you can use the same classes internally that <code>storm local</code> does.</p>
+
+<p>To do this you first need to pull in the dependencies needed to access these classes.  For the java API you should depend on <code>storm-server</code> as a <code>test</code> dependency.</p>
 
 <p>To create an in-process cluster, simply use the <code>LocalCluster</code> class. For example:</p>
 <div class="highlight"><pre><code class="language-java" data-lang="java"><span class="kn">import</span> <span class="nn">org.apache.storm.LocalCluster</span><span class="o">;</span>
 
-<span class="n">LocalCluster</span> <span class="n">cluster</span> <span class="o">=</span> <span class="k">new</span> <span class="n">LocalCluster</span><span class="o">();</span>
+<span class="o">...</span>
+
+<span class="k">try</span> <span class="o">(</span><span class="n">LocalCluster</span> <span class="n">cluster</span> <span class="o">=</span> <span class="k">new</span> <span class="n">LocalCluster</span><span class="o">())</span> <span class="o">{</span>
+    <span class="c1">//Interact with the cluster...</span>
+<span class="o">}</span>
 </code></pre></div>
 <p>You can then submit topologies using the <code>submitTopology</code> method on the <code>LocalCluster</code> object. Just like the corresponding method on <a href="javadocs/org/apache/storm/StormSubmitter.html">StormSubmitter</a>, <code>submitTopology</code> takes a name, a topology configuration, and the topology object. You can then kill a topology using the <code>killTopology</code> method which takes the topology name as an argument.</p>
 
-<p>To shutdown a local cluster, simple call:</p>
-<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="n">cluster</span><span class="o">.</span><span class="na">shutdown</span><span class="o">();</span>
+<p>The <code>LocalCluster</code> is an <code>AutoCloseable</code> and will shut down when close is called. </p>
+
+<p>many of the Nimbus APIs are also available through the LocalCluster.</p>
+
+<h3 id="drpc">DRPC</h3>
+
+<p>DRPC can be run in local mode as well. Here&#39;s how to run the above example in local mode:</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="k">try</span> <span class="o">(</span><span class="n">LocalDRPC</span> <span class="n">drpc</span> <span class="o">=</span> <span class="k">new</span> <span class="n">LocalDRPC</span><span class="o">();</span>
+     <span class="n">LocalCluster</span> <span class="n">cluster</span> <span class="o">=</span> <span class="k">new</span> <span class="n">LocalCluster</span><span class="o">();</span>
+     <span class="n">LocalTopology</span> <span class="n">topo</span> <span class="o">=</span> <span class="n">cluster</span><span class="o">.</span><span class="na">submitTopology</span><span class="o">(</span><span class="s">"drpc-demo"</span><span class="o">,</span> <span class="n">conf</span><span class="o">,</span> <span class="n">builder</span><span class="o">.</span><span class="na">createLocalTopology</span><span class="o">(</span><span class="n">drpc</span><span class="o">)))</span> <span class="o">{</span>
+
+    <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Results for 'hello':"</span> <span class="o">+</span> <span class="n">drpc</span><span class="o">.</span><span class="na">execute</span><span class="o">(</span><span class="s">"exclamation"</span><span class="o">,</span> <span class="s">"hello"</span><span class="o">));</span>
+<span class="o">}</span>
+</code></pre></div>
+<p>First you create a <code>LocalDRPC</code> object. This object simulates a DRPC server in process, just like how <code>LocalCluster</code> simulates a Storm cluster in process. Then you create the <code>LocalCluster</code> to run the topology in local mode. <code>LinearDRPCTopologyBuilder</code> has separate methods for creating local topologies and remote topologies. In local mode the <code>LocalDRPC</code> object does not bind to any ports so the topology needs to know about the object to communicate with it. This is why <code>createLocalTopology</code> takes in the <code>LocalDRPC</code> object as input.</p>
+
+<p>After launching the topology, you can do DRPC invocations using the <code>execute</code> method on <code>LocalDRPC</code>.</p>
+
+<p>Because all of the objects used are instances of AutoCloseable when the try blocks scope ends the topology is killed, the cluster is shut down and the drpc server also shuts down.</p>
+
+<h3 id="clojure-api">Clojure API</h3>
+
+<p>Storm also offers a clojure API for testing.</p>
+
+<p><a href="http://www.pixelmachine.org/2011/12/21/Testing-Storm-Topologies-Part-2.html">This blog post</a> talk about this, but is a little out of date.  To get this functionality you need to include the <code>storm-clojure-test</code> dependency.  This will pull in a lot of storm itself that should not be packaged with your topology, sp please make sure it is a test dependency only,.</p>
+
+<h3 id="debugging-your-topology-with-an-ide">Debugging your topology with an IDE</h3>
+
+<p>One of the great use cases for local mode is to be able to walk through the code execution of your bolts and spouts using an IDE.  You can do this on the command line by adding the <code>--java-debug</code> option followed by the parameter you would pass to jdwp. This makes it simple to launch the local cluster with <code>-agentlib:jdwp=</code> turned on.</p>
+
+<p>When running from within an IDE itself you can modify your code run run withing a call to <code>LocalCluster.withLocalModeOverride</code></p>
+<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="kd">final</span> <span class="n">String</span> <span class="n">args</span><span class="o">[])</span> <span class="o">{</span>
+    <span class="n">LocalCluster</span><span class="o">.</span><span class="na">withLocalModeOverride</span><span class="o">(()</span> <span class="o">-&gt;</span> <span class="n">originalMain</span><span class="o">(</span><span class="n">args</span><span class="o">),</span> <span class="mi">10</span><span class="o">);</span>
+<span class="o">}</span>
 </code></pre></div>
+<p>Or you could also modify the IDE to run &quot;org.apache.storm.LocalCluster&quot; instead of your main class when launching, and pass in the name of the class as an argument to it.  This will also trigger local mode, and is what <code>storm local</code> does behind the scenes. </p>
+
 <h3 id="common-configurations-for-local-mode">Common configurations for local mode</h3>
 
 <p>You can see a full list of configurations <a href="javadocs/org/apache/storm/Config.html">here</a>.</p>
 
 <ol>
 <li><strong>Config.TOPOLOGY_MAX_TASK_PARALLELISM</strong>: This config puts a ceiling on the number of threads spawned for a single component. Oftentimes production topologies have a lot of parallelism (hundreds of threads) which places unreasonable load when trying to test the topology in local mode. This config lets you easy control that parallelism.</li>
-<li><strong>Config.TOPOLOGY_DEBUG</strong>: When this is set to true, Storm will log a message every time a tuple is emitted from any spout or bolt. This is extremely useful for debugging.</li>
+<li><strong>Config.TOPOLOGY_DEBUG</strong>: When this is set to true, Storm will log a message every time a tuple is emitted from any spout or bolt. This is extremely useful for debugging.A</li>
 </ol>
 
+<p>These, like all other configs, can be set on the command line when launching your toplogy with the <code>-c</code> flag.  The flag is of the form <code>-c &lt;conf_name&gt;=&lt;JSON_VALUE&gt;</code>  so to enable debugging when launching your topology in local mode you could run</p>
+<div class="highlight"><pre><code class="language-" data-lang="">storm local topology.jar &lt;MY_MAIN_CLASS&gt; -c topology.debug=true
+</code></pre></div>
 
 
 	          </div>

http://git-wip-us.apache.org/repos/asf/storm-site/blob/0183bf7e/content/releases/2.0.0-SNAPSHOT/Maven.html
----------------------------------------------------------------------
diff --git a/content/releases/2.0.0-SNAPSHOT/Maven.html b/content/releases/2.0.0-SNAPSHOT/Maven.html
index 4a39a88..ce7b7a2 100644
--- a/content/releases/2.0.0-SNAPSHOT/Maven.html
+++ b/content/releases/2.0.0-SNAPSHOT/Maven.html
@@ -147,7 +147,7 @@
 <p>To develop topologies, you&#39;ll need the Storm jars on your classpath. You should either include the unpacked jars in the classpath for your project or use Maven to include Storm as a development dependency. Storm is hosted on Maven Central. To include Storm in your project as a development dependency, add the following to your pom.xml:</p>
 <div class="highlight"><pre><code class="language-xml" data-lang="xml"><span class="nt">&lt;dependency&gt;</span>
   <span class="nt">&lt;groupId&gt;</span>org.apache.storm<span class="nt">&lt;/groupId&gt;</span>
-  <span class="nt">&lt;artifactId&gt;</span>storm-core<span class="nt">&lt;/artifactId&gt;</span>
+  <span class="nt">&lt;artifactId&gt;</span>storm-client<span class="nt">&lt;/artifactId&gt;</span>
   <span class="nt">&lt;version&gt;</span>2.0.0-SNAPSHOT<span class="nt">&lt;/version&gt;</span>
   <span class="nt">&lt;scope&gt;</span>provided<span class="nt">&lt;/scope&gt;</span>
 <span class="nt">&lt;/dependency&gt;</span>

http://git-wip-us.apache.org/repos/asf/storm-site/blob/0183bf7e/content/releases/2.0.0-SNAPSHOT/Metrics.html
----------------------------------------------------------------------
diff --git a/content/releases/2.0.0-SNAPSHOT/Metrics.html b/content/releases/2.0.0-SNAPSHOT/Metrics.html
index 660a2d3..576c702 100644
--- a/content/releases/2.0.0-SNAPSHOT/Metrics.html
+++ b/content/releases/2.0.0-SNAPSHOT/Metrics.html
@@ -145,30 +145,32 @@
 <p class="post-meta"></p>
 
 <p>Storm exposes a metrics interface to report summary statistics across the full topology.
-It&#39;s used internally to track the numbers you see in the Nimbus UI console: counts of executes and acks; average process latency per bolt; worker heap usage; and so forth.</p>
+The numbers you see on the UI come from some of these built in metrics, but are reported through the worker heartbeats instead of through the IMetricsConsumer described below.</p>
 
 <h3 id="metric-types">Metric Types</h3>
 
-<p>Metrics have to implement <a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/api/IMetric.java"><code>IMetric</code></a> which contains just one method, <code>getValueAndReset</code> -- do any remaining work to find the summary value, and reset back to an initial state. For example, the MeanReducer divides the running total by its running count to find the mean, then initializes both values back to zero.</p>
+<p>Metrics have to implement <a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/metric/api/IMetric.java"><code>IMetric</code></a> which contains just one method, <code>getValueAndReset</code> -- do any remaining work to find the summary value, and reset back to an initial state. For example, the MeanReducer divides the running total by its running count to find the mean, then initializes both values back to zero.</p>
 
 <p>Storm gives you these metric types:</p>
 
 <ul>
-<li><a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/api/AssignableMetric.java">AssignableMetric</a> -- set the metric to the explicit value you supply. Useful if it&#39;s an external value or in the case that you are already calculating the summary statistic yourself.</li>
-<li><a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/api/CombinedMetric.java">CombinedMetric</a> -- generic interface for metrics that can be updated associatively. </li>
-<li><a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/api/CountMetric.java">CountMetric</a> -- a running total of the supplied values. Call <code>incr()</code> to increment by one, <code>incrBy(n)</code> to add/subtract the given number.
+<li><a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/metric/api/AssignableMetric.java">AssignableMetric</a> -- set the metric to the explicit value you supply. Useful if it&#39;s an external value or in the case that you are already calculating the summary statistic yourself.</li>
+<li><a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/metric/api/CombinedMetric.java">CombinedMetric</a> -- generic interface for metrics that can be updated associatively. </li>
+<li><a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/metric/api/CountMetric.java">CountMetric</a> -- a running total of the supplied values. Call <code>incr()</code> to increment by one, <code>incrBy(n)</code> to add/subtract the given number.
 
 <ul>
-<li><a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/api/MultiCountMetric.java">MultiCountMetric</a> -- a hashmap of count metrics.</li>
+<li><a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/metric/api/MultiCountMetric.java">MultiCountMetric</a> -- a hashmap of count metrics.</li>
 </ul></li>
-<li><a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/api/ReducedMetric.java">ReducedMetric</a>
+<li><a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/metric/api/ReducedMetric.java">ReducedMetric</a>
 
 <ul>
-<li><a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/api/MeanReducer.java">MeanReducer</a> -- track a running average of values given to its <code>reduce()</code> method. (It accepts <code>Double</code>, <code>Integer</code> or <code>Long</code> values, and maintains the internal average as a <code>Double</code>.) Despite his reputation, the MeanReducer is actually a pretty nice guy in person.</li>
-<li><a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/api/MultiReducedMetric.java">MultiReducedMetric</a> -- a hashmap of reduced metrics.</li>
+<li><a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/metric/api/MeanReducer.java">MeanReducer</a> -- track a running average of values given to its <code>reduce()</code> method. (It accepts <code>Double</code>, <code>Integer</code> or <code>Long</code> values, and maintains the internal average as a <code>Double</code>.) Despite his reputation, the MeanReducer is actually a pretty nice guy in person.</li>
+<li><a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/metric/api/MultiReducedMetric.java">MultiReducedMetric</a> -- a hashmap of reduced metrics.</li>
 </ul></li>
 </ul>
 
+<p>Be aware that even though <code>getValueAndReset</code> can return an object returning any object makes it very difficult for an <code>IMetricsConsumer</code> to know how to translate it into something usable.  Also note that because it is sent to the <code>IMetricsConsumer</code> as a part of a tuple the values returned need to be able to be <a href="Serialization.html">serialized</a> by your topology.</p>
+
 <h3 id="metrics-consumer">Metrics Consumer</h3>
 
 <p>You can listen and handle the topology metrics via registering Metrics Consumer to your topology. </p>
@@ -186,16 +188,16 @@ It&#39;s used internally to track the numbers you see in the Nimbus UI console:
     <span class="s">parallelism.hint</span><span class="pi">:</span> <span class="s">1</span>
     <span class="na">argument</span><span class="pi">:</span> <span class="s2">"</span><span class="s">http://example.com:8080/metrics/my-topology/"</span>
 </code></pre></div>
-<p>Storm appends MetricsConsumerBolt to your topology per each registered metrics consumer internally, and each MetricsConsumerBolt subscribes to receive metrics from all tasks. The parallelism for that Bolt is set to <code>parallelism.hint</code> and <code>component id</code> for that Bolt is set to <code>__metrics_&lt;metrics consumer class name&gt;</code>. If you register same class name more than once, postfix <code>#&lt;sequence number&gt;</code> is appended to component id.</p>
+<p>Storm adds a MetricsConsumerBolt to your topolology for each class in the <code>topology.metrics.consumer.register</code> list. Each MetricsConsumerBolt subscribes to receive metrics from all tasks in the topology. The parallelism for each Bolt is set to <code>parallelism.hint</code> and <code>component id</code> for that Bolt is set to <code>__metrics_&lt;metrics consumer class name&gt;</code>. If you register the same class name more than once, postfix <code>#&lt;sequence number&gt;</code> is appended to component id.</p>
 
 <p>Storm provides some built-in metrics consumers for you to try out to see which metrics are provided in your topology.</p>
 
 <ul>
-<li><a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/LoggingMetricsConsumer.java"><code>LoggingMetricsConsumer</code></a> -- listens for all metrics and dumps them to log file with TSV (Tab Separated Values).</li>
-<li><a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/HttpForwardingMetricsConsumer.java"><code>HttpForwardingMetricsConsumer</code></a> -- listens for all metrics and POSTs them serialized to a configured URL via HTTP. Storm also provides <a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/HttpForwardingMetricsServer.java"><code>HttpForwardingMetricsServer</code></a> as abstract class so you can extend this class and run as a HTTP server, and handle metrics sent by HttpForwardingMetricsConsumer.</li>
+<li><a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/metric/LoggingMetricsConsumer.java"><code>LoggingMetricsConsumer</code></a> -- listens for all metrics and dumps them to log file with TSV (Tab Separated Values).</li>
+<li><a href="http://github.com/apache/storm/blob/master/examples/storm-loadgen/src/main/java/org/apache/storm/loadgen/HttpForwardingMetricsConsumer.java"><code>HttpForwardingMetricsConsumer</code></a> -- listens for all metrics and POSTs them serialized to a configured URL via HTTP. Storm also provides <a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/HttpForwardingMetricsServer.java"><code>HttpForwardingMetricsServer</code></a> as abstract class so you can extend this class and run as a HTTP server, and handle metrics sent by HttpForwardingMetricsConsumer.</li>
 </ul>
 
-<p>Also, Storm exposes the interface <a href="http://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/metric/api/IMetricsConsumer.java"><code>IMetricsConsumer</code></a> for implementing Metrics Consumer so you can create custom metrics consumers and attach to their topologies, or use other great implementation of Metrics Consumers provided by Storm community. Some of examples are <a href="https://github.com/verisign/storm-graphite">versign/storm-graphite</a>, and <a href="https://github.com/endgameinc/storm-metrics-statsd">storm-metrics-statsd</a>.</p>
+<p>Also, Storm exposes the interface <a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/metric/api/IMetricsConsumer.java"><code>IMetricsConsumer</code></a> for implementing Metrics Consumer so you can create custom metrics consumers and attach to their topologies, or use other great implementation of Metrics Consumers provided by Storm community. Some of examples are <a href="https://github.com/verisign/storm-graphite">versign/storm-graphite</a>, and <a href="https://github.com/endgameinc/storm-metrics-statsd">storm-metrics-statsd</a>.</p>
 
 <p>When you implement your own metrics consumer, <code>argument</code> is passed to Object when <a href="javadocs/org/apache/storm/metric/api/IMetricsConsumer.html#prepare-java.util.Map-java.lang.Object-org.apache.storm.task.TopologyContext-org.apache.storm.task.IErrorReporter-">IMetricsConsumer#prepare</a> is called, so you need to infer the Java type of configured value on yaml, and do explicit type casting.</p>
 
@@ -213,7 +215,7 @@ It&#39;s used internally to track the numbers you see in the Nimbus UI console:
 <p>Next, let&#39;s initialize and register the metric instance.</p>
 <div class="highlight"><pre><code class="language-java" data-lang="java"><span class="nd">@Override</span>
 <span class="kd">public</span> <span class="kt">void</span> <span class="nf">prepare</span><span class="o">(</span><span class="n">Map</span> <span class="n">conf</span><span class="o">,</span> <span class="n">TopologyContext</span> <span class="n">context</span><span class="o">,</span> <span class="n">OutputCollector</span> <span class="n">collector</span><span class="o">)</span> <span class="o">{</span>
-    <span class="c1">// other intialization here.</span>
+    <span class="c1">// other initialization here.</span>
     <span class="n">countMetric</span> <span class="o">=</span> <span class="k">new</span> <span class="n">CountMetric</span><span class="o">();</span>
     <span class="n">context</span><span class="o">.</span><span class="na">registerMetric</span><span class="o">(</span><span class="s">"execute_count"</span><span class="o">,</span> <span class="n">countMetric</span><span class="o">,</span> <span class="mi">60</span><span class="o">);</span>
 <span class="o">}</span>
@@ -242,7 +244,7 @@ It&#39;s used internally to track the numbers you see in the Nimbus UI console:
 </code></pre></div>
 <p>or put <code>Map&lt;String, String&gt;</code> (metric name, metric class name) with key <code>Config.TOPOLOGY_WORKER_METRICS</code> to config map.</p>
 
-<p>There&#39;re some restrictions for worker level metric instances: </p>
+<p>There are some restrictions for worker level metric instances: </p>
 
 <p>A) Metrics for worker level should be kind of gauge since it is initialized and registered from SystemBolt and not exposed to user tasks.</p>
 
@@ -252,9 +254,226 @@ It&#39;s used internally to track the numbers you see in the Nimbus UI console:
 
 <h3 id="builtin-metrics">Builtin Metrics</h3>
 
-<p>The <a href="http://github.com/apache/storm/blob/master/storm-core/src/clj/org/apache/storm/daemon/builtin_metrics.clj">builtin metrics</a> instrument Storm itself.</p>
+<p>The <a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/daemon/metrics/BuiltinMetricsUtil.java">builtin metrics</a> instrument Storm itself.</p>
+
+<p><a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/daemon/metrics/BuiltinMetricsUtil.java">BuiltinMetricsUtil.java</a> sets up data structures for the built-in metrics, and facade methods that the other framework components can use to update them. The metrics themselves are calculated in the calling code -- see for example <a href="http://github.com/apache/storm/blob/master/storm-client/src/jvm/org/apache/storm/executor/Executor.java"><code>ackSpoutMsg</code></a>.</p>
+
+<h4 id="reporting-rate">Reporting Rate</h4>
+
+<p>The rate at which built in metrics are reported is configurable through the <code>topology.builtin.metrics.bucket.size.secs</code> config.  If you set this too low it can overload the consumers,
+so please use caution when modifying it.</p>
+
+<h4 id="tuple-counting-metrics">Tuple Counting Metrics</h4>
+
+<p>There are several different metrics related to counting what a bolt or spout does to a tuple. These include things like emitting, transferring, acking, and failing of tuples.</p>
+
+<p>In general all of these tuple count metrics are randomly sub-sampled unless otherwise stated.  This means that the counts you see both on the UI and from the built in metrics are not necessarily exact.  In fact by default we sample only 5% of the events and estimate the total number of events from that.  The sampling percentage is configurable per topology through the <code>topology.stats.sample.rate</code> config.  Setting it to 1.0 will make the counts exact, but be aware that the more events we sample the slower your topology will run (as the metrics are counted in the same code path as tuples are processed).  This is why we have a 5% sample rate as the default.</p>
+
+<p>The tuple counting metrics are generally reported to the metrics consumers as maps unless explicitly stated otherwise.  They break down each count for finer grained reporting.
+The keys to these maps fall into two categories <code>&quot;${stream_name}&quot;</code> or <code>&quot;${upstream_component}:${stream_name}&quot;</code>.  The former is used for all spout metrics and for outgoing bolt metrics (<code>__emit-count</code> and <code>__transfer-count</code>).  The latter is used for bolt metrics that deal with incoming tuples.</p>
+
+<p>So for a word count topology the count bolt might show something like the following for the <code>__ack-count</code> metric</p>
+<div class="highlight"><pre><code class="language-" data-lang="">{
+    "split:default": 80080
+}
+</code></pre></div>
+<p>But the spout instead would show something like the following for the <code>__ack-count</code> metric.</p>
+<div class="highlight"><pre><code class="language-" data-lang="">{
+    "default": 12500
+}
+</code></pre></div>
+<h5 id="__ack-count"><code>__ack-count</code></h5>
+
+<p>For bolts it is the number of incoming tuples that had the <code>ack</code> method called on them.  For spouts it is the number of tuples trees that were fully acked. See Guaranteeing Message Processing<a href="Guaranteeing-message-processing.html"></a> for more information about what a tuple tree is. If acking is disabled this metric is still reported, but it is not really meaningful.</p>
+
+<h5 id="__fail-count"><code>__fail-count</code></h5>
+
+<p>For bolts this is the number of incoming tuples that had the <code>fail</code> method called on them.  For spouts this is the number of tuple trees that failed.  Tuple trees may fail from timing out or because a bolt called fail on it.  The two are not separated out by this metric.</p>
+
+<h5 id="__emit-count"><code>__emit-count</code></h5>
+
+<p>This is the total number of times the <code>emit</code> method was called to send a tuple.  This is the same for both bolts and spouts.</p>
+
+<h5 id="__transfer-count"><code>__transfer-count</code></h5>
+
+<p>This is the total number of tuples transferred to a downstream bolt/spout for processing. This number will not always match <code>__emit_count</code>.  If nothing is registered to receive a tuple down stream the number will be 0 even if tuples were emitted.  Similarly if there are multiple down stream consumers it may be a multiple of the number emitted.  The grouping also can play a role if it sends the tuple to multiple instances of a single bolt down stream.</p>
+
+<h5 id="__execute-count"><code>__execute-count</code></h5>
+
+<p>This count metric is bolt specific.  It counts the number of times that a bolt&#39;s <code>execute</code> method was called.</p>
+
+<h4 id="tuple-latency-metrics">Tuple Latency Metrics</h4>
+
+<p>Similar to the tuple counting metrics storm also collects average latency metrics for bolts and spouts.  These follow the same structure as the bolt/spout maps and are sub-sampled in the same way as well.  In all cases the latency is measured in milliseconds.</p>
+
+<h5 id="__complete-latency"><code>__complete-latency</code></h5>
+
+<p>The complete latency is just for spouts.  It is the average amount of time it took for <code>ack</code> or <code>fail</code> to be called for a tuple after it was emitted.  If acking is disabled this metric is likely to be blank or 0 for all values, and should be ignored.</p>
+
+<h5 id="__execute-latency"><code>__execute-latency</code></h5>
+
+<p>This is just for bolts.  It is the average amount of time that the bolt spent in the call to the <code>execute</code> method.  The higher this gets, the lower the throughput of tuples per bolt instance.</p>
+
+<h5 id="__process-latency"><code>__process-latency</code></h5>
+
+<p>This is also just for bolts.  It is the average amount of time between when <code>execute</code> was called to start processing a tuple, to when it was acked or failed by the bolt.  If your bolt is a very simple bolt and the processing is synchronous then <code>__process-latency</code> and <code>__execute-latency</code> should be very close to one another, with process latency being slightly smaller.  If you are doing a join or have asynchronous processing then it may take a while for a tuple to be acked so the process latency would be higher than the execute latency.</p>
+
+<h5 id="__skipped-max-spout-ms"><code>__skipped-max-spout-ms</code></h5>
+
+<p>This metric records how much time a spout was idle because more tuples than <code>topology.max.spout.pending</code> were still outstanding.  This is the total time in milliseconds, not the average amount of time and is not sub-sampled.</p>
+
+<h5 id="__skipped-backpressure-ms"><code>__skipped-backpressure-ms</code></h5>
+
+<p>This metric records how much time a spout was idle because back-pressure indicated that downstream queues in the topology were too full.  This is the total time in milliseconds, not the average amount of time and is not sub-sampled. This is similar to skipped-throttle-ms in Storm 1.x.</p>
+
+<h5 id="skipped-inactive-ms"><code>skipped-inactive-ms</code></h5>
+
+<p>This metric records how much time a spout was idle because the topology was deactivated.  This is the total time in milliseconds, not the average amount of time and is not sub-sampled.</p>
+
+<h4 id="error-reporting-metrics">Error Reporting Metrics</h4>
 
-<p><a href="http://github.com/apache/storm/blob/master/storm-core/src/clj/org/apache/storm/daemon/builtin_metrics.clj">builtin_metrics.clj</a> sets up data structures for the built-in metrics, and facade methods that the other framework components can use to update them. The metrics themselves are calculated in the calling code -- see for example <a href="http://github.com/apache/storm/blob/master/storm-core/src/clj/org/apache/storm/daemon/executor.clj#358"><code>ack-spout-msg</code></a>  in <code>clj/b/s/daemon/daemon/executor.clj</code></p>
+<p>Storm also collects error reporting metrics for bolts and spouts.</p>
+
+<h5 id="__reported-error-count"><code>__reported-error-count</code></h5>
+
+<p>This metric records how many errors were reported by a spout/bolt. It is the total number of times the <code>reportError</code> method was called.</p>
+
+<h4 id="queue-metrics">Queue Metrics</h4>
+
+<p>Each bolt or spout instance in a topology has a receive queue and a send queue.  Each worker also has a queue for sending messages to other workers.  All of these have metrics that are reported.</p>
+
+<p>The receive queue metrics are reported under the <code>__receive</code> name and send queue metrics are reported under the <code>__sendqueue</code> for the given bolt/spout they are a part of.  The metrics for the queue that sends messages to other workers is under the <code>__transfer</code> metric name for the system bolt (<code>__system</code>).</p>
+
+<p>They all have the form.</p>
+<div class="highlight"><pre><code class="language-" data-lang="">{
+    "arrival_rate_secs": 1229.1195171893523,
+    "overflow": 0,
+    "read_pos": 103445,
+    "write_pos": 103448,
+    "sojourn_time_ms": 2.440771591407277,
+    "capacity": 1024,
+    "population": 19
+    "tuple_population": 200
+}
+</code></pre></div>
+<p>In storm we sometimes batch multiple tuples into a single entry in the disruptor queue. This batching is an optimization that has been in storm in some form since the beginning, but the metrics did not always reflect this so be careful with how you interpret the metrics and pay attention to which metrics are for tuples and which metrics are for entries in the disruptor queue. The <code>__receive</code> and <code>__transfer</code> queues can have batching but the <code>__sendqueue</code> should not.</p>
+
+<p><code>arrival_rate_secs</code> is an estimation of the number of tuples that are inserted into the queue in one second, although it is actually the dequeue rate.
+The <code>sojourn_time_ms</code> is calculated from the arrival rate and is an estimate of how many milliseconds each tuple sits in the queue before it is processed.
+Prior to STORM-2621 (v1.1.1, v1.2.0, and v2.0.0) these were the rate of entries, not of tuples.</p>
+
+<p>A disruptor queue has a set maximum number of entries.  If the regular queue fills up an overflow queue takes over.  The number of tuple batches stored in this overflow section are represented by the <code>overflow</code> metric.  Storm also does some micro batching of tuples for performance/efficiency reasons so you may see the overflow with a very small number in it even if the queue is not full.</p>
+
+<p><code>read_pos</code> and <code>write_pos</code> are internal disruptor accounting numbers.  You can think of them almost as the total number of entries written (<code>write_pos</code>) or read (<code>read_pos</code>) since the queue was created.  They allow for integer overflow so if you use them please take that into account.</p>
+
+<p><code>capacity</code> is the maximum number of entries in the disruptor queue. <code>population</code> is the number of entries currently filled in the queue.</p>
+
+<p><code>tuple_population</code> is the number of tuples currently in the queue as opposed to the number of entries.  This was added at the same time as STORM-2621 (v1.1.1, v1.2.0, and v2.0.0)</p>
+
+<h4 id="system-bolt-worker-metrics">System Bolt (Worker) Metrics</h4>
+
+<p>The System Bolt <code>__system</code> provides lots of metrics for different worker wide things.  The one metric not described here is the <code>__transfer</code> queue metric, because it fits with the other disruptor metrics described above.</p>
+
+<p>Be aware that the <code>__system</code> bolt is an actual bolt so regular bolt metrics described above also will be reported for it.</p>
+
+<h5 id="receive-nettyserver">Receive (NettyServer)</h5>
+
+<p><code>__recv-iconnection</code> reports stats for the netty server on the worker.  This is what gets messages from other workers.  It is of the form</p>
+<div class="highlight"><pre><code class="language-" data-lang="">{
+    "dequeuedMessages": 0,
+    "enqueued": {
+      "/127.0.0.1:49952": 389951
+    }
+}
+</code></pre></div>
+<p><code>dequeuedMessages</code> is a throwback to older code where there was an internal queue between the server and the bolts/spouts.  That is no longer the case and the value can be ignored.
+<code>enqueued</code> is a map between the address of the remote worker and the number of tuples that were sent from it to this worker.</p>
+
+<h5 id="send-netty-client">Send (Netty Client)</h5>
+
+<p>The <code>__send-iconnection</code> metric holds information about all of the clients for this worker.  It is of the form</p>
+<div class="highlight"><pre><code class="language-" data-lang="">{
+    NodeInfo(node:7decee4b-c314-41f4-b362-fd1358c985b3-127.0.01, port:[6701]): {
+        "reconnects": 0,
+        "src": "/127.0.0.1:49951",
+        "pending": 0,
+        "dest": "localhost/127.0.0.1:6701",
+        "sent": 420779,
+        "lostOnSend": 0
+    }
+}
+</code></pre></div>
+<p>The value is a map where the key is a NodeInfo class for the downstream worker it is sending messages to.  This is the SupervisorId + port.  The value is another map with the fields</p>
+
+<ul>
+<li><code>src</code>  What host/port this client has used to connect to the receiving worker.</li>
+<li><code>dest</code> What host/port this client has connected to.</li>
+<li><code>reconnects</code> the number of reconnections that have happened.</li>
+<li><code>pending</code> the number of messages that have not been sent.  (This corresponds to messages, not tuples)</li>
+<li><code>sent</code> the number of messages that have been sent.  (This is messages not tuples)</li>
+<li><code>lostOnSend</code>.  This is the number of messages that were lost because of connection issues. (This is messages not tuples). </li>
+</ul>
+
+<h5 id="jvm-memory">JVM Memory</h5>
+
+<p>JVM memory usage is reported through <code>memory/nonHeap</code> for off heap memory and <code>memory/heap</code> for on heap memory.  These values come from the <a href="https://docs.oracle.com/javase/8/docs/api/index.html?java/lang/management/MemoryUsage.html">MemoryUsage</a> mxbean.  Each of the metrics are reported as a map with the following keys, and values returned by the corresponding java code.</p>
+
+<table><thead>
+<tr>
+<th>Key</th>
+<th>Corresponding Code</th>
+</tr>
+</thead><tbody>
+<tr>
+<td><code>maxBytes</code></td>
+<td><code>memUsage.getMax()</code></td>
+</tr>
+<tr>
+<td><code>committedBytes</code></td>
+<td><code>memUsage.getCommitted()</code></td>
+</tr>
+<tr>
+<td><code>initBytes</code></td>
+<td><code>memUsage.getInit()</code></td>
+</tr>
+<tr>
+<td><code>usedBytes</code></td>
+<td><code>memUsage.getUsed()</code></td>
+</tr>
+<tr>
+<td><code>virtualFreeBytes</code></td>
+<td><code>memUsage.getMax() - memUsage.getUsed()</code></td>
+</tr>
+<tr>
+<td><code>unusedBytes</code></td>
+<td><code>memUsage.getCommitted() - memUsage.getUsed()</code></td>
+</tr>
+</tbody></table>
+
+<h5 id="jvm-garbage-collection">JVM Garbage Collection</h5>
+
+<p>The exact GC metric name depends on the garbage collector that your worker uses.  The data is all collected from <code>ManagementFactory.getGarbageCollectorMXBeans()</code> and the name of the metrics is <code>&quot;GC/&quot;</code> followed by the name of the returned bean with white space removed.  The reported metrics are just</p>
+
+<ul>
+<li><code>count</code> the number of gc events that happened and</li>
+<li><code>timeMs</code> the total number of milliseconds that were spent doing gc.<br></li>
+</ul>
+
+<p>Please refer to the <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/management/ManagementFactory.html#getGarbageCollectorMXBeans--">JVM documentation</a> for more details.</p>
+
+<h5 id="jvm-misc">JVM Misc</h5>
+
+<ul>
+<li><code>threadCount</code> is the number of threads currently in the JVM.</li>
+</ul>
+
+<h5 id="uptime">Uptime</h5>
+
+<ul>
+<li><code>uptimeSecs</code> reports the number of seconds the worker has been up for</li>
+<li><code>newWorkerEvent</code> is 1 when a worker is first started and 0 all other times.  This can be used to tell when a worker has crashed and is restarted.</li>
+<li><code>startTimeSecs</code> is when the worker started in seconds since the epoch</li>
+</ul>
 
 
 

http://git-wip-us.apache.org/repos/asf/storm-site/blob/0183bf7e/content/releases/2.0.0-SNAPSHOT/Multilang-protocol.html
----------------------------------------------------------------------
diff --git a/content/releases/2.0.0-SNAPSHOT/Multilang-protocol.html b/content/releases/2.0.0-SNAPSHOT/Multilang-protocol.html
index ce044ab..aebc4c4 100644
--- a/content/releases/2.0.0-SNAPSHOT/Multilang-protocol.html
+++ b/content/releases/2.0.0-SNAPSHOT/Multilang-protocol.html
@@ -279,7 +279,7 @@ to specify which fields are involved in a <code>FIELDS</code> grouping.</p>
 <p>Shell spouts are synchronous. The rest happens in a while(true) loop:</p>
 
 <ul>
-<li>STDIN: Either a next, ack, or fail command.</li>
+<li>STDIN: Either a next, ack, activate, deactivate or fail command.</li>
 </ul>
 
 <p>&quot;next&quot; is the equivalent of ISpout&#39;s <code>nextTuple</code>. It looks like:</p>
@@ -288,6 +288,16 @@ to specify which fields are involved in a <code>FIELDS</code> grouping.</p>
 <p>&quot;ack&quot; looks like:</p>
 <div class="highlight"><pre><code class="language-" data-lang="">{"command": "ack", "id": "1231231"}
 </code></pre></div>
+<p>&quot;activate&quot; is the equivalent of ISpout&#39;s <code>activate</code>:
+<code>
+{&quot;command&quot;: &quot;activate&quot;}
+</code></p>
+
+<p>&quot;deactivate&quot; is the equivalent of ISpout&#39;s <code>deactivate</code>:
+<code>
+{&quot;command&quot;: &quot;deactivate&quot;}
+</code></p>
+
 <p>&quot;fail&quot; looks like:</p>
 <div class="highlight"><pre><code class="language-" data-lang="">{"command": "fail", "id": "1231231"}
 </code></pre></div>