You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@apache.org on 2009/11/05 02:55:26 UTC

svn commit: r832971 - in /httpd/httpd/trunk/docs/manual/rewrite: advanced.html.en advanced.xml

Author: rbowen
Date: Thu Nov  5 01:55:25 2009
New Revision: 832971

URL: http://svn.apache.org/viewvc?rev=832971&view=rev
Log:
Moves the 'sharding' rule into the 'advanced' doc.

Modified:
    httpd/httpd/trunk/docs/manual/rewrite/advanced.html.en
    httpd/httpd/trunk/docs/manual/rewrite/advanced.xml

Modified: httpd/httpd/trunk/docs/manual/rewrite/advanced.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/advanced.html.en?rev=832971&r1=832970&r2=832971&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/advanced.html.en (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/advanced.html.en Thu Nov  5 01:55:25 2009
@@ -33,7 +33,64 @@
 
 </div>
 <div id="quickview"><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</a></li><li><a href="intro.html">mod_rewrite introduction</a></li></ul></div>
-</div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="sharding" id="sharding">URL-based sharding accross multiple backends</a></h2>
+
+  
+
+  <dl>
+    <dt>Description:</dt>
+
+    <dd>
+      <p>A common technique for distributing the burden of 
+      server load or storage space is called "sharding". 
+      When using this method, a front-end server will use the
+      url to consistently "shard" users or objects to separate
+      backend servers.</p>
+    </dd>
+
+    <dt>Solution:</dt>
+
+    <dd>
+      <p>A mapping is maintained, from users to target servers, in
+      external map files. They look like:</p>
+
+<div class="example"><pre>
+user1  physical_host_of_user1
+user2  physical_host_of_user2
+:      :
+</pre></div>
+
+  <p>We put this into a <code>map.users-to-hosts</code> file. The
+    aim is to map;</p>
+
+<div class="example"><pre>
+/u/user1/anypath
+</pre></div>
+
+  <p>to</p>
+
+<div class="example"><pre>
+http://physical_host_of_user1/u/user/anypath
+</pre></div>
+
+      <p>thus every URL path need not be valid on every backend physical
+      host. The following ruleset does this for us with the help of the map
+      files assuming that server0 is a default server which will be used if
+      a user has no entry in the map):</p>
+
+<div class="example"><pre>
+RewriteEngine on
+
+RewriteMap      users-to-hosts   txt:/path/to/map.users-to-hosts
+
+RewriteRule   ^/u/<strong>([^/]+)</strong>/?(.*)   http://<strong>${users-to-hosts:$1|server0}</strong>/u/$1/$2
+</pre></div>
+    </dd>
+  </dl>
+
+</div></div>
 <div class="bottomlang">
 <p><span>Available Languages: </span><a href="../en/rewrite/avoid.html" title="English">&nbsp;en&nbsp;</a></p>
 </div><div id="footer">

Modified: httpd/httpd/trunk/docs/manual/rewrite/advanced.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/advanced.xml?rev=832971&r1=832970&r2=832971&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/advanced.xml (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/advanced.xml Thu Nov  5 01:55:25 2009
@@ -40,5 +40,61 @@
 <seealso><a href="../mod/mod_rewrite.html">Module documentation</a></seealso>
 <seealso><a href="intro.html">mod_rewrite introduction</a></seealso>
 
+<section id="sharding">
+
+  <title>URL-based sharding accross multiple backends</title>
+
+  <dl>
+    <dt>Description:</dt>
+
+    <dd>
+      <p>A common technique for distributing the burden of 
+      server load or storage space is called "sharding". 
+      When using this method, a front-end server will use the
+      url to consistently "shard" users or objects to separate
+      backend servers.</p>
+    </dd>
+
+    <dt>Solution:</dt>
+
+    <dd>
+      <p>A mapping is maintained, from users to target servers, in
+      external map files. They look like:</p>
+
+<example><pre>
+user1  physical_host_of_user1
+user2  physical_host_of_user2
+:      :
+</pre></example>
+
+  <p>We put this into a <code>map.users-to-hosts</code> file. The
+    aim is to map;</p>
+
+<example><pre>
+/u/user1/anypath
+</pre></example>
+
+  <p>to</p>
+
+<example><pre>
+http://physical_host_of_user1/u/user/anypath
+</pre></example>
+
+      <p>thus every URL path need not be valid on every backend physical
+      host. The following ruleset does this for us with the help of the map
+      files assuming that server0 is a default server which will be used if
+      a user has no entry in the map):</p>
+
+<example><pre>
+RewriteEngine on
+
+RewriteMap      users-to-hosts   txt:/path/to/map.users-to-hosts
+
+RewriteRule   ^/u/<strong>([^/]+)</strong>/?(.*)   http://<strong>${users-to-hosts:$1|server0}</strong>/u/$1/$2
+</pre></example>
+    </dd>
+  </dl>
+
+</section>
 
 </manualpage>