-
Notifications
You must be signed in to change notification settings - Fork 679
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(bandwidth_scheduler) - Remove BandwidthRequestValues which can ne…
…ver be granted (#12747) As @matejpavlovic pointed out in his NEP review, the last few `BandwidthRequestValues` can never be granted because granting them along with base bandwidth would always cause the shard to exceed `max_shard_bandwidth`. In the current configuration with 6 shards the `base_bandwidth` is set to `61139` and the last few values are `4194304, 4278056, 4389028, 4500000`. But `4278056` can never be granted on a link because `4278056 + 5 * 61139 = 4583751`, which is more than `max_shard_bandwidth` (4_500_000). That makes the last three values useless, they just take up space that could be used for more precise bandwidth requests. Let's solve it by adding a new parameter to `BandwidthSchedulerParams`: `max_single_grant` `max_single_grant` describes the maximum amount of bandwidth that can be granted on a single link. `BandwidthRequestValues` now go only up to `max_single_grant`, as there is no point in requesting more than the maximum that can be granted. We can also get rid of the weird logic of setting one value to `max_receipt_size` because the last value always corresponds to `max_single_grant`, and that's enough to send a max size receipt. Base bandwidth is now calculated using `max_single_grant` instead of `max_receipt_size`. I think it makes much more sense than the previous logic with `max_receipt_size`. Decoupling `max_receipt_size` and `max_single_grant` is also more future proof, it'll keep working even if we reduce `max_receipt_size` to say 1MB in the future. The PR is divided into commits for easier review. --------- Co-authored-by: Matej Pavlovic <[email protected]>
- Loading branch information
1 parent
b6f82d6
commit 515b5fa
Showing
4 changed files
with
83 additions
and
88 deletions.
There are no files selected for viewing
This file contains 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 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 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 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