Forum Discussion
Store data in variable from HTTP_REQUEST to LB_FAILED
Hi,
I am wondering, is it OK to set a variable in HTTP_REQUEST and then read it later in LB_FAILED? My purpose is to store the name of a failover pool, just in case LB_FAILED occurs with the primary pool.when HTTP_REQUEST {
...
set failoverPool $val
...
}
when LB_FAILED {
LB::reselect pool $failoverPool
}
When I tested this under heavy load, it seemed like $failoverPool did not always retain the correct value. I'm wondering if other request threads might overwrite this variable during the time the primary request is pending.
I am using:
BIG-IP 11.2.1 Build 1148.0 Hotfix HF5 HTTP keep-alive is activeThanks! Jamie
7 Replies
- Kevin_Stewart
Employee
For clarification, are you saying that the failoverPool variable doesn't exist in the LB_FAILED event, or that it was different than what you expected? Can I also assume you're setting different values in this variable in the HTTP_REQUEST event?
- jaddessi_207433
Nimbostratus
The failoverPool variable does exist, but it has different values than what was set.
Yes, there were thousands of requests coming in, all setting different values to this variable. But I expected BigIP to keep them separate per request.
Thanks for your ideas!
- Kevin_Stewart
Employee
There isn't usually a one-to-one ratio between HTTP requests and LB events. If I may ask, what are you defining in the HTTP request? You may be able to perform the same function in the LB event.
- jaddessi_207433
Nimbostratus
I make a remote call to determine which backup pool is best for the particular request, and store it in a variable during HTTP_REQUEST.
Usually there is no LB_FAILED event. But when there is, the variable does not always have the correct value anymore. Sometimes it has one of the other possible values.
- Stanislas_Piro2
Cumulonimbus
Hi,
LB_FAILED is triggered when LTM is ready to send the request to a pool member and one hasn’t been chosen (the system failed to select a pool or a pool member), is unreachable (when no route to the target exists), has reached a queue limit, or is non-responsive (fails to respond to a connection request).
So, LB_FAILED is not only triggered when there is no pool member available in the pool but also when persistent pool member goes down.
if you want to select a new pool when no pool member is available in the default pool, check active_members in HTTP_REQUEST:
when HTTP_REQUEST { ... set failoverPool $val ... if { [active_members default_pool] < 1 } { pool $failoverPool } } - jaddessi_207433
Nimbostratus
Thanks so much for your response, but unfortunately this doesn't help.
I already have that exact code in HTTP_REQUEST, but [active_members] doesn't work immediately after a pool goes down. It takes some time after the last pool member goes down, until the pool is marked as unavailable. During this short period, the LB_FAILED method is triggered.
I would like to understand why the correct value of the $failoverPool variable is not retained from HTTP_REQUEST to LB_FAILED. Is this correct behavior, or a bug?
Any ideas are greatly appreciated.
- Kevin_Stewart
Employee
Understand that variables exists through the life of a single TCP connection. You can have many HTTP requests within a single TCP connection, and indeed you can have many HTTP requests before an LB_FAILED event happens. If you throw some logging in the HTTP request and LB_FAILED event to show what's happening and when, you may find that the variable is being set (incorrectly) by subsequent HTTP requests before the failing event happens.
when HTTP_REQUEST { ... code to derive value ... log local0. "value is $value" } when LB_FAILED { log local0. "in event" if { [info exists value] } { log local0. "value = $value" } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
