Forum Discussion

Wil_Schultz_101's avatar
Wil_Schultz_101
Icon for Nimbostratus rankNimbostratus
Jul 30, 2007

Reselect pool on status code 500 or above...

So we run some Tomcat servers, when we undeploy the server will send a 503 that states that the application is unavailable. I do have a check that looks for a static page every 5 seconds and fails at 16 seconds, however for that 16 second period people from the outside world see this 503 error.

 

 

I would like to set it up to where any status code above 500 reselects but I seem to have an order of operation problem. Maybe someone that i saner than I might have a suggestion?

 

 

Here is what I have so far:

 

 


when HTTP_RESPONSE {
 if { [HTTP::status] > 499 }{
  set ::hostfailed 1
  log local0. "Setting up ::hostfailed."
 }
}
when LB_SELECTED {
  if { $::hostfailed == 1 } {
  LB::detach
  LB::reselect [LB::server pool]
  log local0. "LB failed, re-load balancing to pool."
 }
}

 

 

This irule fails because LB_SELECTED us called after HTTP_RESPONSE and ::hostfailed is not set.

22 Replies