Simple database benchmark tool written on Rust. Generated by ChatGPT
./rust_db_bench [--duration SECS] [--concurrency N] [--host S] [--port N] [--db S] [--mode S]
./target/release/rust-db-bench --duration 1 --concurrency 1 --host 127.0.0.1 --port 9042 --db scylla --mode write
db scylla
Starting: duration=1s conc=1
[tick] rps=19490 total=19490 ok=19490 err=0
===== SUMMARY =====
Ids used for primary key: from 1 - to 19491
Total: 19490 | OK: 19490 | ERR: 0 | RPS: 19490.00
Latency ms -> avg: 0.050, min: 0.035, p50: 0.043, p90: 0.080, p95: 0.092, p99: 0.116, max: 0.386
use --network host on docker for better performance !!! instead you'll get docker bridge with at least 10% network overhead
choose db & create table cargo build --release ./target/release/rust-db-bench --duration 10 --concurrency 4 --host 127.0.0.1 --port 9042 --db cassandra --mode read
calc_traffic.sh allow to calculate tx/rx traffic on network interface during test set IFACE and command line for benchmark
docker run -p9042:9042 scylladb/scylla --developer-mode 1
docker exec -it <container id> bash
cqlsh
CREATE KEYSPACE bench_test WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor': '1'};
CREATE TABLE bench_test.vectors (
pk BIGINT,
vector LIST<INT>,
uud TEXT,
PRIMARY KEY (pk)
);
./target/release/rust-db-bench --duration 1 --concurrency 1 --host 127.0.0.1 --port 9042 --db scylla --mode write
docker run -p 9042:9042 cassandra:latest
docker exec -it <container id> bash
cqlsh
CREATE KEYSPACE bench_test WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor': '1'};
CREATE TABLE bench_test.vectors (
pk BIGINT,
vector LIST<INT>,
uud TEXT,
PRIMARY KEY (pk)
);
./target/release/rust-db-bench --duration 10 --concurrency 4 --host 127.0.0.1 --port 9042 --db cassandra --mode read
docker run -p 6379:6379 redis:latest
docker exec -it <container id> bash
redis-cli
./target/release/rust-db-bench --duration 10 --concurrency 1 --host 127.0.0.1 --port 6379 --db redis --mode read
docker run -p 5432:5432 -e POSTGRES_PASSWORD=postgres postgres
docker exec -it <container id> bash
psql -d postgres -U postgres
CREATE TABLE vectors (
pk bigint PRIMARY KEY,
vector int[16],
uud text
);
./target/release/rust-db-bench --duration 1 --concurrency 1 --host 127.0.0.1 --port 5432 --db postgres --mode read
docker run -p 27017:27017 mongodb/mongodb-community-server
docker exec -it <container id> bash
mongosh
use bench_test;
db.createCollection("vectors");
db.vectors.createIndex({"pk": 1}, {unique: true});
./target/release/rust-db-bench --duration 1 --concurrency 1 --host 127.0.0.1 --port 27017 --db mongo --mode read