Skip to content
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

Delayed Write: calculate delay based on current state #276

Closed
Yuval-Ariel opened this issue Nov 27, 2022 · 5 comments · Fixed by #281
Closed

Delayed Write: calculate delay based on current state #276

Yuval-Ariel opened this issue Nov 27, 2022 · 5 comments · Fixed by #281
Assignees

Comments

@Yuval-Ariel
Copy link
Contributor

Yuval-Ariel commented Nov 27, 2022

Owner: yuval

as can be seen in the analysis in #154 (comment) , the current mechanism which calculates the delayed write rate needs improvement.
the current delay rate is calculated in SetupDelay in db/column_family.cc. (called from RecalculateWriteStallConditions)
the problem with the current implementation is that the delayed write rate (DWR from now) is calculated based on the changes in compaction pending bytes between the current and previous call to RecalculateWriteStallConditions (which is called on every InstallSuperVersion ). If compaction pending bytes is less than the prev then it increases the current DWR by 25% and if equal or greater than the prev then it reduces the DWR by 20%.
so no matter by how much the state has changed, the DWR is always changed by the same amount.
furthermore, these changes are bigger the closer we are to the original (user) DWR, e.g. reduce by 20Mb/s from 100Mb/s versus reduce by 2 Mb/s from 10MB/s. so the closer we are to the stop limitation, the less we change the amount by which we delay which is not what we want. we'd like the delay to be small at small violations of the limitations (L0 files, compaction pending bytes, memory) and increase the delay by bigger quantities as we get closer to the stop limitations.

We propose to calculate the DWR based on by how much we're currently in a violation of the limitation and calculate according to the user DWR and not the previously calculated DWR. e.g. if the user DWR is 100MB/s, L0 slowdown is set to 10 and stop is set to 20 files, and there are 14 L0 files:
there are 10 steps until stop. so each step toward the stop is 10MB/s reduction from the delayed rate the user specified and the other way when increasing the write rate.
10 L0 files - 100 Mb/s
11 L0 files - 90 Mb/s
until total stop at 20 L0 files.
same solution for compaction pending bytes and memtables.

@Yuval-Ariel
Copy link
Contributor Author

consider adding the option to the c- API and to the java

Yuval-Ariel added a commit that referenced this issue Dec 14, 2022
Calculate the delayed write rate based on the current state of the CF
based on the value of delayed_write_rate that the user initially set.
The calculation reduces speed linearly with regards to how much
the CF has exceeded the slowdown conditions (L0 files and pending bytes).
The slowdown for writing to the last memtable (when theres more than 3)
is 10 fold
Yuval-Ariel added a commit that referenced this issue Dec 14, 2022
Calculate the delayed write rate based on the current state of the CF
based on the value of delayed_write_rate that the user initially set.
The calculation reduces speed linearly with regards to how much
the CF has exceeded the slowdown conditions (L0 files and pending bytes).
The slowdown for writing to the last memtable (when theres more than 3)
is 10 fold
@Yuval-Ariel
Copy link
Contributor Author

Yuval-Ariel commented Dec 14, 2022

example of the benefits of this approach: red - this branch. green - main branch
image
image

as can be seen, the rate stays mostly stable.

@Yuval-Ariel
Copy link
Contributor Author

Yuval-Ariel commented Dec 14, 2022

QA passed on ffe9b9c

@erez-speedb
Copy link

The Performance tests show no improvements, no degradation on average.
The stability above was shown on the fillup only (single thread), and not with overwrite (multithreads).

Image

This behaviour is not existing with small obj.

Image

@Yuval-Ariel
Copy link
Contributor Author

@erez-speedb , regarding the 25% deterioration in the fillup of the small obj test:
i've looked at the LOGs of the small obj results and the new code isnt reached at all (there are no cases when Speedb is in a delayed state) so the difference in performance is because of something else. can you guess why?

Yuval-Ariel added a commit that referenced this issue Dec 19, 2022
Calculate the delayed write rate based on the current state of the CF
based on the value of delayed_write_rate that the user initially set.
The calculation reduces speed linearly with regards to how much
the CF has exceeded the slowdown conditions (L0 files and pending bytes).
The slowdown for writing to the last memtable (when theres more than 3)
is 10 fold
Yuval-Ariel added a commit that referenced this issue Dec 20, 2022
Calculate the delayed write rate based on the current state of the CF
based on the value of delayed_write_rate that the user initially set.
The calculation reduces speed linearly with regards to how much
the CF has exceeded the slowdown conditions (L0 files and pending bytes).
The slowdown for writing to the last memtable (when theres more than 3)
is 10 fold
erez-speedb added a commit that referenced this issue Dec 25, 2022
Yuval-Ariel added a commit that referenced this issue May 1, 2023
Calculate the delayed write rate based on the current state of the CF
based on the value of delayed_write_rate that the user initially set.
The calculation reduces speed linearly with regards to how much
the CF has exceeded the slowdown conditions (L0 files and pending bytes).
The slowdown for writing to the last memtable (when theres more than 3)
is 10 fold
Yuval-Ariel added a commit that referenced this issue May 4, 2023
Calculate the delayed write rate based on the current state of the CF
based on the value of delayed_write_rate that the user initially set.
The calculation reduces speed linearly with regards to how much
the CF has exceeded the slowdown conditions (L0 files and pending bytes).
The slowdown for writing to the last memtable (when theres more than 3)
is 10 fold
udi-speedb pushed a commit that referenced this issue Nov 13, 2023
Calculate the delayed write rate based on the current state of the CF
based on the value of delayed_write_rate that the user initially set.
The calculation reduces speed linearly with regards to how much
the CF has exceeded the slowdown conditions (L0 files and pending bytes).
The slowdown for writing to the last memtable (when theres more than 3)
is 10 fold
udi-speedb pushed a commit that referenced this issue Nov 15, 2023
Calculate the delayed write rate based on the current state of the CF
based on the value of delayed_write_rate that the user initially set.
The calculation reduces speed linearly with regards to how much
the CF has exceeded the slowdown conditions (L0 files and pending bytes).
The slowdown for writing to the last memtable (when theres more than 3)
is 10 fold
udi-speedb pushed a commit that referenced this issue Dec 3, 2023
Calculate the delayed write rate based on the current state of the CF
based on the value of delayed_write_rate that the user initially set.
The calculation reduces speed linearly with regards to how much
the CF has exceeded the slowdown conditions (L0 files and pending bytes).
The slowdown for writing to the last memtable (when theres more than 3)
is 10 fold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Shipped
Development

Successfully merging a pull request may close this issue.

2 participants