flow-control: fix compaction slowdown caused by increased flow-control thresholds.#18710
Conversation
7de2145 to
3be7d14
Compare
|
/retest |
|
/hold |
src/config/mod.rs
Outdated
| ); | ||
| $cf_opts.level0_slowdown_writes_trigger = $cfg.l0_files_threshold as i32; | ||
| } | ||
| // Keep override for level0_stop_writes_trigger to ensure ingest_maybe_stall |
There was a problem hiding this comment.
nit: this may highlight their differences?
| // Keep override for level0_stop_writes_trigger to ensure ingest_maybe_stall | |
| // If unset, `level0_stop_writes_trigger` defaults to `l0_files_threshold` (unlike `level0_slowdown_writes_trigger`, which defaults to 20) to ensure ingest_maybe_stall |
components/engine_rocks/src/misc.rs
Outdated
| // Use level0_stop_writes_trigger instead of level0_slowdown_writes_trigger | ||
| // to integrate with flow control while preserving RocksDB's compaction speed-up | ||
| // mechanism | ||
| let stop_trigger = options.get_level_zero_stop_writes_trigger(); |
There was a problem hiding this comment.
this is confusing, why not use flow_control.l0-threshold directly?
There was a problem hiding this comment.
+1. flow control parameters should be used here, rocksdb parameters should only be used to control the rocks internal compaction scheduling.
There was a problem hiding this comment.
@Connor1996 @glorv
Absolutely, flow-control.l0-file-threshold is a prefect fit here. But the problem is — how can we access the flow-contrl configuration from the engine_rocks module? There isn't a proper way to do that, since flow-control is on the upper storage module.
Ideally, flow-control should be indendent module that can be accessed by both the storage module and engine_rocks, but that's not an easy thing.
I guess that's why the original code uses level0-slowdown-writes-trigger instead of l0-file-threshold, right?
| pub target_file_size_base: Option<ReadableSize>, | ||
| pub level0_file_num_compaction_trigger: i32, | ||
| pub level0_slowdown_writes_trigger: Option<i32>, | ||
| pub level0_slowdown_writes_trigger: i32, |
There was a problem hiding this comment.
Why only change slowdown but not stop_writes? Is stop_writes still useful when write_stall is disabled?
There was a problem hiding this comment.
Why only change slowdown but not stop_writes?
The default stop_writes(36) is larger than l0-file-threshold(20). If we use this default, we cannot identify and log a warning when the user manually sets stop_writes to a larger value, as we did in the previous logic.
Is stop_writes still useful when write_stall is disabled?
No.
There was a problem hiding this comment.
Ok. Please add a comment on level0_slowdown_writes_trigger as it is useless when disable_write_stall is on.
There was a problem hiding this comment.
Sorry for the wrong reply.
When disable_write_stall is on, level0_slowdown_writes_trigger is used for compaction speed-up mechanism, and level0_stop_writes_triiger is used for determine wheter triggering a write stall.
There was a problem hiding this comment.
Comments are already in fill_cf_opt!
|
/retest |
Signed-off-by: hhwyt <hhwyt1@gmail.com> address comments Signed-off-by: hhwyt <hhwyt1@gmail.com> set default values Signed-off-by: hhwyt <hhwyt1@gmail.com> flow-control: remove override for level0-slowdown-writes-trigger and soft-pending-compaction-bytes-limit Signed-off-by: hhwyt <hhwyt1@gmail.com>
Signed-off-by: hhwyt <hhwyt1@gmail.com>
77278e6 to
af7a83a
Compare
Signed-off-by: hhwyt <hhwyt1@gmail.com>
Signed-off-by: hhwyt <hhwyt1@gmail.com>
|
/unhold |
|
/cc @zhangjinpeng87 @cfzjywxk PTAL for the config change |
|
@glorv: GitHub didn't allow me to request PR reviews from the following users: the, config, change, PTAL, for. Note that only tikv members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hbisheng, v01dstar, zhangjinpeng87 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
In response to a cherrypick label: new pull request created to branch |
…l thresholds. (tikv#18710) close tikv#18708 This PR addresses performance stability issues caused by increasing storage.flow-control.l0-file-threshold and storage.flow-control.soft-pending-compaction-bytes-limit. Previously, raising these values could reduce the effectiveness of RocksDB’s compaction speed-up mechanism, because the RocksDB internal thresholds (level0-slowdown-writes-trigger and soft-pending-compaction-bytes-limit) would be overridden, delaying compaction acceleration. Key improvements: 1. Conditional override of RocksDB thresholds: - level0-slowdown-writes-trigger is overridden by l0-file-threshold only if it is smaller. - soft-pending-compaction-bytes-limit is overridden only if it is smaller than storage.flow-control.soft-pending-compaction-bytes-limit. This ensures that increasing flow-control settings does not weaken compaction acceleration, while user-configured RocksDB thresholds that are larger than the flow-control limits are overriden, allowing compaction speed-up to trigger before write flow control. flow control. 3. Updated write stall check: - ingest_maybe_slowdown_writes now uses level0-stop-writes-trigger instead of level0-slowdown-writes-trigger to determine whether ingest may trigger a write stall. - This keeps the original behavior, since `l0-file-threshold` overrides `level0-stop-writes-trigger`, just like the previous behavior with `level0-slowdown-writes-trigger`. Ideally, flow-control settings would be used directly to determine write stalls, but `ingest_maybe_slowdown_writes` cannot access the flow-control module configuration because this function resides inside the Engine module。 After this change, write control effectively has three stages: 1. Compaction acceleration: triggered when RocksDB thresholds are reached. 2. Flow control: triggered at storage.flow-control.l0-file-threshold and storage.flow-control.soft-pending-compaction-bytes-limit. 4. Stop writes: triggered at storage.flow-control.hard-pending-compaction-bytes-limit. Signed-off-by: hhwyt <hhwyt1@gmail.com> Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
…l thresholds. (#18710) (#18994) close #18708 This PR addresses performance stability issues caused by increasing storage.flow-control.l0-file-threshold and storage.flow-control.soft-pending-compaction-bytes-limit. Previously, raising these values could reduce the effectiveness of RocksDB’s compaction speed-up mechanism, because the RocksDB internal thresholds (level0-slowdown-writes-trigger and soft-pending-compaction-bytes-limit) would be overridden, delaying compaction acceleration. Key improvements: 1. Conditional override of RocksDB thresholds: - level0-slowdown-writes-trigger is overridden by l0-file-threshold only if it is smaller. - soft-pending-compaction-bytes-limit is overridden only if it is smaller than storage.flow-control.soft-pending-compaction-bytes-limit. This ensures that increasing flow-control settings does not weaken compaction acceleration, while user-configured RocksDB thresholds that are larger than the flow-control limits are overriden, allowing compaction speed-up to trigger before write flow control. flow control. 3. Updated write stall check: - ingest_maybe_slowdown_writes now uses level0-stop-writes-trigger instead of level0-slowdown-writes-trigger to determine whether ingest may trigger a write stall. - This keeps the original behavior, since `l0-file-threshold` overrides `level0-stop-writes-trigger`, just like the previous behavior with `level0-slowdown-writes-trigger`. Ideally, flow-control settings would be used directly to determine write stalls, but `ingest_maybe_slowdown_writes` cannot access the flow-control module configuration because this function resides inside the Engine module。 After this change, write control effectively has three stages: 1. Compaction acceleration: triggered when RocksDB thresholds are reached. 2. Flow control: triggered at storage.flow-control.l0-file-threshold and storage.flow-control.soft-pending-compaction-bytes-limit. 4. Stop writes: triggered at storage.flow-control.hard-pending-compaction-bytes-limit. Signed-off-by: hhwyt <hhwyt1@gmail.com> Co-authored-by: hhwyt <hhwyt1@gmail.com>
What is changed and how it works?
Issue Number: Close #18708
What's Changed:
Related changes
pingcap/docs/pingcap/docs-cn:TODO
Check List
Tests
Side effects
Release note