Starting Nostr Relay Benchmark (Badger Backend)
Data Directory: /tmp/benchmark_khatru-sqlite_8
Events: 50000, Workers: 24, Duration: 1m0s
1763839231750842ℹ️ migrating to version 1... /build/pkg/database/migrations.go:66
1763839231750901ℹ️ migrating to version 2... /build/pkg/database/migrations.go:73
1763839231750925ℹ️ migrating to version 3... /build/pkg/database/migrations.go:80
1763839231750931ℹ️ cleaning up ephemeral events (kinds 20000-29999)... /build/pkg/database/migrations.go:294
1763839231750941ℹ️ cleaned up 0 ephemeral events from database /build/pkg/database/migrations.go:339
1763839231750956ℹ️ migrating to version 4... /build/pkg/database/migrations.go:87
1763839231750961ℹ️ converting events to optimized inline storage (Reiser4 optimization)... /build/pkg/database/migrations.go:347
1763839231750983ℹ️ found 0 events to convert (0 regular, 0 replaceable, 0 addressable) /build/pkg/database/migrations.go:436
1763839231750993ℹ️ migration complete: converted 0 events to optimized inline storage, deleted 0 old keys /build/pkg/database/migrations.go:545
1763839231751016ℹ️ migrating to version 5... /build/pkg/database/migrations.go:94
1763839231751021ℹ️ re-encoding events with optimized tag binary format... /build/pkg/database/migrations.go:552
1763839231751033ℹ️ found 0 events with e/p tags to re-encode /build/pkg/database/migrations.go:639
1763839231751038ℹ️ no events need re-encoding /build/pkg/database/migrations.go:642

╔════════════════════════════════════════════════════════╗
║         BADGER BACKEND BENCHMARK SUITE                 ║
╚════════════════════════════════════════════════════════╝

=== Starting Badger benchmark ===
RunPeakThroughputTest (Badger)..

=== Peak Throughput Test ===
2025/11/22 19:20:31 WARN: Failed to load embedded library from /tmp/orly-libsecp256k1/libsecp256k1.so: Error relocating /tmp/orly-libsecp256k1/libsecp256k1.so: __fprintf_chk: symbol not found, falling back to system paths
2025/11/22 19:20:31 INFO: Successfully loaded libsecp256k1 v5.0.0 from system path: libsecp256k1.so.2
Events saved: 50000/50000 (100.0%), errors: 0
Duration: 3.76701384s
Events/sec: 13273.11
Avg latency: 1.732057ms
P90 latency: 2.725001ms
P95 latency: 3.370931ms
P99 latency: 5.636846ms
Bottom 10% Avg latency: 803.833µs
Wiping database between tests...
RunBurstPatternTest (Badger)..

=== Burst Pattern Test ===
Burst completed: 5000 events in 324.962224ms
Burst completed: 5000 events in 319.788529ms
Burst completed: 5000 events in 292.223747ms
Burst completed: 5000 events in 297.968607ms
Burst completed: 5000 events in 285.831691ms
Burst completed: 5000 events in 385.949074ms
Burst completed: 5000 events in 290.335776ms
Burst completed: 5000 events in 276.875448ms
Burst completed: 5000 events in 304.201963ms
Burst completed: 5000 events in 273.277754ms
Burst test completed: 50000 events in 8.058529464s, errors: 0
Events/sec: 6204.61
Wiping database between tests...
RunMixedReadWriteTest (Badger)..

=== Mixed Read/Write Test ===
Generating 1000 unique synthetic events (minimum 300 bytes each)...
Generated 1000 events:
  Average content size: 312 bytes
  All events are unique (incremental timestamps)
  All events are properly signed

Pre-populating database for read tests...
Generating 50000 unique synthetic events (minimum 300 bytes each)...
Generated 50000 events:
  Average content size: 314 bytes
  All events are unique (incremental timestamps)
  All events are properly signed

Mixed test completed: 25000 writes, 25000 reads in 24.559984136s
Combined ops/sec: 2035.83
Wiping database between tests...
RunQueryTest (Badger)..

=== Query Test ===
Generating 10000 unique synthetic events (minimum 300 bytes each)...
Generated 10000 events:
  Average content size: 313 bytes
  All events are unique (incremental timestamps)
  All events are properly signed

Pre-populating database with 10000 events for query tests...
Query test completed: 382812 queries in 1m0.004759428s
Queries/sec: 6379.69
Avg query latency: 1.753564ms
P95 query latency: 7.120429ms
P99 query latency: 11.234021ms
Wiping database between tests...
RunConcurrentQueryStoreTest (Badger)..

=== Concurrent Query/Store Test ===
Generating 5000 unique synthetic events (minimum 300 bytes each)...
Generated 5000 events:
  Average content size: 313 bytes
  All events are unique (incremental timestamps)
  All events are properly signed

Pre-populating database with 5000 events for concurrent query/store test...
Generating 50000 unique synthetic events (minimum 300 bytes each)...
Generated 50000 events:
  Average content size: 314 bytes
  All events are unique (incremental timestamps)
  All events are properly signed

Concurrent test completed: 310209 operations (260209 queries, 50000 writes) in 1m0.002874017s
Operations/sec: 5169.90
Avg latency: 1.497119ms
Avg query latency: 1.472534ms
Avg write latency: 1.625063ms
P95 latency: 3.842736ms
P99 latency: 6.293151ms

=== Badger benchmark completed ===


================================================================================
BENCHMARK REPORT
================================================================================

Test: Peak Throughput
Duration: 3.76701384s
Total Events: 50000
Events/sec: 13273.11
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 133 MB
Avg Latency: 1.732057ms
P90 Latency: 2.725001ms
P95 Latency: 3.370931ms
P99 Latency: 5.636846ms
Bottom 10% Avg Latency: 803.833µs
----------------------------------------

Test: Burst Pattern
Duration: 8.058529464s
Total Events: 50000
Events/sec: 6204.61
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 196 MB
Avg Latency: 1.263843ms
P90 Latency: 1.851055ms
P95 Latency: 2.195471ms
P99 Latency: 3.218951ms
Bottom 10% Avg Latency: 504.149µs
----------------------------------------

Test: Mixed Read/Write
Duration: 24.559984136s
Total Events: 50000
Events/sec: 2035.83
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 127 MB
Avg Latency: 390.903µs
P90 Latency: 809.291µs
P95 Latency: 905.805µs
P99 Latency: 1.149089ms
Bottom 10% Avg Latency: 1.046555ms
----------------------------------------

Test: Query Performance
Duration: 1m0.004759428s
Total Events: 382812
Events/sec: 6379.69
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 118 MB
Avg Latency: 1.753564ms
P90 Latency: 5.356742ms
P95 Latency: 7.120429ms
P99 Latency: 11.234021ms
Bottom 10% Avg Latency: 7.946956ms
----------------------------------------

Test: Concurrent Query/Store
Duration: 1m0.002874017s
Total Events: 310209
Events/sec: 5169.90
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 123 MB
Avg Latency: 1.497119ms
P90 Latency: 2.998239ms
P95 Latency: 3.842736ms
P99 Latency: 6.293151ms
Bottom 10% Avg Latency: 4.449237ms
----------------------------------------

Report saved to: /tmp/benchmark_khatru-sqlite_8/benchmark_report.txt
AsciiDoc report saved to: /tmp/benchmark_khatru-sqlite_8/benchmark_report.adoc

RELAY_NAME: khatru-sqlite
RELAY_URL: ws://khatru-sqlite:3334
TEST_TIMESTAMP: 2025-11-22T19:23:50+00:00
BENCHMARK_CONFIG:
  Events: 50000
  Workers: 24
  Duration: 60s
