Forum Discussion
JamesS_40157
Nimbostratus
Sep 17, 2009404 re-load balance in pool
Hi all,
Firstly apologies if this has already been covered - I've tried searching the forums and google but can't find exactly what I'm looking for. I'm also very new to irules so please forgive my ignorance here!
We have a pool of servers that in theory should have the same content on each but in practice they do not - that is to say at any one time 1 or 2 servers could potentially serve a 404 on a piece of content.
What I'm after is a rule to say that if the load balancer receives a 404 error, to transparently re-balance to the next node, and then re-balance again to the next node until it has tried all servers in the pool. At this point I'd like it to serve a 404 to the client if it cannot find the content anywhere. To me this seems like a trivial thing a load balancer should do but I can't see to find info on it anywhere!
I've had a go at writing the rule however it does not work perfectly (using LB:reselect) as this relies I belive on the load balancer mechanism which is currently set to round-robin. Therefore it will not be foolproof to ensuring it tries each and every node in the pool for a single client request.
This is the code I have ( mainly copied from an older post on this forum)
when CLIENT_ACCEPTED {
set retries 0
}
when HTTP_REQUEST {
set request [HTTP::request]
}
when HTTP_RESPONSE {
if { [HTTP::status] eq "404"} {
if { $retries < [active_members mediapool] } {
incr retries
HTTP::retry $request
} else {
HTTP::respond 404
}
}
}
This does not guarantee to try each member of the pool per client request. I'm sure I'm close but can't see the final step...could someone please help me out? Many thanks!
No RepliesBe the first to reply
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects