For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

ra3ac_138315's avatar
ra3ac_138315
Icon for Nimbostratus rankNimbostratus
May 10, 2014

LTM - load balancing to the same web server

Hi,

 

I'm hoping someone has had the same scenario.

 

We have two identical web servers. The web servers host multiple sites which uses the same IP and a URL to differentiate the pages. I have been requested to load balance the servers which works fine, but I have also been requested to monitor each site independently and if this site fails than just take that site out of the pool leaving all other instances working as normal. To throw another spanner in the works, they believe that 4-6 sites get added a year.

 

What would be the best way to design this scenario. I don't want to create a virtual server per site. Could I add host records or use DNS instead of IP's (I also use route domains do that may change the answer).

 

I find this request challenging because I would just monitor all the sites and if one goes down then the server should be taken out of the pool and rectified. Any advise would be appreciated.

 

10 Replies

  • Depending on the number of virtual hosts you're running, my initial reaction is that it might be more trouble than it's worth. The virtual hosts are merely front ends, right? So I don't really see one virtual host taking a dive when all the others are available, unless someone accidentally deletes the content.

     

    Having said that, if you absolutely want that solution I would create one pool for each site with its' individual monitoring even though it is the same servers in all the pools. Then I would create an iRule that checks the Host header and sends the requests to the correct pool. That way you can do it with only one virtual server. Would that be useful?

     

  • That's my rational, seems a lot of work for no real gain.

     

    So to clarify, create one virtual server with no attached pools, then create multiple pools with the same members and a monitor specific to that site. Then create an iRule to redirect the connection to a virtual server to a specific pool via the host header. Would have to lab it but seems logical - only thing is the virtual server would be down as it has no pool members, would have to lab it to see if it would work.

     

    Thanks for the advice, really appreciated.

     

  • No worries, and no - the virtual server will not be down, it has a dependency on pool members available through iRules as well so it will all be good. Give me a holler if you need some suggestions about the iRule.

     

  • Just to add to Henrik's excellent idea:

     

    when HTTP_REQUEST {    
        switch -glob [string tolower [HTTP::uri]] {        
            "/app1*" { pool app1_pool }            
            "/app2*" { pool app2_pool }            
        }        
    }    

    And then have a different pool and monitor(s) for each app. The beauty of this approach is that you scale up or down individual applications without affecting other services or modifying any code. If you wanted to get fancy with it, you could also do something like this:

     

    if { [active_members app1_pool] < 1 } {    
        HTTP::respond 200 content "HTML maintenance page content"        
    } else {    
        pool app1_pool        
    }
  • Thanks Kevin, the first iRule saved me searching through Dev central.

     

    The second one is really intriguing. I'm not sure how you add both rules, would you just add both iRules - the first one and a multiple of the second one per VS instance/page?. If that's the case the only concern is the number of iRules that would be added, sure there is a way to combine it all in one rule but that is above my scripting ability. Something to play with thou - thanks.

     

  • It's all a single iRule. The content in the second part would get inserted into the first and replace every pool statement.

     

  • No, the second part is an addition to the iRule. So the entire iRule would look something like this:

    when HTTP_REQUEST {    
        switch -glob [string tolower [HTTP::uri]] {        
            "/app1*" {
                if { [active_members app1_pool] < 1 } {    
                    HTTP::respond 200 content "HTML maintenance page content"        
                } else {    
                    pool app1_pool        
                }
            }            
            "/app2*" {
                if { [active_members app2_pool] < 1 } {    
                    HTTP::respond 200 content "HTML maintenance page content"        
                } else {    
                    pool app2_pool        
                }
            }            
        }        
    }    
    
  • Just showing off now ... Lol. Thanks guys, brilliant advice - all you advise will be used and appreciated.