trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1028908 - in /trafficserver/traffic/trunk/proxy: InkAPI.cc http2/HttpConfig.h http2/HttpConnectionCount.cc http2/HttpSM.cc http2/HttpServerSession.cc http2/HttpTransact.cc
Date Fri, 29 Oct 2010 21:26:56 GMT
Author: zwoop
Date: Fri Oct 29 21:26:55 2010
New Revision: 1028908

URL: http://svn.apache.org/viewvc?rev=1028908&view=rev
Log:
TS-501 Fixes for stats around origin counter

This could potentially break in certain conditions, and also not
particularly efficiently done anyways (since it mixes the per
thread stats with the global stats).

Modified:
    trafficserver/traffic/trunk/proxy/InkAPI.cc
    trafficserver/traffic/trunk/proxy/http2/HttpConfig.h
    trafficserver/traffic/trunk/proxy/http2/HttpConnectionCount.cc
    trafficserver/traffic/trunk/proxy/http2/HttpSM.cc
    trafficserver/traffic/trunk/proxy/http2/HttpServerSession.cc
    trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc

Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=1028908&r1=1028907&r2=1028908&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Fri Oct 29 21:26:55 2010
@@ -6544,6 +6544,7 @@ INKHttpCurrentIdleClientConnectionsGet(i
 {
   int64 total = 0;
   int64 active = 0;
+
   HTTP_READ_DYN_SUM(http_current_client_connections_stat, total);
   HTTP_READ_DYN_SUM(http_current_active_client_connections_stat, active);
 
@@ -6559,6 +6560,7 @@ int
 INKHttpCurrentCacheConnectionsGet(int *num_connections)
 {
   int64 S;
+
   HTTP_READ_DYN_SUM(http_current_cache_connections_stat, S);
   *num_connections = (int) S;
   return 1;
@@ -6569,7 +6571,7 @@ INKHttpCurrentServerConnectionsGet(int *
 {
   int64 S;
 
-  HTTP_READ_DYN_SUM(http_current_server_connections_stat, S);
+  HTTP_READ_GLOBAL_DYN_SUM(http_current_server_connections_stat, S);
   *num_connections = (int) S;
   return 1;
 }

Modified: trafficserver/traffic/trunk/proxy/http2/HttpConfig.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpConfig.h?rev=1028908&r1=1028907&r2=1028908&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpConfig.h (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpConfig.h Fri Oct 29 21:26:55 2010
@@ -306,31 +306,19 @@ enum
 extern RecRawStatBlock *http_rsb;
 
 /* Stats should only be accessed using these macros */
+#define HTTP_INCREMENT_DYN_STAT(x) RecIncrRawStat(http_rsb, mutex->thread_holding, (int)
x, 1);
+#define HTTP_DECREMENT_DYN_STAT(x) RecIncrRawStat(http_rsb, mutex->thread_holding, (int)
x, -1);
+#define HTTP_SUM_DYN_STAT(x, y) RecIncrRawStat(http_rsb, mutex->thread_holding, (int)
x, (int) y);
+#define HTTP_SUM_GLOBAL_DYN_STAT(x, y) RecIncrGlobalRawStatSum(http_rsb,x,y)
 
-#define HTTP_SET_DYN_STAT(x,C, S) \
-do { \
-        RecSetRawStatSum(http_rsb, x, S); \
-        RecSetRawStatCount(http_rsb, x, C); \
-} while (0);
-#define HTTP_INCREMENT_DYN_STAT(x) \
-        RecIncrRawStat(http_rsb, mutex->thread_holding, (int) x, 1);
-#define HTTP_DECREMENT_DYN_STAT(x) \
-        RecIncrRawStat(http_rsb, mutex->thread_holding, (int) x, -1);
-#define HTTP_SUM_DYN_STAT(x, y) \
-        RecIncrRawStat(http_rsb, mutex->thread_holding, (int) x, (int) y);
-#define HTTP_SUM_GLOBAL_DYN_STAT(x, y) \
-        RecIncrGlobalRawStatSum(http_rsb,x,y)
 #define HTTP_CLEAR_DYN_STAT(x) \
 do { \
         RecSetRawStatSum(http_rsb, x, 0); \
         RecSetRawStatCount(http_rsb, x, 0); \
 } while (0);
-#define HTTP_READ_DYN_STAT(x, C, S)             \
-  RecGetRawStatCount(http_rsb, (int) x, &C);    \
-  RecGetRawStatSum(http_rsb, (int) x, &S);
 
-#define HTTP_READ_DYN_SUM(x, S)             \
-  RecGetRawStatSum(http_rsb, (int) x, &S);
+#define HTTP_READ_DYN_SUM(x, S) RecGetRawStatSum(http_rsb, (int)x, &S); // This aggregates
threads too
+#define HTTP_READ_GLOBAL_DYN_SUM(x, S) RecGetGlobalRawStatSum(http_rsb, int(x), &S)
 
 #define HTTP_ConfigReadInteger         REC_ConfigReadInteger
 #define HTTP_ConfigReadString          REC_ConfigReadString

Modified: trafficserver/traffic/trunk/proxy/http2/HttpConnectionCount.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpConnectionCount.cc?rev=1028908&r1=1028907&r2=1028908&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpConnectionCount.cc (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpConnectionCount.cc Fri Oct 29 21:26:55 2010
@@ -24,7 +24,5 @@
 #include "HttpConnectionCount.h"
 
 
-ConnectionCount *
-  ConnectionCount::_connectionCount = NULL;
-ink_mutex
-  ConnectionCount::_mutex;
+ConnectionCount *ConnectionCount::_connectionCount = NULL;
+ink_mutex ConnectionCount::_mutex;

Modified: trafficserver/traffic/trunk/proxy/http2/HttpSM.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpSM.cc?rev=1028908&r1=1028907&r2=1028908&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpSM.cc (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpSM.cc Fri Oct 29 21:26:55 2010
@@ -2882,8 +2882,7 @@ HttpSM::tunnel_handler_server(int event,
 
     ink_assert(p->vc_type == HT_HTTP_SERVER);
     if (is_http_server_eos_truncation(p)) {
-      Debug("http", "[%lld] [HttpSM::tunnel_handler_server] "
-            "aborting cache writes due to server truncation", sm_id);
+      Debug("http", "[%lld] [HttpSM::tunnel_handler_server] aborting cache writes due to
server truncation", sm_id);
       tunnel.abort_cache_write_finish_others(p);
       t_state.current.server->abort = HttpTransact::ABORTED;
       if (t_state.http_config_param->log_spider_codes) {
@@ -4356,13 +4355,14 @@ HttpSM::do_http_server_open(bool raw)
   // Atomically read the current number of connections and check to see
   // if we have gone above the max allowed.
   if (t_state.http_config_param->server_max_connections > 0) {
-    int64 Count, Sum;
-    HTTP_READ_DYN_STAT(http_current_server_connections_stat, Count, Sum);
+    int64 sum;
+
+    HTTP_READ_GLOBAL_DYN_SUM(http_current_server_connections_stat, sum);
     // Note that there is a potential race condition here where
     // the value of the http_current_server_connections_stat gets changed
     // between the statement above and the check below.
     // If this happens, we might go over the max by 1 but this is ok.
-    if (Sum >= t_state.http_config_param->server_max_connections) {
+    if (sum >= t_state.http_config_param->server_max_connections) {
       ink_debug_assert(pending_action == NULL);
       pending_action = eventProcessor.schedule_in(this, HRTIME_MSECONDS(100));
       httpSessionManager.purge_keepalives();

Modified: trafficserver/traffic/trunk/proxy/http2/HttpServerSession.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpServerSession.cc?rev=1028908&r1=1028907&r2=1028908&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpServerSession.cc (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpServerSession.cc Fri Oct 29 21:26:55 2010
@@ -98,7 +98,7 @@ HttpServerSession::new_connection(NetVCo
   con_id = ink_atomic_increment64((int64 *) (&next_ss_id), 1);
 
   magic = HTTP_SS_MAGIC_ALIVE;
-  HTTP_INCREMENT_DYN_STAT(http_current_server_connections_stat);
+  HTTP_SUM_GLOBAL_DYN_STAT(http_current_server_connections_stat, 1); // Update the true global
stat
   HTTP_INCREMENT_DYN_STAT(http_total_server_connections_stat);
   // Check to see if we are limiting the number of connections
   // per host
@@ -148,13 +148,8 @@ HttpServerSession::do_io_close(int alerr
   Debug("http_ss", "[%lld] session closed", con_id);
   server_vc = NULL;
 
-//  Have to a taken mutex to use normal stat stuff now, we don't
-//    so use funny macros here....
-//    HTTP_DECREMENT_DYN_STAT(http_current_server_connections_stat);
-//    HTTP_SUM_DYN_STAT(http_transactions_per_server_con, transact_count);
-
-  HTTP_SUM_GLOBAL_DYN_STAT(http_current_server_connections_stat, -1);
-  HTTP_SUM_GLOBAL_DYN_STAT(http_transactions_per_server_con, transact_count);
+  HTTP_SUM_GLOBAL_DYN_STAT(http_current_server_connections_stat, -1); // Make sure to work
on the global stat
+  HTTP_SUM_DYN_STAT(http_transactions_per_server_con, transact_count);
 
   // Check to see if we are limiting the number of connections
   // per host
@@ -171,7 +166,7 @@ HttpServerSession::do_io_close(int alerr
   }
 
   if (to_parent_proxy) {
-    HTTP_SUM_GLOBAL_DYN_STAT(http_current_parent_proxy_connections_stat, -1);
+    HTTP_DECREMENT_DYN_STAT(http_current_parent_proxy_connections_stat);
   }
   destroy();
 }

Modified: trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc?rev=1028908&r1=1028907&r2=1028908&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc Fri Oct 29 21:26:55 2010
@@ -5974,6 +5974,8 @@ HttpTransact::initialize_state_variables
     // content length to the browser, and we will correct //
     // the cache if it turnrd out that the servers lied.  //
     ////////////////////////////////////////////////////////
+    //TODO: We should quite possibly disable this check, it will cause us to violate the
+    // protocol in some cases (returning too much data). /leif XXX
     if (incoming_response->presence(MIME_PRESENCE_CONTENT_LENGTH)) {
       if (s->current.server->keep_alive == HTTP_NO_KEEPALIVE) {
         s->hdr_info.trust_response_cl = false;
@@ -7379,8 +7381,7 @@ HttpTransact::delete_all_document_altern
     } else {
       if (valid_max_forwards) {
         --max_forwards;
-        Debug("http_trans",
-              "[delete_all_document_alternates_and_return] " "Decrementing max_forwards to
%d", max_forwards);
+        Debug("http_trans", "[delete_all_document_alternates_and_return] " "Decrementing
max_forwards to %d", max_forwards);
         s->hdr_info.client_request.value_set_int(MIME_FIELD_MAX_FORWARDS, MIME_LEN_MAX_FORWARDS,
max_forwards);
       }
     }



Mime
View raw message