-
Notifications
You must be signed in to change notification settings - Fork 5.3k
overload: remove createScaledTimer with OverloadTimerType #14536
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scale lookups could be made constant by using an array as a representation instead of a map. The new API seems more complex. What are your thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still an extra lookup. The goal of this change is to allow implementing the TLS handshake scaled timeout without plumbing around the entire thread-local overload state. Instead we can pass around a ScaledTimerMinimum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the API more usable with the lookup? We should optimize for humans rather than micro optimizing machine cycles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goals here are
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all started with the SSL connection case. How does this change address the need to plumb this minimum to ServerConnectionImpl's constructor as done in https://github.com/envoyproxy/envoy/pull/13800/files#diff-3ee563f926e7a290ac2d07369316327fbdf327c89db4a9faef2bf382e33fc0c2 ?
Having the creation mechanism in the dispatcher take an enum clearly answers the plumbing question. It is less clear how to address the plumbing issue after this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd still need to plumb the minimum there, but as a value object, not a reference with potential lifetime issues. I'm imagining
ServerConnectionImpl::setTransportSocketConnectTimeoutwould calldispatcher_->createScaledTimerwith the minimum value from the constructor.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be worth sketching out the full change. At least my pushback on that PR was related to the large nature of the changes. Having to plumb the minimum would still require extensive changes. Please talk to @ggreenway about his opinion about this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, here's my thinking. Right now, the ThreadLocalOverloadState (TLOS) is used to create scaled timers, either by providing a ScaledTimerMinimum value or an OverloadTimerType enum value. If the enum is provided, the TLOS does a lookup in its table to find the mapped ScaledTimerMinimum, if any. Assuming we keep the OverloadTimerType enum, we have to have that map somewhere. Here are some options I've come up with:
I'm not a big fan of 3 since it feels like adding bloat to the DispatcherImpl. I do like that it doesn't require plumbing a bunch of stuff everywhere, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are your thoughts of having the ScaledTimerManager keep the mapping of enum values to minimums? The dispatcher would own the ScaledTimerManager and delegate creation of scaled timers to it.
There is still the question of how to get the map to the dispatcher constructor. I'm guessing that passing in the singleton overload manager to the dispatcher constructor would be a suitable solution. Passing in a thread local overload state to the dispatcher constructor would also work. Acquiring the map on the first overload state update would be fine too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not too terrible. We'd want to have a way of injecting/modifying the ScaledTimerManager in the Dispatcher already for testing purposes, and we could use that here as well. I'll play around with different ways of getting the map in.