<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>*.hosting &#187; Load Balancing</title>
	<atom:link href="http://www.stardothosting.com/blog/category/load-balancing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stardothosting.com/blog</link>
	<description>Star Dot Hosting : Technology, Security, Virtualization and Cloud Computing</description>
	<lastBuildDate>Wed, 16 May 2012 19:07:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Varnish Caching with Joomla</title>
		<link>http://www.stardothosting.com/blog/2011/08/08/varnish-caching-with-joomla/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=varnish-caching-with-joomla</link>
		<comments>http://www.stardothosting.com/blog/2011/08/08/varnish-caching-with-joomla/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 21:05:50 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Load Balancing]]></category>
		<category><![CDATA[Varnish Cache]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[systems administration]]></category>
		<category><![CDATA[varnish cache]]></category>
		<category><![CDATA[varnish joomla]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=437</guid>
		<description><![CDATA[Hello There! One of the exciting new technologies to come out in the last few years is a tremendously efficient and dynamic caching system called Varnish (see : http://www.varnish-cache.org). We have been employing the use of Varnish for high traffic websites for the purposes of user experience improvements as well as for redundancy and load [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hello There!</p>
<p>One of the exciting new technologies to come out in the last few years is a tremendously efficient and dynamic caching system called Varnish (see : <a href="http://www.varnish-cache.org" target="_new">http://www.varnish-cache.org</a>).</p>
<p>We have been employing the use of Varnish for high traffic websites for the purposes of user experience improvements as well as for redundancy and load balancing purposes.</p>
<p>Varnish can do it all &#8211; complex load balancing and polling based on many different weighting methodologies for fail over, as well as holding on to a &#8220;stale&#8221; cache in the event of a back end web server outage, or perhaps for geographic redundancy (holding a stale cache in a secondary data center).</p>
<p>One of the challenges we have faced in the many different implementations of varnish into web stacks, is dealing with dynamic and user session (i.e. &#8220;logged in&#8221;) content. </p>
<p>If the Internet was full of only static (see 1995) html files, varnish would work beautifully out of the box. Unfortunately the web is a complicated mess of session based authentication, POSTS, GETS and query strings among a few things.</p>
<p>One of our recent accomplishments was getting the Joomla 1.5 content management system to work with Varnish 2.1.</p>
<p>The biggest challenge for Joomla was that it creates a session cookie for all users. This means the session is created and established for any guest visiting the site, and if they decide to log in , that same session is used to establish a logged in session through authentication. This is an apparent effort to deter or avoid session hijacking.</p>
<p>The problem with this is that Varnish ends up caching all the logged in session content, as well as the anonymous front page content. </p>
<p>I spent a significant amount of time fine tuning my VCL (varnish configuration language) to play nice with Joomla. Unfortunately it became apparent that some minor modifications to the Joomla code was necessary in order for it to communicate properly with Varnish.</p>
<p><big><u><b>Step 1 : Move the login form off the front page</big></u></b></p>
<p>I realize this might be a hard decision. I cant offer an alternative. If you have an integrated login form on the front page of your site, and you wish to cache that page with varnish, you will likely have to chose one or the other. It would probably be ideal to replace that login form with a button to bring the user to a secondary page off the main page. </p>
<p>For the sake of argument, lets call our site &#8220;example.com&#8221; and the login page url within Joomla should look like the following :</p>
<p><b>http://www.example.com/index.php?option=com_user&#038;view=login</b></p>
<p>Take note of <b>login</b> URI in this string.</p>
<p>The reason we need the login form on a secondary page is because we need an almost &#8220;sandboxed&#8221; section of the site where the anonymous session cookie can be established, and passed through the authentication process to a logged in session. We will tell varnish to essentially ignore this page.</p>
<p><big><u><b>Step 2 : Modify Joomla to send HTTP headers for user/guest sessions</big></u></b></p>
<p>This isn&#8217;t that hard. In the Joomla code, there is a section where it defines the HTTP headers it sends to the browser for cache variables such as expire times and whatnot. I&#8217;m going to assume you have turned off the built-in Joomla caching system. </p>
<p>What you need to do is tell Joomla to send a special HTTP header that will give either a True or False value if the user is logged in or not. This is useful information. It will allow varnish to not cache any logged in content such as &#8220;Welcome back, USERNAME&#8221; after the user is passed back to the front page from logging in.</p>
<p>In my joomla installation, I modified the following file :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">libraries/joomla/environment/response.php</div></div>
<p>The parent folder being the public_html / root folder for your Joomla installation. In this file, please find the line that determines if the Joomla caching system is disabled :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">if (JResponse::allowCache() === false)</div></div>
<p>After this line, you will see about 5 HTTP header declarations (expires, last-modified, cache-control, cache-control again and pragma). Above those declarations , add the following 6 lines of code :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$user =&amp; JFactory::getUser();<br />
if (!$user-&gt;guest) {<br />
JResponse::setHeader( 'X-Logged-In', 'True', true);<br />
} else {<br />
JResponse::setHeader( 'X-Logged-In', 'False', true );<br />
}</div></div>
<p>If you read the above code, its fairly straight forward. I do a check to see if the user is a guest (aka anonymous) or not. If they are logged in I send an HTTP header called &#8220;X-Logged-In&#8221;, and assign a &#8220;True&#8221; value to it. If the user is not logged in, it sets it to &#8220;False&#8221;.</p>
<p>Pretty easy, right?</p>
<p>This will allow varnish to avoid caching a logged in user&#8217;s page.</p>
<p><big><u><b>Step 3 : Configure Varnish</big></u></b></p>
<p>This is the part that took the most time during this entire process. Mind you patching the Joomla code and whatnot took some time as well, this process took a lot of experimentation and long hours examining session cookies and host headers. </p>
<p>What I will do is break down the generalized configuration directives into two groups : VCL_RECV and VCL_FETCH.</p>
<p><big><b>VCL_RECV</big></b></p>
<p>In here, I set a bunch of IF statement directives to tell varnish what it should look up in the cache and what it should pipe to the backend and what it should pass. This could probably be optimized and improved upon, but it works for me :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># If user sends an http POST, pipe to backend<br />
if (req.request == &quot;POST&quot;) {<br />
set req.backend = iamloggedin;<br />
return(pipe);<br />
}<br />
<br />
# http authenticated sessions are piped<br />
if (req.http.Authenticate || req.http.Authorization) {<br />
set req.backend = iamloggedin;<br />
return(pipe);<br />
}<br />
<br />
# if the user is coming FROM the login page, pipe to backend <br />
if (req.http.referer ~ &quot;(?i)(com_user|login)&quot;) {<br />
set req.backend = iamloggedin;<br />
return(pipe);<br />
}</div></div>
<p><big><b>VCL_FETCH</big></b></p>
<p>The fetch section is a little bit easier. I only have about 5 directives. The first one is the most important one you want to look at. It &#8220;unsets&#8221; the cookie from any page on the site, EXCEPT the login page. This allows varnish to properly establish the logged in session. The subsequent rules determine what to deliver and what to pass based on URI or HTTP header checks :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># discard backend setcookie unless it equals the following<br />
if (!req.url ~ &quot;(?i)(login|com_user|user|logout)&quot;) {<br />
unset beresp.http.Set-Cookie;<br />
}<br />
<br />
if (req.http.referer ~ &quot;(?i)(com_user|login|logout)&quot;) {<br />
set req.backend = iamloggedin;<br />
return(pass);<br />
}<br />
<br />
if (beresp.http.x-logged-in ~ &quot;False&quot;){<br />
set req.backend = webfarm;<br />
return(deliver);<br />
}<br />
<br />
if (beresp.http.x-logged-in ~ &quot;True&quot;){<br />
set req.backend = iamloggedin;<br />
return(pass);<br />
}<br />
<br />
if (req.http.Authenticate || req.http.Authorization) {<br />
set req.backend = iamloggedin;<br />
return(pass);<br />
}</div></div>
<p>Thats it! I just saved you many sleepless nights (I hope!). Hopefully your headers will look something like this after you implement varnish in front of Joomla :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Set-Cookie&nbsp; example_auth_129bf15asdfasdf52f3afaafawef; path=/<br />
P3P CP=&quot;NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM&quot;<br />
X-Logged-In False<br />
Expires Mon, 1 Jan 2001 00:00:00 GMT<br />
Last-Modified &nbsp; Mon, 08 Aug 2011 20:49:37 GMT<br />
Cache-Control &nbsp; post-check=0, pre-check=0<br />
Pragma&nbsp; no-cache<br />
Content-Type&nbsp; &nbsp; text/html; charset=utf-8<br />
Content-Length&nbsp; 85898<br />
Date&nbsp; &nbsp; Mon, 08 Aug 2011 21:01:52 GMT<br />
X-Varnish &nbsp; 761778669 761751685<br />
Age 735<br />
Via 1.1 varnish<br />
Connection&nbsp; keep-alive<br />
X-Cache-Svr cache.example.com<br />
X-Cache HIT<br />
X-Cache-Hits&nbsp; &nbsp; 121</div></div>
<p><b><big><u>UPDATE : 12/08/2011</b></big></u></p>
<p>I realize I made a mistake and have corrected this post. In vcl_fetch, i had the following :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># discard backend setcookie unless it equals the following<br />
if (!req.url ~ &quot;(?i)(login|com_user|user|logout)&quot;) {<br />
unset req.http.Set-Cookie;<br />
}</div></div>
<p>Well I realize I should be unsetting the response cookie, not the set cookie. For some reason, the above (erroneous) directive works only right after you login. If you start clicking around the site, your logged in session disappears. I suspect this is because either joomla or varnish is mistakenly unsetting a logged in session.</p>
<p>This is the correct entry (I have fixed it in my original post as well) :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># discard backend setcookie unless it equals the following<br />
if (!req.url ~ &quot;(?i)(login|com_user|user|logout)&quot;) {<br />
unset beresp.http.Set-Cookie;<br />
}</div></div>
<p>After making the above change, I can login and browse the site and my session stays intact. Mind you, the Joomla site I am testing with is definitely not a vanilla Joomla installation. </p>
<p>I&#8217;d love to hear from anyone who has accomplished the above scenario either way!</p>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;linkname=Varnish%20Caching%20with%20Joomla" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;linkname=Varnish%20Caching%20with%20Joomla" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;linkname=Varnish%20Caching%20with%20Joomla" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;linkname=Varnish%20Caching%20with%20Joomla" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://www.stardothosting.com/blog/2011/08/08/varnish-caching-with-joomla/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;title=Varnish%20Caching%20with%20Joomla" id="wpa2a_2"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2011/08/08/varnish-caching-with-joomla/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Foundry Load Balancers HTTP sticky sessions</title>
		<link>http://www.stardothosting.com/blog/2010/08/30/foundry-load-balancers-http-sticky-sessions/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=foundry-load-balancers-http-sticky-sessions</link>
		<comments>http://www.stardothosting.com/blog/2010/08/30/foundry-load-balancers-http-sticky-sessions/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 19:15:06 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Load Balancing]]></category>
		<category><![CDATA[foundry]]></category>
		<category><![CDATA[load balancers]]></category>
		<category><![CDATA[sticky sessions]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=401</guid>
		<description><![CDATA[This post is intended to be a general guide for configuring &#8220;stickied&#8221; load balanced HTTP servers. Whether it&#8217;s F5 load balancers, foundry load balancers or open source based load balancers (keepalived/lvs), the concepts are the same and can be migrated across said platforms. If you have a paid of foundry&#8217;s and are looking to configure [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>This post is intended to be a general guide for configuring &#8220;stickied&#8221; load balanced HTTP servers. Whether it&#8217;s F5 load balancers, foundry load balancers or open source based load balancers (keepalived/lvs), the concepts are the same and can be migrated across said platforms.</p>
<p>If you have a paid of foundry&#8217;s and are looking to configure stickied load balanced HTTP servers, hopefully this guide will provide some assistance.</p>
<ul>
<strong>Logging into the load balancer</strong></ul>
<p>Telnet to the box and &#8216;enable&#8217; to allow admin access. The first thing you want to do is show the current configuration to view the existing setup for other working boxes :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&gt; telnet 192.x.x.x<br />
Trying 192.x.x.x...<br />
Connected to 10.x.x.x.<br />
Escape character is '^]'.<br />
<br />
User Access Verification<br />
<br />
Please Enter Login Name: admin<br />
Please Enter Password: <br />
<br />
User login successful.<br />
<br />
SLB-telnet@XXXX&gt;enable<br />
Enable Password:<br />
Error - Incorrect username or password.<br />
SLB-telnet@XXXX&gt;enable<br />
Enable Password:<br />
SLB-telnet@XXXX#</div></div>
<ul>
<strong>Real servers : defining the multiple load balanced boxes</strong></ul>
<p>Show the existing configuration on the foundary :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sh config</div></div>
<p>Take a look at the configuration of two &#8220;real&#8221; servers, which are the two servers that are behind the load balancer that will have balanced sticky connections :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">server real serverposapp01-tomcat01 192.168.1.141<br />
&nbsp;port default disable<br />
&nbsp;port 8001<br />
! &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
!<br />
server real serverposapp03-tomcat01 192.168.1.143<br />
&nbsp;port default disable<br />
&nbsp;port 8001</div></div>
<p>The above example is balancing TCP 8001 traffic, which is for TOMCAT. Here are entries for two servers doing simple HTTP traffic :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">server real serverapp01-vhost01 192.168.1.195<br />
&nbsp;port default disable &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;port http<br />
&nbsp;port http keepalive<br />
&nbsp;port http url &quot;HEAD /&quot;<br />
!<br />
server real serverapp02-vhost01 192.168.1.196<br />
&nbsp;port default disable<br />
&nbsp;port http<br />
&nbsp;port http keepalive<br />
&nbsp;port http url &quot;HEAD /&quot;</div></div>
<p>This example is similar to the tomcat example, except you have several options. &#8220;port default disable&#8221; disables all other ports. &#8220;port http keepalive&#8221; and &#8220;port http url &#8220;HEAD /&#8221;" define the http checks that take place to ensure apache is running on that box. If not , it will fail over to the second box and stop sending traffic to it.</p>
<ul>
<strong>SSL Connections</strong></ul>
<p>SSL incoming connections are handled by the load balancer initially, then passed off to the actual server as regular http / port 80 traffic. The internal box configuration would be similar to the above configuration examples :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">server virtual portal 192.168.1.104<br />
&nbsp;port default disable<br />
&nbsp;port ssl sticky<br />
&nbsp;port ssl ssl-terminate portal<br />
&nbsp;bind ssl serverapp01-portal01 http<br />
<br />
Notice how instead of &quot;port http sticky&quot; , its &quot;port ssl sticky&quot;. First of all, the sticky option is only set on the &quot;virtual&quot; configuration directives. Secondly, the SSL traffic is bound to the real servers via http in the last line of this example. Its pretty self explanatory.<br />
[edit] Regular HTTP Sticky Connections<br />
<br />
If no SSL Is being used on the site at all, then all you need is to set an HTTP virtual configuration :<br />
<br />
&lt;code&gt;<br />
server virtual serverapp-vhost01 192.168.1.106<br />
&nbsp;port default disable<br />
&nbsp;port http sticky &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;bind http serverapp02-vhost01 http</div></div>
<ul>
<strong>Configuring the external IP to NAT to the internal virtual</strong></ul>
<p>Typically, you will have a firewall in front of the load balancer that actaully holds the external ip addresses. The traffic is filtered initially by the firewall, then NAT&#8217;d to the virtual ip (VIP) of the load balancer, which then handles balancing the traffic.</p>
<p>You will need to either establish a new external ip , or use an existing one (for instance, if you are moving from 1 web server to 2 web servers , and want to balance the traffic using the load balancer). You need to setup the external IP address, and NAT it to the internal VIP.</p>
<ul>
<strong>Verifying the configuration works</strong></ul>
<p>Once everything is setup properly, and the external IP is being NAT&#8217;d to the load balancer, it is time to ensure the load balancer is seeing the connections. You could do this before doing the switchover on the firewall as well, just to ensure everything looks right before actually doing the switchover.</p>
<p>To see the active connections being load balanced, issue the following command (replacing the servername for whichever one you want to check) :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sh server real serverapp02-vhost01</div></div>
<p>That should display information similar to this :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Real Servers Info<br />
========================<br />
State(St) - ACT:active, ENB:enabled, FAL:failed, TST:test, DIS:disabled,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UNK:unknown, UNB:unbind, AWU:await-unbind, AWD:await-delete<br />
<br />
Name: serverapp02-vhost01 &nbsp; &nbsp; State: Active &nbsp; &nbsp; &nbsp; Cost: 0 &nbsp;IP:192.168.1.196: &nbsp; 1<br />
Mac: 0012.7990.d06a &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Weight: 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MaxConn: 2000000<br />
SrcNAT: not-cfg, not-op &nbsp; &nbsp; &nbsp;DstNAT: not-cfg, not-op &nbsp; &nbsp;Serv-Rsts: 0<br />
tcp conn rate:udp conn rate = 1:0, max tcp conn rate:max udp conn rate = 8:0<br />
BP max local conn configured No: 0 0 0 0 0 0 <br />
BP max conn percentage configured No: 0 0 0 0 0 0 <br />
Use local conn : No<br />
<br />
Port &nbsp; &nbsp;St &nbsp;Ms ServerConn TotConn &nbsp; &nbsp;Rx-pkts &nbsp; Tx-pkts &nbsp; Rx-octet &nbsp; Tx-octet &nbsp; Reas<br />
---- &nbsp; &nbsp;-- &nbsp;-- ------- ------- &nbsp; &nbsp;------- &nbsp; ------- &nbsp; -------- &nbsp; -------- &nbsp; ----<br />
default DIS 0 &nbsp;0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp;<br />
http &nbsp; &nbsp;ACT 0 &nbsp;104 &nbsp; &nbsp; 13094 &nbsp; &nbsp; &nbsp;181671 &nbsp; &nbsp;150813 &nbsp; &nbsp;162364862 &nbsp;20325115 &nbsp; 0 &nbsp;<br />
<br />
Server &nbsp;Total &nbsp;104 &nbsp; &nbsp; 13094 &nbsp; &nbsp; &nbsp;181671 &nbsp; &nbsp;150813 &nbsp; &nbsp;162364862 &nbsp;20325115 &nbsp; 0</div></div>
<p>The above is displaying the specific connection details for a single real server. To check the VIP / Virtual server :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sh server virtual tomcat</div></div>
<p>Which will display the following :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Virtual Servers Info<br />
<br />
Name: tomcat &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; State: Enabled &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IP:192.168.1.101: &nbsp; 1<br />
Pred: least-conn &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ACL-Id: 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TotalConn: 149959<br />
<br />
Port &nbsp; &nbsp;State &nbsp; &nbsp; Sticky &nbsp;Concur &nbsp;Proxy &nbsp;DSR &nbsp; ServerConn &nbsp;TotConn &nbsp;PeakConn &nbsp;<br />
---- &nbsp; &nbsp;----- &nbsp; &nbsp; ------ &nbsp;------ &nbsp;----- &nbsp;--- &nbsp; ------- &nbsp;------- &nbsp;-------- &nbsp;<br />
<br />
default disabled &nbsp;NO &nbsp; &nbsp; &nbsp;NO &nbsp; &nbsp; &nbsp;NO &nbsp; &nbsp; NO &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp; <br />
ssl &nbsp; &nbsp; enabled &nbsp; YES &nbsp; &nbsp; NO &nbsp; &nbsp; &nbsp;NO &nbsp; &nbsp; NO &nbsp; &nbsp;46 &nbsp; &nbsp; &nbsp; 149959 &nbsp; 443</div></div>
<p>You can see that &#8220;ServerConn&#8221; is displaying 46 connections. Thats it! </p>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;linkname=Foundry%20Load%20Balancers%20HTTP%20sticky%20sessions" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;linkname=Foundry%20Load%20Balancers%20HTTP%20sticky%20sessions" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;linkname=Foundry%20Load%20Balancers%20HTTP%20sticky%20sessions" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;linkname=Foundry%20Load%20Balancers%20HTTP%20sticky%20sessions" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://www.stardothosting.com/blog/2010/08/30/foundry-load-balancers-http-sticky-sessions/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;title=Foundry%20Load%20Balancers%20HTTP%20sticky%20sessions" id="wpa2a_4"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2010/08/30/foundry-load-balancers-http-sticky-sessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

