Skip to content
Merged
Show file tree
Hide file tree
Changes from 41 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
Comment thread
mattklein123 marked this conversation as resolved.
// on a single connection. If the limit is reached, Envoy may queue requests or establish
// additional connections (as allowed per circuit breaker limits).
Comment thread
ggreenway marked this conversation as resolved.
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
22 changes: 14 additions & 8 deletions docs/root/intro/arch_overview/upstream/circuit_breaking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
Circuit breaking
================

.. attention::

Circuit breaking behavior changed in version 1.14. If the previous behavior (documented `here <https://www.envoyproxy.io/docs/envoy/v1.13.0/intro/arch_overview/upstream/circuit_breaking>`
is needed, disable 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. Note that the old behavior is deprecated and will be removed according to the deprecation
policy.

Circuit breaking is a critical component of distributed systems. It’s nearly always better to fail
quickly and apply back pressure downstream as soon as possible. One of the main benefits of an Envoy
mesh is that Envoy enforces circuit breaking limits at the network level as opposed to having to
Expand All @@ -12,23 +20,21 @@ 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
waiting for a ready connection pool connection. Since HTTP/2 allows many requests concurrently over a single
connection, this circuit breaker only comes into play as the initial connection is created,
Comment thread
ggreenway marked this conversation as resolved.
Outdated
as requests will be multiplexed immediately afterwards. For HTTP/1.1, requests are added to the list
as requests will be multiplexed immediately afterwards (unless :ref:`max concurrent streams <envoy_api_field_core.Http2ProtocolOptions.max_concurrent_streams>`
is configured). For HTTP/1.1, 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
: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
1 change: 1 addition & 0 deletions docs/root/intro/version_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ 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.
Comment thread
ggreenway marked this conversation as resolved.
Outdated

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