This is an automated email from the ASF dual-hosted git repository.
pmaheshwari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/samza.git
The following commit(s) were added to refs/heads/master by this push:
new 082899d85 Add MAX_BACKGROUND_JOBS config for RocksDB (#1694)
082899d85 is described below
commit 082899d85c9031c2a75eae9dd01675a78d944634
Author: Shekhar Sharma <[email protected]>
AuthorDate: Fri Dec 8 16:40:47 2023 -0800
Add MAX_BACKGROUND_JOBS config for RocksDB (#1694)
---
.../org/apache/samza/storage/kv/RocksDbOptionsHelper.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git
a/samza-kv-rocksdb/src/main/java/org/apache/samza/storage/kv/RocksDbOptionsHelper.java
b/samza-kv-rocksdb/src/main/java/org/apache/samza/storage/kv/RocksDbOptionsHelper.java
index 53720602f..ba5492d6d 100644
---
a/samza-kv-rocksdb/src/main/java/org/apache/samza/storage/kv/RocksDbOptionsHelper.java
+++
b/samza-kv-rocksdb/src/main/java/org/apache/samza/storage/kv/RocksDbOptionsHelper.java
@@ -72,11 +72,20 @@ public class RocksDbOptionsHelper {
private static final String ROCKSDB_MAX_OPEN_FILES =
"rocksdb.max.open.files";
private static final String ROCKSDB_MAX_FILE_OPENING_THREADS =
"rocksdb.max.file.opening.threads";
+ private static final String ROCKSDB_MAX_BACKGROUND_JOBS =
"rocksdb.max.background.jobs";
+
/**
* RocksDB default for {@link
RocksDbOptionsHelper#ROCKSDB_COMPACTION_MAX_BACKGROUND_COMPACTIONS} is 1.
*/
private static final int
DEFAULT_ROCKSDB_COMPACTION_MAX_BACKGROUND_COMPACTIONS = 4;
+ /**
+ * RocksDB default for {@link
RocksDbOptionsHelper#ROCKSDB_MAX_BACKGROUND_JOBS} is 2
+ * Note: {@link
RocksDbOptionsHelper#ROCKSDB_COMPACTION_MAX_BACKGROUND_COMPACTIONS} is
deprecated and is decided by
+ * ROCKSDB_MAX_BACKGROUND_JOBS now.
+ */
+ private static final int DEFAULT_ROCKSDB_MAX_BACKGROUND_JOBS = 4;
+
public static Options options(Config storeConfig, int numTasksForContainer,
File storeDir, StorageEngineFactory.StoreMode storeMode) {
Options options = new Options();
@@ -174,6 +183,10 @@ public class RocksDbOptionsHelper {
options.setTargetFileSizeBase(storeConfig.getLong(ROCKSDB_COMPACTION_TARGET_FILE_SIZE_MULTIPLIER));
}
+ if (storeConfig.containsKey(ROCKSDB_MAX_BACKGROUND_JOBS)) {
+
options.setMaxBackgroundJobs(storeConfig.getInt(ROCKSDB_MAX_BACKGROUND_JOBS,
DEFAULT_ROCKSDB_MAX_BACKGROUND_JOBS));
+ }
+
CompactionStyle compactionStyle = CompactionStyle.UNIVERSAL;
String compactionStyleInConfig = storeConfig.get(ROCKSDB_COMPACTION_STYLE,
"universal");
switch (compactionStyleInConfig) {