Updated Branches:
  refs/heads/master 2072690b3 -> 80402b507

TS-1142 record ram hit in stats

follow the TCP_MEM_HIT, enabled by proxy.config.http.record_tcp_mem_hit


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

Branch: refs/heads/master
Commit: 80402b5070bb86199c91d27c9fba83c3d64bf735
Parents: 2072690
Author: Chen Bin <[email protected]>
Authored: Fri Apr 27 20:26:18 2012 +0800
Committer: Zhao Yongming <[email protected]>
Committed: Fri Apr 27 20:57:16 2012 +0800

----------------------------------------------------------------------
 CHANGES                               |    2 +
 mgmt/RecordsConfig.cc                 |   22 +++++++
 mgmt/api/remote/APITestCliRemote.cc   |   26 ++++++---
 mgmt/cli/ShowCmd.cc                   |    3 +
 mgmt/web2/WebOverview.cc              |   19 ++++++-
 proxy/config/stats.config.xml.default |   84 ++++++++++++++++++++++++++++
 proxy/http/HttpConfig.cc              |    4 +
 proxy/http/HttpConfig.h               |    1 +
 proxy/http/HttpTransact.cc            |    3 +-
 9 files changed, 154 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80402b50/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 138fe07..8878d5a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.1.4
+  *) [TS-1142] record ram hit in stats.
+
   *) [TS-1213] update will crash at HttpTransact::process_quick_http_filter.
 
   *) [TS-1186] Fixed Perl stats API to work with 64-bit stat values

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80402b50/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 63095c9..7d5d362 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1476,6 +1476,12 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_NODE, "proxy.node.cache_hit_ratio_avg_10s_int_pct", RECD_INT, "0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
+  {RECT_NODE, "proxy.node.cache_hit_mem_ratio", RECD_FLOAT, "0", RECU_NULL, 
RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
+  {RECT_NODE, "proxy.node.cache_hit_mem_ratio_int_pct", RECD_INT, "0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
+  {RECT_NODE, "proxy.node.cache_hit_mem_ratio_avg_10s_int_pct", RECD_INT, "0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
   {RECT_NODE, "proxy.node.bandwidth_hit_ratio_avg_10s_int_pct", RECD_INT, "0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
 
@@ -1487,6 +1493,8 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_NODE, "proxy.node.http.cache_hit_fresh_avg_10s", RECD_FLOAT, "0.0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
+  {RECT_NODE, "proxy.node.http.cache_hit_mem_fresh_avg_10s", RECD_FLOAT, 
"0.0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
   {RECT_NODE, "proxy.node.http.cache_hit_revalidated_avg_10s", RECD_FLOAT, 
"0.0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_NODE, "proxy.node.http.cache_hit_ims_avg_10s", RECD_FLOAT, "0.0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
@@ -1507,10 +1515,14 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_NODE, "proxy.node.cache_total_hits_avg_10s", RECD_FLOAT, "0.0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
+  {RECT_NODE, "proxy.node.cache_total_hits_mem_avg_10s", RECD_FLOAT, "0.0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
   {RECT_NODE, "proxy.node.cache_total_misses_avg_10s", RECD_FLOAT, "0.0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_NODE, "proxy.node.cache_hit_ratio_avg_10s", RECD_FLOAT, "0.0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
+  {RECT_NODE, "proxy.node.cache_hit_mem_ratio_avg_10s", RECD_FLOAT, "0.0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
   {RECT_NODE, "proxy.node.hostdb.total_lookups_avg_10s", RECD_FLOAT, "0.0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_NODE, "proxy.node.hostdb.total_hits_avg_10s", RECD_FLOAT, "0.0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
@@ -1685,6 +1697,8 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_NODE, "proxy.node.cache_total_hits", RECD_INT, "0", RECU_NULL, 
RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
+  {RECT_NODE, "proxy.node.cache_total_hits_mem", RECD_INT, "0", RECU_NULL, 
RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
   {RECT_NODE, "proxy.node.cache_total_misses", RECD_INT, "0", RECU_NULL, 
RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_NODE, "proxy.node.current_cache_connections", RECD_INT, "0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
@@ -1786,6 +1800,10 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_CLUSTER, "proxy.cluster.cache_hit_ratio_int_pct", RECD_INT, "0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
+  {RECT_CLUSTER, "proxy.cluster.cache_hit_mem_ratio", RECD_FLOAT, "0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
+  {RECT_CLUSTER, "proxy.cluster.cache_hit_mem_ratio_int_pct", RECD_INT, "0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
   {RECT_CLUSTER, "proxy.cluster.cache_total_hits", RECD_INT, "0", RECU_NULL, 
RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_CLUSTER, "proxy.cluster.cache_total_misses", RECD_INT, "0", RECU_NULL, 
RR_NULL, RECC_NULL, NULL, RECA_NULL}
@@ -1794,10 +1812,14 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_CLUSTER, "proxy.cluster.cache_total_hits_avg_10s", RECD_FLOAT, "0.0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
+  {RECT_CLUSTER, "proxy.cluster.cache_total_hits_mem_avg_10s", RECD_FLOAT, 
"0.0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
   {RECT_CLUSTER, "proxy.cluster.cache_total_misses_avg_10s", RECD_FLOAT, 
"0.0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_CLUSTER, "proxy.cluster.cache_hit_ratio_avg_10s", RECD_FLOAT, "0.0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
+  {RECT_CLUSTER, "proxy.cluster.cache_hit_mem_ratio_avg_10s", RECD_FLOAT, 
"0.0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
   //# DNS
   {RECT_CLUSTER, "proxy.cluster.dns.lookups_per_second", RECD_FLOAT, "0", 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80402b50/mgmt/api/remote/APITestCliRemote.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/remote/APITestCliRemote.cc 
b/mgmt/api/remote/APITestCliRemote.cc
index f387aa3..dbd3b4c 100644
--- a/mgmt/api/remote/APITestCliRemote.cc
+++ b/mgmt/api/remote/APITestCliRemote.cc
@@ -2179,19 +2179,21 @@ set_stats()
   TSRecordSetFloat("proxy.node.hostdb.hit_ratio", 110, &action);
   TSRecordSetFloat("proxy.node.cache.percent_free", 110, &action);
   TSRecordSetFloat("proxy.node.cache_hit_ratio", 110, &action);
+  TSRecordSetFloat("proxy.node.cache_hit_mem_ratio", 110, &action);
   TSRecordSetFloat("proxy.node.bandwidth_hit_ratio_avg_10s", 110, &action);
   TSRecordSetFloat("proxy.node.http.cache_hit_fresh_avg_10s", 110, &action);
+  TSRecordSetFloat("proxy.node.http.cache_hit_mem_fresh_avg_10s", 110, 
&action);
   TSRecordSetFloat("proxy.node.http.cache_hit_revalidated_avg_10s", 110, 
&action);
   TSRecordSetFloat("proxy.node.http.cache_hit_ims_avg_10s", 100, &action);
   TSRecordSetFloat("proxy.node.client_throughput_out", 110, &action);
 
   TSRecordSetInt("proxy.node.cache_hit_ratio_int_pct", 110, &action);
+  TSRecordSetInt("proxy.node.cache_hit_mem_ratio_int_pct", 110, &action);
   TSRecordSetInt("proxy.node.bandwidth_hit_ratio_int_pct", 110, &action);
   TSRecordSetInt("proxy.node.hostdb.hit_ratio_int_pct", 110, &action);
   TSRecordSetInt("proxy.node.proxy_running", 110, &action);
   TSRecordSetInt("proxy.node.hostdb.hit_ratio_int_pct", 110, &action);
   TSRecordSetInt("proxy.node.proxy_running", 110, &action);
-  TSRecordSetInt("proxy.node.cache_hit_ratio_int_pct", 110, &action);
   TSRecordSetInt("proxy.node.current_client_connections", 110, &action);
   TSRecordSetInt("proxy.node.current_cache_connections", 110, &action);
 
@@ -2200,10 +2202,13 @@ set_stats()
   TSRecordSetFloat("proxy.cluster.bandwidth_hit_ratio", 110, &action);
   TSRecordSetFloat("proxy.cluster.bandwidth_hit_ratio_avg_10s", 110, &action);
   TSRecordSetFloat("proxy.cluster.cache_hit_ratio", 110, &action);
+  TSRecordSetFloat("proxy.cluster.cache_hit_mem_ratio", 110, &action);
 
   TSRecordSetInt("proxy.cluster.cache_hit_ratio_int_pct", 110, &action);
+  TSRecordSetInt("proxy.cluster.cache_hit_mem_ratio_int_pct", 110, &action);
   TSRecordSetInt("proxy.cluster.bandwidth_hit_ratio_int_pct", 110, &action);
   TSRecordSetInt("proxy.cluster.cache_total_hits", 110, &action);
+  TSRecordSetInt("proxy.cluster.cache_total_hits_mem", 110, &action);
   TSRecordSetInt("proxy.cluster.cache_total_misses", 110, &action);
   TSRecordSetInt("proxy.cluster.http.throughput", 110, &action);
 }
@@ -2211,7 +2216,7 @@ set_stats()
 void
 print_stats()
 {
-  TSFloat f1, f2, f3, f4, f5, f6, f7, f8, f9;
+  TSFloat f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11;
   TSInt i1, i2, i3, i4, i5, i6, i7, i8, i9;
 
   fprintf(stderr, "[print_stats]\n");
@@ -2232,43 +2237,48 @@ print_stats()
   TSRecordGetFloat("proxy.node.hostdb.hit_ratio", &f2);
   TSRecordGetFloat("proxy.node.cache.percent_free", &f3);
   TSRecordGetFloat("proxy.node.cache_hit_ratio", &f4);
+  TSRecordGetFloat("proxy.node.cache_hit_mem_ratio", &f10);
   TSRecordGetFloat("proxy.node.bandwidth_hit_ratio_avg_10s", &f5);
   TSRecordGetFloat("proxy.node.http.cache_hit_fresh_avg_10s", &f6);
+  TSRecordGetFloat("proxy.node.http.cache_hit_mem_fresh_avg_10s", &f11);
   TSRecordGetFloat("proxy.node.http.cache_hit_revalidated_avg_10s", &f7);
   TSRecordGetFloat("proxy.node.http.cache_hit_ims_avg_10s", &f8);
   TSRecordGetFloat("proxy.node.client_throughput_out", &f9);
 
-  fprintf(stderr, "NODE stats: \n%f, %f, %f, %f, %f, %f, %f, %f, %f\n",
-          f1, f2, f3, f4, f5, f6, f7, f8, f9);
+  fprintf(stderr, "NODE stats: \n%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n",
+          f1, f2, f3, f4, f10, f5, f6, f11, f7, f8, f9);
 
   TSRecordGetInt("proxy.node.cache_hit_ratio_int_pct", &i1);
+  TSRecordGetInt("proxy.node.cache_hit_mem_ratio_int_pct", &i7);
   TSRecordGetInt("proxy.node.bandwidth_hit_ratio_int_pct", &i2);
   TSRecordGetInt("proxy.node.hostdb.hit_ratio_int_pct", &i3);
   TSRecordGetInt("proxy.node.proxy_running", &i4);
   TSRecordGetInt("proxy.node.hostdb.hit_ratio_int_pct", &i5);
   TSRecordGetInt("proxy.node.proxy_running", &i6);
-  TSRecordGetInt("proxy.node.cache_hit_ratio_int_pct", &i7);
   TSRecordGetInt("proxy.node.current_client_connections", &i8);
   TSRecordGetInt("proxy.node.current_cache_connections", &i9);
 
   fprintf(stderr, "%" PRId64 ", %" PRId64 ", %" PRId64 ", %" PRId64 ", %" 
PRId64 ", %" PRId64 ", %" PRId64 ", %" PRId64 ", %" PRId64 "\n",
-          i1, i2, i3, i4, i5, i6, i7, i8, i9);
+          i1, i7, i2, i3, i4, i5, i6, i8, i9);
 
   TSRecordGetFloat("proxy.cluster.user_agent_total_bytes_avg_10s", &f1);
   TSRecordGetFloat("proxy.cluster.origin_server_total_bytes_avg_10s", &f2);
   TSRecordGetFloat("proxy.cluster.bandwidth_hit_ratio", &f3);
   TSRecordGetFloat("proxy.cluster.bandwidth_hit_ratio_avg_10s", &f4);
   TSRecordGetFloat("proxy.cluster.cache_hit_ratio", &f5);
+  TSRecordGetFloat("proxy.cluster.cache_hit_mem_ratio", &f6);
 
   TSRecordGetInt("proxy.cluster.cache_hit_ratio_int_pct", &i1);
+  TSRecordGetInt("proxy.cluster.cache_hit_mem_ratio_int_pct", &i6);
   TSRecordGetInt("proxy.cluster.bandwidth_hit_ratio_int_pct", &i2);
   TSRecordGetInt("proxy.cluster.cache_total_hits", &i3);
+  TSRecordGetInt("proxy.cluster.cache_total_hits_mem", &i7);
   TSRecordGetInt("proxy.cluster.cache_total_misses", &i4);
   TSRecordGetInt("proxy.cluster.http.throughput", &i5);
 
   fprintf(stderr, "CLUSTER stats: \n");
-  fprintf(stderr, "%f, %f, %f, %f, %f\n", f1, f2, f3, f4, f5);
-  fprintf(stderr, "%" PRId64 ", %" PRId64 ", %" PRId64 ", %" PRId64 ", %" 
PRId64 "\n", i1, i2, i3, i4, i5);
+  fprintf(stderr, "%f, %f, %f, %f, %f, %f\n", f1, f2, f3, f4, f5, f6);
+  fprintf(stderr, "%" PRId64 ", %" PRId64 ", %" PRId64 ", %" PRId64 ", %" 
PRId64 ", %" PRId64 ", %" PRId64 "\n", i1, i6, i2, i3, i7, i4, i5);
 
   fprintf(stderr, "PROCESS stats: \n");
   fprintf(stderr, "%f, %f\n", f1, f2);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80402b50/mgmt/cli/ShowCmd.cc
----------------------------------------------------------------------
diff --git a/mgmt/cli/ShowCmd.cc b/mgmt/cli/ShowCmd.cc
index 711b1b8..4a6571b 100644
--- a/mgmt/cli/ShowCmd.cc
+++ b/mgmt/cli/ShowCmd.cc
@@ -2044,6 +2044,7 @@ ShowProxyStats()
 {
 
   TSFloat cache_hit_ratio = -1.0;
+  TSFloat cache_hit_mem_ratio = -1.0;
   TSFloat bandwidth_hit_ratio = -1.0;
   TSFloat percent_free = -1.0;
   TSInt current_server_connection = -1;
@@ -2055,6 +2056,7 @@ ShowProxyStats()
 
   //get value
   Cli_RecordGetFloat("proxy.node.cache_hit_ratio", &cache_hit_ratio);
+  Cli_RecordGetFloat("proxy.node.cache_hit_mem_ratio", &cache_hit_mem_ratio);
   Cli_RecordGetFloat("proxy.node.bandwidth_hit_ratio", &bandwidth_hit_ratio);
   Cli_RecordGetFloat("proxy.node.cache.percent_free", &percent_free);
   Cli_RecordGetInt("proxy.node.current_server_connections", 
&current_server_connection);
@@ -2068,6 +2070,7 @@ ShowProxyStats()
   Cli_Printf("\n");
 
   Cli_Printf("Document Hit Rate -------- %f %%\t *\n", 100 * cache_hit_ratio);
+  Cli_Printf("Ram cache Hit Rate ------- %f %%\t *\n", 100 * 
cache_hit_mem_ratio);
   Cli_Printf("Bandwidth Saving --------- %f %%\t *\n", 100 * 
bandwidth_hit_ratio);
   Cli_Printf("Cache Percent Free ------- %f %%\n", 100 * percent_free);
   Cli_Printf("Open Server Connections -- %d\n", current_server_connection);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80402b50/mgmt/web2/WebOverview.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebOverview.cc b/mgmt/web2/WebOverview.cc
index bbb9859..fc380fe 100644
--- a/mgmt/web2/WebOverview.cc
+++ b/mgmt/web2/WebOverview.cc
@@ -909,14 +909,18 @@ overviewPage::agCacheHitRate()
   static ink_hrtime last_set_time = 0;
   const ink_hrtime window = 10 * HRTIME_SECOND; // update every 10 seconds
   static StatTwoIntSamples cluster_hit_count = { 
"proxy.node.cache_total_hits", 0, 0, 0, 0 };
+  static StatTwoIntSamples cluster_hit_mem_count = { 
"proxy.node.cache_total_hits_mem", 0, 0, 0, 0 };
   static StatTwoIntSamples cluster_miss_count = { 
"proxy.node.cache_total_misses", 0, 0, 0, 0 };
   static const char *cluster_hit_count_name = 
"proxy.cluster.cache_total_hits_avg_10s";
+  static const char *cluster_hit_mem_count_name = 
"proxy.cluster.cache_total_hits_mem_avg_10s";
   static const char *cluster_miss_count_name = 
"proxy.cluster.cache_total_misses_avg_10s";
 
   MgmtIntCounter totalHits = 0;
+  MgmtIntCounter totalMemHits = 0;
   MgmtIntCounter totalMisses = 0;
   MgmtIntCounter totalAccess = 0;
   MgmtFloat hitRate = 0.00;
+  MgmtFloat hitMemRate = 0.00;
 
   // get current time and delta to work with
   ink_hrtime current_time = ink_get_hrtime();
@@ -959,6 +963,7 @@ overviewPage::agCacheHitRate()
     ////////////////////////////////////////////////
     if ((current_time - last_set_time) > window) {
       RecInt num_hits = 0;
+      RecInt num_hits_mem = 0;
       RecInt num_misses = 0;
       RecInt diff = 0;
       RecInt total = 0;
@@ -967,6 +972,10 @@ overviewPage::agCacheHitRate()
       varSetInt(cluster_hit_count_name, diff);
       num_hits = diff;
 
+      diff = cluster_hit_mem_count.diff_value();
+      varSetInt(cluster_hit_mem_count_name, diff);
+      num_hits_mem = diff;
+
       diff = cluster_miss_count.diff_value();
       varSetInt(cluster_miss_count_name, diff);
       num_misses = diff;
@@ -974,8 +983,10 @@ overviewPage::agCacheHitRate()
       total = num_hits + num_misses;
       if (total == 0)
         hitRate = 0.00;
-      else
+      else {
         hitRate = (MgmtFloat) ((double) num_hits / (double) total);
+        hitMemRate = (MgmtFloat) ((double) num_hits_mem / (double) total);
+      }
 
       // Check if more than one cluster node
       MgmtInt num_nodes;
@@ -983,9 +994,11 @@ overviewPage::agCacheHitRate()
       if (1 == num_nodes) {
         // Only one node , so grab local value
         varFloatFromName("proxy.node.cache_hit_ratio_avg_10s", &hitRate);
+        varFloatFromName("proxy.node.cache_hit_mem_ratio_avg_10s", 
&hitMemRate);
       }
       // new stat
       varSetFloat("proxy.cluster.cache_hit_ratio_avg_10s", hitRate);
+      varSetFloat("proxy.cluster.cache_hit_mem_ratio_avg_10s", hitMemRate);
     }
     /////////////////////////////////////////////////
     // done with a cycle, update the last_set_time //
@@ -994,15 +1007,19 @@ overviewPage::agCacheHitRate()
   }
   // Deal with Lifetime stats
   clusterSumInt("proxy.node.cache_total_hits", &totalHits);
+  clusterSumInt("proxy.node.cache_total_hits_mem", &totalMemHits);
   clusterSumInt("proxy.node.cache_total_misses", &totalMisses);
   totalAccess = totalHits + totalMisses;
 
   if (totalAccess != 0) {
     hitRate = (MgmtFloat) ((double) totalHits / (double) totalAccess);
+    hitMemRate = (MgmtFloat) ((double) totalMemHits / (double) totalAccess);
   }
   // new stats
   ink_assert(varSetFloat("proxy.cluster.cache_hit_ratio", hitRate));
+  ink_assert(varSetFloat("proxy.cluster.cache_hit_mem_ratio", hitMemRate));
   ink_assert(varSetInt("proxy.cluster.cache_total_hits", totalHits));
+  ink_assert(varSetInt("proxy.cluster.cache_total_hits_mem", totalMemHits));
   ink_assert(varSetInt("proxy.cluster.cache_total_misses", totalMisses));
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80402b50/proxy/config/stats.config.xml.default
----------------------------------------------------------------------
diff --git a/proxy/config/stats.config.xml.default 
b/proxy/config/stats.config.xml.default
index e5bab3c..ac6d211 100644
--- a/proxy/config/stats.config.xml.default
+++ b/proxy/config/stats.config.xml.default
@@ -392,6 +392,16 @@
     <statistics
        minimum="0"
         interval="10">
+        <destination>proxy.node.http.cache_hit_mem_fresh_avg_10s</destination>
+        <expression>
+            #proxy.process.http.cache_hit_mem_fresh
+        </expression>
+    </statistics>
+
+
+    <statistics
+       minimum="0"
+        interval="10">
         
<destination>proxy.node.http.cache_hit_revalidated_avg_10s</destination>
         <expression>
             #proxy.process.http.cache_hit_revalidated
@@ -496,6 +506,17 @@
     <statistics
        minimum="0"
         interval="10">
+        <destination>proxy.node.cache_total_hits_mem_avg_10s</destination>
+        <destination 
scope="cluster">proxy.cluster.cache_total_hits_mem_avg_10s</destination>
+        <expression>
+            proxy.node.http.cache_hit_mem_fresh_avg_10s
+        </expression>
+    </statistics>
+
+
+    <statistics
+       minimum="0"
+        interval="10">
         <destination>proxy.node.cache_total_misses_avg_10s</destination>
         <destination 
scope="cluster">proxy.cluster.cache_total_misses_avg_10s</destination>
         <expression>
@@ -527,6 +548,22 @@
 
     <statistics
        minimum="0"
+       maximum="1"
+        interval="10">
+        <destination>proxy.node.cache_hit_mem_ratio_avg_10s</destination>
+        <destination scope="cluster" 
operation="re-calculate">proxy.cluster.cache_hit_mem_ratio_avg_10s</destination>
+        <expression>
+            proxy.node.cache_total_hits_mem_avg_10s   /
+            (
+            proxy.node.cache_total_hits_avg_10s   +
+            proxy.node.cache_total_misses_avg_10s
+            )
+        </expression>
+    </statistics>
+
+
+    <statistics
+       minimum="0"
        maximum="100"
         interval="10">
         <destination>proxy.node.cache_hit_ratio_avg_10s_int_pct</destination>
@@ -538,6 +575,18 @@
 
 
     <statistics
+       minimum="0"
+       maximum="100"
+        interval="10">
+        
<destination>proxy.node.cache_hit_mem_ratio_avg_10s_int_pct</destination>
+        <expression>
+           proxy.node.cache_hit_mem_ratio_avg_10s *
+            $PCT_TO_INTPCT_SCALE
+        </expression>
+    </statistics>
+
+
+    <statistics
        minimum="0">
         <destination>proxy.node.cache_total_hits</destination>
         <destination 
scope="cluster">proxy.cluster.cache_total_hits</destination>
@@ -552,6 +601,16 @@
 
     <statistics
        minimum="0">
+        <destination>proxy.node.cache_total_hits_mem</destination>
+        <destination 
scope="cluster">proxy.cluster.cache_total_hits_mem</destination>
+        <expression>
+            proxy.process.http.cache_hit_mem_fresh
+        </expression>
+    </statistics>
+
+
+    <statistics
+       minimum="0">
         <destination>proxy.node.cache_total_misses</destination>
         <destination 
scope="cluster">proxy.cluster.cache_total_misses</destination>
         <expression>
@@ -580,6 +639,20 @@
     </statistics>
 
 
+    <statistics
+       minimum="0"
+       maximum="100">
+        <destination>proxy.node.cache_hit_mem_ratio</destination>
+        <destination scope="cluster" 
operation="re-calculate">proxy.cluster.cache_hit_mem_ratio</destination>
+        <expression>
+            proxy.node.cache_total_hits_mem   /
+            (
+            proxy.node.cache_total_hits   +
+            proxy.node.cache_total_misses
+            )
+        </expression>
+    </statistics>
+
        <!-- 
########################################################################### -->
     <!-- StatAggregation::Ag_cachePercent() -->
     <statistics
@@ -1617,6 +1690,17 @@
 
     <statistics
        minimum="0">
+        <destination>proxy.node.cache_hit_mem_ratio_int_pct</destination>
+        <destination 
scope="cluster">proxy.cluster.cache_hit_mem_ratio_int_pct</destination>
+        <expression>
+            proxy.node.cache_hit_mem_ratio *
+            $PCT_TO_INTPCT_SCALE
+        </expression>
+    </statistics>
+
+
+    <statistics
+       minimum="0">
         <destination>proxy.node.bandwidth_hit_ratio_int_pct</destination>
         <destination 
scope="cluster">proxy.cluster.bandwidth_hit_ratio_int_pct</destination>
         <expression>

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80402b50/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 9737450..52aaf01 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -630,6 +630,10 @@ register_stat_callbacks()
                      RECD_COUNTER, RECP_NULL, (int) http_cache_hit_fresh_stat, 
RecRawStatSyncCount);
 
   RecRegisterRawStat(http_rsb, RECT_PROCESS,
+                     "proxy.process.http.cache_hit_mem_fresh",
+                     RECD_COUNTER, RECP_NULL, (int) 
http_cache_hit_mem_fresh_stat, RecRawStatSyncCount);
+
+  RecRegisterRawStat(http_rsb, RECT_PROCESS,
                      "proxy.process.http.cache_hit_revalidated",
                      RECD_COUNTER, RECP_NULL, (int) http_cache_hit_reval_stat, 
RecRawStatSyncCount);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80402b50/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index d8c6f7a..52be291 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -212,6 +212,7 @@ enum
 
   // cache result stats
   http_cache_hit_fresh_stat,
+  http_cache_hit_mem_fresh_stat,
   http_cache_hit_reval_stat,
   http_cache_hit_ims_stat,
   http_cache_hit_stale_served_stat,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80402b50/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index cce52b1..dd91fb8 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -8403,8 +8403,9 @@ HttpTransact::client_result_stat(State* s, ink_hrtime 
total_time, ink_hrtime req
     client_transaction_result = CLIENT_TRANSACTION_RESULT_ERROR_CONNECT_FAIL;
     break;
 
-  case SQUID_LOG_TCP_HIT:
   case SQUID_LOG_TCP_MEM_HIT:
+    HTTP_INCREMENT_TRANS_STAT(http_cache_hit_mem_fresh_stat);
+  case SQUID_LOG_TCP_HIT:
     // It's possible to have two stat's instead of one, if needed.
     HTTP_INCREMENT_TRANS_STAT(http_cache_hit_fresh_stat);
     client_transaction_result = CLIENT_TRANSACTION_RESULT_HIT_FRESH;

Reply via email to