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

feat(rockdb): Allow customization of Rocksdb threads number #2764

Closed

Conversation

ltagliamonte-dd
Copy link
Contributor

Allow customization of rocksdb low and high thread number

@torwig
Copy link
Contributor

torwig commented Feb 3, 2025

@ltagliamonte-dd Could you please elaborate on the change? I see that we can set max_background_compactions and max_background_flushes. It's not enough? Or it's something different?

@ltagliamonte-dd
Copy link
Contributor Author

@ltagliamonte-dd Could you please elaborate on the change? I see that we can set max_background_compactions and max_background_flushes. It's not enough? Or it's something different?

Hello @torwig, I'm very new to rocksdb, I may be wrong, but:
max_background_jobs/max_background_compactions/max_background_flushes are higher-level setting that controls the total number of concurrent background operations that RocksDB will perform.

SetBackgroundThreads controls the size of the thread pools separately for HIGH priority (typically compactions) and LOW priority (typically flushes) operations.

this is my understanding reading this doc

so for optimal perfomances you should configure both.

@git-hulk
Copy link
Member

git-hulk commented Feb 3, 2025

@ltagliamonte-dd You could just control the compaction/flush thread number by configuring:

  • rocksdb.max_background_compactions (default is LOW priority)
  • rocksdb.max_background_flushes (default is HIGH priority)

But those two parameters might be deprecated in future versions. It will use 1/4 * max_background_jobs as the flush thread number if both of them are not set. See GetBGJobLimits

@ltagliamonte-dd
Copy link
Contributor Author

ltagliamonte-dd commented Feb 3, 2025

@git-hulk I may be reading this wrong, but where is it the correlation between this params (max_background_jobs/max_background_compactions/max_background_flushes) and the number of threads in rocksdb codebase?

In this example in the doc I see the setting of the threadpool size and max_background_jobs
https://github.com/facebook/rocksdb/wiki/Thread-Pool

@git-hulk
Copy link
Member

git-hulk commented Feb 3, 2025

where is it the correlation between this params (max_background_jobs/max_background_compactions/max_background_flushes) and the number of threads in rocksdb codebase?

The correlation, you could refer: GetBGJobLimits

@ltagliamonte-dd
Copy link
Contributor Author

Closing in favor of using max_background_compactions and max_background_flushes has the same effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants