TS-312: Add option to always share keep-alive connections to the origin server


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d6ab7482
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d6ab7482
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d6ab7482

Branch: refs/heads/5.0.x
Commit: d6ab7482489be6b79d911f55564afb707c7004d6
Parents: 960c3f8
Author: Bryan Call <bc...@apache.org>
Authored: Fri Dec 6 17:04:50 2013 -0800
Committer: Bryan Call <bc...@apache.org>
Committed: Fri Dec 6 17:04:50 2013 -0800

----------------------------------------------------------------------
 CHANGES                  |  2 ++
 mgmt/RecordsConfig.cc    |  2 ++
 proxy/http/HttpConfig.cc |  1 +
 proxy/http/HttpConfig.h  |  1 +
 proxy/http/HttpSM.cc     | 16 +++++++---------
 5 files changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6ab7482/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index cacc5ad..eca1bad 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+  *) [TS-312] Add option to always share keep-alive connections to the origin 
server
+
   *) [TS-2419] Don't close client connection when responding with a 204 and 
there is no body
 
   *) [TS-1146] Add RFC 5077 TLS session ticket support.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6ab7482/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index a54e018..bf3674e 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -456,6 +456,8 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_CONFIG, "proxy.config.http.origin_min_keep_alive_connections", 
RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.http.attach_sever_session_to_client", RECD_INT, 
"0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+  ,
 
   //       ##########################
   //       # HTTP referer filtering #

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6ab7482/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 3c8109d..d36b3cc 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1145,6 +1145,7 @@ HttpConfig::startup()
   HttpEstablishStaticConfigLongLong(c.oride.server_tcp_init_cwnd, 
"proxy.config.http.server_tcp_init_cwnd");
   HttpEstablishStaticConfigLongLong(c.oride.origin_max_connections, 
"proxy.config.http.origin_max_connections");
   HttpEstablishStaticConfigLongLong(c.origin_min_keep_alive_connections, 
"proxy.config.http.origin_min_keep_alive_connections");
+  HttpEstablishStaticConfigLongLong(c.attach_server_session_to_client, 
"proxy.config.http.attach_server_session_to_client");
 
   HttpEstablishStaticConfigByte(c.parent_proxy_routing_enable, 
"proxy.config.http.parent_proxy_routing_enable");
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6ab7482/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 033ee7f..a663e2f 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -640,6 +640,7 @@ public:
 
   MgmtInt server_max_connections;
   MgmtInt origin_min_keep_alive_connections; // TODO: This one really ought to 
be overridable, but difficult right now.
+  MgmtInt attach_server_session_to_client;
 
   MgmtByte parent_proxy_routing_enable;
   MgmtByte disable_ssl_parenting;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6ab7482/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 503ac9b..1ae8615 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2934,15 +2934,13 @@ HttpSM::tunnel_handler_server(int event, 
HttpTunnelProducer * p)
     server_session->server_trans_stat--;
     HTTP_DECREMENT_DYN_STAT(http_current_server_transactions_stat);
 
-    // If the client is still around, attach the server session
-    // to so the next ka request can use it.  We bind privately to the
-    // client to add some degree of affinity to the system.  However,
-    // we turn off private binding when outbound connections are being
-    // limit since it makes it too expensive to initiate a purge of idle
-    // server keep-alive sessions
-    if (ua_session && t_state.client_info.keep_alive == HTTP_KEEPALIVE &&
-        t_state.http_config_param->server_max_connections <= 0 &&
-        t_state.txn_conf->origin_max_connections <= 0) {
+    // If the option to attach the server session to the client session is set
+    // and if the client is still around and the client is keep-alive, attach 
the
+    // server session to so the next ka request can use it.  Server sessions 
will
+    // be placed into the shared pool if the next incoming request is for a 
different
+    // origin server
+    if (t_state.http_config_param->attach_server_session_to_client == 1 &&
+        ua_session && t_state.client_info.keep_alive == HTTP_KEEPALIVE) {
       ua_session->attach_server_session(server_session);
     } else {
       // Release the session back into the shared session pool

Reply via email to