Skip to content

http/2: remove upstream max concurrent streams check#981

Merged
mattklein123 merged 9 commits intoenvoyproxy:masterfrom
jwfang:issue963
May 19, 2017
Merged

http/2: remove upstream max concurrent streams check#981
mattklein123 merged 9 commits intoenvoyproxy:masterfrom
jwfang:issue963

Conversation

@jwfang
Copy link
Copy Markdown
Contributor

@jwfang jwfang commented May 17, 2017

try to implement #963 , for preview

current only upstream/client side of max stream config,

other thing to be done:

  1. listener side config and nghttp2 setting;
  2. docs

@mattklein123
Copy link
Copy Markdown
Member

@jwfang in thinking about this a bit more, I think we should just delete the check on the client side connection pool: https://github.com/lyft/envoy/blob/master/source/common/http/http2/conn_pool.cc#L85

Basically, delete that line and remove all occurrences of maxConcurrentStreams() function. The reason for this is that we already have protection via circuit breakers. There is no point in having additional protection (other than potentially for push, which we don't support currently, and can deal with later). If we overflow the other side, the code will correctly handle the REFUSED_STREAM reset that happens.

This should still be configurable on the listener side of things, but that could be done in a different change if you want if that is not a problem that you have.

@jwfang
Copy link
Copy Markdown
Contributor Author

jwfang commented May 18, 2017

great, that's what i am confused too.

in theory, for upstream connection, i think we need to check against MAX_STREAM setting from the server, not envoy's limit.
i guess envoy's upstream limit is another net previously. since we don't need it any more, this cleared my confusion.

i will do it as you suggested when at the office. for listener side MAX_STREAM, can you give me some guide ?

@jwfang
Copy link
Copy Markdown
Contributor Author

jwfang commented May 18, 2017

BTW, do you know what's the behaviour for nghttp2 when we overflow MAX_STREAM?
for both sending and receiving.

@mattklein123
Copy link
Copy Markdown
Member

This is a little confusing so I will discuss upstream and listener side independently.

Both sides: it comes down to actually setting max concurrent streams in the http/2 settings frame here: https://github.com/lyft/envoy/blob/master/source/common/http/http2/codec_impl.cc#L509. Currently we do this the same for both client and server connections. The client side connection actually doesn't do anything, since this only affects the number of allowed incoming streams. It would effect push streams, but we don't support that currently, so it's effectively NOP.

Upstream: So for upstream, the settings frame basically does nothing, which is why the check should be removed. I think I originally added this since we run Envoy everywhere in an http/2 mesh and at some point it made sense to do an early check since I know what the other side is doing. However in general, this makes no sense, so just kill the check entirely. IIRC nghttp2 will auto fail a new stream locally if it knows the remote side can't take it. Envoy will correctly 503 the request. Optimally, we would listen to the incoming settings frame from the other side, and know what the limit is, and then fail it, with a good stat. We could file a different issue on doing that.

Downstream/listener: If you don't care about this for your use case, I would just ignore in this PR and we can deal with it some other time and just note in the issue. If you do care, you basically have to plumb through the limit from the config all the way to the codec. Basically, figure out how uint64_t codec_options gets to the codec from the listener. Switch that to a struct CodecOptions which contains both some flags (current options) as well as the ability to set max concurrent streams. Then just plumb that all the way through and use it to fill in the outbound settings.

方俊武 added 2 commits May 18, 2017 11:16
The reason for this is that we already have protection via circuit breakers.
There is no point in having additional protection (other than potentially
for push, which we don't support currently, and can deal with later). If we
overflow the other side, the code will correctly handle the REFUSED_STREAM
reset that happens.
@jwfang
Copy link
Copy Markdown
Contributor Author

jwfang commented May 18, 2017

thanks for your detailed explanation.

then are we going to remove the hard-coded max stream check ( this pull request)?
and then fire two separate issues for:

  1. upstream using peer max stream setting
  2. listeners advertise envoy's max stream setting

the later two issues maybe a little hard for me at the moment, but i will try to see if i can help.

方俊武 added 4 commits May 18, 2017 12:19
The reason for this is that we already have protection via circuit breakers.
There is no point in having additional protection (other than potentially
for push, which we don't support currently, and can deal with later). If we
overflow the other side, the code will correctly handle the REFUSED_STREAM
reset that happens.
@jwfang jwfang closed this May 18, 2017
@jwfang jwfang deleted the issue963 branch May 18, 2017 08:45
it seems the whole TEST_F(Http2ConnPoolImplTest, MaxRequests) is for
the max_concurrent_request thing, so i delete it.
@jwfang
Copy link
Copy Markdown
Contributor Author

jwfang commented May 18, 2017

added #988 and #987

@mattklein123 mattklein123 changed the title cluster max_concurrent_streams config http/2: remove upstream max concurrent streams check May 18, 2017
@mattklein123
Copy link
Copy Markdown
Member

@jwfang thanks, I think this is the right fix. Please sign the CLA: https://oss.lyft.com/cla/#/signature

@jwfang
Copy link
Copy Markdown
Contributor Author

jwfang commented May 19, 2017

@mattklein123 signed

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mattklein123 mattklein123 merged commit 56a8c03 into envoyproxy:master May 19, 2017
rshriram pushed a commit to rshriram/envoy that referenced this pull request Oct 30, 2018
Automatic merge from submit-queue.

[DO NOT MERGE] Auto PR to update dependencies of proxy

This PR will be merged automatically once checks are successful.
```release-note
none
```
jpsim pushed a commit that referenced this pull request Nov 28, 2022
Description: update Envoy to f958d39. Format checker required moving away from std::unordered_map. Additionally, link stamping changed significantly. New bazel targets adapt to the new mechanisms.
Risk level: increase in binary size, need to re-analyze #983
Testing: CI

Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
Description: update Envoy to f958d39. Format checker required moving away from std::unordered_map. Additionally, link stamping changed significantly. New bazel targets adapt to the new mechanisms.
Risk level: increase in binary size, need to re-analyze #983
Testing: CI

Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: JP Simard <jp@jpsim.com>
mathetake added a commit that referenced this pull request Mar 3, 2026
**Description**

This commit adds support for configuring additional metrics labels
corresponding to request headers. Notably, this adds a new flag to the
controller `metricsRequestHeaderLabelMapping` that will be validated and
propagated to the extproc.

The flag is in the format of the comma separated key value pairs as in
"header1:label1,header2:label2,..."

Fixes #848

---------

Signed-off-by: Suren Raju <suren.raju@careem.com>
Co-authored-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
mathetake added a commit that referenced this pull request Mar 3, 2026
**Description**

This fixes the naming for the additional label configuration from
`metricsRequestHeaderLabelMapping` to `metricsRequestHeaderLabels`, and
fixed a bug in helm. Additionally, this adds an end to end test case to
verify this flag working.


**Related Issues/PRs (if applicable)**

Follow up on #981

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
mathetake added a commit that referenced this pull request Mar 3, 2026
**Description**

Previously, we had "filterapi/x" package to enable advanced users to
build their own extproc with some custom metrics handling. In practice,
the only use case was to "add some headers as a labels of metrics". Now
that #981 is in, that can be achieved without rebuilding extproc by
themselves by utilizing the new flag. Therefore, this removes the
package altogether to eliminate the unnecessary code.

**Related Issues/PRs (if applicable)**

Follow up on #981

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants