Starting Nostr Relay Benchmark
Data Directory: /tmp/benchmark_khatru-sqlite_8
Events: 50000, Workers: 24, Duration: 1m0s
1763397017138391ℹ️ /tmp/benchmark_khatru-sqlite_8: All 0 tables opened in 0s
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/levels.go:161 /build/pkg/database/logger.go:56
1763397017141550ℹ️ /tmp/benchmark_khatru-sqlite_8: Discard stats nextEmptySlot: 0
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/discard.go:55 /build/pkg/database/logger.go:56
1763397017141593ℹ️ /tmp/benchmark_khatru-sqlite_8: Set nextTxnTs to 0
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/db.go:358 /build/pkg/database/logger.go:56
1763397017141951ℹ️ migrating to version 1... /build/pkg/database/migrations.go:66
1763397017142013ℹ️ migrating to version 2... /build/pkg/database/migrations.go:73
1763397017142036ℹ️ migrating to version 3... /build/pkg/database/migrations.go:80
1763397017142042ℹ️ cleaning up ephemeral events (kinds 20000-29999)... /build/pkg/database/migrations.go:287
1763397017142055ℹ️ cleaned up 0 ephemeral events from database /build/pkg/database/migrations.go:332
1763397017142080ℹ️ migrating to version 4... /build/pkg/database/migrations.go:87
1763397017142086ℹ️ converting events to optimized inline storage (Reiser4 optimization)... /build/pkg/database/migrations.go:340
1763397017142103ℹ️ found 0 events to convert (0 regular, 0 replaceable, 0 addressable) /build/pkg/database/migrations.go:429
1763397017142109ℹ️ migration complete: converted 0 events to optimized inline storage, deleted 0 old keys /build/pkg/database/migrations.go:538

=== Starting test round 1/2 ===
RunPeakThroughputTest..

=== Peak Throughput Test ===
2025/11/17 16:30:17 INFO: Successfully loaded libsecp256k1 v5.0.0 from libsecp256k1.so.2
1763397019142156ℹ️ /tmp/benchmark_khatru-sqlite_8: database warmup complete, ready to serve requests
/usr/local/go/src/runtime/asm_amd64.s:1693 /build/pkg/database/logger.go:56
Events saved: 50000/50000 (100.0%)
Duration: 4.697220167s
Events/sec: 10644.59
Avg latency: 1.589521ms
P90 latency: 1.927686ms
P95 latency: 2.072081ms
P99 latency: 2.794007ms
Bottom 10% Avg latency: 2.449508ms
RunBurstPatternTest..

=== Burst Pattern Test ===
Burst completed: 5000 events in 331.053594ms
Burst completed: 5000 events in 339.97436ms
Burst completed: 5000 events in 352.328844ms
Burst completed: 5000 events in 376.613834ms
Burst completed: 5000 events in 321.307729ms
Burst completed: 5000 events in 314.265411ms
Burst completed: 5000 events in 321.656622ms
Burst completed: 5000 events in 325.689539ms
Burst completed: 5000 events in 367.767832ms
Burst completed: 5000 events in 367.275402ms
Burst test completed: 50000 events in 9.780316233s
Events/sec: 5112.31
RunMixedReadWriteTest..

=== Mixed Read/Write Test ===
Pre-populating database for read tests...
Mixed test completed: 25000 writes, 25000 reads in 24.45356557s
Combined ops/sec: 2044.69
1763397077132611⚠️ /tmp/benchmark_khatru-sqlite_8: Block cache might be too small. Metrics: hit: 164850 miss: 294509 keys-added: 226622 keys-updated: 54881 keys-evicted: 226603 cost-added: 12429978548485 cost-evicted: 12428976154843 sets-dropped: 0 sets-rejected: 12954 gets-dropped: 192 gets-kept: 458368 gets-total: 459359 hit-ratio: 0.36
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/db.go:450 /build/pkg/database/logger.go:46
1763397077132680⚠️ /tmp/benchmark_khatru-sqlite_8: Cache life expectancy (in seconds): 
 -- Histogram: 
Min value: 0 
Max value: 11 
Count: 226603 
50p: 2.00 
75p: 2.00 
90p: 2.00 
[0, 2) 226567 99.98% 99.98%
[8, 16) 36 0.02% 100.00%
 --
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/db.go:451 /build/pkg/database/logger.go:46
RunQueryTest..

=== Query Test ===
Pre-populating database with 10000 events for query tests...
Query test completed: 253442 queries in 1m0.011742602s
Queries/sec: 4223.21
Avg query latency: 4.105842ms
P95 query latency: 13.288591ms
P99 query latency: 23.937862ms
RunConcurrentQueryStoreTest..

=== Concurrent Query/Store Test ===
Pre-populating database with 5000 events for concurrent query/store test...
Concurrent test completed: 237910 operations (187910 queries, 50000 writes) in 1m0.007412985s
Operations/sec: 3964.68
Avg latency: 2.360698ms
Avg query latency: 2.630397ms
Avg write latency: 1.347113ms
P95 latency: 4.390739ms
P99 latency: 6.940329ms

Pausing 10s before next round...

=== Test round completed ===


=== Starting test round 2/2 ===
RunPeakThroughputTest..

=== Peak Throughput Test ===
Events saved: 50000/50000 (100.0%)
Duration: 4.792392684s
Events/sec: 10433.20
Avg latency: 1.649743ms
P90 latency: 1.991666ms
P95 latency: 2.145348ms
P99 latency: 2.77034ms
Bottom 10% Avg latency: 2.781523ms
RunBurstPatternTest..

=== Burst Pattern Test ===
Burst completed: 5000 events in 330.357755ms
Burst completed: 5000 events in 334.984623ms
Burst completed: 5000 events in 345.478382ms
Burst completed: 5000 events in 340.589233ms
Burst completed: 5000 events in 348.792025ms
Burst completed: 5000 events in 354.019658ms
Burst completed: 5000 events in 356.823662ms
Burst completed: 5000 events in 347.496865ms
Burst completed: 5000 events in 342.618798ms
Burst completed: 5000 events in 337.759666ms
Burst test completed: 50000 events in 9.775603327s
Events/sec: 5114.77
1763397250998218ℹ️ /tmp/benchmark_khatru-sqlite_8: [6] [E] LOG Compact 0->6 (8, 0 -> 4 tables with 1 splits). [00001 00002 00003 00004 00005 00006 00007 00008 . .] -> [00009 00010 00011 00012 .], took 2.922s
, deleted 1932516 bytes
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/levels.go:1479 /build/pkg/database/logger.go:56
RunMixedReadWriteTest..

=== Mixed Read/Write Test ===
Pre-populating database for read tests...
Mixed test completed: 25000 writes, 25000 reads in 24.35620806s
Combined ops/sec: 2052.86
RunQueryTest..

=== Query Test ===
Pre-populating database with 10000 events for query tests...
Query test completed: 334922 queries in 1m0.011826287s
Queries/sec: 5580.93
Avg query latency: 2.871941ms
P95 query latency: 8.86787ms
P99 query latency: 16.075646ms
RunConcurrentQueryStoreTest..

=== Concurrent Query/Store Test ===
Pre-populating database with 5000 events for concurrent query/store test...
1763397377131811ℹ️ /tmp/benchmark_khatru-sqlite_8: Block cache metrics: hit: 485497199 miss: 4802603 keys-added: 1628313 keys-updated: 2776240 keys-evicted: 1628292 cost-added: 85662348259200 cost-evicted: 85661362474446 sets-dropped: 0 sets-rejected: 336231 gets-dropped: 382997632 gets-kept: 107185536 gets-total: 490299843 hit-ratio: 0.99
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/db.go:454 /build/pkg/database/logger.go:56
Concurrent test completed: 266462 operations (216462 queries, 50000 writes) in 1m0.004503525s
Operations/sec: 4440.70
Avg latency: 1.968296ms
Avg query latency: 2.154689ms
Avg write latency: 1.161355ms
P95 latency: 3.329033ms
P99 latency: 4.878236ms

=== Test round completed ===


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

Test: Peak Throughput
Duration: 4.697220167s
Total Events: 50000
Events/sec: 10644.59
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 432 MB
Avg Latency: 1.589521ms
P90 Latency: 1.927686ms
P95 Latency: 2.072081ms
P99 Latency: 2.794007ms
Bottom 10% Avg Latency: 2.449508ms
----------------------------------------

Test: Burst Pattern
Duration: 9.780316233s
Total Events: 50000
Events/sec: 5112.31
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 147 MB
Avg Latency: 3.589724ms
P90 Latency: 7.397294ms
P95 Latency: 9.015658ms
P99 Latency: 12.848707ms
Bottom 10% Avg Latency: 10.286462ms
----------------------------------------

Test: Mixed Read/Write
Duration: 24.45356557s
Total Events: 50000
Events/sec: 2044.69
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 189 MB
Avg Latency: 439.984µs
P90 Latency: 878.495µs
P95 Latency: 980.94µs
P99 Latency: 1.17514ms
Bottom 10% Avg Latency: 1.261937ms
----------------------------------------

Test: Query Performance
Duration: 1m0.011742602s
Total Events: 253442
Events/sec: 4223.21
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 165 MB
Avg Latency: 4.105842ms
P90 Latency: 8.468483ms
P95 Latency: 13.288591ms
P99 Latency: 23.937862ms
Bottom 10% Avg Latency: 15.251447ms
----------------------------------------

Test: Concurrent Query/Store
Duration: 1m0.007412985s
Total Events: 237910
Events/sec: 3964.68
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 149 MB
Avg Latency: 2.360698ms
P90 Latency: 3.517024ms
P95 Latency: 4.390739ms
P99 Latency: 6.940329ms
Bottom 10% Avg Latency: 5.015416ms
----------------------------------------

Test: Peak Throughput
Duration: 4.792392684s
Total Events: 50000
Events/sec: 10433.20
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 523 MB
Avg Latency: 1.649743ms
P90 Latency: 1.991666ms
P95 Latency: 2.145348ms
P99 Latency: 2.77034ms
Bottom 10% Avg Latency: 2.781523ms
----------------------------------------

Test: Burst Pattern
Duration: 9.775603327s
Total Events: 50000
Events/sec: 5114.77
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 541 MB
Avg Latency: 2.925486ms
P90 Latency: 5.542703ms
P95 Latency: 7.775478ms
P99 Latency: 11.125804ms
Bottom 10% Avg Latency: 8.91184ms
----------------------------------------

Test: Mixed Read/Write
Duration: 24.35620806s
Total Events: 50000
Events/sec: 2052.86
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 200 MB
Avg Latency: 424.333µs
P90 Latency: 865.429µs
P95 Latency: 968.085µs
P99 Latency: 1.174568ms
Bottom 10% Avg Latency: 1.224002ms
----------------------------------------

Test: Query Performance
Duration: 1m0.011826287s
Total Events: 334922
Events/sec: 5580.93
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 129 MB
Avg Latency: 2.871941ms
P90 Latency: 5.60422ms
P95 Latency: 8.86787ms
P99 Latency: 16.075646ms
Bottom 10% Avg Latency: 10.23636ms
----------------------------------------

Test: Concurrent Query/Store
Duration: 1m0.004503525s
Total Events: 266462
Events/sec: 4440.70
Success Rate: 100.0%
Concurrent Workers: 24
Memory Used: 155 MB
Avg Latency: 1.968296ms
P90 Latency: 2.729181ms
P95 Latency: 3.329033ms
P99 Latency: 4.878236ms
Bottom 10% Avg Latency: 3.768185ms
----------------------------------------

Report saved to: /tmp/benchmark_khatru-sqlite_8/benchmark_report.txt
AsciiDoc report saved to: /tmp/benchmark_khatru-sqlite_8/benchmark_report.adoc
1763397425682348ℹ️ /tmp/benchmark_khatru-sqlite_8: Lifetime L0 stalled for: 0s
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/db.go:536 /build/pkg/database/logger.go:56
1763397426982581ℹ️ /tmp/benchmark_khatru-sqlite_8: 
Level 0 [ ]: NumTables: 00. Size: 0 B of 0 B. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 61 MiB
Level 1 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 61 MiB
Level 2 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 61 MiB
Level 3 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 61 MiB
Level 4 [B]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 61 MiB
Level 5 [ ]: NumTables: 01. Size: 94 MiB of 23 MiB. Score: 4.08->4.08 StaleData: 0 B Target FileSize: 122 MiB
Level 6 [ ]: NumTables: 04. Size: 230 MiB of 230 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 244 MiB
Level Done
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/db.go:615 /build/pkg/database/logger.go:56

RELAY_NAME: khatru-sqlite
RELAY_URL: ws://khatru-sqlite:3334
TEST_TIMESTAMP: 2025-11-17T16:37:07+00:00
BENCHMARK_CONFIG:
  Events: 50000
  Workers: 24
  Duration: 60s
