feat(layer): add throttle layer#2444
Merged
Xuanwo merged 4 commits intoapache:mainfrom Jun 13, 2023
Merged
Conversation
6dbe3e9 to
a917016
Compare
Xuanwo
reviewed
Jun 10, 2023
a917016 to
9a7bf48
Compare
Xuanwo
reviewed
Jun 13, 2023
Member
Xuanwo
left a comment
There was a problem hiding this comment.
Mostly LGTM, only some naming related issues.
Member
Author
|
BTW, there are still 2 todo item comments inside this PR:
If you believe that they are not essential, then I will remove them. |
Member
We can get the read size and wait for them. But it may be complex for waiting in
Current behavior LGTM. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Background
As there's no open-source repository that uses Governor to limit bandwidth so far IMK, it's mostly used to limit the number of requests, e.g. tower-governor (although Governor can theoretically limit any element).
There's an issue asked by Quickwit's author about how to use Governor to limit IO throughput, but he ended up using async-speed-limit for Quickwit (PR, which also seems to use a truncated byte stream implementation.).
My current implementation uses the answer provided in the above issue by the Governor author. However, it's rough and untested, and there are some uncertainties that I left comments inline. Things I need more information to confirm include:
inner.read()implementor's behavior?(I assume)?