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

set min file count on L0->base compactions #2140

Closed
wants to merge 1 commit into from

Conversation

ajkr
Copy link
Contributor

@ajkr ajkr commented Apr 11, 2017

With the L0 scoring change in #2027, individual L0 files may trigger compaction when dynamic level sizing is enabled. This behavior increases write-amp.

This diff is a temporary fix to prevent such single-file compactions until #2123 gets reviewed. We need one of these fixes for the next release.

Test Plan:

command:

TEST_TMPDIR=/data/rate_limit_bench/  ./db_bench -benchmarks=fillrandom -options_file=/home/andrewkr/myrocks-options-modified -statistics -stats_per_interval=1 -stats_interval=10000000 -num=500000000
  • master
    • Throughput: 19.9 MB/s
    • W-Amp: 10.0
    • rocksdb.stall.micros: 21486605
  • after this diff
    • Throughput: 19.8 MB/s
    • W-Amp: 9.8
    • rocksdb.stall.micros: 0

@facebook-github-bot
Copy link
Contributor

@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@ajkr
Copy link
Contributor Author

ajkr commented Apr 12, 2017

I ran the benchmark, this isn't as effective as #2123 since it computes high compaction score for L0 with only 4 L0 files, whereas after #2123 compactions to base typically contain 6-8 files. It means W-Amp will still be worse until we commit #2123.

@@ -1310,7 +1310,8 @@ void VersionStorageInfo::ComputeCompactionScore(
} else {
score = static_cast<double>(num_sorted_runs) /
mutable_cf_options.level0_file_num_compaction_trigger;
if (compaction_style_ == kCompactionStyleLevel && num_levels() > 1) {
if (score >= 1.0 && compaction_style_ == kCompactionStyleLevel &&
num_levels() > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In line 1320, can we use mutable_cf_options.max_bytes_for_level_base instead of MaxBytesForLevel(base_level())?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that seems like a good idea so we don't have to change base-level sizing in the current release! Will do it in the morning.

@ajkr
Copy link
Contributor Author

ajkr commented Apr 19, 2017

replaced with #2172

@ajkr ajkr closed this Apr 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants