Skip to content

Commit

Permalink
[dingo-executor] Optimize local store parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
githubgxll authored and ketor committed Mar 20, 2024
1 parent 7a8f633 commit 8836253
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions dingo-dist/conf/executor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ variable:
autoIncrementIncrement: 1
autoIncrementOffset: 1
store:
bufferSize: 8388608
bufferSize: 67108864
bufferNumber: 2
fileSize: 2097152
fileSize: 67108864
security:
cipher:
keyPath: /opt/dingo/conf/dingodb.jks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public static Configuration instance() {

private String path;

private int bufferSize = 8388608;
private int bufferSize = 67108864;
private int bufferNumber = 2;
private int fileSize = 2097152;
private int fileSize = 67108864;
public static String path() {
return INSTANCE.path;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.rocksdb.RocksIterator;
import org.rocksdb.WriteOptions;

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

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

@Override
public CommonId id() {
Expand All @@ -50,21 +52,21 @@ public boolean put(KeyValue row) {
if (StoreService.db.get(row.getKey()) != null) {
return false;
}
StoreService.db.put(nonNull(row.getKey(), "key"), cleanNull(row.getValue(), ByteArrayUtils.EMPTY_BYTES));
StoreService.db.put(writeOptions, nonNull(row.getKey(), "key"), cleanNull(row.getValue(), ByteArrayUtils.EMPTY_BYTES));
return true;
}

@Override
@SneakyThrows
public boolean delete(byte[] key) {
StoreService.db.delete(key);
StoreService.db.delete(writeOptions, key);
return true;
}

@Override
@SneakyThrows
public void deletePrefix(byte[] prefix) {
StoreService.db.deleteRange(prefix, nextKey(prefix));
StoreService.db.deleteRange(writeOptions, prefix, nextKey(prefix));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,11 @@ public class StoreService implements io.dingodb.store.api.StoreService {
FileUtils.deleteIfExists(dbPath);
FileUtils.createDirectories(dbPath);
Options options = new Options();
options.setNumLevels(1);
options.setCreateIfMissing(true);
options.setDisableAutoCompactions(true);
options.setWriteBufferSize(Configuration.instance().getBufferSize());
options.setMaxWriteBufferNumber(Configuration.instance().getBufferNumber());
options.setTargetFileSizeBase(Configuration.instance().getFileSize());
WriteOptions writeOptions = new WriteOptions();
writeOptions.setDisableWAL(true);
rocksdb = RocksDB.open(options, path);
WriteBatch batch = new WriteBatch();
rocksdb.write(writeOptions, batch) ;
} catch (Exception e) {
log.info("No local db.", e);
}
Expand Down

0 comments on commit 8836253

Please sign in to comment.