You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/10/13 22:54:53 UTC

[trafficserver] branch 9.2.x updated: Add stats for concurrent stream limits exceeded (#8409)

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

zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.2.x by this push:
     new 79439b8  Add stats for concurrent stream limits exceeded (#8409)
79439b8 is described below

commit 79439b8b90d8e0b235fbb178b1a5a04a4e054e72
Author: Emanuele Rocca <em...@wikimedia.org>
AuthorDate: Wed Oct 13 18:01:47 2021 +0200

    Add stats for concurrent stream limits exceeded (#8409)
    
    Introduce two new stats tracking when the limits on maximum concurrent
    streams are exceeded for both inbound and outbount streams, respectively
    proxy.process.http2.max_concurrent_streams_exceeded_in and
    proxy.process.http2.max_concurrent_streams_exceeded_out.
    
    See https://datatracker.ietf.org/doc/html/rfc7540#section-5.1.2
    
    (cherry picked from commit 92fd44fb5540fd0928493bc08f8ad28a1dc15789)
---
 .../monitoring/statistics/core/http-connection.en.rst      | 14 ++++++++++++++
 proxy/http2/HTTP2.cc                                       |  8 ++++++++
 proxy/http2/HTTP2.h                                        |  2 ++
 proxy/http2/Http2ConnectionState.cc                        |  2 ++
 4 files changed, 26 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 37cdcb0..0baa9db 100644
--- a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
+++ b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
@@ -256,3 +256,17 @@ HTTP/2
    Represents the total number of closed HTTP/2 connections for not reaching the
    minimum average window increment limit which is configured by
    :ts:cv:`proxy.config.http2.min_avg_window_update`.
+
+.. ts:stat:: global proxy.process.http2.max_concurrent_streams_exceeded_in integer
+   :type: counter
+
+   Represents the number of times an inbound HTTP/2 stream was not created for
+   reaching the maximum number of concurrent streams per inbound connection
+   configured by :ts:cv:`proxy.config.http2.max_concurrent_streams_in`.
+
+.. ts:stat:: global proxy.process.http2.max_concurrent_streams_exceeded_out integer
+   :type: counter
+
+   Represents the number of times an outbound HTTP/2 stream was not created for
+   reaching the maximum number of concurrent streams per outbound connection
+   the client can initiate as specified by the server.
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 6799425..8a4ba48 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -84,6 +84,10 @@ static const char *const HTTP2_STAT_MAX_PING_FRAMES_PER_MINUTE_EXCEEDED_NAME =
 static const char *const HTTP2_STAT_MAX_PRIORITY_FRAMES_PER_MINUTE_EXCEEDED_NAME =
   "proxy.process.http2.max_priority_frames_per_minute_exceeded";
 static const char *const HTTP2_STAT_INSUFFICIENT_AVG_WINDOW_UPDATE_NAME = "proxy.process.http2.insufficient_avg_window_update";
+static const char *const HTTP2_STAT_MAX_CONCURRENT_STREAMS_EXCEEDED_IN_NAME =
+  "proxy.process.http2.max_concurrent_streams_exceeded_in";
+static const char *const HTTP2_STAT_MAX_CONCURRENT_STREAMS_EXCEEDED_OUT_NAME =
+  "proxy.process.http2.max_concurrent_streams_exceeded_out";
 
 union byte_pointer {
   byte_pointer(void *p) : ptr(p) {}
@@ -899,6 +903,10 @@ Http2::init()
                      static_cast<int>(HTTP2_STAT_MAX_PRIORITY_FRAMES_PER_MINUTE_EXCEEDED), RecRawStatSyncSum);
   RecRegisterRawStat(http2_rsb, RECT_PROCESS, HTTP2_STAT_INSUFFICIENT_AVG_WINDOW_UPDATE_NAME, RECD_INT, RECP_PERSISTENT,
                      static_cast<int>(HTTP2_STAT_INSUFFICIENT_AVG_WINDOW_UPDATE), RecRawStatSyncSum);
+  RecRegisterRawStat(http2_rsb, RECT_PROCESS, HTTP2_STAT_MAX_CONCURRENT_STREAMS_EXCEEDED_IN_NAME, RECD_INT, RECP_PERSISTENT,
+                     static_cast<int>(HTTP2_STAT_MAX_CONCURRENT_STREAMS_EXCEEDED_IN), RecRawStatSyncSum);
+  RecRegisterRawStat(http2_rsb, RECT_PROCESS, HTTP2_STAT_MAX_CONCURRENT_STREAMS_EXCEEDED_OUT_NAME, RECD_INT, RECP_PERSISTENT,
+                     static_cast<int>(HTTP2_STAT_MAX_CONCURRENT_STREAMS_EXCEEDED_OUT), RecRawStatSyncSum);
 
   http2_init();
 }
diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index d2eed22..e5fdc3e 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -105,6 +105,8 @@ enum {
   HTTP2_STAT_MAX_PING_FRAMES_PER_MINUTE_EXCEEDED,
   HTTP2_STAT_MAX_PRIORITY_FRAMES_PER_MINUTE_EXCEEDED,
   HTTP2_STAT_INSUFFICIENT_AVG_WINDOW_UPDATE,
+  HTTP2_STAT_MAX_CONCURRENT_STREAMS_EXCEEDED_IN,
+  HTTP2_STAT_MAX_CONCURRENT_STREAMS_EXCEEDED_OUT,
 
   HTTP2_N_STATS // Terminal counter, NOT A STAT INDEX.
 };
diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index 75e8588..650b72b 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -1322,12 +1322,14 @@ Http2ConnectionState::create_stream(Http2StreamId new_id, Http2Error &error)
   // stream limit to be exceeded MUST treat this as a stream error.
   if (client_streamid) {
     if (client_streams_in_count >= server_settings.get(HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS)) {
+      HTTP2_INCREMENT_THREAD_DYN_STAT(HTTP2_STAT_MAX_CONCURRENT_STREAMS_EXCEEDED_IN, this_ethread());
       error = Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_REFUSED_STREAM,
                          "recv headers creating inbound stream beyond max_concurrent limit");
       return nullptr;
     }
   } else {
     if (client_streams_out_count >= client_settings.get(HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS)) {
+      HTTP2_INCREMENT_THREAD_DYN_STAT(HTTP2_STAT_MAX_CONCURRENT_STREAMS_EXCEEDED_OUT, this_ethread());
       error = Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, Http2ErrorCode::HTTP2_ERROR_REFUSED_STREAM,
                          "recv headers creating outbound stream beyond max_concurrent limit");
       return nullptr;