Starting Nostr Relay Benchmark (Badger Backend)
Data Directory: /tmp/benchmark_khatru-badger_8
Events: 50000, Workers: 24, Duration: 1m0s
1764801231368401ℹ️ migrating to version 1... /build/pkg/database/migrations.go:68
1764801231368486ℹ️ migrating to version 2... /build/pkg/database/migrations.go:75
1764801231368519ℹ️ migrating to version 3... /build/pkg/database/migrations.go:82
1764801231368527ℹ️ cleaning up ephemeral events (kinds 20000-29999)... /build/pkg/database/migrations.go:304
1764801231368536ℹ️ cleaned up 0 ephemeral events from database /build/pkg/database/migrations.go:349
1764801231368548ℹ️ migrating to version 4... /build/pkg/database/migrations.go:89
1764801231368553ℹ️ converting events to optimized inline storage (Reiser4 optimization)... /build/pkg/database/migrations.go:357
1764801231368563ℹ️ found 0 events to convert (0 regular, 0 replaceable, 0 addressable) /build/pkg/database/migrations.go:446
1764801231368569ℹ️ migration complete: converted 0 events to optimized inline storage, deleted 0 old keys /build/pkg/database/migrations.go:555
1764801231368582ℹ️ migrating to version 5... /build/pkg/database/migrations.go:96
1764801231368586ℹ️ re-encoding events with optimized tag binary format... /build/pkg/database/migrations.go:562
1764801231368621ℹ️ found 0 events with e/p tags to re-encode /build/pkg/database/migrations.go:649
1764801231368649ℹ️ no events need re-encoding /build/pkg/database/migrations.go:652
1764801231368698ℹ️ migrating to version 6... /build/pkg/database/migrations.go:103
1764801231368705ℹ️ converting events to compact serial-reference format... /build/pkg/database/migrations.go:706
1764801231368720ℹ️ found 0 events to convert to compact format /build/pkg/database/migrations.go:846
1764801231368725ℹ️ no events need conversion /build/pkg/database/migrations.go:849

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

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

=== Peak Throughput Test ===
2025/12/03 22:33:51 INFO: Successfully loaded embedded libsecp256k1 v5.0.0 from /tmp/orly-libsecp256k1/libsecp256k1.so
Events saved: 50000/50000 (100.0%), errors: 0
Duration: 3.133049501s
Events/sec: 15958.89
Avg latency: 1.414398ms
P90 latency: 1.890809ms
P95 latency: 2.191322ms
P99 latency: 3.903963ms
Bottom 10% Avg latency: 791.675µs
Wiping database between tests...
RunBurstPatternTest (Badger)..

=== Burst Pattern Test ===
Burst completed: 5000 events in 324.488191ms
Burst completed: 5000 events in 290.052978ms
Burst completed: 5000 events in 282.1799ms
Burst completed: 5000 events in 293.897308ms
Burst completed: 5000 events in 291.897961ms
Burst completed: 5000 events in 289.485539ms
Burst completed: 5000 events in 274.266496ms
Burst completed: 5000 events in 267.924152ms
Burst completed: 5000 events in 270.096418ms
Burst completed: 5000 events in 279.041228ms
Burst test completed: 50000 events in 7.870569084s, errors: 0
Events/sec: 6352.78
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.293101466s
Combined ops/sec: 2058.20
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: 414124 queries in 1m0.005028928s
Queries/sec: 6901.49
Avg query latency: 2.186993ms
P95 query latency: 8.150708ms
P99 query latency: 12.392244ms
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: 315470 operations (265470 queries, 50000 writes) in 1m0.003725813s
Operations/sec: 5257.51
Avg latency: 1.463937ms
Avg query latency: 1.521887ms
Avg write latency: 1.156254ms
P95 latency: 3.595486ms
P99 latency: 9.347708ms

=== Badger benchmark completed ===


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

Test: Peak Throughput
Duration: 3.133049501s
Total Events: 50000
Events/sec: 15958.89
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 189 MB
Avg Latency: 1.414398ms
P90 Latency: 1.890809ms
P95 Latency: 2.191322ms
P99 Latency: 3.903963ms
Bottom 10% Avg Latency: 791.675µs
----------------------------------------

Test: Burst Pattern
Duration: 7.870569084s
Total Events: 50000
Events/sec: 6352.78
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 172 MB
Avg Latency: 1.183812ms
P90 Latency: 1.587121ms
P95 Latency: 1.80172ms
P99 Latency: 3.298169ms
Bottom 10% Avg Latency: 529.205µs
----------------------------------------

Test: Mixed Read/Write
Duration: 24.293101466s
Total Events: 50000
Events/sec: 2058.20
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 186 MB
Avg Latency: 384.638µs
P90 Latency: 808.86µs
P95 Latency: 903.25µs
P99 Latency: 1.120102ms
Bottom 10% Avg Latency: 1.02527ms
----------------------------------------

Test: Query Performance
Duration: 1m0.005028928s
Total Events: 414124
Events/sec: 6901.49
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 198 MB
Avg Latency: 2.186993ms
P90 Latency: 6.624883ms
P95 Latency: 8.150708ms
P99 Latency: 12.392244ms
Bottom 10% Avg Latency: 8.999206ms
----------------------------------------

Test: Concurrent Query/Store
Duration: 1m0.003725813s
Total Events: 315470
Events/sec: 5257.51
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 188 MB
Avg Latency: 1.463937ms
P90 Latency: 2.911413ms
P95 Latency: 3.595486ms
P99 Latency: 9.347708ms
Bottom 10% Avg Latency: 5.359325ms
----------------------------------------

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

RELAY_NAME: khatru-badger
RELAY_URL: ws://khatru-badger:3334
TEST_TIMESTAMP: 2025-12-03T22:37:08+00:00
BENCHMARK_CONFIG:
  Events: 50000
  Workers: 24
  Duration: 60s
