Forum Discussion

Stefan_Bokler_1's avatar
Stefan_Bokler_1
Icon for Nimbostratus rankNimbostratus
Feb 28, 2006

no load-balancing by LB::reselect pool $NewPool;

I wrote a little IRule to test how we can realise a retry if the webserver returns an 404-Error.

 

 

If the page is not found on the webserver, the url will be modified in the HTTP_Response-Event another pool is selected and the request will be send back to the webservers.

 

 

Everything works fine. The only problem is, that always the same member of the pool is selected.

 

The load-balancing-methode is Round Robin.

 

Persistens is disabled.

 

 

I also tried to delete the keep-alive string in the request.

 

 

What else can I do.

 

 

Thanks

 

steve

 

***************************************************

 

 

 

timing on

 

 

when HTTP_RESPONSE {

 

 

log local. "Response-Server=[LB::server pool] [LB::server name]";

 

log local. "There are [active_nodes d.faz.net] active nodes in the pool."

 

 

if { [HTTP::status] eq "404"} {

 

log local. "found 404 Response";

 

set lowerReq [string tolower $request];

 

 

if {$lowerReq contains "_test/"} {

 

set startPos [string first "_test/" $lowerReq];

 

set endPos [string length "_test/"];

 

set endPos [expr $startPos + $endPos - 1];

 

set newRequest [string replace $request $startPos $endPos "/"];

 

log local. "newRequest = $newRequest";

 

HTTP::retry $newRequest

 

}

 

}

 

 

}

 

 

when HTTP_REQUEST {

 

set NewPool "";

 

set path [HTTP::path];

 

set request [HTTP::request]

 

 

 

if { $::DEBUG } {

 

log local. "There are [active_nodes xxxx] active nodes in the pool xxxx";

 

log local. "Request number [HTTP::request_num], Client: [IP::remote_addr]:[TCP::remote_port] , Status: [LB::status]";

 

}

 

 

persist none; persist none ist default

 

 

if { $path starts_with "/y/" } {

 

set NewPool "yyyy";

 

}

 

elseif { $path ends_with ".asp" } {

 

set NewPool "aspPool";

 

}

 

elseif { $path ends_with ".aspx" } {

 

set NewPool "aspxPool";

 

} else {

 

set NewPool "vvvv";

 

}

 

 

pool $NewPool;

 

 

}

 

 

 

when LB_SELECTED {

 

 

if {[LB::server pool] ne $NewPool} {

 

if the new Request is started using LB:retry

 

"pool $NewPool;" doesnt work in HTTP_REQUEST

 

so in this case we do a reselect here

 

log local. "doing reselect $NewPool";

 

reselect works fine, but why is it alwayse the same pool-member

 

load-balancing-methode is Round Robin

 

http://devcentral.f5.com/wiki/default.aspx/iRules/LB__reselect.htmlDescription

 

Selects the next available member in the specified pool, based on the Load Balancing options of that pool

 

LB::reselect pool $NewPool;

 

 

} else {

 

log local. "Pool=$NewPool, Server=[LB::server pool], Uri=[HTTP::uri]";

 

}

 

}
  • I am trying to eliminate the errors between a weblogic instance failure and the time where the bigIP records the pool member as down. In the LB_FAILED event, I am reselecting the pool member, with no apparent change. If I add HTTP::retry to the event, I get an undefined procedure (I am on 9.1.2). Are there any workarounds for resending client requests to a new app server on pre-9.2 systems?

    
    when LB_FAILED {
      LB::reselect pool myPool
      HTTP::retry
    }

    Thanks!
  • bl0ndie_127134's avatar
    bl0ndie_127134
    Historic F5 Account
    There is no need to do a 'retry' there; the re-select is all thet you need. The 'retry' should be used when you have already got the response from the server.
  • will oneconnect being enabled impact the success of this?
  • If I am building a session entry, do I need to delete that in the LB_FAILED event? We are seeing that although I have a reselect in the LB_FAILED event, traffic continues to be sent to the destination pool member until the LTM marks it down. Would it benefit me to delete the session entry when the LB_FAILED event is kicked off? Does this event get triggered for persistent connections? Here's what I'd like to do:

    
    when LB_SELECTED {
      log "Server [IP::remote_addr] selected!"
    }
    when LB_FAILED {
      log "Server [IP::remote_addr] Failed!"
      set lbfailed 1
      session delete uie $trimID
      LB::reselect pool MyPool
    }

    BTW, the session entry is the server IP address for the key which is the jsessionID. It is set on the HTTP_RESPONSE event for new connections and when LB_FAILED is triggered. I am currently deleting the session in the HTTP_RESPONSE event only when the lbfailed variable is true.