trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From je...@apache.org
Subject svn commit: r1164676 - in /trafficserver/traffic/trunk: iocore/net/ proxy/ proxy/api/ts/ proxy/http/
Date Fri, 02 Sep 2011 19:40:36 GMT
Author: jesus
Date: Fri Sep  2 19:40:36 2011
New Revision: 1164676

URL: http://svn.apache.org/viewvc?rev=1164676&view=rev
Log:
TS-940

On bleeding-edge Illumos, this can be set on the fly. And, if the Linux
implementation is added, this flow makes more sense.  The initial congestion
window is set on the parent socket (that which is bound) and then it
can be set again immediately before the first write.  This allows you to
set it to 10 in records.conf and then use a module to set it back down to
something like 3 or 4 for mobile devices.  I used conf_remap to test
on-the-fly alteration of the congestion window.

Modified:
    trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h
    trafficserver/traffic/trunk/iocore/net/P_UnixNetVConnection.h
    trafficserver/traffic/trunk/proxy/InkAPI.cc
    trafficserver/traffic/trunk/proxy/PluginVC.cc
    trafficserver/traffic/trunk/proxy/PluginVC.h
    trafficserver/traffic/trunk/proxy/api/ts/ts.h.in
    trafficserver/traffic/trunk/proxy/http/HttpClientSession.cc
    trafficserver/traffic/trunk/proxy/http/HttpClientSession.h
    trafficserver/traffic/trunk/proxy/http/HttpConfig.cc
    trafficserver/traffic/trunk/proxy/http/HttpConfig.h

Modified: trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h?rev=1164676&r1=1164675&r2=1164676&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h (original)
+++ trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h Fri Sep  2 19:40:36 2011
@@ -423,6 +423,9 @@ public:
 
   virtual SOCKET get_socket() = 0;
 
+  /** Set the TCP initial congestion window */
+  virtual int set_tcp_init_cwnd(int init_cwnd) = 0;
+
   /** Set local sock addr struct. */
   virtual void set_local_addr() = 0;
 

Modified: trafficserver/traffic/trunk/iocore/net/P_UnixNetVConnection.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/P_UnixNetVConnection.h?rev=1164676&r1=1164675&r2=1164676&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/P_UnixNetVConnection.h (original)
+++ trafficserver/traffic/trunk/iocore/net/P_UnixNetVConnection.h Fri Sep  2 19:40:36 2011
@@ -235,6 +235,7 @@ public:
 
   virtual void set_local_addr();
   virtual void set_remote_addr();
+  virtual int set_tcp_init_cwnd(int init_cwnd);
 };
 
 extern ClassAllocator<UnixNetVConnection> netVCAllocator;
@@ -333,6 +334,21 @@ UnixNetVConnection::cancel_active_timeou
   }
 }
 
+TS_INLINE int
+UnixNetVConnection::set_tcp_init_cwnd(int init_cwnd)
+{
+#ifdef TCP_INIT_CWND
+  int rv;
+  uint32_t val = init_cwnd;
+  rv = setsockopt(con.fd, IPPROTO_TCP, TCP_INIT_CWND, &val, sizeof(val));
+  Debug("socket", "Setting TCP initial congestion window (%d) -> %d", init_cwnd, rv);
+  return rv;
+#else
+  Debug("socket", "Setting TCP initial congestion window %d -> unsupported", init_cwnd);
+  return -1;
+#endif
+}
+
 TS_INLINE UnixNetVConnection::~UnixNetVConnection() { }
 
 TS_INLINE SOCKET

Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=1164676&r1=1164675&r2=1164676&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Fri Sep  2 19:40:36 2011
@@ -7293,6 +7293,9 @@ _conf_to_memberp(TSOverridableConfigKey 
   case TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR:
     ret = &sm->t_state.txn_conf->insert_squid_x_forwarded_for;
     break;
+  case TS_CONFIG_HTTP_SERVER_TCP_INIT_CWND:
+    ret = &sm->t_state.txn_conf->server_tcp_init_cwnd;
+    break;
   case TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS:
     ret = &sm->t_state.txn_conf->send_http11_requests;
     break;
@@ -7612,8 +7615,16 @@ TSHttpTxnConfigFind(const char* name, in
     break;
 
   case 38:
-    if (!strncmp(name, "proxy.config.http.send_http11_requests", length))
-      cnf = TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS;
+    switch (name[length-1]) {
+    case 'd':
+      if (!strncmp(name, "proxy.config.http.server_tcp_init_cwnd", length))
+        cnf = TS_CONFIG_HTTP_SERVER_TCP_INIT_CWND;
+      break;
+    case 's':
+      if (!strncmp(name, "proxy.config.http.send_http11_requests", length))
+        cnf = TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS;
+      break;
+    }
     break;
 
   case 39:

Modified: trafficserver/traffic/trunk/proxy/PluginVC.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/PluginVC.cc?rev=1164676&r1=1164675&r2=1164676&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/PluginVC.cc (original)
+++ trafficserver/traffic/trunk/proxy/PluginVC.cc Fri Sep  2 19:40:36 2011
@@ -897,6 +897,11 @@ PluginVC::set_remote_addr()
   }
 }
 
+int
+PluginVC::set_tcp_init_cwnd(int init_cwnd)
+{
+  return -1;
+}
 
 bool
 PluginVC::get_data(int id, void *data)

Modified: trafficserver/traffic/trunk/proxy/PluginVC.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/PluginVC.h?rev=1164676&r1=1164675&r2=1164676&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/PluginVC.h (original)
+++ trafficserver/traffic/trunk/proxy/PluginVC.h Fri Sep  2 19:40:36 2011
@@ -111,6 +111,7 @@ public:
   virtual SOCKET get_socket();
   virtual void set_local_addr();
   virtual void set_remote_addr();
+  virtual int set_tcp_init_cwnd(int init_cwnd);
 
   virtual bool get_data(int id, void *data);
   virtual bool set_data(int id, void *data);

Modified: trafficserver/traffic/trunk/proxy/api/ts/ts.h.in
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/ts.h.in?rev=1164676&r1=1164675&r2=1164676&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/ts.h.in (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/ts.h.in Fri Sep  2 19:40:36 2011
@@ -507,6 +507,7 @@ extern "C"
     TS_CONFIG_HTTP_APPEND_XFORWARDS_HEADER,
     TS_CONFIG_HTTP_RESPONSE_SERVER_ENABLED,
     TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR,
+    TS_CONFIG_HTTP_SERVER_TCP_INIT_CWND,
     TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS,
     TS_CONFIG_HTTP_CACHE_HTTP,
     TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_NO_CACHE,

Modified: trafficserver/traffic/trunk/proxy/http/HttpClientSession.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpClientSession.cc?rev=1164676&r1=1164675&r2=1164676&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpClientSession.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpClientSession.cc Fri Sep  2 19:40:36 2011
@@ -60,7 +60,7 @@ HttpClientSession::HttpClientSession()
   : VConnection(NULL), con_id(0), client_vc(NULL), magic(HTTP_CS_MAGIC_DEAD),
     transact_count(0), half_close(false), conn_decrease(false), bound_ss(NULL),
     read_buffer(NULL), current_reader(NULL), read_state(HCS_INIT),
-    ka_vio(NULL), slave_ka_vio(NULL),
+    ka_vio(NULL), slave_ka_vio(NULL), tcp_init_cwnd_set(false),
     cur_hook_id(TS_HTTP_LAST_HOOK), cur_hook(NULL),
     cur_hooks(0), backdoor_connect(false), hooks_set(0),
     m_active(false)
@@ -249,10 +249,27 @@ HttpClientSession::do_io_read(Continuati
 VIO *
 HttpClientSession::do_io_write(Continuation * c, int64_t nbytes, IOBufferReader * buf, bool
owner)
 {
+  /* conditionally set the tcp initial congestion window
+     before our first write. */
+  Debug("http_cs", "tcp_init_cwnd_set %d\n", (int)tcp_init_cwnd_set);
+  if(!tcp_init_cwnd_set) {
+    tcp_init_cwnd_set = true;
+    set_tcp_init_cwnd();
+  }
   return client_vc->do_io_write(c, nbytes, buf, owner);
 }
 
 void
+HttpClientSession::set_tcp_init_cwnd()
+{
+  int desired_tcp_init_cwnd = current_reader->t_state.txn_conf->server_tcp_init_cwnd;
+  Debug("http_cs", "desired TCP congestion window is %d\n", desired_tcp_init_cwnd);
+  if(desired_tcp_init_cwnd == 0) return;
+  if(get_netvc()->set_tcp_init_cwnd(desired_tcp_init_cwnd) != 0)
+    Debug("http_cs", "set_tcp_init_cwnd(%d) failed", desired_tcp_init_cwnd);
+}
+
+void
 HttpClientSession::do_io_shutdown(ShutdownHowTo_t howto)
 {
   client_vc->do_io_shutdown(howto);

Modified: trafficserver/traffic/trunk/proxy/http/HttpClientSession.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpClientSession.h?rev=1164676&r1=1164675&r2=1164676&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpClientSession.h (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpClientSession.h Fri Sep  2 19:40:36 2011
@@ -95,6 +95,7 @@ private:
   int state_keep_alive(int event, void *data);
   int state_slave_keep_alive(int event, void *data);
   int state_wait_for_close(int event, void *data);
+  void set_tcp_init_cwnd();
 
   void handle_api_return(int event);
   int state_api_callout(int event, void *data);
@@ -113,6 +114,7 @@ private:
 
   NetVConnection *client_vc;
   int magic;
+  bool tcp_init_cwnd_set;
   int transact_count;
   bool half_close;
   bool conn_decrease;

Modified: trafficserver/traffic/trunk/proxy/http/HttpConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpConfig.cc?rev=1164676&r1=1164675&r2=1164676&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpConfig.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpConfig.cc Fri Sep  2 19:40:36 2011
@@ -1146,7 +1146,7 @@ HttpConfig::startup()
   }
 
   HttpEstablishStaticConfigLongLong(c.server_max_connections, "proxy.config.http.server_max_connections");
-  HttpEstablishStaticConfigLongLong(c.server_tcp_init_cwnd, "proxy.config.http.server_tcp_init_cwnd");
+  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");
 
@@ -1427,7 +1427,7 @@ HttpConfig::reconfigure()
   params->disable_ssl_parenting = INT_TO_BOOL(m_master.disable_ssl_parenting);
 
   params->server_max_connections = m_master.server_max_connections;
-  params->server_tcp_init_cwnd = m_master.server_tcp_init_cwnd;
+  params->oride.server_tcp_init_cwnd = m_master.oride.server_tcp_init_cwnd;
   params->oride.origin_max_connections = m_master.oride.origin_max_connections;
   params->origin_min_keep_alive_connections = m_master.origin_min_keep_alive_connections;
 
@@ -1618,7 +1618,6 @@ HttpConfig::reconfigure()
 #undef INT_TO_BOOL
 
 // Redirection debug statements
-  Debug("http_init", "proxy.config.http.server_tcp_init_cwnd = %d", params->server_tcp_init_cwnd);
   Debug("http_init", "proxy.config.http.redirection_enabled = %d", params->redirection_enabled);
   Debug("http_init", "proxy.config.http.number_of_redirections = %d", params->number_of_redirections);
 

Modified: trafficserver/traffic/trunk/proxy/http/HttpConfig.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpConfig.h?rev=1164676&r1=1164675&r2=1164676&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpConfig.h (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpConfig.h Fri Sep  2 19:40:36 2011
@@ -403,7 +403,7 @@ struct OverridableHttpConfigParams {
        negative_caching_enabled(0), negative_caching_lifetime(0), cache_when_to_revalidate(0),
        keep_alive_enabled_in(0), keep_alive_enabled_out(0), keep_alive_post_out(0),
        sock_recv_buffer_size_out(0), sock_send_buffer_size_out(0), sock_option_flag_out(0),
-       fwd_proxy_auth_to_parent(0),
+       fwd_proxy_auth_to_parent(0), server_tcp_init_cwnd(0),
        anonymize_remove_from(0), anonymize_remove_referer(0), anonymize_remove_user_agent(0),
        anonymize_remove_cookie(0), anonymize_remove_client_ip(0), anonymize_insert_client_ip(1),
        append_xforwards_header(0), proxy_response_server_enabled(0),
@@ -452,6 +452,7 @@ struct OverridableHttpConfigParams {
   MgmtByte keep_alive_enabled_in;
   MgmtByte keep_alive_enabled_out;
   MgmtByte keep_alive_post_out;  // share server sessions for post
+  MgmtInt server_tcp_init_cwnd;
 
   ///////////////////////////////////////
   // origin server connection settings //
@@ -603,7 +604,6 @@ public:
   char *outgoing_ip_to_bind;
 
   MgmtInt server_max_connections;
-  MgmtInt server_tcp_init_cwnd;
   MgmtInt origin_min_keep_alive_connections; // TODO: This one really ought to be overridable,
but difficult right now.
 
   MgmtByte parent_proxy_routing_enable;
@@ -900,7 +900,6 @@ HttpConfigParams::HttpConfigParams()
     incoming_ip_to_bind_saddr(0),
     outgoing_ip_to_bind(0),
     server_max_connections(0),
-    server_tcp_init_cwnd(0),
     origin_min_keep_alive_connections(0),
     parent_proxy_routing_enable(0),
     disable_ssl_parenting(0),



Mime
View raw message