Use YCSB to test the performance of rocksdb (the code you modified yourself), the operating environment:
Get the code for rocksdb version 5.18.3 via github as the basis:
> git clone https://github.com/facebook/rocksdb.git
> cd rocksdb
> git tag # View the version number of the release, the label of the corresponding branch
> git checkout v5.18.3 #Switch branches, view current branch git branch View all branches git branch -a
> git checkout -b doycsb v5.18.3 # Create replication branch v5.18.3 for the new branch doycsb, easy to modify the code submission of v5.18.3, of course, the best way is to fork first
ifneq ($(ROCKSDB_JAVA_NO_COMPRESSION), 1)
# JAVA_COMPRESSIONS = libz.a libbz2.a libsnappy.a liblz4.a libzstd.a
JAVA_COMPRESSIONS = libsnappy.a
endif
#JAVA_STATIC_FLAGS = -DZLIB -DBZIP2 -DSNAPPY -DLZ4 -DZSTD
JAVA_STATIC_FLAGS = -DSNAPPY
#JAVA_STATIC_INCLUDES = -I./zlib-$(ZLIB_VER) -I./bzip2-$(BZIP2_VER) -I./snappy-$(SNAPPY_VER) -I./lz4-$(LZ4_VER)/lib -I./zstd-$(ZSTD_VER)/lib/include
JAVA_STATIC_INCLUDES = -I./snappy-$(SNAPPY_VER)
#cd java/crossbuild && vagrant destroy -f && vagrant up linux32 && vagrant halt linux32 && vagrant up linux64 && vagrant halt linux64
make rocksdbjavastaticrelease -j16, the following error will occur:cd java/target;jar -uf rocksdbjni-5.18.3.jar librocksdbjni-*.so librocksdbjni-*.jnilib
librocksdbjni-*.jnilib : no such file or directory
make: *** [rocksdbjavastaticrelease] Error 1
This is because we canceled the cross-platform java package, and .jnilib is under the mac os platform, so just remove librocksdbjni-*.jnilib:
cd java/target;jar -uf $(ROCKSDB_JAR_ALL) librocksdbjni-*.so
Continue to compilemake rocksdbjavastaticrelease -j16。
rocksdb/java/target/rocksdbjni-5.18.3.jarWill be used later.> git clone https://github.com/brianfrankcooper/YCSB.git
> git checkout 0.15.0
> mvn -pl com.yahoo.ycsb:rocksdb-binding -am clean package
This is a dependency package for downloading the rocksdb-binding module via mvn. Don't directlymvn clean packageThis will download the dependencies of all database modules and takes a very long time.
Can be seen in the YCSB/pom.xml file<rocksdb.version>5.11.3</rocksdb.version>This will be through mvnhttps://repo.maven.apache.org/maven2/org/rocksdb/rocksdbjni/Download the corresponding 5.11.3 version of the jni package. If you don't want to use your own rocksdbjni package, you can directly modify the corresponding version to get a new version of the jni package.
I chose the bin/ycsb.sh script to run and execute:
> bin/ycsb.sh load rocksdb -s -P workloads/workloada -p rocksdb.dir=/home/lzw/ceshi
Where rocksdb.dir is the database path, run load to load the data, the configuration is the workloads/workloada file.
Execute the output of the previous section of the load command:
/usr/lib/jvm/jdk1.8.0_181/bin/java -classpath /home/lzw/ce_ycsb/YCSB/conf:/home/lzw/ce_ycsb/YCSB/core/target/core-0.15.0.jar:/home/lzw/ce_ycsb/YCSB/rocksdb/target/rocksdb-binding-0.15.0.jar:/home/lzw/ce_ycsb/YCSB/rocksdb/target/dependency/jcip-annotations-1.0.jar:/home/lzw/ce_ycsb/YCSB/rocksdb/target/dependency/rocksdbjni-5.11.3.jar:/home/lzw/ce_ycsb/YCSB/rocksdb/target/dependency/slf4j-api-1.7.25.jar:/home/lzw/ce_ycsb/YCSB/rocksdb/target/dependency/slf4j-simple-1.7.25.jar com.yahoo.ycsb.Client -load -db com.yahoo.ycsb.db.rocksdb.RocksDBClient -s -P workloads/workloada -p rocksdb.dir=/home/lzw/ceshi
This run command is very important, this is the classpath, the jni package, you can also view the contents of the bin/ycsb.sh script, these jni packages determine the results of the run.
The above load run results will have the following problems:
Loading workload...
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/htrace/core/Tracer$Builder
at com.yahoo.ycsb.Client.getTracer(Client.java:903)
at com.yahoo.ycsb.Client.main(Client.java:752)
Caused by: java.lang.ClassNotFoundException: org.apache.htrace.core.Tracer$Builder
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
This is due to the lack of htrace-core4 in the core module of YCSB, which can be viewed.YCSB/core/pom.xmlFile, found that the core module's dependencies are not downloaded, willYCSB/core/pom.xmlContent:
<dependency>
<groupId>org.apache.htrace</groupId>
<artifactId>htrace-core4</artifactId>
<version>4.1.0-incubating</version>
</dependency>
add toYCSB/rocksdb/pom.xmlDocumentary<dependencies>Under the tab, then run:
> mvn -pl com.yahoo.ycsb:rocksdb-binding -am clean package
Can be found inYCSB/rocksdb/target/dependency/Added htrace-core4-4.1.0-incubating.jar to the directory.
Continue to run the load command, the following problems will occur:
Exception in thread "Thread-3" java.lang.NoClassDefFoundError: org/HdrHistogram/EncodableHistogram
at com.yahoo.ycsb.measurements.Measurements.constructOneMeasurement(Measurements.java:129)
at com.yahoo.ycsb.measurements.Measurements.getOpMeasurement(Measurements.java:220)
at com.yahoo.ycsb.measurements.Measurements.measure(Measurements.java:188)
at com.yahoo.ycsb.DBWrapper.measure(DBWrapper.java:178)
at com.yahoo.ycsb.DBWrapper.insert(DBWrapper.java:223)
at com.yahoo.ycsb.workloads.CoreWorkload.doInsert(CoreWorkload.java:588)
at com.yahoo.ycsb.ClientThread.run(Client.java:468)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.HdrHistogram.EncodableHistogram
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 8 more
This problem is the same as the above problem. The lack of the core module depends on the HdrHistogram.YCSB/core/pom.xmlContent:
<dependency>
<groupId>org.hdrhistogram</groupId>
<artifactId>HdrHistogram</artifactId>
<version>2.1.4</version>
</dependency>
add toYCSB/rocksdb/pom.xmlDocumentary<dependencies>Under the tab, then run:
> mvn -pl com.yahoo.ycsb:rocksdb-binding -am clean package
Can be found inYCSB/rocksdb/target/dependency/HdrHistogram-2.1.4.jar has been added to the directory.
Run the load command:
> bin/ycsb.sh load rocksdb -s -P workloads/workloada -p rocksdb.dir=/home/lzw/ceshi
Finally, it can run normally, you can see at the beginning of the LOG file in the database path.RocksDB version: 5.11.3On behalf of the running is rocksdb v5.11.3.
rocksdb/java/target/rocksdbjni-5.18.3.jarcopy toYCSB/rocksdb/target/dependency/Directory, then putrocksdbjni-5.11.3.jardelete.Then delete the file under the database path, that is, delete the original database.
Run the load command:
> bin/ycsb.sh load rocksdb -s -P workloads/workloada -p rocksdb.dir=/home/lzw/ceshi
Can be seen at the beginning of the LOG file in the database pathRocksDB version: 5.18.3On behalf of the running is rocksdb v5.18.3.
> bin/ycsb.sh run rocksdb -s -P workloads/workloada -p rocksdb.dir=/home/lzw/ceshi
workloads/workloadaSimilar to the configuration of the file, the command to run load is simplyrecordcount=1000The number of entries is inserted into the database, and the data size of the inserted database is:Fieldcount=10 (default)
Fieldlength=100 (default)
Fieldcount indicates how many segments are in a record. Fieldlength represents the number of bytes in a segment. The value of a data inserted is approximately equal to fieldcount*fieldlength.
YCSB\rocksdb\src\main\java\com\yahoo\ycsb\db\rocksdb\RocksDBClient.java
Test the rocksdb file in YCSB:
YCSB\rocksdb\src\test\java\com\yahoo\ycsb\db\rocksdb\RocksDBClientTest.java
inRocksDBClient.javaIn the file:
Located in the initRocksDB() function:
final Options options = new Options()
.optimizeLevelStyleCompaction()
.setCreateIfMissing(true)
.setCreateMissingColumnFamilies(true)
.setIncreaseParallelism(rocksThreads)
.setMaxBackgroundCompactions(rocksThreads)
.setInfoLogLevel(InfoLogLevel.INFO_LEVEL);
final DBOptions options = new DBOptions()
.setCreateIfMissing(true)
.setCreateMissingColumnFamilies(true)
.setIncreaseParallelism(rocksThreads)
.setMaxBackgroundCompactions(rocksThreads)
.setInfoLogLevel(InfoLogLevel.INFO_LEVEL);
Located in the createColumnFamily() function:
final ColumnFamilyOptions cfOptions = new ColumnFamilyOptions().optimizeLevelStyleCompaction();
Both of these will have an impact on the options of rocksdb, especially the optimizeLevelStyleCompaction() function in rocksdb, which optimizes multiple parameters. The result of the parameters in rocksdb will be saved under the OPTIONS file in the database path.
If modifiedRocksDBClient.javaThe contents of the file, you can compile YCSB again:
> mvn -pl com.yahoo.ycsb:rocksdb-binding -am package
Remove the clean, it will not be the originalrocksdb/java/target/rocksdbjni-5.18.3.jardelete. Will only re-download the package, will be downloadedrocksdb/java/target/rocksdbjni-5.11.3.jarDelete it.
Outline RocksDB is basedlevelDB(Google to achieve a very efficient database kv) development, written in C ++ for embedded kv storage engine. design concept Hypothesis RocksDB original design philosoph...
rocksDBdefinition Fast storage system, fully exploit the reading and writing characteristics of Flash or RAM hardware, support single KV reading and writing and batch reading and writing. Nature:It sa...
We have to understand an emerging thing in two ways: one is to directly analyze its internal principles, and then grasp the use of it; the other is to use it directly, and then understand its internal...
http://alexstocks.github.io/html/rocksdb.html 0 description Rocksdb was used in recent work. The advantage of Rocksdb does not need to say more, it's a Many Optimization options are used to tune Rocks...
The benefits of SSD use SPDK as NVME Driver are realized by user state, asynchronous, polling, lock-free characteristics. Reduced NVME Command compared to NVME Driver in the traditional Linux kernel R...
Reference https://www.git2get.com/av/110153255.html...
RocksDB users can pass configuration information to the engine through the Options class. In addition, other methods can be used to set them as follows: Generate an option class through the option fil...
Tools used: YCSB (https://github.com/brianfrankcooper/YCSB) Wall cracking is recommended to use this YCSB pressure testing tool. Personal use is very simple and efficient. It is simpler than the previ...
There are several directories in ycsb that need to be noted: 2 use When ycsb is executed, it is divided into two phases: the load phase and the transaction phase. 2.1 load stage This stage is mainly u...
references: [1] YCSB test LevelDB database [2] YCSB load tool test leveldb [3] YCSB performance test tool use The above two references propose two ideas to use YCSB to test leveldb. In essence, YCSB i...