-
Notifications
You must be signed in to change notification settings - Fork 5.5k
router filter: implement hedge_on_per_try_timeout. #6228
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
Changes from 21 commits
4ab0641
ac2e338
b51e902
6d8497c
19d7651
6447c06
6763000
4777143
140d4ad
655d126
86d61e5
a12c667
1617ffc
89d0fb4
02bc109
7b50e77
4b68740
71ecc25
fce805d
eae3f0a
c8cd2ce
7ea1a8a
e075531
df47fff
bb6a289
08c093c
12f24b5
e4df7be
56be605
bb83438
f68fa0c
01aa62a
8fd4297
b86bd47
88b2c8b
59fe7b8
899dacc
035ebbe
dc9fff4
e3b4396
3ba2e57
7e41cd1
57593fb
f84a666
6eafa00
1344432
0d7a7fc
acb40e0
00f473f
9b3398b
8ecf854
f4e3b9f
647e18f
73b8f53
f7aa990
701ecce
8312bb7
eea37b3
0685088
b29d6ca
ee1a395
73652ee
ca87a4a
5977860
7b721be
a9db675
6d8e7be
35ce081
ec80324
f2c645c
67b7fa9
fcd8ba7
3dafb66
3d0f2a9
488da68
5b92d57
80cf6a1
e1b4e9d
d364c47
1847f33
5977197
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1477,16 +1477,16 @@ bool ConnectionManagerImpl::ActiveStream::verbose() const { | |
|
|
||
| void ConnectionManagerImpl::ActiveStream::callHighWatermarkCallbacks() { | ||
| ++high_watermark_count_; | ||
| if (watermark_callbacks_) { | ||
| watermark_callbacks_->onAboveWriteBufferHighWatermark(); | ||
| for (auto watermark_callbacks : watermark_callbacks_) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add explicit HCM unit tests for these changes? cc @alyssawilk to also look through this part.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also E2E tests if you can. Some of the large body integration test with low buffer limits are worth checking out.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any particular cases you'd like to see covered? I'm not very familiar with the buffer watermark lifecycle. |
||
| watermark_callbacks->onAboveWriteBufferHighWatermark(); | ||
| } | ||
| } | ||
|
|
||
| void ConnectionManagerImpl::ActiveStream::callLowWatermarkCallbacks() { | ||
| ASSERT(high_watermark_count_ > 0); | ||
| --high_watermark_count_; | ||
| if (watermark_callbacks_) { | ||
| watermark_callbacks_->onBelowWriteBufferLowWatermark(); | ||
| for (auto watermark_callbacks : watermark_callbacks_) { | ||
| watermark_callbacks->onBelowWriteBufferLowWatermark(); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -1801,19 +1801,20 @@ void ConnectionManagerImpl::ActiveStreamDecoderFilter:: | |
|
|
||
| void ConnectionManagerImpl::ActiveStreamDecoderFilter::addDownstreamWatermarkCallbacks( | ||
| DownstreamWatermarkCallbacks& watermark_callbacks) { | ||
| // This is called exactly once per stream, by the router filter. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Once per stream" could be updated for clarity. Before, upstream and downstream streams functionally had 1:1 correspondence (well, to be really picky, one a time for retries). Once per upstream-stream? Also I'd be concerned that if you had an upstream which was timing out, it wouldn't be acking data, so your hedge would fail. This is somewhat mitigated by the fact retries currently work for fully buffered requests, but could cause your hedged request to fail due to the outstanding stream, a problematic design flaw which might be worth documenting. Alternately if we can do more to detect problematic configs, say one with a larger listener perConnectionBufferLimitBytes than cluster perConnectionBufferLimitBytes with hedging on.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah interesting, I hadn't thought of that. Do you mind explaining a bit more why the case where listener buffer size is larger than cluster connection buffer size is particularly problematic? Not sure I get that part. |
||
| // If there's ever a need for another filter to subscribe to watermark callbacks this can be | ||
| // turned into a vector. | ||
| ASSERT(parent_.watermark_callbacks_ == nullptr); | ||
| parent_.watermark_callbacks_ = &watermark_callbacks; | ||
| // This is called exactly once per stream, by the router filter. Therefore we | ||
| // expect the same callbacks to not be registered twice. | ||
| ASSERT(std::find(parent_.watermark_callbacks_.begin(), parent_.watermark_callbacks_.end(), | ||
| &watermark_callbacks) == parent_.watermark_callbacks_.end()); | ||
| parent_.watermark_callbacks_.emplace(parent_.watermark_callbacks_.end(), &watermark_callbacks); | ||
| for (uint32_t i = 0; i < parent_.high_watermark_count_; ++i) { | ||
| watermark_callbacks.onAboveWriteBufferHighWatermark(); | ||
| } | ||
| } | ||
| void ConnectionManagerImpl::ActiveStreamDecoderFilter::removeDownstreamWatermarkCallbacks( | ||
| DownstreamWatermarkCallbacks& watermark_callbacks) { | ||
| ASSERT(parent_.watermark_callbacks_ == &watermark_callbacks); | ||
| parent_.watermark_callbacks_ = nullptr; | ||
| ASSERT(std::find(parent_.watermark_callbacks_.begin(), parent_.watermark_callbacks_.end(), | ||
| &watermark_callbacks) != parent_.watermark_callbacks_.end()); | ||
| parent_.watermark_callbacks_.remove(&watermark_callbacks); | ||
| } | ||
|
|
||
| bool ConnectionManagerImpl::ActiveStreamDecoderFilter::recreateStream() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -193,6 +193,13 @@ RetryStatus RetryStateImpl::shouldRetryReset(Http::StreamResetReason reset_reaso | |
| return shouldRetry(wouldRetryFromReset(reset_reason), callback); | ||
| } | ||
|
|
||
| RetryStatus RetryStateImpl::shouldHedgeRetryPerTryTimeout(DoRetryCallback callback) { | ||
| // A hedged retry on per try timeout is always retried if there are retries | ||
| // left. NOTE: this is different than non-hedged per try timeouts which are only retried | ||
| // if RETRY_ON_5XX or RETRY_ON_GATEWAY_ERROR | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is one place I wasn't sure if this is the right thing to do. There was some discussion on #5841 I'm not caught up on yet
mpuncel marked this conversation as resolved.
Outdated
|
||
| return shouldRetry([]() -> bool { return true; }, callback); | ||
| } | ||
|
|
||
| bool RetryStateImpl::wouldRetryFromHeaders(const Http::HeaderMap& response_headers) { | ||
| if (response_headers.EnvoyOverloaded() != nullptr) { | ||
| return false; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.