Skip to content

Conversation

@ProtoYun
Copy link

@ProtoYun ProtoYun commented Nov 28, 2025

PR #10161 improves compaction performance by using a partial‑sorting mechanism that operates on a fixed number of files (kNumberFilesToSort). However, when the number of concurrent background compaction jobs exceeds kNumberFilesToSort, this strategy causes write amplification. The fix selects sorting files according to the max_compaction_jobs setting in order to mitigate write amplification and keep the performance.

Benchmarks with db_bench fillrandom demonstrate that, when max_compaction_jobs is configured to 128, write amplification is reduced by 25 % without performance degradation.

…mplification in concurrent writes

Fix an issue where RocksDB's fixed compaction file count limit caused excessive write amplification under multi-threaded workloads. This change dynamically adjusts the number of files to sort based on `max_compaction_jobs`.
@meta-cla
Copy link

meta-cla bot commented Nov 28, 2025

Hi @ProtoYun!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@meta-cla meta-cla bot added the CLA Signed label Dec 1, 2025
@meta-cla
Copy link

meta-cla bot commented Dec 1, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@ProtoYun ProtoYun changed the title fix(compaction): modify sorting compaction file limit in accordance with max_compaction_jobs Fix: Limit the sorting files based on max_compaction_jobs instead of kNumberFilesToSort to reduce write amplification Dec 11, 2025
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.

1 participant