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

Make it possible to enable blob files starting from a certain LSM tree level #10077

Closed
wants to merge 13 commits into from

Conversation

gangliao
Copy link
Contributor

Summary:

Currently, if blob files are enabled (i.e. enable_blob_files is true), large values are extracted both during flush/recovery (when SST files are written into level 0 of the LSM tree) and during compaction into any LSM tree level. For certain use cases that have a mix of short-lived and long-lived values, it might make sense to support extracting large values only during compactions whose output level is greater than or equal to a specified LSM tree level (e.g. compactions into L1/L2/... or above). This could reduce the space amplification caused by large values that are turned into garbage shortly after being written at the price of some write amplification incurred by long-lived values whose extraction to blob files is delayed.

In order to achieve this, we would like to do the following:

  • Add a new configuration option blob_file_starting_level (default: 0) to AdvancedColumnFamilyOptions (and MutableCFOptions and extend the related logic)
  • Instantiate BlobFileBuilder in BuildTable (used during flush and recovery, where the LSM tree level is L0) and CompactionJob iff enable_blob_files is set and the LSM tree level is >= blob_file_starting_level
  • Add unit tests for the new functionality, and add the new option to our stress tests (db_stress and db_crashtest.py )
  • Add the new option to our benchmarking tool db_bench and the BlobDB benchmark script run_blob_bench.sh
  • Add the new option to the ldb tool (see https://github.com/facebook/rocksdb/wiki/Administration-and-Data-Access-Tool)
  • Ideally extend the C and Java bindings with the new option
  • Update the BlobDB wiki to document the new option.

Reviewers:

@gangliao
Copy link
Contributor Author

gangliao commented May 31, 2022

TODO:

  • Add a new configuration option blob_file_starting_level (default: 0) to AdvancedColumnFamilyOptions (and MutableCFOptions and extend the related logic)
  • Instantiate BlobFileBuilder in BuildTable (used during flush and recovery, where the LSM tree level is L0) and CompactionJob iff enable_blob_files is set and the LSM tree level is >= blob_file_starting_level
  • Add unit tests for the new functionality, and add the new option to our stress tests (db_stress and db_crashtest.py )
  • Add the new option to our benchmarking tool db_bench and the BlobDB benchmark script run_blob_bench.sh
  • Add the new option to the ldb tool (see https://github.com/facebook/rocksdb/wiki/Administration-and-Data-Access-Tool)
  • Ideally extend the C and Java bindings with the new option
  • Update the BlobDB wiki to document the new option. (see here: https://github.com/facebook/rocksdb/wiki/BlobDB#column-family-options)

@gangliao
Copy link
Contributor Author

gangliao commented Jun 2, 2022

  • Add a new feature to History.md

Copy link
Contributor

@ltamasi ltamasi left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the patch @gangliao ! 🎉

db/blob/db_blob_compaction_test.cc Outdated Show resolved Hide resolved
db/blob/db_blob_compaction_test.cc Show resolved Hide resolved
db/builder.cc Outdated Show resolved Hide resolved
db_stress_tool/db_stress_gflags.cc Outdated Show resolved Hide resolved
docs/_posts/2021-05-26-integrated-blob-db.markdown Outdated Show resolved Hide resolved
Copy link
Contributor

@ltamasi ltamasi left a comment

Choose a reason for hiding this comment

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

LGTM (with one minor comment), thanks for the updates! Please add an entry to HISTORY.md :)

java/rocksjni/options.cc Outdated Show resolved Hide resolved
…e level

Summary:

Currently, if blob files are enabled (i.e. `enable_blob_files` is true), large values are extracted both during flush/recovery (when SST files are written into level 0 of the LSM tree) and during compaction into any LSM tree level. For certain use cases that have a mix of short-lived and long-lived values, it might make sense to support extracting large values only during compactions whose output level is greater than or equal to a specified LSM tree level (e.g. compactions into L1/L2/... or above). This could reduce the space amplification caused by large values that are turned into garbage shortly after being written at the price of some write amplification incurred by long-lived values whose extraction to blob files is delayed.

In order to achieve this, we would like to do the following:
- Add a new configuration option `blob_file_starting_level` (default: 0) to `AdvancedColumnFamilyOptions` (and `MutableCFOptions` and extend the related logic)
- Instantiate `BlobFileBuilder` in `BuildTable` (used during flush and recovery, where the LSM tree level is L0) and `CompactionJob` iff `enable_blob_files` is set and the LSM tree level is `>= blob_file_starting_level`
- Add unit tests for the new functionality, and add the new option to our stress tests (`db_stress` and `db_crashtest.py` )
- Add the new option to our benchmarking tool `db_bench` and the BlobDB benchmark script `run_blob_bench.sh`
- Add the new option to the `ldb` tool (see https://github.com/facebook/rocksdb/wiki/Administration-and-Data-Access-Tool)
- Ideally extend the C and Java bindings with the new option
- Update the BlobDB wiki to document the new option.

Reviewers:
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@gangliao has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@ltamasi ltamasi left a comment

Choose a reason for hiding this comment

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

Just a few more minor things before we land this...

options/cf_options.cc Outdated Show resolved Hide resolved
tools/db_bench_tool.cc Outdated Show resolved Hide resolved
HISTORY.md Outdated Show resolved Hide resolved
HISTORY.md Outdated Show resolved Hide resolved
@facebook-github-bot
Copy link
Contributor

@gangliao has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@gangliao has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@gangliao has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

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

@gangliao gangliao deleted the blob_start_level branch June 3, 2022 07:30
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