Forum Discussion
Kenny_Lussier_5
Jun 17, 2011Nimbostratus
Problem Solved!! The problem isn't connections being refused, it's connections being closed on the back ent. Our tomcat servers have a timeout of 60 seconds. The LTM has a 300 second TCP timeout. So, if the client connects, sends a request, gets a response, and does not properly close a connection, it stays open for 300 seconds as far as the LTM is concerned. However, the tomcat server kills the thread servicing that connection after 60 idle seconds. That makes the LTM think that the pool member has failed, triggering LB_FAILED the next time it tries to use that connection. I solved it with this:
when RULE_INIT {
log local0.info "keepalivetimeout v0.1 $static::tcl_platform(os) $static::tcl_platform(osVersion)"
set static::keepalivetimeoutDEBUG 0
set static::keepAliveTimeout [class lookup "keepAliveTimeout" httpdefaults]
}
when HTTP_REQUEST {
(re)set the TCP idle timeout for the current connection to the profile default
IP::idle_timeout [PROFILE::tcp idle_timeout]
if { $static::keepalivetimeoutDEBUG } { log local0.debug "[IP::client_addr]:[TCP::client_port] TCP idle_timeout set to [IP::idle_timeout]" }
}
when HTTP_RESPONSE {
(re)set the TCP idle timeout for the current connection until
IP::idle_timeout $static::keepAliveTimeout
if { $static::keepalivetimeoutDEBUG } { log local0.debug "[IP::client_addr]:[TCP::client_port] TCP idle_timeout set to [IP::idle_timeout]" }
}
:keepalivetimeout
httpdefaults is a data group with several variables, now with one called keepAliveTimeout, which I have set to 15 seconds. When HTTP_REQUEST is triggered, the timeout is set to 300 (the profile default). When HTTP_RESPONSE is triggered, the timeout is set to 15. If another request comes in on the same connection, then the timeout is reset to 300, and the socket is re-used. If not, it is torn down.
Thanks,
Kenny