Forum Discussion

kyn3s_53106's avatar
kyn3s_53106
Icon for Nimbostratus rankNimbostratus
Feb 03, 2010

Loadbalancing URI on same server ?

Hello folks !

I have an unusual request to submit to your skills. I have two web servers running a proprietary solution. For some dark reasons (process loadbalancing, process optimisation...), they both are running two identical websites on same port but different URI. This is as follows:

http://1.2.3.45:8080/toto1.exe

http://1.2.3.45:8080/toto2.exe

http://1.2.3.46:8080/toto1.exe

http://1.2.3.46:8080/toto2.exe

I would like the users to access each of them. So I wrote the following iRule, as I could see in another post (http://devcentral.f5.com/Default.aspx?tabid=53&forumid=5&tpage=1&view=topic&postid=6232).

I am actually unable to test this solution. So any help is appreciated. My questions are:

Would this work ?

Is there any way to optimize this ?

How about using a pool ?

And what about client-server affinity ?

Thanks again!

rule lb_URI_rule {      
      when RULE_INIT {      
      set ::lb_caisd_counter 1      
      }      
            
      when HTTP_REQUEST {      
      if {$::lb_caisd_counter == 1} {      
      set ::lb_caisd_counter 2      
      HTTP::redirect "http://1.2.3.45:8080/toto1.exe "      
      }      
      elseif {$::lb_caisd_counter == 2} {      
      set ::lb_caisd_counter 3      
      HTTP::redirect "http://1.2.3.46:8080/toto1.exe "      
      }      
      elseif {$::lb_caisd_counter == 3} {      
      set ::lb_caisd_counter 4      
      HTTP::redirect "http://1.2.3.45:8080/toto2.exe "      
      }      
      elseif {$::lb_caisd_counter == 4} {      
      set ::lb_caisd_counter 1      
      HTTP::redirect "http://1.2.3.46:8080/toto2.exe "      
      }      
      }      
      }

12 Replies