mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 12:11:02 +00:00
Fix algorithmic complexity of on-demand scheduler with regards to number of cores. (#3190)
We witnessed really poor performance on Rococo, where we ended up with 50 on-demand cores. This was due to the fact that for each core the full queue was processed. With this change full queue processing will happen way less often (most of the time complexity is O(1) or O(log(n))) and if it happens then only for one core (in expectation). Also spot price is now updated before each order to ensure economic back pressure. TODO: - [x] Implement - [x] Basic tests - [x] Add more tests (see todos) - [x] Run benchmark to confirm better performance, first results suggest > 100x faster. - [x] Write migrations - [x] Bump scale-info version and remove patch in Cargo.toml - [x] Write PR docs: on-demand performance improved, more on-demand cores are now non problematic anymore. If need by also the max queue size can be increased again. (Maybe not to 10k) Optional: Performance can be improved even more, if we called `pop_assignment_for_core()`, before calling `report_processed` (Avoid needless affinity drops). The effect gets smaller the larger the claim queue and I would only go for it, if it does not add complexity to the scheduler. --------- Co-authored-by: eskimor <eskimor@no-such-url.com> Co-authored-by: antonva <anton.asgeirsson@parity.io> Co-authored-by: command-bot <> Co-authored-by: Anton Vilhelm Ásgeirsson <antonva@users.noreply.github.com> Co-authored-by: ordian <write@reusable.software>
This commit is contained in:
@@ -399,6 +399,13 @@ pub const MAX_POV_SIZE: u32 = 5 * 1024 * 1024;
|
||||
/// Can be adjusted in configuration.
|
||||
pub const ON_DEMAND_DEFAULT_QUEUE_MAX_SIZE: u32 = 10_000;
|
||||
|
||||
/// Maximum for maximum queue size.
|
||||
///
|
||||
/// Setting `on_demand_queue_max_size` to a value higher than this is unsound. This is more a
|
||||
/// theoretical limit, just below enough what the target type supports, so comparisons are possible
|
||||
/// even with indices that are overflowing the underyling type.
|
||||
pub const ON_DEMAND_MAX_QUEUE_MAX_SIZE: u32 = 1_000_000_000;
|
||||
|
||||
/// Backing votes threshold used from the host prior to runtime API version 6 and from the runtime
|
||||
/// prior to v9 configuration migration.
|
||||
pub const LEGACY_MIN_BACKING_VOTES: u32 = 2;
|
||||
|
||||
Reference in New Issue
Block a user