Perhaps I misunderstand things here, but isn't this connection timeout
setting used for more than just the timing out the initial formation of
the connection? It would seem that logical that there would be a
connection timeout for forming the initial connection and another for
timeouts of responses, etc, but I had understood this was not the case.
We currently have connection timeout set very, very large as otherwise
we got timeouts when the backend URL was something very computationally
intensive that took a long time to respond with data (e.g. a good number
of minutes). That should seemingly be distinct from an initial
connection timeout, but my understanding was that it is not.
Am I just confused here?
--
Jess Holle
Matt Stevenson wrote:
Hi,
Send this to the wrong address first time. May have saved the GetTcpTable
coding.
Here is a usec timeout fix, although I wouldn't go below 100 milliseconds without some
testing under load. I'm not sure its the perfect way to do it, but it avoids changing the
"connectiontimeout" parameter to usec (still defaults to sec). Order is
important connectiontimeoutisusec must come after connectiontimeout.
Ideas on better ways to do it welcome. I can see a need for timeouts less than
a second outside the windows case.
Also included the non blocking patch without the ifdefs.
Regards
Matt
ProxyPass / balance://hotcluster/
<Proxy balance://hotcluster>
# below IPs are not reachable, acts like a down box (if timeout is small
enough)
# 1 sec
BalancerMember ajp://192.168.0.23:7010 loadfactor=1
connectiontimeout=1000000 connectiontimeoutisusec=1
# 1 sec normal
BalancerMember ajp://192.168.0.24:7010 loadfactor=1 connectiontimeout=1
# 750 milli sec.
BalancerMember ajp://192.168.0.25:7010 loadfactor=1 connectiontimeout=750000
connectiontimeoutisusec=1
BalancerMember ajp://localhost:8009 loadfactor=1 connectiontimeout=2
</Proxy>
Index: modules/proxy/proxy_util.c
===================================================================
--- modules/proxy/proxy_util.c (revision 703688)
+++ modules/proxy/proxy_util.c (working copy)
@@ -2358,9 +2358,17 @@
"proxy: %s: fam %d socket created to connect to %s",
proxy_function, backend_addr->family, worker->hostname);
+ /* use non blocking for connect timeouts to work. The ifdef
+ limits to unix systems which have apr_wait_for_io_or_timeout.
+ TODO: remove the ifdef and see what works/breaks */
+
+ apr_socket_opt_set(newsock, APR_SO_NONBLOCK, 1);
+
/* make the connection out of the socket */
rv = apr_socket_connect(newsock, backend_addr);
+ apr_socket_opt_set(newsock, APR_SO_NONBLOCK, 0);
+
/* if an error occurred, loop round and try again */
if (rv != APR_SUCCESS) {
apr_socket_close(newsock);
Index: modules/proxy/mod_proxy.c
===================================================================
--- modules/proxy/mod_proxy.c (revision 703688)
+++ modules/proxy/mod_proxy.c (working copy)
@@ -291,6 +291,13 @@
worker->conn_timeout = apr_time_from_sec(ival);
worker->conn_timeout_set = 1;
}
+ else if (!strcasecmp(key, "connectiontimeoutisusec")) {
+ /* change timeout to useconds */
+ ival = atoi(val);
+ if (ival == 1 && worker->conn_timeout_set == 1){
+ worker->conn_timeout = apr_time_make(0,
apr_time_sec(worker->conn_timeout) );
+ }
+ }
else {
return "unknown Worker parameter";
}