[RocksJava] DBBenchmark option for RocksMemEnv

Extended DBBenchmark with option to enable RocksMemEnv.
main
fyrz 10 years ago
parent fd8804f979
commit 2b2394cbbb
  1. 14
      java/benchmark/src/main/java/org/rocksdb/benchmark/DbBenchmark.java

@ -40,6 +40,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.rocksdb.*; import org.rocksdb.*;
import org.rocksdb.RocksMemEnv;
import org.rocksdb.util.SizeUnit; import org.rocksdb.util.SizeUnit;
class Stats { class Stats {
@ -445,6 +446,7 @@ public class DbBenchmark {
keysPerPrefix_ = (Integer) flags.get(Flag.keys_per_prefix); keysPerPrefix_ = (Integer) flags.get(Flag.keys_per_prefix);
hashBucketCount_ = (Long) flags.get(Flag.hash_bucket_count); hashBucketCount_ = (Long) flags.get(Flag.hash_bucket_count);
usePlainTable_ = (Boolean) flags.get(Flag.use_plain_table); usePlainTable_ = (Boolean) flags.get(Flag.use_plain_table);
useMemenv_ = (Boolean) flags.get(Flag.use_mem_env);
flags_ = flags; flags_ = flags;
finishLock_ = new Object(); finishLock_ = new Object();
// options.setPrefixSize((Integer)flags_.get(Flag.prefix_size)); // options.setPrefixSize((Integer)flags_.get(Flag.prefix_size));
@ -486,6 +488,9 @@ public class DbBenchmark {
} else { } else {
options.setCreateIfMissing(false); options.setCreateIfMissing(false);
} }
if (useMemenv_) {
options.setEnv(new RocksMemEnv());
}
switch (memtable_) { switch (memtable_) {
case "skip_list": case "skip_list":
options.setMemTableConfig(new SkipListMemTableConfig()); options.setMemTableConfig(new SkipListMemTableConfig());
@ -1482,6 +1487,12 @@ public class DbBenchmark {
@Override public Object parseValue(String value) { @Override public Object parseValue(String value) {
return value; return value;
} }
},
use_mem_env(false, "Use RocksMemEnv instead of default filesystem based\n" +
"environment.") {
@Override public Object parseValue(String value) {
return parseBoolean(value);
}
}; };
private Flag(Object defaultValue, String desc) { private Flag(Object defaultValue, String desc) {
@ -1594,6 +1605,9 @@ public class DbBenchmark {
RandomGenerator gen_; RandomGenerator gen_;
long startTime_; long startTime_;
// env
boolean useMemenv_;
// memtable related // memtable related
final int maxWriteBufferNumber_; final int maxWriteBufferNumber_;
final int prefixSize_; final int prefixSize_;

Loading…
Cancel
Save