httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Stevenson <mavricknzw...@yahoo.com>
Subject Re: Speeding up mod_proxy_balancer on Windows
Date Sun, 12 Oct 2008 19:43:44 GMT
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";
     }


      

Mime
View raw message