You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sh...@apache.org on 2021/03/29 13:15:02 UTC

[trafficserver] branch master updated: Add pooled_server_connections metric (#7627)

This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new ede54c1  Add pooled_server_connections metric (#7627)
ede54c1 is described below

commit ede54c16ab951ecff60d17482fad16e5627070bf
Author: Susan Hinrichs <sh...@verizonmedia.com>
AuthorDate: Mon Mar 29 08:14:54 2021 -0500

    Add pooled_server_connections metric (#7627)
---
 doc/admin-guide/monitoring/statistics/core/http-connection.en.rst | 6 ++++++
 proxy/http/HttpConfig.cc                                          | 4 ++++
 proxy/http/HttpConfig.h                                           | 1 +
 proxy/http/HttpSessionManager.cc                                  | 5 +++++
 4 files changed, 16 insertions(+)

diff --git a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
index 42c680e..80ffff4 100644
--- a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
+++ b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
@@ -138,6 +138,12 @@ HTTP Connection
 
    This tracks the number of origin connections denied due to being over the :ts:cv:`proxy.config.http.per_server.connection.max` limit.
 
+.. ts:stat:: global proxy.process.http.pooled_server_connections integer
+   :type: counter
+
+   This metric tracks the number of server connections currently in the server session sharing pools. The server session sharing is
+   controlled by settings :ts:cv:`proxy.config.http.server_session_sharing.pool` and :ts:cv:`proxy.config.http.server_session_sharing.match`.
+
 
 HTTP/2
 ------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 9e0179d..59bab2f 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -416,6 +416,10 @@ register_stat_callbacks()
                      RECP_PERSISTENT, (int)http_ua_msecs_counts_errors_pre_accept_hangups_stat,
                      RecRawStatSyncIntMsecsToFloatSeconds);
 
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.pooled_server_connections", RECD_INT, RECP_NON_PERSISTENT,
+                     (int)http_pooled_server_connections_stat, RecRawStatSyncSum);
+  HTTP_CLEAR_DYN_STAT(http_pooled_server_connections_stat);
+
   // Transactional stats
 
   RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.incoming_requests", RECD_COUNTER, RECP_PERSISTENT,
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 9067a23..b849194 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -65,6 +65,7 @@ enum {
   http_current_client_transactions_stat,
   http_total_incoming_connections_stat,
   http_current_server_transactions_stat,
+  http_pooled_server_connections_stat,
 
   //  Http Abort information (from HttpNetConnection)
   http_ua_msecs_counts_errors_pre_accept_hangups_stat,
diff --git a/proxy/http/HttpSessionManager.cc b/proxy/http/HttpSessionManager.cc
index c4aa296..4c4ce03 100644
--- a/proxy/http/HttpSessionManager.cc
+++ b/proxy/http/HttpSessionManager.cc
@@ -167,6 +167,7 @@ ServerSessionPool::acquireSession(sockaddr const *addr, CryptoHash const &hostna
     }
     if (zret == HSM_DONE) {
       to_return = first;
+      HTTP_DECREMENT_DYN_STAT(http_pooled_server_connections_stat);
       m_fqdn_pool.erase(first);
       m_ip_pool.erase(to_return);
     }
@@ -191,6 +192,7 @@ ServerSessionPool::acquireSession(sockaddr const *addr, CryptoHash const &hostna
     }
     if (zret == HSM_DONE) {
       to_return = first;
+      HTTP_DECREMENT_DYN_STAT(http_pooled_server_connections_stat);
       m_ip_pool.erase(first);
       m_fqdn_pool.erase(to_return);
     }
@@ -218,6 +220,8 @@ ServerSessionPool::releaseSession(PoolableSession *ss)
   m_ip_pool.insert(ss);
   m_fqdn_pool.insert(ss);
 
+  HTTP_INCREMENT_DYN_STAT(http_pooled_server_connections_stat);
+
   Debug("http_ss",
         "[%" PRId64 "] [release session] "
         "session placed into shared pool",
@@ -288,6 +292,7 @@ ServerSessionPool::eventHandler(int event, void *data)
       // Drop connection on this end.
       s->do_io_close();
       found = true;
+      HTTP_DECREMENT_DYN_STAT(http_pooled_server_connections_stat);
       break;
     }
   }