]> granicus.if.org Git - apache/commitdiff
*) mod_proxy: Improve network performance by setting APR_TCP_NODELAY
authorJim Jagielski <jim@apache.org>
Fri, 3 Aug 2007 15:57:27 +0000 (15:57 +0000)
committerJim Jagielski <jim@apache.org>
Fri, 3 Aug 2007 15:57:27 +0000 (15:57 +0000)
     (disable Nagle algorithm) on sockets if implemented.
     PR 42871 [Christian BOITEL <christian_boitel yahoo.fr>, Jim Jagielski]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@562510 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/proxy/mod_proxy_ftp.c
modules/proxy/proxy_util.c

diff --git a/CHANGES b/CHANGES
index bdc33a483a9b36396eaad5fc719e1266997b9568..8caf79e509b7fb775e980373520ff62e248fe7df 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@
 Changes with Apache 2.3.0
   [Remove entries to the current 2.0 and 2.2 section below, when backported]
 
+  *) mod_proxy: Improve network performance by setting APR_TCP_NODELAY
+     (disable Nagle algorithm) on sockets if implemented.
+     PR 42871 [Christian BOITEL <christian_boitel yahoo.fr>, Jim Jagielski]
+
   *) mod_info: mod_info outputs invalid XHTML 1.0 transitional.
      PR 42847 [Rici Lake <rici ricilake.net>]
 
index c26ccb5803606412cf151133ec4ff2bf27b538a5..b5d3e6b4bcea1828e2611be14a793ff2a18f13c1 100644 (file)
@@ -1233,6 +1233,12 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
                 }
 #endif
 
+                rv = apr_socket_opt_set(data_sock, APR_TCP_NODELAY, 1);
+                if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
+                    ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+                                 "apr_socket_opt_set(APR_TCP_NODELAY): Failed to set");
+                }
+
                 /* make the connection */
                 apr_socket_addr_get(&data_addr, APR_REMOTE, sock);
                 apr_sockaddr_ip_get(&data_ip, data_addr);
@@ -1321,6 +1327,12 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
                 }
 #endif
 
+                rv = apr_socket_opt_set(data_sock, APR_TCP_NODELAY, 1);
+                if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
+                    ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+                                 "apr_socket_opt_set(APR_TCP_NODELAY): Failed to set");
+                }
+
                 /* make the connection */
                 apr_sockaddr_info_get(&pasv_addr, apr_psprintf(p, "%d.%d.%d.%d", h3, h2, h1, h0), connect_addr->family, pasvport, 0, p);
                 rv = apr_socket_connect(data_sock, pasv_addr);
index bd41cdcd5a709a2d1ad508cde7de32822d3c3e3e..e35b9cdc35f968f8072963cb92921ff9efb0806a 100644 (file)
@@ -1530,6 +1530,13 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
         }
 #endif
 
+        rv = apr_socket_opt_set(*newsock, APR_TCP_NODELAY, 1);
+        if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
+             ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
+                          "apr_socket_opt_set(APR_TCP_NODELAY): "
+                          "Failed to set");
+        }
+
         /* Set a timeout on the socket */
         if (conf->timeout_set == 1) {
             apr_socket_timeout_set(*newsock, conf->timeout);
@@ -2157,6 +2164,13 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
         }
 #endif
 
+        rv = apr_socket_opt_set(newsock, APR_TCP_NODELAY, 1);
+        if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
+             ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
+                          "apr_socket_opt_set(APR_TCP_NODELAY): "
+                          "Failed to set");
+        }
+
         /* Set a timeout on the socket */
         if (worker->timeout_set == 1) {
             apr_socket_timeout_set(newsock, worker->timeout);