i18n: 中文版
DBTest is a platform designed for black-box testing of database transaction isolation levels. By integrating various testing methods for isolation levels, it allows convenient and efficient testing of different databases. It also supports performance analysis of the testing methods. In summary, DBTest offers high scalability and excellent usability.
The general architecture of this platform is as follows:
Currently, the following databases are supported. You can use the docker-compose files in the scripts/ directory to quickly deploy the databases for testing (currently supporting single-node database deployment):
- MySQL
- PostgreSQL
- H2
Currently, the following workloads are supported:
Workload | Description |
---|---|
GENERAL | Simulates the workload generated by concurrent access to the database from multiple sessions. Parameters such as the number of simulated sessions, number of transactions per session, number of operations per transaction, read operation ratio, number of workload keys, and distribution type of transaction access keys are randomly generated. |
TPCC | TODO |
The following consistency checking algorithms and their corresponding isolation levels are currently supported:
Checker | Supported Isolation Levels |
---|---|
C4 | READ_COMMITTED READ_ATOMICITY CAUSAL_CONSISTENCY |
PolySI | SNAPSHOT_ISOLATION |
To compile DBTest, the following environments are required:
- JDK 11
- Maven
- Git
Execute the following commands to compile the DBTest source code:
git clone https://github.com/hengxin/db-testing-platform
cd db-testing-platform
mvn clean package
Then you can find the compiled shaded jar file in the target directory.
As there are many running parameters, all parameters are placed in config.properties
. Here is a detailed explanation of each running parameter:
db.url= # JDBC URL
db.username= # username
db.password= # password
db.isolation= # transaction isolation level
db.type= # database type, supports MYSQL, POSTGRESQL and H2
workload.type= # workload type, currently only supports general, plan to add support for TPCC, etc.
workload.history= # historical number of transactions
workload.session= # number of simulated sessions
workload.transaction= # number of transactions per session
workload.operation= # number of operations per transaction
workload.readproportion= # read operation proportion
workload.key= # number of workload keys
workload.distribution= # distribution type of transaction access keys, supports uniform, zipfan and hotspot
checker.type= # consistency checking algorithm type, supports C4 and PolySI
checker.isolation= # isolation level for the consistency checking algorithm, supports READ_COMMITTED, READ_ATOMICITY, CAUSAL_CONSISTENCY and SNAPSHOT_ISOLATION
profiler.enable= # whether to enable performance analysis, true/false
You can use workload.variable
to specify a workload
parameter and use profiler
to perform performance analysis on checker
, for example:
workload.history=3
workload.session=[2,5,10,20,30]
workload.variable=workload.session
profiler.enable=true
After running this configuration file, a profiling_{timestamp}.csv
file will be obtained in the result/
directory, which contains runtime data for the checking algorithm, such as:
sessions | time (ms) | memory (MB) |
---|---|---|
2 | 7 | 34.2 |
5 | 8 | 41.2 |
10 | 11 | 52.2 |
20 | 30 | 71.7 |
30 | 38 | 93.2 |
After compilation, you can run DBTest with the following command:
java -jar ./target/DBTest-1.0-SNAPSHOT-shaded.jar config.properties
Since PolySI depends on monoSAT, you may see the following linking error when running PolySI:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no monosat in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
You can add JVM parameter -Djava.library.path=src/main/resource/libmonosat.so
or add src/main/resource/libmonosat.so
to a directory in java.library.path
. If the libmonosat.so
provided in this repository cannot run on your environment, please compile it yourself using monoSAT source code.