Forum Discussion

Sarnoth_81568's avatar
Sarnoth_81568
Icon for Nimbostratus rankNimbostratus
Aug 01, 2008

LB::reselect problem

Let me give you some background before I get in to the problem.

 

We have a web application that uses session replication. A node can fail in such a way that it always return 5xx error pages. We would like BigIP to route people to the same node as long as it is up, but if it is down (returning 5xx) it should retry their request on the other node.

 

To accomplish this I worked from the example in the documentation for HTTP::retry. My irule is at the bottom of the post. The problem is that the logs show it selecting the other node for a retry on a 5xx error, but in reality it tries to connect to the same node twice. If anyone has an idea about how I can make this work I would appreciate it very much.

 

 

 

BigIP log message:

 

Jul 31 15:26:10 tmm tmm[934]: 01220002:6: Rule methcheck_retry_on_error : Sticky to 1573653002.25635.0000

 

Jul 31 15:26:10 tmm tmm[934]: 01220002:6: Rule methcheck_retry_on_error : Trying node 10.10.204.93:9060

 

Jul 31 15:26:10 tmm tmm[934]: 01220002:6: Rule methcheck_retry_on_error : 5xx error caught: retry 1 out of 2

 

Jul 31 15:26:10 tmm tmm[934]: 01220002:6: Rule methcheck_retry_on_error : Removing cookie

 

Jul 31 15:26:10 tmm tmm[934]: 01220002:6: Rule methcheck_retry_on_error : Trying node 10.10.204.93:9062

 

 

It looks like it is trying port 9060 once and port 9062 once, but in reality two requests come in on port 9060 and none come in on 9062. The second request does not have the BIGipServer cookie and has two x-forwarded-for headers as expected.

 

 

irule:

 

when CLIENT_ACCEPTED {

 

set retries 0

 

}

 

 

when HTTP_REQUEST {

 

if { $retries >= 1 } {

 

HTTP::cookie remove "BIGipServermethcheck"

 

log "Removing cookie"

 

}

 

if { [HTTP::cookie exists "BIGipServermethcheck"] } {

 

log "Sticky to [HTTP::cookie value "BIGipServermethcheck"]"

 

}

 

set request [HTTP::request]

 

}

 

 

when LB_SELECTED {

 

if { $retries >= 1 } {

 

LB::mode rr

 

LB::reselect

 

}

 

log "Trying node [LB::server addr]:[LB::server port]"

 

}

 

 

when HTTP_RESPONSE {

 

if { [HTTP::status] starts_with "5" } {

 

incr retries

 

log "5xx error caught: retry $retries out of [active_members [LB::server pool]]"

 

 

if { $retries < [active_members [LB::server pool]] } {

 

HTTP::retry $request

 

}

 

}

 

}

 

11 Replies