Skip to content

Commit 8836253

Browse files
githubgxllketor
authored andcommitted
[dingo-executor] Optimize local store parameters
1 parent 7a8f633 commit 8836253

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

dingo-dist/conf/executor.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ variable:
1414
autoIncrementIncrement: 1
1515
autoIncrementOffset: 1
1616
store:
17-
bufferSize: 8388608
17+
bufferSize: 67108864
1818
bufferNumber: 2
19-
fileSize: 2097152
19+
fileSize: 67108864
2020
security:
2121
cipher:
2222
keyPath: /opt/dingo/conf/dingodb.jks

dingo-store-local/src/main/java/io/dingodb/store/local/Configuration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public static Configuration instance() {
4141

4242
private String path;
4343

44-
private int bufferSize = 8388608;
44+
private int bufferSize = 67108864;
4545
private int bufferNumber = 2;
46-
private int fileSize = 2097152;
46+
private int fileSize = 67108864;
4747
public static String path() {
4848
return INSTANCE.path;
4949
}

dingo-store-local/src/main/java/io/dingodb/store/local/StoreInstance.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import lombok.AllArgsConstructor;
2323
import lombok.SneakyThrows;
2424
import org.rocksdb.RocksIterator;
25+
import org.rocksdb.WriteOptions;
2526

2627
import java.util.Iterator;
2728
import java.util.List;
@@ -37,6 +38,7 @@
3738
public class StoreInstance implements io.dingodb.store.api.StoreInstance {
3839

3940
public final CommonId regionId;
41+
private static final WriteOptions writeOptions = new WriteOptions().setDisableWAL(true);
4042

4143
@Override
4244
public CommonId id() {
@@ -50,21 +52,21 @@ public boolean put(KeyValue row) {
5052
if (StoreService.db.get(row.getKey()) != null) {
5153
return false;
5254
}
53-
StoreService.db.put(nonNull(row.getKey(), "key"), cleanNull(row.getValue(), ByteArrayUtils.EMPTY_BYTES));
55+
StoreService.db.put(writeOptions, nonNull(row.getKey(), "key"), cleanNull(row.getValue(), ByteArrayUtils.EMPTY_BYTES));
5456
return true;
5557
}
5658

5759
@Override
5860
@SneakyThrows
5961
public boolean delete(byte[] key) {
60-
StoreService.db.delete(key);
62+
StoreService.db.delete(writeOptions, key);
6163
return true;
6264
}
6365

6466
@Override
6567
@SneakyThrows
6668
public void deletePrefix(byte[] prefix) {
67-
StoreService.db.deleteRange(prefix, nextKey(prefix));
69+
StoreService.db.deleteRange(writeOptions, prefix, nextKey(prefix));
6870
}
6971

7072
@Override

dingo-store-local/src/main/java/io/dingodb/store/local/StoreService.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,11 @@ public class StoreService implements io.dingodb.store.api.StoreService {
4848
FileUtils.deleteIfExists(dbPath);
4949
FileUtils.createDirectories(dbPath);
5050
Options options = new Options();
51-
options.setNumLevels(1);
5251
options.setCreateIfMissing(true);
53-
options.setDisableAutoCompactions(true);
5452
options.setWriteBufferSize(Configuration.instance().getBufferSize());
5553
options.setMaxWriteBufferNumber(Configuration.instance().getBufferNumber());
5654
options.setTargetFileSizeBase(Configuration.instance().getFileSize());
57-
WriteOptions writeOptions = new WriteOptions();
58-
writeOptions.setDisableWAL(true);
5955
rocksdb = RocksDB.open(options, path);
60-
WriteBatch batch = new WriteBatch();
61-
rocksdb.write(writeOptions, batch) ;
6256
} catch (Exception e) {
6357
log.info("No local db.", e);
6458
}

0 commit comments

Comments
 (0)