
rbowen at apache
Nov 2, 2009, 10:08 PM
Post #1 of 1
(111 views)
Permalink
|
|
svn commit: r832309 - /httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en
|
|
Author: rbowen Date: Tue Nov 3 06:08:36 2009 New Revision: 832309 URL: http://svn.apache.org/viewvc?rev=832309&view=rev Log: Build Colm's 'sharding' recipe. Modified: httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en Modified: httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en?rev=832309&r1=832308&r2=832309&view=diff ============================================================================== --- httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en (original) +++ httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en Tue Nov 3 06:08:36 2009 @@ -52,7 +52,7 @@ <li><img alt="" src="../images/down.gif" /> <a href="#time-dependent">Time-Dependent Rewriting</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#proxy-deny">Proxy Deny</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#external-rewriting">External Rewriting Engine</a></li> -<li><img alt="" src="../images/down.gif" /> <a href="#cluster">Web Cluster with Consistent URL Space</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#cluster">URL-based sharding accross multiple backends</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#structuredhomedirs">Structured Homedirs</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#browser-dependent-content">Browser Dependent Content</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#dynamic-mirror">Dynamic Mirror</a></li> @@ -401,9 +401,16 @@ <p>This provides the content of <code>foo.day.html</code> under the URL <code>foo.html</code> from - <code>07:00-19:00</code> and at the remaining time the + <code>07:01-18:59</code> and at the remaining time the contents of <code>foo.night.html</code>. Just a nice feature for a homepage...</p> + + <div class="warning"><code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code>, intermediate proxies + and browsers may each cache responses and cause the either page to be + shown outside of the time-window configured. + <code class="module"><a href="../mod/mod_expires.html">mod_expires</a></code> may be used to control this + effect.</div> + </dd> </dl> @@ -500,7 +507,7 @@ </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> -<h2><a name="cluster" id="cluster">Web Cluster with Consistent URL Space</a></h2> +<h2><a name="cluster" id="cluster">URL-based sharding accross multiple backends</a></h2> @@ -508,67 +515,49 @@ <dt>Description:</dt> <dd> - <p>We want to create a homogeneous and consistent URL - layout across all WWW servers on an Intranet web cluster, i.e., - all URLs (by definition server-local and thus - server-dependent!) become server <em>independent</em>! - What we want is to give the WWW namespace a single consistent - layout: no URL should refer to - any particular target server. The cluster itself - should connect users automatically to a physical target - host as needed, invisibly.</p> + <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 seperate + backend servers.</p> </dd> <dt>Solution:</dt> <dd> - <p>First, the knowledge of the target servers comes from - (distributed) external maps which contain information on - where our users, groups, and entities reside. They have the - form:</p> + <p>A mapping is maintained, from users to target servers, in + external map files. They look like:</p> <div class="example"><pre> -user1 server_of_user1 -user2 server_of_user2 +user1 physical_host_of_user1 +user2 physical_host_of_user2 : : </pre></div> - <p>We put them into files <code>map.xxx-to-host</code>. - Second we need to instruct all servers to redirect URLs - of the forms:</p> + <p>We put this into a <code>map.users-to-hosts</code> file. The + aim is to map;</p> <div class="example"><pre> -/u/user/anypath -/g/group/anypath -/e/entity/anypath +/u/user1/anypath </pre></div> <p>to</p> <div class="example"><pre> -http://physical-host/u/user/anypath -http://physical-host/g/group/anypath -http://physical-host/e/entity/anypath +http://physical_host_of_user1/u/user/anypath </pre></div> - <p>when any URL path need not be valid on every server. 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> + <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 user-to-host txt:/path/to/map.user-to-host -RewriteMap group-to-host txt:/path/to/map.group-to-host -RewriteMap entity-to-host txt:/path/to/map.entity-to-host - -RewriteRule ^/u/<strong>([^/]+)</strong>/?(.*) http://<strong>${user-to-host:$1|server0}</strong>/u/$1/$2 -RewriteRule ^/g/<strong>([^/]+)</strong>/?(.*) http://<strong>${group-to-host:$1|server0}</strong>/g/$1/$2 -RewriteRule ^/e/<strong>([^/]+)</strong>/?(.*) http://<strong>${entity-to-host:$1|server0}</strong>/e/$1/$2 +RewriteMap users-to-hosts txt:/path/to/map.users-to-hosts -RewriteRule ^/([uge])/([^/]+)/?$ /$1/$2/.www/ -RewriteRule ^/([uge])/([^/]+)/([^.]+.+) /$1/$2/.www/$3\ +RewriteRule ^/u/<strong>([^/]+)</strong>/?(.*) http://<strong>${users-to-hosts:$1|server0}</strong>/u/$1/$2 </pre></div> </dd> </dl>
|