mirror of
https://github.com/privkeyio/nostr-bench.git
synced 2026-10-23 16:44:11 +00:00
Nostr relay benchmarking tool
- Zig 85.4%
- Shell 11.1%
- wisp 2.5%
- Dockerfile 1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github/workflows | ||
| configs | ||
| reports | ||
| src | ||
| .gitignore | ||
| build.zig | ||
| build.zig.zon | ||
| docker-compose.ramdisk.yml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| Dockerfile.khatru-lmdb | ||
| Dockerfile.khatru-sqlite | ||
| Dockerfile.nostr-bench | ||
| Dockerfile.nostr-rs-relay | ||
| Dockerfile.orly | ||
| Dockerfile.relayer | ||
| Dockerfile.strfry | ||
| Dockerfile.wisp | ||
| LICENSE | ||
| README.md | ||
| run-benchmark.sh | ||
| setup.sh | ||
nostr-bench
Nostr relay benchmark tool written in Zig.
Requires Zig 0.16 or 0.17. For Zig 0.15, use the
v0.1.1release.
Build
zig build -Doptimize=ReleaseFast
Usage
# Benchmark a relay
./zig-out/bin/nostr-bench -r ws://localhost:7777
# Multiple relays
./zig-out/bin/nostr-bench -r ws://localhost:7777 -r ws://localhost:7778
# Custom parameters
./zig-out/bin/nostr-bench -r ws://localhost:7777 -e 10000 -w 8 --rate 1000
Options
-r, --relay <URL> Relay WebSocket URL (can specify multiple)
-e, --events <N> Number of events (default: 10000)
-w, --workers <N> Concurrent workers (default: CPU/4)
-d, --duration <S> Duration in seconds (default: 60)
--rate <N> Events/sec per worker (default: 1000, 0 = unlimited)
--async Fire-and-forget mode
--report-file <PATH> Write JSON report
--only-peak Run only peak throughput test
--only-burst Run only burst pattern test
--only-mixed Run only mixed read/write test
--only-query Run only query performance test
--only-concurrent Run only concurrent query/store test
License
MIT