
gittech. site
for different kinds of informations and explorations.
DB Stress Testing Tool
π db-stress-bench π
π Load Testing Made Simple for Databases
π₯ db-stress-bench is a simple but powerful tool to load test any database with minimal configuration π οΈ
Only 3 of 11 available realtime graphs are shown in this image.
β¨ Key Features
1. π Live Running Stats
- Monitor real-time aggregate statistics directly in your browser.
- Available live in-browser aggregate stat graphs:
- Queries Per Second
- Average Query Time (ms)
- Query StdDev (ms)
- Min Query Time (ms)
- Max Query Time (ms)
- Median Query Time (ms)
- Successfully Completed Queries
- Failed Queries
- Invalid Input Payloads
- Total Queries
- Percentiles: 20th, 50th, 75th, 90th, 95th, 99th
- Support for these same metrics at prometheus compatible metrics endpoint at
/metrics
.
2. ποΈ Query Templates
- Configure multiple queries to stress-test your database.
- Use per-query csv file to repace query template variables from the CSV dynamically at runtime, allowing you to thoroughly stress your database bypassing caching effects.
- Sample query:
select * from Customers where customer_name = '${customer_name}'
3. β‘ High Concurrency Support
- Harness the power of Java Virtual Threads to run thousands of concurrent queries effortlessly (Even works/compiles on java-8+ if not using virtual threads (
useVirtualThreads: false
)). - Gradually ramp up concurrency with configurable options for smooth stress testing.
4. ποΈ Extensive Database Support
- Out-of-the-box support for:
- MySQL π¬
- PostgreSQL π
- SQLite π¦
- DuckDB π¦
- CassandraDB π£
5. 𧩠Easy Extensibility
Add support for new databases by implementing a simple 3-method interface.
6. π Logging
Log raw query results to files for detailed analysis.
7. π οΈ Ready-to-Run Samples
You can start playing around immediately. This project already has:
- Sample test queries
- Sample template data
- Pre-configured test databases (SQLite and DuckDB)
Run with a single command:
java -jar target/db-stress-bench-1.0.1.jar
No setup or configuration required! π
Above one runs load tests against the provided duckdb database. To load test the provided sample SQLite test database, just update activeDatabase
value to com.freakynit.sql.db.stress.bench.db.sqlite.SqliteDatabaseInterface
and run again.
π Getting Started
- Clone this repository:
git clone https://github.com/freakynit/db-stress-bench.git
- Build the project:
mvn clean package
- Run with sample data:
java -jar target/db-stress-bench-1.0.1.jar
- Open your browser at http://localhost:8080 to monitor live stats.
- Check out
config.yaml
for all customizations. - Works/compiles on java-8+ (java-21+ if
useVirtualThreads
is true).
π Supported Databases
Database | Status |
---|---|
MySQL | β Supported |
PostgreSQL | β Supported |
SQLite | β Supported |
DuckDB | β Supported |
CassandraDB | β Supported |
Adding a new database? Implement these 3 methods in the DatabaseInterface
and youβre good to go! π
π₯ Contributing
We welcome contributions! π€
- Report bugs π
- Suggest features β¨
- Submit pull requests π
π License
This project is licensed under the MIT License.