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

Global delayed write rate #346

Closed
bosmatt opened this issue Oct 20, 2022 · 15 comments · Fixed by #392
Closed

Global delayed write rate #346

bosmatt opened this issue Oct 20, 2022 · 15 comments · Fixed by #392
Assignees
Labels

Comments

@bosmatt
Copy link
Contributor

bosmatt commented Oct 20, 2022

What:
Delayed write rate in a system level - shared to all DBs
Why:
The current delayed write mechanism allows the user to set a limit per database.
Databases that have internal delay may be starved by others that work faster
Therefore a write-control for the entire system is requires.
Who:
-This will mostly relevant for systems with multiple DBs.

Requirements:

  1. The user shall have the ability to set delayed write rate to each DB if wishes or a global rate for all the DBs.
  2. At this stage, the triggers to activate the delayed writes should remain the same.
  3. The system should be able to control the writes rate for the entire system
  4. As a result, starvation should be prevented and the system write rate can be predicted.
@bosmatt bosmatt transferred this issue from another repository Jan 4, 2023
@Guyme Guyme added enhancement New feature or request Working on it A feature request that is being actively worked on labels Jan 18, 2023
@Yuval-Ariel Yuval-Ariel linked a pull request Feb 7, 2023 that will close this issue
Yuval-Ariel added a commit that referenced this issue Feb 9, 2023
change write_controller_ of db_impl to pointer
Yuval-Ariel added a commit that referenced this issue Feb 9, 2023
enable sharing the Write Controller across dbs through the db options
while still retaining the old behavior.
when shared between dbs, the write controller keeps track of all the delay
requirements of all cfs in the dbs and enforces on all of them the
lowest write rate required.

NOTE: plz note that setting a write controller in the options is only
valid with use_dynamic_delay = true.

Dynamic Delay: CFs wont override each other (#358)

Currently, in a setting of multiple cfs, the delayed_write_rate_ value is overridden by the latest
cf that entered a delay state. so if a cf registered a delay state that
is less severe than the previous cf, it will override the previous value of
delayed_write_rate_ with a higher rate than the system should use.

fix it by storing the delay requirements of all the CFs in the write controller
and only set a new delayed_write_rate_ when its smaller than the min.
Yuval-Ariel added a commit that referenced this issue Feb 23, 2023
enable sharing the Write Controller across dbs through the db options
while still retaining the old behavior.
when shared between dbs, the write controller keeps track of all the delay
requirements of all cfs in the dbs and enforces on all of them the
lowest write rate required.

NOTE: plz note that setting a write controller in the options is only
valid with use_dynamic_delay = true.

Dynamic Delay: CFs wont override each other (#358)

Currently, in a setting of multiple cfs, the delayed_write_rate_ value is overridden by the latest
cf that entered a delay state. so if a cf registered a delay state that
is less severe than the previous cf, it will override the previous value of
delayed_write_rate_ with a higher rate than the system should use.

fix it by storing the delay requirements of all the CFs in the write controller
and only set a new delayed_write_rate_ when its smaller than the min.
@erez-speedb erez-speedb self-assigned this Feb 27, 2023
@erez-speedb
Copy link

erez-speedb commented Feb 27, 2023

Standard tests are running

@erez-speedb
Copy link

@hilikspdb try ro run with 2 CF, with 90/10 distribution.
Didnt get stalls and didnt get improvments.
/home/ubuntu/speedb/db_bench --compression_type=None -db=/data/ -num=200000000 -value_size=1000 -key_size=16 --delayed_write_rate=536870912 -report_interval_seconds=1 -max_write_buffer_number=4 -num_column_families=2 -histogram -max_background_compactions=8 -cache_size=8388608 -max_background_flushes=4 -bloom_bits=10 -column_family_distribution=90,10 -duration=900 --use_existing_db -threads=50 -duration=900 -benchmark_read_rate_limit=0 -benchmark_write_rate_limit=0 -report_file=overwrite.csv --benchmarks=overwrite,levelstats

https://admin.speedb.io/performance?items=cByN7eMAY3xipublUQ9R&items=FF08AyqBUFlqfOE7O3ra&colors=%2300796b&colors=%23BA68C8

We need better definition.

@hilikspdb
Copy link
Contributor

hilikspdb commented Mar 1, 2023 via email

@Yuval-Ariel
Copy link
Contributor

the test above fails to show the benefit of always picking the slowest cf since:

  1. distribution is not really 90/10 as can be seen in the sizes of the cfs. size is same at the end of the fillrandom 74/72 Gb. later on it increases to 2-3 times.
  2. as hilik mentioned, there needs to be accumulation of compaction debt which cannt happen when the disks are not the bottleneck. it can be seen since the only place where there are WARN stalls is in the fillrandom test.

@erez-speedb
Copy link

  1. the 90/10 do not apply to the fillup stage in the test
  2. running the same test again on a single disk

@erez-speedb
Copy link

@Yuval-Ariel ??

@Yuval-Ariel
Copy link
Contributor

Yuval-Ariel commented Mar 8, 2023

@erez-speedb , this test also doesnt show the benefits since the only place where the 2nd cf reaches a delay state is in the fillrandom test which has equal distribution.
plz run again with 90/10 also in the fillup with level0_slowdown_writes_trigger = 8.

this feature enables the db to use the lowest delay requirement from all cfs and all dbs the wc is connected to.
the benefit we expect to see in this kind of test is when cf1 needs delay of 100 but then cf2 needs delay of 500 and overrides it so that cf1 is running with a higher rate than it should. but if cf2 is never in a delay state then this is useless.

@speedb-io speedb-io deleted a comment from hilikspdb Mar 8, 2023
@erez-speedb
Copy link

@Yuval-Ariel
Copy link
Contributor

Yuval-Ariel commented Mar 12, 2023

@erez-speedb yes because the 2nd cf didnt reach more than 4 L0 files.. so it didnt reach a delay state.
try again with 80/20 , 70/30 , 60/40. all tests with level0_slowdown_writes_trigger = 8. thanks

@Yuval-Ariel
Copy link
Contributor

thanks @erez-speedb for your attempts. i'll run the performance

@Yuval-Ariel
Copy link
Contributor

red - global delay (5e01ba7)
green - main (0d43a01)
red is much more stable.
image
https://admin.speedb.io/performance?items=zcK83ckPh3HQlox9FkXy&items=zndeb524FsgAQT1LilPX&colors=%23F06292&colors=%232e7d32

more exactly measured by the standard deviation of the ops/sec:
global - 124973 ( 30% more stable)
main - 173066

cmd to reproduce:
db_bench --compression_type=None -db=/data/ -num=200000000 -value_size=1000 -key_size=16 --delayed_write_rate=536870912 -report_interval_seconds=1 -max_write_buffer_number=4 -num_column_families=3 -histogram -max_background_compactions=8 -cache_size=8388608 -max_background_flushes=4 -bloom_bits=10 -benchmark_read_rate_limit=0 -benchmark_write_rate_limit=0 -report_file=fillrandom.csv --disable_wal=true --benchmarks=fillrandom,levelstats --column_family_distribution=50,24,26 --level0_slowdown_writes_trigger=8 -write_buffer_size=268435456

@Yuval-Ariel
Copy link
Contributor

@Guyme , ok to merge?

@Guyme
Copy link

Guyme commented Mar 15, 2023

@Yuval-Ariel - YES!

Yuval-Ariel added a commit that referenced this issue Mar 15, 2023
enable sharing the Write Controller across dbs through the db options
while still retaining the old behavior.
when shared between dbs, the write controller keeps track of all the delay
requirements of all cfs in the dbs and enforces on all of them the
lowest write rate required.

NOTE: plz note that setting a write controller in the options is only
valid with use_dynamic_delay = true.

Dynamic Delay: CFs wont override each other (#358)

Currently, in a setting of multiple cfs, the delayed_write_rate_ value is overridden by the latest
cf that entered a delay state. so if a cf registered a delay state that
is less severe than the previous cf, it will override the previous value of
delayed_write_rate_ with a higher rate than the system should use.

fix it by storing the delay requirements of all the CFs in the write controller
and only set a new delayed_write_rate_ when its smaller than the min.
@github-project-automation github-project-automation bot moved this from 🏗️ Working on it to 📖 Need your Opinion! in Speedb Roadmap Mar 15, 2023
@Yuval-Ariel Yuval-Ariel moved this from 📖 Need your Opinion! to ✅ Shipped in Speedb Roadmap Mar 15, 2023
Yuval-Ariel added a commit that referenced this issue May 2, 2023
enable sharing the Write Controller across dbs through the db options
while still retaining the old behavior.
when shared between dbs, the write controller keeps track of all the delay
requirements of all cfs in the dbs and enforces on all of them the
lowest write rate required.

NOTE: plz note that setting a write controller in the options is only
valid with use_dynamic_delay = true.

Dynamic Delay: CFs wont override each other (#358)

Currently, in a setting of multiple cfs, the delayed_write_rate_ value is overridden by the latest
cf that entered a delay state. so if a cf registered a delay state that
is less severe than the previous cf, it will override the previous value of
delayed_write_rate_ with a higher rate than the system should use.

fix it by storing the delay requirements of all the CFs in the write controller
and only set a new delayed_write_rate_ when its smaller than the min.
Yuval-Ariel added a commit that referenced this issue May 4, 2023
enable sharing the Write Controller across dbs through the db options
while still retaining the old behavior.
when shared between dbs, the write controller keeps track of all the delay
requirements of all cfs in the dbs and enforces on all of them the
lowest write rate required.

NOTE: plz note that setting a write controller in the options is only
valid with use_dynamic_delay = true.

Dynamic Delay: CFs wont override each other (#358)

Currently, in a setting of multiple cfs, the delayed_write_rate_ value is overridden by the latest
cf that entered a delay state. so if a cf registered a delay state that
is less severe than the previous cf, it will override the previous value of
delayed_write_rate_ with a higher rate than the system should use.

fix it by storing the delay requirements of all the CFs in the write controller
and only set a new delayed_write_rate_ when its smaller than the min.
Yuval-Ariel added a commit that referenced this issue May 26, 2023
Allow slowing down writes based on memory consumption by having the WBM raise a delay requirement in the WriteController.
The delay requirement is stored in the WC as part of the Global Delay feature (#346). The same way a CF signals the WC that it has a delay requirement.
@bosmatt bosmatt removed the Working on it A feature request that is being actively worked on label Aug 31, 2023
udi-speedb pushed a commit that referenced this issue Nov 13, 2023
enable sharing the Write Controller across dbs through the db options
while still retaining the old behavior.
when shared between dbs, the write controller keeps track of all the delay
requirements of all cfs in the dbs and enforces on all of them the
lowest write rate required.

NOTE: plz note that setting a write controller in the options is only
valid with use_dynamic_delay = true.

Dynamic Delay: CFs wont override each other (#358)

Currently, in a setting of multiple cfs, the delayed_write_rate_ value is overridden by the latest
cf that entered a delay state. so if a cf registered a delay state that
is less severe than the previous cf, it will override the previous value of
delayed_write_rate_ with a higher rate than the system should use.

fix it by storing the delay requirements of all the CFs in the write controller
and only set a new delayed_write_rate_ when its smaller than the min.
udi-speedb pushed a commit that referenced this issue Nov 15, 2023
enable sharing the Write Controller across dbs through the db options
while still retaining the old behavior.
when shared between dbs, the write controller keeps track of all the delay
requirements of all cfs in the dbs and enforces on all of them the
lowest write rate required.

NOTE: plz note that setting a write controller in the options is only
valid with use_dynamic_delay = true.

Dynamic Delay: CFs wont override each other (#358)

Currently, in a setting of multiple cfs, the delayed_write_rate_ value is overridden by the latest
cf that entered a delay state. so if a cf registered a delay state that
is less severe than the previous cf, it will override the previous value of
delayed_write_rate_ with a higher rate than the system should use.

fix it by storing the delay requirements of all the CFs in the write controller
and only set a new delayed_write_rate_ when its smaller than the min.
udi-speedb pushed a commit that referenced this issue Nov 19, 2023
Allow slowing down writes based on memory consumption by having the WBM raise a delay requirement in the WriteController.
The delay requirement is stored in the WC as part of the Global Delay feature (#346). The same way a CF signals the WC that it has a delay requirement.
udi-speedb pushed a commit that referenced this issue Dec 4, 2023
enable sharing the Write Controller across dbs through the db options
while still retaining the old behavior.
when shared between dbs, the write controller keeps track of all the delay
requirements of all cfs in the dbs and enforces on all of them the
lowest write rate required.

NOTE: plz note that setting a write controller in the options is only
valid with use_dynamic_delay = true.

Dynamic Delay: CFs wont override each other (#358)

Currently, in a setting of multiple cfs, the delayed_write_rate_ value is overridden by the latest
cf that entered a delay state. so if a cf registered a delay state that
is less severe than the previous cf, it will override the previous value of
delayed_write_rate_ with a higher rate than the system should use.

fix it by storing the delay requirements of all the CFs in the write controller
and only set a new delayed_write_rate_ when its smaller than the min.
udi-speedb pushed a commit that referenced this issue Dec 5, 2023
Allow slowing down writes based on memory consumption by having the WBM raise a delay requirement in the WriteController.
The delay requirement is stored in the WC as part of the Global Delay feature (#346). The same way a CF signals the WC that it has a delay requirement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Shipped
Development

Successfully merging a pull request may close this issue.

5 participants