<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3192233808876085558</id><updated>2024-09-14T03:04:10.649-05:00</updated><title type='text'>Garrett Web Edition</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://garrettwebedition.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3192233808876085558/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://garrettwebedition.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3192233808876085558.post-536382546978630805</id><published>2011-11-29T21:27:00.000-06:00</published><updated>2011-12-06T12:12:49.130-06:00</updated><title type='text'>A/B testing IIS sites on the same server using Application Request Routing (ARR)</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;I was recently asked to setup A/B testing for 2 sites on the same host. &amp;nbsp;This was for a Windows server running IIS. &amp;nbsp;I searched for some module or other quick way to get this done but couldn&#39;t find anything. &amp;nbsp;I found a bunch of posts talking about using&amp;nbsp;&lt;a href=&quot;http://www.iis.net/download/applicationrequestrouting&quot;&gt;Application Request Routing&lt;/a&gt; (ARR) to accomplish A/B testing but they required the use of 2 or more servers to act as members of the server farm. &amp;nbsp;I had only 1 host to work with and while I could have created another server or 2, I didn&#39;t want to have to manage another host and load balancer.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;It took an hour of messing around and trying different setups but I was finally able to it setup.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;The steps below show how to setup a single IIS server to allow is to host multiple sites for A/B testing using ARR and URL Rewriting.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Install&amp;nbsp;&lt;/span&gt;Application Request Routing&amp;nbsp;(ARR)&amp;nbsp;&lt;/span&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
The latest version of ARR (2.5) is available via Web PI. &amp;nbsp;From your server you can install from the &lt;a href=&quot;http://www.microsoft.com/web/gallery/install.aspx?appid=ARRv2_5&quot;&gt;Web App Gallery page&lt;/a&gt;&amp;nbsp;or launch Web PI (Platform Installer) from within the IIS Manager Console. &amp;nbsp;There are a bunch of resources available for installing ARR and a quick Google search should get you pointed in the right direction.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRrAXndSNiWSaKr4fhbcWY4yEScMlCLNuUTEDqtdv_0EdyAd5bwWAaLZp7daOyTzNCVubz2ZOIrck_dTgXeNn3xfCKTwk48bZEAQ5uVqD-l4gaEWyO30vf4Ao0Sg1QGlhUYplBkghgVuE/s1600/WebPI.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;221&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRrAXndSNiWSaKr4fhbcWY4yEScMlCLNuUTEDqtdv_0EdyAd5bwWAaLZp7daOyTzNCVubz2ZOIrck_dTgXeNn3xfCKTwk48bZEAQ5uVqD-l4gaEWyO30vf4Ao0Sg1QGlhUYplBkghgVuE/s320/WebPI.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit; font-size: large;&quot;&gt;&lt;u&gt;Add some additional entries to the hosts file&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
ARR only allows 1 entry per host name in the server farm. &amp;nbsp;Since our hosts are all going to be served by localhost we need some additional &quot;aliases&quot; for localhost. &amp;nbsp;By creating additional hosts entries we can use these alternate names to all resolve to localhost (127.0.0.1).&lt;br /&gt;
&lt;br /&gt;
Start Notepad.exe as an Administrator and open the file&amp;nbsp;%windir%\System32\drivers\etc\hosts&lt;br /&gt;
Add 2 new entries that resolve to 127.0.0.1.&lt;br /&gt;
&lt;br /&gt;
I used &lt;b&gt;locala&lt;/b&gt;&amp;nbsp;and &lt;b&gt;localb&lt;/b&gt;. &amp;nbsp;Here is what my hosts file looked like when I was done.&lt;br /&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a &#39;#&#39; symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1       localhost
# ::1             localhost
127.0.0.1 locala
127.0.0.1 localb
127.0.0.1 www.localab.com
127.0.0.1 localab.com
&lt;/pre&gt;
&lt;br /&gt;
&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Setup A/B sites to listen on different ports&lt;/span&gt;&lt;/u&gt;&lt;br /&gt;
I&#39;ll include some steps here to create new sites. &amp;nbsp;You can modify your current site bindings accordingly. &lt;br /&gt;
The goal is to have the &quot;A&quot; site have a binding to hostname locala on port 9001 (or whatever port works best for you) and the &quot;B&quot; site with a binding to hostname localb on port 9002. &amp;nbsp;I also create a &quot;shell&quot; site that that holds the bindings for the url we are A/B testing.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:plain&quot;&gt;mkdir %SystemDrive%\inetpub\wwwroot\site-a 
mkdir %SystemDrive%\inetpub\wwwroot\site-b
mkdir %SystemDrive%\inetpub\wwwroot\site-ab-shell
echo site-a &amp;gt; %SystemDrive%\inetpub\wwwroot\site-a\index.html
echo site-b &amp;gt; %SystemDrive%\inetpub\wwwroot\site-b\index.html
echo site-ab-shell &amp;gt; %SystemDrive%\inetpub\wwwroot\site-ab-shell\index.html
%systemroot%\system32\inetsrv\APPCMD add site /name:site-a ^
 /bindings:&quot;http/*:9001:&quot; /physicalPath:&quot;%SystemDrive%\inetpub\wwwroot\site-a&quot;
%systemroot%\system32\inetsrv\APPCMD add site /name:site-b ^
 /bindings:&quot;http/*:9002:&quot; /physicalPath:&quot;%SystemDrive%\inetpub\wwwroot\site-b&quot;
%systemroot%\system32\inetsrv\APPCMD add site /name:site-ab-shell ^
 /bindings:&quot;http/www.localab.com:80:,http/localab.com:80:&quot; ^
 /physicalPath:&quot;%SystemDrive%\inetpub\wwwroot\site-ab-shell&quot;&lt;/pre&gt;
&lt;br /&gt;
&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Configure ARR&lt;/span&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
Open up Internet Information Services (IIS) Manager&lt;br /&gt;
Right-click &lt;b&gt;Server Farms&lt;/b&gt; and click &lt;b&gt;Create Server Farm...&lt;/b&gt;&lt;br /&gt;
Name the farm &lt;b&gt;ab&lt;/b&gt;&amp;nbsp;(or whatever you want)&amp;nbsp;and click &lt;b&gt;Next&lt;/b&gt;&lt;br /&gt;
In the &lt;b&gt;Server address:&lt;/b&gt;&amp;nbsp;box enter &lt;b&gt;locala&lt;/b&gt;&amp;nbsp;(this is the hosts entry me made earlier)&lt;br /&gt;
Click &lt;b&gt;Advanced settings...&lt;/b&gt;&lt;br /&gt;
Change &lt;b&gt;httpPort&lt;/b&gt;&amp;nbsp;to &lt;b&gt;9001 &lt;/b&gt;(this is the port we specified earlier when we created sites site-a)&lt;br /&gt;
Click &lt;b&gt;Add&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In the&amp;nbsp;&lt;b&gt;Server address:&lt;/b&gt;&amp;nbsp;box enter&amp;nbsp;&lt;b&gt;localb&lt;/b&gt;&amp;nbsp;(this is the hosts entry me made earlier)&lt;br /&gt;
Click&amp;nbsp;&lt;b&gt;Advanced settings...&lt;/b&gt;&lt;br /&gt;
Change&amp;nbsp;&lt;b&gt;httpPort&lt;/b&gt;&amp;nbsp;to &lt;b&gt;9002 &lt;/b&gt;(this is the port we specified earlier when we created sites site-a)&lt;br /&gt;
Click&amp;nbsp;&lt;b&gt;Add&lt;/b&gt;&lt;br /&gt;
Click &lt;b&gt;Finish&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
If you are presented with a &lt;b&gt;Rewrite Rules&lt;/b&gt;&amp;nbsp;popup&amp;nbsp;click&amp;nbsp;&lt;b&gt;No&lt;/b&gt;. We will create the rule in the next step.&lt;br /&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitGWYjFBA_mvImRLHtEBVgPgq5Sfa0v8EJAwa0C9sF4lXJoHLpiJzKXcJFhRkGnkv8hTk49vfmyEoJWmRqoeqHNupYkBKpKByf7iPGRjpS6twG65GyQ4a4WOmCpC98qf4goWCdVxkjLVY/s1600/rewrite-rules.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;128&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitGWYjFBA_mvImRLHtEBVgPgq5Sfa0v8EJAwa0C9sF4lXJoHLpiJzKXcJFhRkGnkv8hTk49vfmyEoJWmRqoeqHNupYkBKpKByf7iPGRjpS6twG65GyQ4a4WOmCpC98qf4goWCdVxkjLVY/s320/rewrite-rules.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Setup Url Rewrite Rules&lt;/span&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
Open up Internet Information Services (IIS) Manager&lt;br /&gt;
Click on the root (parent) node on the left side Connections panel. &amp;nbsp;This URL Rewrite rule needs to be created at the root.&lt;br /&gt;
&lt;br /&gt;
Double-click &lt;b&gt;URL Rewrite&lt;/b&gt;&lt;br /&gt;
Click &lt;b&gt;Add Rule(s)...&lt;/b&gt;&lt;br /&gt;
Select &lt;b&gt;Blank rule&lt;/b&gt;&amp;nbsp;and click &lt;b&gt;OK&lt;/b&gt;&lt;br /&gt;
Name the rule &lt;b&gt;A/B testing&lt;/b&gt;&lt;br /&gt;
In the &lt;b&gt;Pattern:&lt;/b&gt;&amp;nbsp;text box enter the text &quot;.*&quot; (without the double quotes)&lt;br /&gt;
Expand the&amp;nbsp;&lt;b&gt;Conditions&lt;/b&gt;&amp;nbsp;group&lt;br /&gt;
&lt;br /&gt;
Click &lt;b&gt;Add...&lt;/b&gt;&lt;br /&gt;
In the &lt;b&gt;Condition input:&lt;/b&gt;&amp;nbsp;text box enter the text &quot;&lt;b&gt;{HTTP_HOST}&lt;/b&gt;&quot;&lt;br /&gt;
In the &lt;b&gt;Pattern:&lt;/b&gt;&amp;nbsp;text box enter the text&amp;nbsp;&quot;&lt;b&gt;(www\.|^)localab.com&lt;/b&gt;&quot;&lt;br /&gt;
Click &lt;b&gt;OK&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Click&amp;nbsp;&lt;b&gt;Add...&lt;/b&gt;&lt;br /&gt;
In the&amp;nbsp;&lt;b&gt;Condition input:&lt;/b&gt;&amp;nbsp;text box enter the text &quot;&lt;b&gt;{SERVER_PORT}&lt;/b&gt;&quot;&lt;br /&gt;
Change the &lt;b&gt;Check if input string:&lt;/b&gt;&amp;nbsp;drop down to &lt;b&gt;Does Not Match the Pattern&lt;/b&gt;&lt;br /&gt;
In the&amp;nbsp;&lt;b&gt;Pattern:&lt;/b&gt;&amp;nbsp;text box enter the text&amp;nbsp;&quot;&lt;b&gt;80&lt;/b&gt;&quot;&lt;br /&gt;
Click&amp;nbsp;&lt;b&gt;OK&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;The {SERVER_PORT} rule is needed so that the traffic proxied by the load balancer does match. &amp;nbsp;Without this rule the proxied requests to locala or localb get stuck in an endless loop.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoYF60NSth7hC6hiylKDeUdpXouCzB2yQ1EEkKdoAxIFgph9rwa0lwBag8eMvI4lk3ifiApSSGUM2cyXpHOtPH-7WDKhzcwIKagVaIStrZGjE-zLL58QkqPgOk4Q68YKklRDrjTt24u0o/s1600/conditions.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;116&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoYF60NSth7hC6hiylKDeUdpXouCzB2yQ1EEkKdoAxIFgph9rwa0lwBag8eMvI4lk3ifiApSSGUM2cyXpHOtPH-7WDKhzcwIKagVaIStrZGjE-zLL58QkqPgOk4Q68YKklRDrjTt24u0o/s320/conditions.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
Expand the &lt;b&gt;Action &lt;/b&gt;group&lt;br /&gt;
Change the &lt;b&gt;Action type:&lt;/b&gt;&amp;nbsp;to &lt;b&gt;Route to Server Farm&lt;/b&gt;&lt;br /&gt;
Check the box &lt;b&gt;Stop processing of subsequent rules&lt;/b&gt;&lt;br /&gt;
Click &lt;b&gt;Apply&lt;/b&gt;&amp;nbsp;on the right side actions pane&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Setup ARR Load Balancing and Client Affinity&lt;/span&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
Open up Internet Information Services (IIS) Manager&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
Expand&amp;nbsp;&lt;b&gt;Server Farms&lt;/b&gt;&amp;nbsp;and click the farm &lt;b&gt;ab&lt;/b&gt;&lt;/div&gt;
Double-click &lt;b&gt;Server Affinity&lt;/b&gt;&lt;br /&gt;
Check the box &lt;b&gt;Client affinity&lt;/b&gt;&lt;br /&gt;
Click &lt;b&gt;Apply&lt;/b&gt;&lt;br /&gt;
Click on the ab farm again&lt;br /&gt;
Double-click &lt;b&gt;Load Balance&lt;/b&gt;&lt;br /&gt;
Change the &lt;b&gt;Load balance algorithm:&lt;/b&gt;&amp;nbsp;to &lt;b&gt;Weighted round robin&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Click&amp;nbsp;&lt;b&gt;Apply&lt;/b&gt;&lt;br /&gt;
If you see a popup for runtime statistics you can click &lt;b&gt;Yes&lt;/b&gt;&amp;nbsp;to reset the statistics&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;u&gt;Test it out!&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Going to&amp;nbsp;http://localab.com should bring up a site that displays either &quot;site-a&quot; or &quot;site-b&quot;. &lt;br /&gt;
&lt;br /&gt;
If you see &quot;site-ab-shell&quot; then the URL Rewrite rule is not matching and the request is falling through to the shell site. &amp;nbsp;Double check the URL Rewrite rule.&lt;br /&gt;
&lt;br /&gt;
You can close and open your browser and you should be balanced back and forth between sites.&lt;br /&gt;
&lt;br /&gt;
You can view traffic stats for each site by going to Server Farms -&amp;gt; ab -&amp;gt; Monitoring and Management&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://garrettwebedition.blogspot.com/feeds/536382546978630805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://garrettwebedition.blogspot.com/2011/11/ab-testing-iis-sites-on-same-server.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3192233808876085558/posts/default/536382546978630805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3192233808876085558/posts/default/536382546978630805'/><link rel='alternate' type='text/html' href='http://garrettwebedition.blogspot.com/2011/11/ab-testing-iis-sites-on-same-server.html' title='A/B testing IIS sites on the same server using Application Request Routing (ARR)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRrAXndSNiWSaKr4fhbcWY4yEScMlCLNuUTEDqtdv_0EdyAd5bwWAaLZp7daOyTzNCVubz2ZOIrck_dTgXeNn3xfCKTwk48bZEAQ5uVqD-l4gaEWyO30vf4Ao0Sg1QGlhUYplBkghgVuE/s72-c/WebPI.png" height="72" width="72"/><thr:total>1</thr:total></entry></feed>