Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
a38c215
http: extract conn pool behavior into base class
Dec 14, 2019
77f16dd
Merge branch 'master' into h2-combined
ggreenway Dec 20, 2019
c6ca9b7
Fix build: logger
ggreenway Dec 20, 2019
249770b
fix tests build
ggreenway Dec 21, 2019
579dbef
more build fixes
ggreenway Dec 21, 2019
e7a0587
Improve docs for LinkedObject::moveBetweenLists
ggreenway Jan 7, 2020
4e2c147
Phase one: moved some logic to base class.
ggreenway Jan 7, 2020
75bdc34
Merge remote-tracking branch 'upstream/master' into h2-combined
ggreenway Jan 7, 2020
3a35fa6
Working version; tests pass
ggreenway Jan 9, 2020
379cdb1
Merge remote-tracking branch 'upstream/master' into h2-combined
ggreenway Jan 9, 2020
6c5f650
fix_format
ggreenway Jan 9, 2020
206c6f3
cleanup: remove maxTotalStreams(), used only by tests.
ggreenway Jan 9, 2020
30c38e9
cleanup: translate 0 to MAX so that special code for zero isn't needed
ggreenway Jan 9, 2020
85b0e6e
upstream: Enforce max_concurrent_streams on http2 upstream pools.
ggreenway Jan 9, 2020
8a53fd5
Remove now-unneeded ENVOY_CONN_ID_LOG.
ggreenway Jan 9, 2020
107abcb
grammar/whitespace
ggreenway Jan 9, 2020
6fb21fd
Fix ASAN error when destructing a pool with connections still in it.
ggreenway Jan 10, 2020
f145d10
Fix ASAN failure in test code (mutate vector while iterating)
ggreenway Jan 10, 2020
c792feb
Merge remote-tracking branch 'upstream/master' into h2-combined
ggreenway Jan 11, 2020
32252a6
apply api change to v3alpha to fix CI
ggreenway Jan 13, 2020
7f0656b
code review fixes
ggreenway Jan 14, 2020
26b9a91
Merge remote-tracking branch 'upstream/master' into h2-combined
ggreenway Jan 14, 2020
4f95f95
Add more test coverage for h2 draining
ggreenway Jan 17, 2020
c733911
Merge remote-tracking branch 'upstream/master' into h2-combined
ggreenway Jan 17, 2020
97086dc
Comment about list movement
ggreenway Jan 17, 2020
3370f19
Make hasActiveConnections() O(1)
ggreenway Jan 17, 2020
602e198
anytime -> any time
ggreenway Jan 17, 2020
b017f14
Add coverage for stat upstream_cx_active
ggreenway Jan 17, 2020
898b4e6
naming: toClose -> to_close
ggreenway Jan 17, 2020
c921dd2
Better comment on special case
ggreenway Jan 17, 2020
bff92b5
fix_format again (did a merge eat this diff?)
ggreenway Jan 17, 2020
32fbddd
Remove unused http1settings param
ggreenway Jan 17, 2020
1d8ce78
fix generated_api_shadow
ggreenway Jan 17, 2020
eb09181
Add the original conn_pool code back as _legacy; add a runtime-feature
ggreenway Jan 17, 2020
562bbfe
Rename legacy test class to avoid a name conflict to make gtest happy
ggreenway Jan 21, 2020
2439fa5
Merge remote-tracking branch 'upstream/master' into h2-combined
ggreenway Jan 21, 2020
9e4f045
Fix code review issues
ggreenway Jan 23, 2020
3ea1285
Merge remote-tracking branch 'upstream/master' into h2-combined
ggreenway Jan 23, 2020
b4f7ef5
docs
ggreenway Jan 23, 2020
0197d3e
try to fix docs build
ggreenway Jan 24, 2020
37a1e61
more doc fixes
ggreenway Jan 24, 2020
b27cb5b
Merge remote-tracking branch 'upstream/master' into h2-combined
ggreenway Jan 24, 2020
aebea9e
prune unneeded deps
ggreenway Jan 24, 2020
2b24f00
code review items
ggreenway Jan 24, 2020
f891652
Fix two bugs:
ggreenway Jan 24, 2020
7b8857f
More doc changes: deprecated.rst, circuit breakers, and conn pool docs.
ggreenway Jan 24, 2020
1a826d4
formatting of md
ggreenway Jan 24, 2020
51bc879
properly mark as external link
ggreenway Jan 24, 2020
7c5d261
Fix a bug introduced in last change that could put
ggreenway Jan 28, 2020
dab1c60
doc fixes
ggreenway Jan 29, 2020
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
4 changes: 4 additions & 0 deletions api/envoy/api/v2/core/protocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ message Http2ProtocolOptions {
// `Maximum concurrent streams <https://httpwg.org/specs/rfc7540.html#rfc.section.5.1.2>`_
// allowed for peer on one HTTP/2 connection. Valid values range from 1 to 2147483647 (2^31 - 1)
// and defaults to 2147483647.
//
// For upstream connections, this also limits how many streams Envoy will initiate concurrently
// on a single connection. If the limit is reached, Envoy may queue requests or establish
// additional connections (as allowed per circuit breaker limits).
google.protobuf.UInt32Value max_concurrent_streams = 2
[(validate.rules).uint32 = {lte: 2147483647 gte: 1}];

Expand Down
4 changes: 4 additions & 0 deletions api/envoy/config/core/v3/protocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ message Http2ProtocolOptions {
// `Maximum concurrent streams <https://httpwg.org/specs/rfc7540.html#rfc.section.5.1.2>`_
// allowed for peer on one HTTP/2 connection. Valid values range from 1 to 2147483647 (2^31 - 1)
// and defaults to 2147483647.
//
// For upstream connections, this also limits how many streams Envoy will initiate concurrently
// on a single connection. If the limit is reached, Envoy may queue requests or establish
// additional connections (as allowed per circuit breaker limits).
google.protobuf.UInt32Value max_concurrent_streams = 2
[(validate.rules).uint32 = {lte: 2147483647 gte: 1}];

Expand Down
19 changes: 8 additions & 11 deletions docs/root/intro/arch_overview/upstream/circuit_breaking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,20 @@ configure and code each application independently. Envoy supports various types
.. _arch_overview_circuit_break_cluster_maximum_connections:

* **Cluster maximum connections**: The maximum number of connections that Envoy will establish to
all hosts in an upstream cluster. In practice this is only applicable to HTTP/1.1 clusters since
HTTP/2 uses a single connection to each host. If this circuit breaker overflows the :ref:`upstream_cx_overflow
all hosts in an upstream cluster. If this circuit breaker overflows the :ref:`upstream_cx_overflow
<config_cluster_manager_cluster_stats>` counter for the cluster will increment.
* **Cluster maximum pending requests**: The maximum number of requests that will be queued while
waiting for a ready connection pool connection. Since HTTP/2 requests are sent over a single
connection, this circuit breaker only comes into play as the initial connection is created,
as requests will be multiplexed immediately afterwards. For HTTP/1.1, requests are added to the list
waiting for a ready connection pool connection. Requests are added to the list
of pending requests whenever there aren't enough upstream connections available to immediately dispatch
the request, so this circuit breaker will remain in play for the lifetime of the process.
If this circuit breaker overflows the
the request. For HTTP/2 connections, if :ref:`max concurrent streams <envoy_api_field_core.Http2ProtocolOptions.max_concurrent_streams>`
and :ref:`max requests per connection <envoy_api_field_Cluster.max_requests_per_connection>` are not
configured, all requests will be multiplexed over the same connection so this circuit breaker
will only be hit when no connection is already established. If this circuit breaker overflows the
:ref:`upstream_rq_pending_overflow <config_cluster_manager_cluster_stats>` counter for the cluster will
increment.
* **Cluster maximum requests**: The maximum number of requests that can be outstanding to all hosts
in a cluster at any given time. In practice this is applicable to HTTP/2 clusters since HTTP/1.1
clusters are governed by the maximum connections circuit breaker. If this circuit breaker
overflows the :ref:`upstream_rq_pending_overflow <config_cluster_manager_cluster_stats>` counter
for the cluster will increment.
in a cluster at any given time. If this circuit breaker overflows the :ref:`upstream_rq_pending_overflow <config_cluster_manager_cluster_stats>`
counter for the cluster will increment.
* **Cluster maximum active retries**: The maximum number of retries that can be outstanding to all
hosts in a cluster at any given time. In general we recommend using :ref:`retry budgets <envoy_api_field_cluster.CircuitBreakers.Thresholds.retry_budget>`; however, if static circuit breaking is preferred it should aggressively circuit break
retries. This is so that retries for sporadic failures are allowed, but the overall retry volume cannot
Expand Down
11 changes: 8 additions & 3 deletions docs/root/intro/arch_overview/upstream/connection_pooling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ downstream request must be reset if the upstream connection is severed.
HTTP/2
------

The HTTP/2 connection pool acquires a single connection to an upstream host. All requests are
multiplexed over this connection. If a GOAWAY frame is received or if the connection reaches the
maximum stream limit, the connection pool will create a new connection and drain the existing one.
The HTTP/2 connection pool multiplexes multiple requests over a single connection, up to the limits
imposed by :ref:`max concurrent streams <envoy_api_field_core.Http2ProtocolOptions.max_concurrent_streams>`
and :ref:`max requests per connection <envoy_api_field_Cluster.max_requests_per_connection>`.
The HTTP/2 connection pool establishes only as many connections as are needed to serve the current
requests. With no limits, this will be only a single connection. If a GOAWAY frame is received or
if the connection reaches the maximum stream limit, the connection pool will drain the existing one.
New connections are established anytime there is a pending request without a connection that it can
be dispatched to (up to circuit breaker limits for connections).
HTTP/2 is the preferred communication protocol as connections rarely if ever get severed.

.. _arch_overview_conn_pool_health_checking:
Expand Down
3 changes: 3 additions & 0 deletions docs/root/intro/deprecated.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Deprecated items below are listed in chronological order.

1.14.0 (Pending)
================
* The previous behavior for upstream connection pool circuit breaking described
`here <https://www.envoyproxy.io/docs/envoy/v1.13.0/intro/arch_overview/upstream/circuit_breaking>`_ has
been deprecated in favor of the new behavior described :ref:`here <arch_overview_circuit_break>`.

1.13.0 (January 20, 2020)
=========================
Expand Down
8 changes: 8 additions & 0 deletions docs/root/intro/version_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ Version history
================
* config: use type URL to select an extension whenever the config type URL (or its previous versions) uniquely identify a typed extension, see :ref:`extension configuration <config_overview_extension_configuration>`.
* retry: added a retry predicate that :ref:`rejects hosts based on metadata. <envoy_api_field_route.RetryPolicy.retry_host_predicate>`
* upstream: combined HTTP/1 and HTTP/2 connection pool code. This means that circuit breaker
limits for both requests and connections apply to both pool types. Also, HTTP/2 now has
the option to limit concurrent requests on a connection, and allow multiple draining
connections. The old behavior is deprecated, but can be used during the deprecation
period by disabling runtime feature "envoy.reloadable_features.new_http1_connection_pool_behavior" or
"envoy.reloadable_features.new_http2_connection_pool_behavior" and then re-configure your clusters or
restart Envoy. The behavior will not switch until the connection pools are recreated. The new
circuit breaker behavior is described :ref:`here <arch_overview_circuit_break>`.
* upstream: changed load distribution algorithm when all priorities enter :ref:`panic mode<arch_overview_load_balancing_panic_threshold>`.

1.13.0 (January 20, 2020)
Expand Down
4 changes: 4 additions & 0 deletions generated_api_shadow/envoy/api/v2/core/protocol.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions generated_api_shadow/envoy/config/core/v3/protocol.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions source/common/common/linked_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ template <class T> class LinkedObject {
bool inserted() { return inserted_; }

/**
* Move a linked item between 2 lists.
* @param list1 supplies the first list.
* @param list2 supplies the second list.
* Move a linked item from src list to dst list.
* @param src supplies the list that the item is currently in.
* @param dst supplies the destination list for the item.
*/
void moveBetweenLists(ListType& list1, ListType& list2) {
void moveBetweenLists(ListType& src, ListType& dst) {
ASSERT(inserted_);
ASSERT(std::find(list1.begin(), list1.end(), *entry_) != list1.end());
ASSERT(std::find(src.begin(), src.end(), *entry_) != src.end());

list2.splice(list2.begin(), list1, entry_);
dst.splice(dst.begin(), src, entry_);
}

/**
Expand Down
14 changes: 14 additions & 0 deletions source/common/http/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ envoy_cc_library(
name = "conn_pool_base_lib",
srcs = ["conn_pool_base.cc"],
hdrs = ["conn_pool_base.h"],
deps = [
":codec_client_lib",
"//include/envoy/http:conn_pool_interface",
"//include/envoy/stats:timespan_interface",
"//source/common/common:linked_object",
"//source/common/stats:timespan_lib",
"//source/common/upstream:upstream_lib",
],
)

envoy_cc_library(
name = "conn_pool_base_legacy_lib",
srcs = ["conn_pool_base_legacy.cc"],
hdrs = ["conn_pool_base_legacy.h"],
deps = [
"//include/envoy/http:conn_pool_interface",
"//include/envoy/stats:timespan_interface",
Expand Down
Loading