From 2935b6b0d19e734f412e79c45d488c104026c74b Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Fri, 26 Mar 2021 14:51:22 +0000 Subject: [PATCH] Add pooled_server_connections metric --- .../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 42c680e1f4e..80ffff4a3ba 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 756ecbc7b43..c914e5959bd 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -413,6 +413,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 718de047119..b8bf03813c4 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 c4aa296bc7f..4c4ce03feb4 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; } }