- Java:
$ sudo apt-get install openjdk-8-jdk
$ javac -version
javac 1.8.0_292
$ which javac
/usr/bin/javac
$ readlink -f /usr/bin/javac
/usr/lib/jvm/java-8-openjdk-amd64
$ sudo vi /etc/profile
...
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
$ source /etc/profile
$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64
- Maven 3:
$ sudo apt-get install maven
- Clone the YCSB git repository:
$ git clone https://github.com/brianfrankcooper/YCSB
- Compile:
$ cd YCSB
$ mvn -pl site.ycsb:rocksdb-binding -am clean package
- Load the data:
$ ./bin/ycsb load rocksdb -s -P workloads/workloadb -p rocksdb.dir=/home/mijin/ycsb-rocksdb-data
- Run the workload:
$ ./bin/ycsb run rocksdb -s -P workloads/workloadb -p rocksdb.dir=/home/mijin/ycsb-rocksdb-data
To write the output to a file, you can use the below command:
$ ./bin/ycsb run rocksdb -s -P workloads/workloadb \
-p rocksdb.dir=/home/mijin/ycsb-rocksdb-data \
-threads 8 2>&1 | tee result.dat
Use rocksdb.optionfile
(e.g., ycsb-rocksdb-options.ini
)
Or add configuration parameters (e.g., .setUseDirectIoForFlushAndCompaction(true)
) to RocksDBClient.java
file (YCSB/rocksdb/src/main/java/site/ycsb/db/rocksdb/RocksDBClient.java
):
private RocksDB initRocksDB() throws IOException, RocksDBException {
...
if(cfDescriptors.isEmpty()) {
final Options options = new Options()
.optimizeLevelStyleCompaction()
.setCreateIfMissing(true)
.setCreateMissingColumnFamilies(true)
.setUseDirectReads(true)
.setUseDirectIoForFlushAndCompaction(true)
.setIncreaseParallelism(rocksThreads)
.setMaxBackgroundCompactions(rocksThreads)
.setInfoLogLevel(InfoLogLevel.INFO_LEVEL);
dbOptions = options;
return RocksDB.open(options, rocksDbDir.toAbsolutePath().toString());
} else {
final DBOptions options = new DBOptions()
.setCreateIfMissing(true)
.setCreateMissingColumnFamilies(true)
.setUseDirectReads(true)
.setUseDirectIoForFlushAndCompaction(true)
.setIncreaseParallelism(rocksThreads)
.setMaxBackgroundCompactions(rocksThreads)
.setInfoLogLevel(InfoLogLevel.INFO_LEVEL);
dbOptions = options;
final List<ColumnFamilyHandle> cfHandles = new ArrayList<>();
final RocksDB db = RocksDB.open(options, rocksDbDir.toAbsolutePath().toString(), cfDescriptors, cfHandles);
for(int i = 0; i < cfNames.size(); i++) {
COLUMN_FAMILIES.put(cfNames.get(i), new ColumnFamily(cfHandles.get(i), cfOptionss.get(i)));
}
return db;
}
...
- Refer
java/src/main/java/org/rocksdb/Options.java
andjava/src/main/java/org/rocksdb/DBOptions.java
for details of option functions - After modifying the code, re-compile YCSB. The result of the parameters in rocksdb will be saved under the
OPTIONS
file in the database path:
$ mvn -pl site.ycsb:rocksdb-binding -am package