Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP/2 backports for 8.1.x (part 1) #6581

Merged
merged 19 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4deb7cd
Reduce process duration of test_Http2FrequencyCounter
masaori335 Jan 6, 2020
ef63035
Add history to HTTP/2
masaori335 Feb 7, 2019
c7ea72c
HTTP/2: increment write_vio.ndone by consumed size
masaori335 Jun 14, 2019
63a0ebe
HTTP/2: cancel reading buffer when ATS received GOAWAY
masaori335 Jun 14, 2019
1255a27
Separate out common header compression logic to hdrs directory
maskit Jul 3, 2019
5e8f47d
Log H2 errors with the codes
maskit Jun 27, 2019
50db081
HTTP/2 - tweak for better field name handling.
SolidWallOfCode Jun 28, 2019
ea4c7c9
Convert regression tests for XPACK into Catch based unit tests
masaori335 Jul 11, 2019
0eefa91
Add slow logs for HTTP/2 Connection & Stream
masaori335 Jul 24, 2019
7a41396
Allocate DependencyTree only if HTTP/2 stream priority is enabled
masaori335 Aug 7, 2019
055d125
Record HttpSM Id on new transaction
masaori335 Aug 15, 2019
107d5d5
Cleanup: Remove unused function & old comments
masaori335 Aug 14, 2019
9d12a32
Cleanup: Signal READ_READY event only if the buffer is readable
masaori335 Aug 14, 2019
91ec71a
Doc: Add documentation for HTTP/2 statistics
masaori335 Jun 10, 2019
8b75473
Provide stats for the recently introduced HTTP/2 rate limits
jvgutierrez Aug 28, 2019
777ba85
Allow disabling HTTP/2 priority frames limit
jvgutierrez Aug 28, 2019
6079998
Add a config for internal HPACK header table size limit
maskit Oct 23, 2019
c809466
Replace container of HPACK dynamic table from std::vector to std::deque
masaori335 Oct 30, 2019
b12129d
Make sure shutdown_cont_event isn't holding any garbage references.
sudheerv Sep 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ iocore/eventsystem/test_MIOBufferWriter
iocore/hostdb/test_RefCountCache

proxy/hdrs/test_mime
proxy/hdrs/test_Huffmancode
proxy/hdrs/test_XPACK
proxy/http/test_ForwardedConfig
proxy/http2/test_Huffmancode
proxy/http2/test_Http2DependencyTree
proxy/http2/test_Http2FrequencyCounter
proxy/http2/test_HPACK
Expand Down
34 changes: 32 additions & 2 deletions doc/admin-guide/files/records.config.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2882,6 +2882,26 @@ Logging Configuration
completion will cause its timing stats to be written to the :ts:cv:`debugging log file
<proxy.config.output.logfile>`. This is identifying data about the transaction and all of the :c:type:`transaction milestones <TSMilestonesType>`.

.. ts:cv:: CONFIG proxy.config.http2.connection.slow.log.threshold INT 0
:reloadable:
:units: milliseconds

If set to a non-zero value :arg:`N` then any HTTP/2 connection
that takes longer than :arg:`N` milliseconds from open to close will cause
its timing stats to be written to the :ts:cv:`debugging log file
<proxy.config.output.logfile>`. This is identifying data about the
transaction and all of the :c:type:`transaction milestones <TSMilestonesType>`.

.. ts:cv:: CONFIG proxy.config.http2.stream.slow.log.threshold INT 0
:reloadable:
:units: milliseconds

If set to a non-zero value :arg:`N` then any HTTP/2 stream
that takes longer than :arg:`N` milliseconds from open to close will cause
its timing stats to be written to the :ts:cv:`debugging log file
<proxy.config.output.logfile>`. This is identifying data about the
transaction and all of the :c:type:`transaction milestones <TSMilestonesType>`.

.. ts:cv:: CONFIG proxy.config.log.config.filename STRING logging.yaml
:reloadable:

Expand Down Expand Up @@ -3507,7 +3527,15 @@ HTTP/2 Configuration
:reloadable:

The maximum size of the header compression table used to decode header
blocks.
blocks. This value will be advertised as SETTINGS_HEADER_TABLE_SIZE.

.. ts:cv:: CONFIG proxy.config.http2.header_table_size_limit INT 65536
:reloadable:

The maximum size of the header compression table ATS actually use when ATS
encodes headers. Setting 0 means ATS doesn't insert headers into HPACK
Dynamic Table, however, headers still can be encoded as indexable
representations. The upper limit is 65536.

.. ts:cv:: CONFIG proxy.config.http2.max_header_list_size INT 4294967295
:reloadable:
Expand Down Expand Up @@ -3603,7 +3631,9 @@ HTTP/2 Configuration

Specifies how many number of PRIORITY frames |TS| receives for a minute at maximum.
Clients exceeded this limit will be immediately disconnected with an error
code of ENHANCE_YOUR_CALM.
code of ENHANCE_YOUR_CALM. If this is set to 0, the limit logic is disabled.
This limit only will be enforced if :ts:cv:`proxy.config.http2.stream_priority_enabled`
is set to 1.

.. ts:cv:: CONFIG proxy.config.http2.min_avg_window_update FLOAT 2560.0
:reloadable:
Expand Down
106 changes: 105 additions & 1 deletion doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,111 @@ HTTP Connection

This tracks the number of origin connections denied due to being over the :ts:cv:`proxy.config.http.origin_max_connections` limit.

.. ts:stat:: global proxy.process.http2.current_active_client_connections integer

HTTP/2
------


.. ts:stat:: global proxy.process.http2.total_client_connections integer
:type: counter

Represents the total number of HTTP/2 connections from client to the |TS|.

.. ts:stat:: global proxy.process.http2.current_client_connections integer
:type: gauge

Represents the current number of HTTP/2 connections from client to the |TS|.

.. ts:stat:: global proxy.process.http2.current_active_client_connections integer
:type: gauge

Represents the current number of HTTP/2 active connections from client to the |TS|.

.. ts:stat:: global proxy.process.http2.connection_errors integer
:type: counter

Represents the total number of HTTP/2 connections errors.

.. ts:stat:: global proxy.process.http2.session_die_default integer
:type: counter

Represents the total number of closed HTTP/2 connections with
``VC_EVENT_NONE`` event.

.. ts:stat:: global proxy.process.http2.session_die_active integer
:type: counter

Represents the total number of closed HTTP/2 connections with
``VC_EVENT_ACTIVE_TIMEOUT`` event.

.. ts:stat:: global proxy.process.http2.session_die_inactive integer
:type: counter

Represents the total number of closed HTTP/2 connections with
``VC_EVENT_INACTIVITY_TIMEOUT`` event.

.. ts:stat:: global proxy.process.http2.session_die_eos integer
:type: counter

Represents the total number of closed HTTP/2 connections with
``VC_EVENT_EOS`` event.

.. ts:stat:: global proxy.process.http2.session_die_error integer
:type: counter

Represents the total number of closed HTTP/2 connections with
``VC_EVENT_ERROR`` event.

.. ts:stat:: global proxy.process.http2.session_die_other integer
:type: counter

Represents the total number of closed HTTP/2 connections with
unknown event.

.. ts:stat:: global proxy.process.http2.session_die_high_error_rate integer
:type: counter

Represents the total number of closed HTTP/2 connections with high
error rate which is configured by :ts:cv:`proxy.config.http2.stream_error_rate_threshold`.

.. ts:stat:: global proxy.process.http2.max_settings_per_frame_exceeded integer
:type: counter

Represents the total number of closed HTTP/2 connections for exceeding the
maximum allowed number of settings per frame limit which is configured by
:ts:cv:`proxy.config.http2.max_settings_per_frame`.

.. ts:stat:: global proxy.process.http2.max_settings_per_minute_exceeded integer
:type: counter

Represents the total number of closed HTTP/2 connections for exceeding the
maximum allowed number of settings per minute limit which is configured by
:ts:cv:`proxy.config.http2.max_settings_per_minute`.

.. ts:stat:: global proxy.process.http2.max_settings_frames_per_minute_exceeded integer
:type: counter

Represents the total number of closed HTTP/2 connections for exceeding the
maximum allowed number of settings frames per minute limit which is configured by
:ts:cv:`proxy.config.http2.max_settings_frames_per_minute`.

.. ts:stat:: global proxy.process.http2.max_ping_frames_per_minute_exceeded integer
:type: counter

Represents the total number of closed HTTP/2 connections for exceeding the
maximum allowed number of ping frames per minute limit which is configured by
:ts:cv:`proxy.config.http2.max_ping_frames_per_minute`.

.. ts:stat:: global proxy.process.http2.max_priority_frames_per_minute_exceeded integer
:type: counter

Represents the total number of closed HTTP/2 connections for exceeding the
maximum allowed number of priority frames per minute limit which is configured by
:ts:cv:`proxy.config.http2.max_priority_frames_per_minute`.

.. ts:stat:: global proxy.process.http2.insufficient_avg_window_update integer
:type: counter

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`.
25 changes: 25 additions & 0 deletions doc/admin-guide/monitoring/statistics/core/http-transaction.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,28 @@ HTTP Transaction
:units: seconds
:ungathered:


HTTP/2
------


.. ts:stat:: global proxy.process.http2.total_client_streams integer
:type: counter

Represents the total number of HTTP/2 streams from client to the |TS|.

.. ts:stat:: global proxy.process.http2.current_client_streams integer
:type: gauge

Represents the current number of HTTP/2 streams from client to the |TS|.

.. ts:stat:: global proxy.process.http2.total_transactions_time integer
:type: counter
:units: seconds

Represents the total transaction time of HTTP/2 streams from client to the |TS|.

.. ts:stat:: global proxy.process.http2.stream_errors integer
:type: counter

Represents the total number of HTTP/2 stream errors.
6 changes: 6 additions & 0 deletions mgmt/RecordsConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,10 @@ static const RecordElement RecordsConfig[] =
,
{RECT_CONFIG, "proxy.config.http.slow.log.threshold", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http2.connection.slow.log.threshold", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http2.stream.slow.log.threshold", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
,

//##############################################################################
//#
Expand Down Expand Up @@ -1342,6 +1346,8 @@ static const RecordElement RecordsConfig[] =
,
{RECT_CONFIG, "proxy.config.http2.min_avg_window_update", RECD_FLOAT, "2560.0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http2.header_table_size_limit", RECD_INT, "65536", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
,

//# Add LOCAL Records Here
{RECT_LOCAL, "proxy.local.incoming_ip_to_bind", RECD_STRING, nullptr, RECU_NULL, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
Expand Down
59 changes: 39 additions & 20 deletions proxy/Milestones.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @file

A brief file description
Milestones

@section license License

Expand All @@ -23,35 +23,45 @@

#pragma once

#include "tscore/ink_platform.h"
#include "tscore/ink_hrtime.h"
#include "ts/apidefs.h"

#include "tscore/ink_platform.h"
#include "tscore/ink_hrtime.h"

/////////////////////////////////////////////////////////////
//
// class TransactionMilestones
//
/////////////////////////////////////////////////////////////
class TransactionMilestones
#include "I_EventSystem.h"

template <class T, size_t entries> class Milestones
{
public:
TransactionMilestones() { ink_zero(milestones); }
ink_hrtime &operator[](TSMilestonesType ms) { return milestones[ms]; }
ink_hrtime operator[](TSMilestonesType ms) const { return milestones[ms]; }
ink_hrtime &operator[](T ms) { return this->_milestones[static_cast<size_t>(ms)]; }
ink_hrtime operator[](T ms) const { return this->_milestones[static_cast<size_t>(ms)]; }

/**
* Mark given milestone with timestamp if it's not marked yet
* @param ms The milestone to mark
* @return N/A
*/
void
mark(T ms)
{
if (this->_milestones[static_cast<size_t>(ms)] == 0) {
this->_milestones[static_cast<size_t>(ms)] = Thread::get_hrtime();
}
}

/**
* Takes two milestones and returns the difference.
* @param start The start time
* @param end The end time
* @return The difference time in milliseconds
*/
int64_t
difference_msec(TSMilestonesType ms_start, TSMilestonesType ms_end) const
difference_msec(T ms_start, T ms_end) const
{
if (milestones[ms_end] == 0) {
if (this->_milestones[static_cast<size_t>(ms_end)] == 0) {
return -1;
}
return ink_hrtime_to_msec(milestones[ms_end] - milestones[ms_start]);
return ink_hrtime_to_msec(this->_milestones[static_cast<size_t>(ms_end)] - this->_milestones[static_cast<size_t>(ms_start)]);
}

/**
Expand All @@ -61,17 +71,26 @@ class TransactionMilestones
* @return A double that is the difference time in seconds
*/
double
difference_sec(TSMilestonesType ms_start, TSMilestonesType ms_end) const
difference_sec(T ms_start, T ms_end) const
{
return (double)difference_msec(ms_start, ms_end) / 1000.0;
return static_cast<double>(difference_msec(ms_start, ms_end) / 1000.0);
}

/**
* Takes two milestones and returns the difference.
* @param start The start time
* @param end The end time
* @return The difference time in high-resolution time
*/
ink_hrtime
elapsed(TSMilestonesType ms_start, TSMilestonesType ms_end) const
elapsed(T ms_start, T ms_end) const
{
return milestones[ms_end] - milestones[ms_start];
return this->_milestones[static_cast<size_t>(ms_end)] - this->_milestones[static_cast<size_t>(ms_start)];
}

private:
ink_hrtime milestones[TS_MILESTONE_LAST_ENTRY];
std::array<ink_hrtime, entries> _milestones = {0};
};

// For compatibility with HttpSM.h and HttpTransact.h
using TransactionMilestones = Milestones<TSMilestonesType, TS_MILESTONE_LAST_ENTRY>;
File renamed without changes.
File renamed without changes.
35 changes: 32 additions & 3 deletions proxy/hdrs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ libhdrs_a_SOURCES = \
MIME.cc \
MIME.h \
URL.cc \
URL.h
URL.h \
HuffmanCodec.cc \
HuffmanCodec.h \
XPACK.cc \
XPACK.h

if BUILD_TESTS
libhdrs_a_SOURCES += \
Expand All @@ -62,9 +66,12 @@ load_http_hdr_LDADD = -L. -lhdrs \
$(top_builddir)/src/tscpp/util/libtscpputil.la \
@LIBTCL@

check_PROGRAMS = test_mime
check_PROGRAMS = \
test_mime \
test_Huffmancode \
test_XPACK

TESTS = test_mime
TESTS = $(check_PROGRAMS)

test_mime_LDADD = -L. -lhdrs \
$(top_builddir)/src/tscore/libtscore.la \
Expand All @@ -78,6 +85,28 @@ test_mime_LDADD = -L. -lhdrs \

test_mime_SOURCES = test_mime.cc

test_Huffmancode_LDADD = \
$(top_builddir)/src/tscore/libtscore.la \
$(top_builddir)/src/tscpp/util/libtscpputil.la

test_Huffmancode_SOURCES = \
test_Huffmancode.cc \
HuffmanCodec.cc \
HuffmanCodec.h

test_XPACK_CPPFLAGS = \
$(AM_CPPFLAGS) \
-I$(abs_top_srcdir)/tests/include

test_XPACK_LDADD = \
$(top_builddir)/src/tscore/libtscore.la \
$(top_builddir)/src/tscpp/util/libtscpputil.la

test_XPACK_SOURCES = \
unit_tests/test_XPACK.cc \
HuffmanCodec.cc \
XPACK.cc

#test_UNUSED_SOURCES = \
# test_urlhash.cc

Expand Down
Loading