ARR routing problemRSS

15 replies

Last post Feb 04, 2010 09:39 AM by aahm__

  • ARR routing problem

    Jan 19, 2010 10:34 AM|aahm__|LINK

    Hi All,

    I am setting up 2 servers in our beta environment for testing purposes. There is running Windows Server 2008 + IIS 7 + MySQL Cluster (NDB) on both machines (beta1.something.com and beta2.something.com). The machines are not in any windows domain and we are not using any DNS in this environment, just plain host files. I have deployed our web application on both servers and it is working fine with hostnames (beta1.application.something.com and beta2.application.something.com).

    I have installed ARRv2 on beta1 server and created a server farm which includes both servers (beta1 and beta2). I also created a single inbound rule for URL rewrite as following:

    <rule name="ARR_beta_loadBalance" patternSyntax="Wildcard" stopProcessing="true">
       <match url="*" />
       <action type="Rewrite" url="http://beta.application.something.com/{R:0}" />
    </rule>

    The problem is the following: when I request "beta.application.something.com" I am getting the default IIS7 webpage instead of the application's web page. I can see from the log (request diagnostics) that the request is being redirected to the server in the farm correctly but the URL is always rewrited:

    44. -URL_CHANGED
    OldUrl http://beta.application.something.com/
    NewUrl /

    I think the problem is caused because of this. I have also tried to set preserveHostHeader="true" directly in the applicationHost.config file. But it had no effect. Note: bindings of web sites on both servers are of course configured for beta.application.something.com as well (I don't see the problem here). 

    Does anyone have any ideas? I am going slightly desparate :-)

    Anyone's help is very much appreciated. Thank you!

    Marek.

  • Re: ARR routing problem

    Jan 27, 2010 11:27 AM|aahm__|LINK

    Hm ... I can see this forum is really "helpful" :-(

  • Re: ARR routing problem

    Jan 27, 2010 12:46 PM|wonyoo|LINK

    Sorry about that - let me see if we can be more helpful.

    I am a bit confused though on what you are trying to accomplish.  In your current configuration, are you using both NLB and ARR?   That's what it seems like, but I am not sure why.  

    As I understand your setup, you have 2 servers (beta1 and beta 2) that are configured to use NLB (ie. they share a VIP - beta.something.com).  And this works as expected.   Then you've deployed ARR on beta1.something.com?  Why?

    NLB and ARR can be used together and there is a whitepaper that discusses a scenario and recommendations on why and how someone may want to do this (this can be found at http://learn.iis.net/page.aspx/511/achieving-high-availability-and-scalability---arr-and-nlb/).

    So I am curious to understand what you are trying to accomplish, and perhaps we can go from there.

     

    Thanks.

    application Request Routiing

  • Re: ARR routing problem

    Jan 28, 2010 03:18 AM|aahm__|LINK

    I am sorry. Perhaps I did not make myself clear enough. I am not using both NLB + ARR, only ARR. What I try to accomplish is actually very simple scenario for some beta testing:

    Our application is deployed on both beta servers, client machines have configured only hosts files. The application site bindings are configured as following:

    Server BETA1 is configured for beta1.application.somedomain.com.

    Server BETA2 is configured for beta2.application.somedomain.com.

    If client directly requests http://beta1.application.somedomain.com or http://beta2.application.somedomain.com everything works fine. I have installed ARR to server BETA1 only and what I want to achieve is that BETA1 server will listen also for http://beta.application.somedomain.com (without numbers 1,2) and will distribute these requests in the farm (which contains both servers BETA1 and BETA2).

    The problem in my current configuration is: when the client requests http://beta.application.somedomain.com then the request is being handled by ARR and it is being distributed to a server in the farm but the server from the farm always returns the default IIS7 page instead of the application's default page.

    I hope I have described it clearly enough :-)

    Thanks,

    Marek.

  • Re: ARR routing problem

    Jan 28, 2010 01:59 PM|wonyoo|LINK

    Thanks for the clarification. 

    I am not sure if your deployment configuration is just for testing or if it is the actual/production deployment topology.   The reason why I say this is becase if I am understanding you right, it is not the recommended deployment topology.

    ARR is a proxy based request router.  So in your case, you probably have 2 bindings on BETA1 (BETA1 and BETA - by the way, how are they bound?  2 IP addresses?  Different ports?  Hostname binding?  Are they two separate sites?  Or one site?  If you prefer, you can send me your applicationHost.config file.)

    So, the BETA1 server answers to beta.application.somedomain.com.  And based on the load balancing algorithm, it will route the request to self (via loopback) to BETA1 or it will proxy the request to the second server BETA2.

    If this is what you are trying to do, then the routing rules are little bit more advanced - and if you are familiar with URL rewrite rules, ARR leverages URL rewrite for that.

    Alternatively, send me an private message with your ApplicationHost.config and I can help you with the rules.

    application Request Routiing

  • Re: ARR routing problem

    Jan 28, 2010 05:06 PM|aahm__|LINK

    Yes, web sites on BETA1 and BETA2 servers are bound by hostname binding.

    This is only beta environment for our internal testing purposes. It is not production environment. And the scenario you described is exactly what I am trying to accomplish:

    Server BETA1 will answer to all requests made to http://beta.application.somedomain.com and it will route it (based on load balancing algorithm) to itself via loopback and to the second server BETA2.

    And that is exactly what I thought I have configured correctly ... but I am still getting that damn default IIS7 page :-) ... now I am really curious what a "tricky" URL rewrite rule can handle this ... because at the very beginning I was thinking this will be prettty straightforward ... but it was not (for me) :-)

    Thanks for your help!

    Marek.

  • Re: ARR routing problem

    Jan 28, 2010 07:54 PM|wonyoo|LINK

    Marek

    Here is what I have done in my environment.   The idea is rather simple once you dig into it.

    ARR is a server level feature, meaning it applies to all sites on the server.   Since you have 2 names (BETA1 and BETA) that are bound on the machine, you will want to write the rules in such a way that the load balancing is done only for the first request (BETA) and not applied again the second time (BETA1) when the request is made via loopback.

    I am doing this by opening the notepad, but you could also do it via the UI.   The configuration file is located at %windir%\system32\inetsrv\config\applicationHost.config.

    I have a farm named "test" with 2 servers:

            <webFarm name="test" enabled="true">
                <server address="BETA1" enabled="true" />
                <server address="BETA2" enabled="true" />
            </webFarm>

    Now in the URL rewrite section, I only want to apply the rules if the host header is BETA.   So I have:

                <globalRules>
                    <rule name="ARR_test_loadbalance" patternSyntax="Wildcard" stopProcessing="true">
                        <match url="*" />
                        <action type="Rewrite" url="http://test/{R:0}" />
                        <conditions trackAllCaptures="true">
                            <add input="{HTTP_HOST}" pattern="beta.application.somedomain.com" />
                        </conditions>
                    </rule>
                </globalRules>

     

    Above rule basically says, if the request contains the host header "beta.application.somedomain.com", then route the request to "test" server farm.  ARR then uses the LB logic to pick either BETA1 or BETA2.   In your case, since BETA and BETA1 are on the same box, when the reqeust is routed to the same "self" physical machine, you don't want the rules to be applied again the second time (which is what the conditional statement above mitigates; it's only applied to the request with host header BETA but not BETA1.

    Hope this helps.

    application Request Routiing

  • Re: ARR routing problem

    Jan 29, 2010 06:49 AM|aahm__|LINK

    Thanks for your help. I made some progress, now I am getting really the application default page at least, not the IIS7 page :-) That is the good news. The bad news is that the BETA1 server is routing all requests to the BETA2 server only. It newer goes to the BETA1. I checked the server affinity feature in my farm and it is turned off.

    Here are snippets from my applicationHost.config file. The <webFarm> section:

             <webFarm name="betafarm" enabled="true">
                <server address="10.0.0.120" enabled="true">
                    <applicationRequestRouting weight="100" />
                </server>
                <server address="10.0.0.121" enabled="true">
                    <applicationRequestRouting weight="100" />
                </server>
                <applicationRequestRouting>
                    <loadBalancing algorithm="WeightedRoundRobin" />
                </applicationRequestRouting>
            </webFarm>

    And the <rewrite> section:

            <rewrite>
                <globalRules>
                    <rule name="ARR_betafarm_loadbalance" patternSyntax="Wildcard" stopProcessing="true">
                        <match url="*" />
                        <action type="Rewrite" url="http://betafarm/{R:0}" />
         <conditions trackAllCaptures="true">
          <add input="{HTTP_HOST}" pattern="beta.application.somedomain.com" />
         </conditions>
                    </rule>
                </globalRules>
            </rewrite>
            <proxy enabled="false" reverseRewriteHostInResponseHeaders="false" />

    NOTE: BETA1 = 10.0.0.120 and BETA2 = 10.0.0.121

    Marek.

  • Re: ARR routing problem

    Jan 29, 2010 11:24 AM|wonyoo|LINK

    Could you tell me what you see under "Monitoring and Management" icon for ARR?   You should be able to see the 2 servers.

    Please ensure that both servers are marked as "healthy" and the runtime stats are non-zeros for both.  (Meaning, they are really getting routed to both servers - I am curious to see how you are determining that the requests are routed to only BETA2 server?)  

     

    application Request Routiing

  • Re: ARR routing problem

    Jan 29, 2010 12:06 PM|aahm__|LINK

    Actually it is very simple. I have just put into the default.aspx file a simple string determining the server (beta1 or beta2) ... so everytime the server sends response I can identify where it is coming from.

    Monitoring and Management seems OK, there are following information:

    Server / Availability / Health Status / Req. per second / Response Time(ms) / Current Req. / Total Req. / Failed Req. / Req. size(KB) / Req. Distribution(%) / Response size(KB) / Load Balance Weight

    10.0.0.120 / Available / Healthy / 0 / 16 / 0 / 197 / 0 / 121,04 / 50,00% / 706,66 / 50,00%

    10.0.0.121 / Available / Healthy / 0 / 16 / 0 / 197 / 0 / 123,81 / 50,00% / 817,66 / 50,00%

    M.

  • Re: ARR routing problem

    Jan 29, 2010 01:17 PM|wonyoo|LINK

    The load balancing is working correctly, as expected.

    Here is what I suspect - Depending on the page that you are testing, I am thinking that the page requires 2 HTTP requests, where the second request is the one that returns the name of the server.  In that case, the first request is routed to BETA1 and the second request is routed to BETA2.   And since it is the second request that tells you the name of the server, it always seems like the page is coming from BETA2.

    (As you can see, from the stats, the requests are being routed evenly - 197/197).

    So what you may want to do is to change the weight of the load balancing just for testing purposes.   In your configuration, instead of having 100/100 as weight, change it to something uneven, say 100/50:

                <server address="10.0.0.120" enabled="true">
                    <applicationRequestRouting weight="100" />
                </server>
                <server address="10.0.0.121" enabled="true">
                    <applicationRequestRouting weight="50" />
                </server>

    In above case, BETA1 will get twice as many requests as BETA2.   (I am pretty sure that the behavior that you are seeing is due to the nature of how your test page is designed.)

    Hope that that's it.

    application Request Routiing

  • Re: ARR routing problem

    Jan 29, 2010 04:24 PM|aahm__|LINK

    Honestly I am not sure what do you mean by suspecting that page :-) It is really very simple scenario. I have the following:

    On BETA1 - default.aspx with content:

    ...<div>BETA1 <%= DateTime.Now %></div> ...

    and on BETA2 - default.aspx with content:

    ... <div>BETA2 <%= DateTime.Now %></div> ...

    And when I make request from browser I always see BETA2 ... never BETA1 ... I am expecting that sometimes I should see BETA1 and sometimes BETA2 (when server affinity is turned off) ... am I right?

     Marek.

  • Re: ARR routing problem

    Jan 29, 2010 05:57 PM|wonyoo|LINK

    What else is in the test page? 

    Have you tried changing the weight?

    The runtime stat that you sent me clearly shows that the requests are being sent to both servers evenly.  So I am guessing that the page may contain multiple requests.

    Please try changing the weight unevenly and try again?

     

  • Re: ARR routing problem

    Jan 30, 2010 12:10 PM|aahm__|LINK

    I tried as you said. I changed the distribution ratio to 75% for BETA1 and 25% for BETA2. I was requesting just simple txt file. I always got the one from BETA2 only.

    What is more weird (to me at least) is that the stats in the MaM are showing data that seems to be correct. The BETA1 is getting more requests than BETA2. But why I never see the txt file from BETA1? Always only from BETA2.

    Server / Availability / Health Status / Req. per second / Response Time(ms) / Current Req. / Total Req. / Failed Req. / Req. size(KB) / Req. Distribution(%) / Response size(KB) / Load Balance Weight

    10.0.0.120 / Available / Healthy / 0 / 2 / 0 / 118 / 0 / 71,70 / 74,68% / 29,48 / 75,00 %

    10.0.0.121 / Available / Healthy / 0 / 2 / 0 / 40 / 0 / 25,67 / 25,32% / 8,20 / 25,00 %

    Marek.

  • Re: ARR routing problem

    Jan 30, 2010 03:07 PM|wonyoo|LINK

    That is strange.

    Is it possible for you to send me both your applicationHost.config as well as the test pages that you are using via private message?

     

  • Re: ARR routing problem

    Feb 04, 2010 09:39 AM|aahm__|LINK

    Hi All,

    after great help from wonyoo I have a working solution of this problem. So for anyone who might be dealing with the same problem, here it is ...

    The rewrite section of applicationHost.config file:

    <rewrite>
       <globalRules>
        <clear />
        <rule name="Do not route" patternSyntax="Wildcard" stopProcessing="true">
         <match url="*" />
         <conditions logicalGrouping="MatchAll" trackAllCaptures="true">
          <add input="{HTTP_NOPROXY}" pattern="1" />
         </conditions>
         <action type="None" />
        </rule>
        <rule name="ARR_betafarm_loadbalance" patternSyntax="Wildcard" stopProcessing="true">
         <match url="*" />
         <conditions logicalGrouping="MatchAll" />
         <serverVariables>
          <set name="HTTP_NOPROXY" value="1" />
         </serverVariables>
         <action type="Rewrite" url="http://betafarm/{R:0}" />
        </rule>
       </globalRules>
    </rewrite>