completed basic benchmark

This commit is contained in:
2025-09-12 21:30:27 +01:00
parent bf062a4a46
commit fefa4d202e
20 changed files with 927 additions and 85 deletions

View File

@@ -92,4 +92,6 @@ A good typical example:
use the source of the relay-tester to help guide what expectations the test has,
and use context7 for information about the nostr protocol, and use additional
log statements to help locate the cause of bugs
log statements to help locate the cause of bugs
always use Go v1.25.1 for everything involving Go

2
.gitignore vendored
View File

@@ -30,7 +30,7 @@ node_modules/**
/go.work.sum
/secp256k1/
cmd/benchmark/external
cmd/benchmark/data
# But not these files...
!/.gitignore
!*.go

View File

@@ -27,6 +27,7 @@ type C struct {
DataDir string `env:"ORLY_DATA_DIR" usage:"storage location for the event store" default:"~/.local/share/ORLY"`
Listen string `env:"ORLY_LISTEN" default:"0.0.0.0" usage:"network listen address"`
Port int `env:"ORLY_PORT" default:"3334" usage:"port to listen on"`
HealthPort int `env:"ORLY_HEALTH_PORT" default:"0" usage:"optional health check HTTP port; 0 disables"`
LogLevel string `env:"ORLY_LOG_LEVEL" default:"info" usage:"relay log level: fatal error warn info debug trace"`
DBLogLevel string `env:"ORLY_DB_LOG_LEVEL" default:"info" usage:"database log level: fatal error warn info debug trace"`
LogToStdout bool `env:"ORLY_LOG_TO_STDOUT" default:"false" usage:"log to stdout instead of stderr"`

View File

@@ -15,9 +15,8 @@ RUN apk --no-cache add ca-certificates wget
WORKDIR /app
COPY --from=builder /build/examples/basic-badger/khatru-badger /app/
RUN mkdir -p /data
EXPOSE 8080
EXPOSE 3334
ENV DATABASE_PATH=/data/badger
ENV PORT=8080
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --quiet --tries=1 --spider http://localhost:8080 || exit 1
CMD wget --quiet --tries=1 --spider http://localhost:3334 || exit 1
CMD ["/app/khatru-badger"]

View File

@@ -5,7 +5,7 @@ RUN apk add --no-cache git ca-certificates sqlite-dev gcc musl-dev
WORKDIR /build
COPY . .
# Build the basic-sqlite example
# Build the basic-sqlite3 example
RUN cd examples/basic-sqlite3 && \
go mod tidy && \
CGO_ENABLED=1 go build -o khatru-sqlite .
@@ -15,9 +15,8 @@ RUN apk --no-cache add ca-certificates sqlite wget
WORKDIR /app
COPY --from=builder /build/examples/basic-sqlite3/khatru-sqlite /app/
RUN mkdir -p /data
EXPOSE 8080
EXPOSE 3334
ENV DATABASE_PATH=/data/khatru.db
ENV PORT=8080
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --quiet --tries=1 --spider http://localhost:8080 || exit 1
CMD wget --quiet --tries=1 --spider http://localhost:3334 || exit 1
CMD ["/app/khatru-sqlite"]

View File

@@ -2,7 +2,7 @@
FROM ubuntu:22.04 as builder
# Set environment variables
ARG GOLANG_VERSION=1.25.1
ARG GOLANG_VERSION=1.22.5
# Update package list and install dependencies
RUN apt-get update && \
@@ -67,14 +67,14 @@ RUN mkdir -p /data
EXPOSE 8080
# Set environment variables
ENV DATA_DIR=/data
ENV LISTEN=0.0.0.0
ENV PORT=8080
ENV LOG_LEVEL=info
ENV ORLY_DATA_DIR=/data
ENV ORLY_LISTEN=0.0.0.0
ENV ORLY_PORT=8080
ENV ORLY_LOG_LEVEL=info
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080 || exit 1
CMD bash -lc "code=\$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8080 || echo 000); echo \$code | grep -E '^(101|200|400|404|426)$' >/dev/null || exit 1"
# Run the relay
CMD ["/app/relay"]

View File

@@ -1,16 +1,6 @@
FROM ubuntu:22.04 AS builder
FROM rust:1.81-alpine AS builder
RUN apt-get update && apt-get install -y \
curl \
build-essential \
libsqlite3-dev \
pkg-config \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN apk add --no-cache musl-dev sqlite-dev build-base bash perl protobuf
WORKDIR /build
COPY . .
@@ -18,8 +8,8 @@ COPY . .
# Build the relay
RUN cargo build --release
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y ca-certificates sqlite3 wget && rm -rf /var/lib/apt/lists/*
FROM alpine:latest
RUN apk --no-cache add ca-certificates sqlite wget
WORKDIR /app
COPY --from=builder /build/target/release/nostr-rs-relay /app/
RUN mkdir -p /data

View File

@@ -15,9 +15,9 @@ RUN apk --no-cache add ca-certificates sqlite wget
WORKDIR /app
COPY --from=builder /build/examples/basic/relayer-basic /app/
RUN mkdir -p /data
EXPOSE 8080
EXPOSE 7447
ENV DATABASE_PATH=/data/relayer.db
ENV PORT=8080
# PORT env is not used by relayer-basic; it always binds to 7447 in code.
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --quiet --tries=1 --spider http://localhost:8080 || exit 1
CMD wget --quiet --tries=1 --spider http://localhost:7447 || exit 1
CMD ["/app/relayer-basic"]

View File

@@ -3,14 +3,21 @@ FROM ubuntu:22.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Install build dependencies
RUN apt-get update && apt-get install -y git g++ make libssl-dev zlib1g-dev liblmdb-dev libflatbuffers-dev libsecp256k1-dev libzstd-dev \
RUN apt-get update && apt-get install -y \
git \
build-essential \
liblmdb-dev \
libsecp256k1-dev \
pkg-config \
libtool \
autoconf \
automake \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
COPY . .
# Initialize git submodules
RUN git submodule update --init --recursive
# Fetch strfry source with submodules to ensure golpe is present
RUN git clone --recurse-submodules https://github.com/hoytech/strfry .
# Build strfry
RUN make setup-golpe && \
@@ -21,34 +28,17 @@ RUN apt-get update && apt-get install -y \
liblmdb0 \
libsecp256k1-0 \
curl \
bash \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /build/strfry /app/
COPY --from=builder /build/strfry.conf /app/
# Create the data directory placeholder (may be masked by volume at runtime)
RUN mkdir -p /data && \
chmod 755 /data
# Update strfry.conf to bind to all interfaces and use port 8080
RUN sed -i 's/bind = "127.0.0.1"/bind = "0.0.0.0"/' /app/strfry.conf && \
sed -i 's/port = 7777/port = 8080/' /app/strfry.conf
# Entrypoint ensures the LMDB directory exists inside the mounted volume before starting
ENV STRFRY_DB_PATH=/data/strfry.lmdb
RUN echo '#!/usr/bin/env bash' > /entrypoint.sh && \
echo 'set -euo pipefail' >> /entrypoint.sh && \
echo 'DB_PATH="${STRFRY_DB_PATH:-/data/strfry.lmdb}"' >> /entrypoint.sh && \
echo 'mkdir -p "$DB_PATH"' >> /entrypoint.sh && \
echo 'chown -R root:root "$(dirname "$DB_PATH")"' >> /entrypoint.sh && \
echo 'exec /app/strfry relay' >> /entrypoint.sh && \
chmod +x /entrypoint.sh
RUN mkdir -p /data
EXPOSE 8080
ENV STRFRY_DB_PATH=/data/strfry.lmdb
ENV STRFRY_RELAY_PORT=8080
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080 || exit 1
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/app/strfry", "relay"]

View File

@@ -9,7 +9,7 @@ set -e
BENCHMARK_EVENTS="${BENCHMARK_EVENTS:-10000}"
BENCHMARK_WORKERS="${BENCHMARK_WORKERS:-8}"
BENCHMARK_DURATION="${BENCHMARK_DURATION:-60s}"
BENCHMARK_TARGETS="${BENCHMARK_TARGETS:-next-orly:8001,khatru-sqlite:8002,khatru-badger:8003,relayer-basic:8004,strfry:8005,nostr-rs-relay:8006}"
BENCHMARK_TARGETS="${BENCHMARK_TARGETS:-next-orly:8080,khatru-sqlite:3334,khatru-badger:3334,relayer-basic:7447,strfry:8080,nostr-rs-relay:8080}"
OUTPUT_DIR="${OUTPUT_DIR:-/reports}"
# Create output directory
@@ -40,14 +40,24 @@ wait_for_relay() {
echo "Waiting for ${name} to be ready at ${url}..."
while [ $attempt -lt $max_attempts ]; do
if wget --quiet --tries=1 --spider --timeout=5 "http://${url}" 2>/dev/null || \
curl -f --connect-timeout 5 --max-time 5 "http://${url}" >/dev/null 2>&1; then
echo "${name} is ready!"
return 0
# Try wget first to obtain an HTTP status code
local status=""
status=$(wget --quiet --server-response --tries=1 --timeout=5 "http://${url}" 2>&1 | awk '/^ HTTP\//{print $2; exit}')
# Fallback to curl to obtain an HTTP status code
if [ -z "$status" ]; then
status=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 5 "http://${url}" || echo 000)
fi
case "$status" in
101|200|400|404|426)
echo "${name} is ready! (HTTP ${status})"
return 0
;;
esac
attempt=$((attempt + 1))
echo " Attempt ${attempt}/${max_attempts}: ${name} not ready yet..."
echo " Attempt ${attempt}/${max_attempts}: ${name} not ready yet (HTTP ${status:-none})..."
sleep 2
done

View File

@@ -8,10 +8,10 @@ services:
dockerfile: cmd/benchmark/Dockerfile.next-orly
container_name: benchmark-next-orly
environment:
- DATA_DIR=/data
- LISTEN=0.0.0.0
- PORT=8080
- LOG_LEVEL=info
- ORLY_DATA_DIR=/data
- ORLY_LISTEN=0.0.0.0
- ORLY_PORT=8080
- ORLY_LOG_LEVEL=info
volumes:
- ./data/next-orly:/data
ports:
@@ -19,7 +19,7 @@ services:
networks:
- benchmark-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
test: ["CMD-SHELL", "code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8080 || echo 000); echo $$code | grep -E '^(101|200|400|404|426)$' >/dev/null"]
interval: 30s
timeout: 10s
retries: 3
@@ -34,15 +34,14 @@ services:
environment:
- DATABASE_TYPE=sqlite
- DATABASE_PATH=/data/khatru.db
- PORT=8080
volumes:
- ./data/khatru-sqlite:/data
ports:
- "8002:8080"
- "8002:3334"
networks:
- benchmark-net
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080"]
test: ["CMD-SHELL", "wget --quiet --server-response --tries=1 http://localhost:3334 2>&1 | grep -E 'HTTP/[0-9.]+ (101|200|400|404)' >/dev/null"]
interval: 30s
timeout: 10s
retries: 3
@@ -57,15 +56,14 @@ services:
environment:
- DATABASE_TYPE=badger
- DATABASE_PATH=/data/badger
- PORT=8080
volumes:
- ./data/khatru-badger:/data
ports:
- "8003:8080"
- "8003:3334"
networks:
- benchmark-net
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080"]
test: ["CMD-SHELL", "wget --quiet --server-response --tries=1 http://localhost:3334 2>&1 | grep -E 'HTTP/[0-9.]+ (101|200|400|404)' >/dev/null"]
interval: 30s
timeout: 10s
retries: 3
@@ -78,16 +76,18 @@ services:
dockerfile: ../../Dockerfile.relayer-basic
container_name: benchmark-relayer-basic
environment:
- PORT=8080
- DATABASE_PATH=/data/relayer.db
- POSTGRESQL_DATABASE=postgres://relayer:relayerpass@postgres:5432/relayerdb?sslmode=disable
volumes:
- ./data/relayer-basic:/data
ports:
- "8004:8080"
- "8004:7447"
networks:
- benchmark-net
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080"]
test: ["CMD-SHELL", "wget --quiet --server-response --tries=1 http://localhost:7447 2>&1 | grep -E 'HTTP/[0-9.]+ (101|200|400|404)' >/dev/null"]
interval: 30s
timeout: 10s
retries: 3
@@ -95,9 +95,7 @@ services:
# Strfry
strfry:
build:
context: ./external/strfry
dockerfile: ../../Dockerfile.strfry
image: ghcr.io/hoytech/strfry:latest
container_name: benchmark-strfry
environment:
- STRFRY_DB_PATH=/data/strfry.lmdb
@@ -110,7 +108,7 @@ services:
networks:
- benchmark-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
test: ["CMD-SHELL", "wget --quiet --server-response --tries=1 http://127.0.0.1:8080 2>&1 | grep -E 'HTTP/[0-9.]+ (101|200|400|404|426)' >/dev/null"]
interval: 30s
timeout: 10s
retries: 3
@@ -158,7 +156,7 @@ services:
nostr-rs-relay:
condition: service_healthy
environment:
- BENCHMARK_TARGETS=next-orly:8001,khatru-sqlite:8002,khatru-badger:8003,relayer-basic:8004,strfry:8005,nostr-rs-relay:8006
- BENCHMARK_TARGETS=next-orly:8080,khatru-sqlite:3334,khatru-badger:3334,relayer-basic:7447,strfry:8080,nostr-rs-relay:8080
- BENCHMARK_EVENTS=10000
- BENCHMARK_WORKERS=8
- BENCHMARK_DURATION=60s
@@ -174,6 +172,25 @@ services:
/app/benchmark-runner --output-dir=/reports
"
# PostgreSQL for relayer-basic
postgres:
image: postgres:16-alpine
container_name: benchmark-postgres
environment:
- POSTGRES_DB=relayerdb
- POSTGRES_USER=relayer
- POSTGRES_PASSWORD=relayerpass
volumes:
- ./data/postgres:/var/lib/postgresql/data
networks:
- benchmark-net
healthcheck:
test: ["CMD-SHELL", "pg_isready -U relayer -d relayerdb"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
networks:
benchmark-net:
driver: bridge

View File

@@ -0,0 +1,140 @@
================================================================
NOSTR RELAY BENCHMARK AGGREGATE REPORT
================================================================
Generated: 2025-09-12T20:02:26+00:00
Benchmark Configuration:
Events per test: 10000
Concurrent workers: 8
Test duration: 60s
Relays tested: 6
================================================================
SUMMARY BY RELAY
================================================================
Relay: next-orly
----------------------------------------
Status: COMPLETED
Events/sec: 17901.30
Events/sec: 1504.52
Events/sec: 17901.30
Success Rate: 100.0%
Success Rate: 100.0%
Success Rate: 100.0%
Avg Latency: 433.058µs
Avg Latency: 182.813µs
Avg Latency: 9.086952ms
P95 Latency: 456.738µs
P95 Latency: 152.86µs
P95 Latency: 18.156339ms
Relay: khatru-sqlite
----------------------------------------
Status: COMPLETED
Events/sec: 14291.70
Events/sec: 1530.29
Events/sec: 14291.70
Success Rate: 100.0%
Success Rate: 100.0%
Success Rate: 100.0%
Avg Latency: 545.724µs
Avg Latency: 205.962µs
Avg Latency: 9.092604ms
P95 Latency: 473.43µs
P95 Latency: 165.525µs
P95 Latency: 19.302571ms
Relay: khatru-badger
----------------------------------------
Status: COMPLETED
Events/sec: 16351.11
Events/sec: 1539.25
Events/sec: 16351.11
Success Rate: 100.0%
Success Rate: 100.0%
Success Rate: 100.0%
Avg Latency: 474.016µs
Avg Latency: 226.602µs
Avg Latency: 9.930935ms
P95 Latency: 479.03µs
P95 Latency: 239.525µs
P95 Latency: 17.75358ms
Relay: relayer-basic
----------------------------------------
Status: COMPLETED
Events/sec: 16522.60
Events/sec: 1537.71
Events/sec: 16522.60
Success Rate: 100.0%
Success Rate: 100.0%
Success Rate: 100.0%
Avg Latency: 466.066µs
Avg Latency: 215.609µs
Avg Latency: 9.851217ms
P95 Latency: 514.849µs
P95 Latency: 141.91µs
P95 Latency: 23.101412ms
Relay: strfry
----------------------------------------
Status: COMPLETED
Events/sec: 15346.12
Events/sec: 1534.88
Events/sec: 15346.12
Success Rate: 100.0%
Success Rate: 100.0%
Success Rate: 100.0%
Avg Latency: 506.51µs
Avg Latency: 216.564µs
Avg Latency: 9.938991ms
P95 Latency: 590.442µs
P95 Latency: 267.91µs
P95 Latency: 19.784708ms
Relay: nostr-rs-relay
----------------------------------------
Status: COMPLETED
Events/sec: 15199.95
Events/sec: 1533.87
Events/sec: 15199.95
Success Rate: 100.0%
Success Rate: 100.0%
Success Rate: 100.0%
Avg Latency: 508.699µs
Avg Latency: 217.187µs
Avg Latency: 9.38757ms
P95 Latency: 1.011413ms
P95 Latency: 130.018µs
P95 Latency: 19.250416ms
================================================================
DETAILED RESULTS
================================================================
Individual relay reports are available in:
- /reports/run_20250912_195729/khatru-badger_results.txt
- /reports/run_20250912_195729/khatru-sqlite_results.txt
- /reports/run_20250912_195729/next-orly_results.txt
- /reports/run_20250912_195729/nostr-rs-relay_results.txt
- /reports/run_20250912_195729/relayer-basic_results.txt
- /reports/run_20250912_195729/strfry_results.txt
================================================================
BENCHMARK COMPARISON TABLE
================================================================
Relay Status Peak Tput/s Avg Latency Success Rate
---- ------ ----------- ----------- ------------
next-orly OK 17901.30 433.058µs 100.0%
khatru-sqlite OK 14291.70 545.724µs 100.0%
khatru-badger OK 16351.11 474.016µs 100.0%
relayer-basic OK 16522.60 466.066µs 100.0%
strfry OK 15346.12 506.51µs 100.0%
nostr-rs-relay OK 15199.95 508.699µs 100.0%
================================================================
End of Report
================================================================

View File

@@ -0,0 +1,104 @@
Starting Nostr Relay Benchmark
Data Directory: /tmp/benchmark_khatru-badger_8
Events: 10000, Workers: 8, Duration: 1m0s
20250912195906053114 INF /tmp/benchmark_khatru-badger_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:57
20250912195906053741 INF /tmp/benchmark_khatru-badger_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:57
20250912195906053768 INF /tmp/benchmark_khatru-badger_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:57
20250912195906054020 INF (*types.Uint32)(0xc00570406c)({
value: (uint32) 1
})
/build/pkg/database/migrations.go:65
20250912195906054071 INF migrating to version 1... /build/pkg/database/migrations.go:79
=== Peak Throughput Test ===
Events saved: 10000/10000 (100.0%)
Duration: 611.579176ms
Events/sec: 16351.11
Avg latency: 474.016µs
P95 latency: 479.03µs
P99 latency: 594.73µs
=== Burst Pattern Test ===
Burst completed: 1000 events in 160.976517ms
Burst completed: 1000 events in 153.010415ms
Burst completed: 1000 events in 146.10015ms
Burst completed: 1000 events in 148.403729ms
Burst completed: 1000 events in 141.681801ms
Burst completed: 1000 events in 154.663067ms
Burst completed: 1000 events in 135.960988ms
Burst completed: 1000 events in 136.240589ms
Burst completed: 1000 events in 141.75454ms
Burst completed: 1000 events in 152.485379ms
Burst test completed: 10000 events in 6.496690038s
Events/sec: 1539.25
=== Mixed Read/Write Test ===
Pre-populating database for read tests...
Mixed test completed: 5000 writes, 5000 reads in 37.695370694s
Combined ops/sec: 265.28
================================================================================
BENCHMARK REPORT
================================================================================
Test: Peak Throughput
Duration: 611.579176ms
Total Events: 10000
Events/sec: 16351.11
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 154 MB
Avg Latency: 474.016µs
P95 Latency: 479.03µs
P99 Latency: 594.73µs
----------------------------------------
Test: Burst Pattern
Duration: 6.496690038s
Total Events: 10000
Events/sec: 1539.25
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 207 MB
Avg Latency: 226.602µs
P95 Latency: 239.525µs
P99 Latency: 168.561µs
----------------------------------------
Test: Mixed Read/Write
Duration: 37.695370694s
Total Events: 10000
Events/sec: 265.28
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 132 MB
Avg Latency: 9.930935ms
P95 Latency: 17.75358ms
P99 Latency: 24.256293ms
----------------------------------------
Report saved to: /tmp/benchmark_khatru-badger_8/benchmark_report.txt
20250912195950858706 INF /tmp/benchmark_khatru-badger_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:57
20250912195951643646 INF /tmp/benchmark_khatru-badger_8:
Level 0 [ ]: NumTables: 00. Size: 0 B of 0 B. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 64 MiB
Level 1 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 2 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 3 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 4 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 5 [B]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 6 [ ]: NumTables: 01. Size: 21 MiB of 21 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 4.0 MiB
Level Done
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/db.go:615 /build/pkg/database/logger.go:57
20250912195951645255 INF /tmp/benchmark_khatru-badger_8: database closed /build/pkg/database/database.go:134
RELAY_NAME: khatru-badger
RELAY_URL: ws://khatru-badger:3334
TEST_TIMESTAMP: 2025-09-12T19:59:51+00:00
BENCHMARK_CONFIG:
Events: 10000
Workers: 8
Duration: 60s

View File

@@ -0,0 +1,104 @@
Starting Nostr Relay Benchmark
Data Directory: /tmp/benchmark_khatru-sqlite_8
Events: 10000, Workers: 8, Duration: 1m0s
20250912195817361580 INF /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:57
20250912195817362030 INF /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:57
20250912195817362064 INF /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:57
20250912195817362711 INF (*types.Uint32)(0xc00000005c)({
value: (uint32) 1
})
/build/pkg/database/migrations.go:65
20250912195817362777 INF migrating to version 1... /build/pkg/database/migrations.go:79
=== Peak Throughput Test ===
Events saved: 10000/10000 (100.0%)
Duration: 699.706889ms
Events/sec: 14291.70
Avg latency: 545.724µs
P95 latency: 473.43µs
P99 latency: 478.349µs
=== Burst Pattern Test ===
Burst completed: 1000 events in 138.253122ms
Burst completed: 1000 events in 153.709429ms
Burst completed: 1000 events in 158.711026ms
Burst completed: 1000 events in 152.54677ms
Burst completed: 1000 events in 144.735244ms
Burst completed: 1000 events in 153.236893ms
Burst completed: 1000 events in 150.180515ms
Burst completed: 1000 events in 154.733588ms
Burst completed: 1000 events in 151.252182ms
Burst completed: 1000 events in 150.610613ms
Burst test completed: 10000 events in 6.534724469s
Events/sec: 1530.29
=== Mixed Read/Write Test ===
Pre-populating database for read tests...
Mixed test completed: 5000 writes, 5000 reads in 35.563312501s
Combined ops/sec: 281.19
================================================================================
BENCHMARK REPORT
================================================================================
Test: Peak Throughput
Duration: 699.706889ms
Total Events: 10000
Events/sec: 14291.70
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 154 MB
Avg Latency: 545.724µs
P95 Latency: 473.43µs
P99 Latency: 478.349µs
----------------------------------------
Test: Burst Pattern
Duration: 6.534724469s
Total Events: 10000
Events/sec: 1530.29
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 208 MB
Avg Latency: 205.962µs
P95 Latency: 165.525µs
P99 Latency: 253.411µs
----------------------------------------
Test: Mixed Read/Write
Duration: 35.563312501s
Total Events: 10000
Events/sec: 281.19
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 146 MB
Avg Latency: 9.092604ms
P95 Latency: 19.302571ms
P99 Latency: 16.944829ms
----------------------------------------
Report saved to: /tmp/benchmark_khatru-sqlite_8/benchmark_report.txt
20250912195900161526 INF /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:57
20250912195900909573 INF /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: 64 MiB
Level 1 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 2 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 3 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 4 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 5 [B]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 6 [ ]: NumTables: 01. Size: 21 MiB of 21 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 4.0 MiB
Level Done
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/db.go:615 /build/pkg/database/logger.go:57
20250912195900911092 INF /tmp/benchmark_khatru-sqlite_8: database closed /build/pkg/database/database.go:134
RELAY_NAME: khatru-sqlite
RELAY_URL: ws://khatru-sqlite:3334
TEST_TIMESTAMP: 2025-09-12T19:59:01+00:00
BENCHMARK_CONFIG:
Events: 10000
Workers: 8
Duration: 60s

View File

@@ -0,0 +1,104 @@
Starting Nostr Relay Benchmark
Data Directory: /tmp/benchmark_next-orly_8
Events: 10000, Workers: 8, Duration: 1m0s
20250912195729240522 INF /tmp/benchmark_next-orly_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:57
20250912195729241087 INF /tmp/benchmark_next-orly_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:57
20250912195729241168 INF /tmp/benchmark_next-orly_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:57
20250912195729241759 INF (*types.Uint32)(0xc0001de49c)({
value: (uint32) 1
})
/build/pkg/database/migrations.go:65
20250912195729241847 INF migrating to version 1... /build/pkg/database/migrations.go:79
=== Peak Throughput Test ===
Events saved: 10000/10000 (100.0%)
Duration: 558.618706ms
Events/sec: 17901.30
Avg latency: 433.058µs
P95 latency: 456.738µs
P99 latency: 337.231µs
=== Burst Pattern Test ===
Burst completed: 1000 events in 172.949275ms
Burst completed: 1000 events in 175.209401ms
Burst completed: 1000 events in 156.532197ms
Burst completed: 1000 events in 157.913421ms
Burst completed: 1000 events in 151.37659ms
Burst completed: 1000 events in 161.938783ms
Burst completed: 1000 events in 168.47761ms
Burst completed: 1000 events in 159.951768ms
Burst completed: 1000 events in 170.308111ms
Burst completed: 1000 events in 146.767432ms
Burst test completed: 10000 events in 6.646634323s
Events/sec: 1504.52
=== Mixed Read/Write Test ===
Pre-populating database for read tests...
Mixed test completed: 5000 writes, 5000 reads in 35.548232107s
Combined ops/sec: 281.31
================================================================================
BENCHMARK REPORT
================================================================================
Test: Peak Throughput
Duration: 558.618706ms
Total Events: 10000
Events/sec: 17901.30
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 154 MB
Avg Latency: 433.058µs
P95 Latency: 456.738µs
P99 Latency: 337.231µs
----------------------------------------
Test: Burst Pattern
Duration: 6.646634323s
Total Events: 10000
Events/sec: 1504.52
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 207 MB
Avg Latency: 182.813µs
P95 Latency: 152.86µs
P99 Latency: 204.198µs
----------------------------------------
Test: Mixed Read/Write
Duration: 35.548232107s
Total Events: 10000
Events/sec: 281.31
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 215 MB
Avg Latency: 9.086952ms
P95 Latency: 18.156339ms
P99 Latency: 24.346573ms
----------------------------------------
Report saved to: /tmp/benchmark_next-orly_8/benchmark_report.txt
20250912195811996353 INF /tmp/benchmark_next-orly_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:57
20250912195812308400 INF /tmp/benchmark_next-orly_8:
Level 0 [ ]: NumTables: 00. Size: 0 B of 0 B. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 64 MiB
Level 1 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 2 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 3 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 4 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 5 [B]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 6 [ ]: NumTables: 01. Size: 21 MiB of 21 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 4.0 MiB
Level Done
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/db.go:615 /build/pkg/database/logger.go:57
20250912195812310341 INF /tmp/benchmark_next-orly_8: database closed /build/pkg/database/database.go:134
RELAY_NAME: next-orly
RELAY_URL: ws://next-orly:8080
TEST_TIMESTAMP: 2025-09-12T19:58:12+00:00
BENCHMARK_CONFIG:
Events: 10000
Workers: 8
Duration: 60s

View File

@@ -0,0 +1,104 @@
Starting Nostr Relay Benchmark
Data Directory: /tmp/benchmark_nostr-rs-relay_8
Events: 10000, Workers: 8, Duration: 1m0s
20250912200137539643 INF /tmp/benchmark_nostr-rs-relay_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:57
20250912200137540391 INF /tmp/benchmark_nostr-rs-relay_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:57
20250912200137540449 INF /tmp/benchmark_nostr-rs-relay_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:57
20250912200137540903 INF (*types.Uint32)(0xc0001c24cc)({
value: (uint32) 1
})
/build/pkg/database/migrations.go:65
20250912200137540961 INF migrating to version 1... /build/pkg/database/migrations.go:79
=== Peak Throughput Test ===
Events saved: 10000/10000 (100.0%)
Duration: 657.896815ms
Events/sec: 15199.95
Avg latency: 508.699µs
P95 latency: 1.011413ms
P99 latency: 710.782µs
=== Burst Pattern Test ===
Burst completed: 1000 events in 149.389787ms
Burst completed: 1000 events in 138.154354ms
Burst completed: 1000 events in 139.952633ms
Burst completed: 1000 events in 148.684306ms
Burst completed: 1000 events in 154.779586ms
Burst completed: 1000 events in 163.72717ms
Burst completed: 1000 events in 142.665132ms
Burst completed: 1000 events in 151.637082ms
Burst completed: 1000 events in 143.018896ms
Burst completed: 1000 events in 157.963802ms
Burst test completed: 10000 events in 6.519459944s
Events/sec: 1533.87
=== Mixed Read/Write Test ===
Pre-populating database for read tests...
Mixed test completed: 5000 writes, 5000 reads in 36.26569002s
Combined ops/sec: 275.74
================================================================================
BENCHMARK REPORT
================================================================================
Test: Peak Throughput
Duration: 657.896815ms
Total Events: 10000
Events/sec: 15199.95
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 153 MB
Avg Latency: 508.699µs
P95 Latency: 1.011413ms
P99 Latency: 710.782µs
----------------------------------------
Test: Burst Pattern
Duration: 6.519459944s
Total Events: 10000
Events/sec: 1533.87
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 206 MB
Avg Latency: 217.187µs
P95 Latency: 130.018µs
P99 Latency: 261.728µs
----------------------------------------
Test: Mixed Read/Write
Duration: 36.26569002s
Total Events: 10000
Events/sec: 275.74
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 225 MB
Avg Latency: 9.38757ms
P95 Latency: 19.250416ms
P99 Latency: 20.049957ms
----------------------------------------
Report saved to: /tmp/benchmark_nostr-rs-relay_8/benchmark_report.txt
20250912200220985006 INF /tmp/benchmark_nostr-rs-relay_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:57
20250912200221295381 INF /tmp/benchmark_nostr-rs-relay_8:
Level 0 [ ]: NumTables: 00. Size: 0 B of 0 B. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 64 MiB
Level 1 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 2 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 3 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 4 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 5 [B]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 6 [ ]: NumTables: 01. Size: 21 MiB of 21 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 4.0 MiB
Level Done
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/db.go:615 /build/pkg/database/logger.go:57
20250912200221297677 INF /tmp/benchmark_nostr-rs-relay_8: database closed /build/pkg/database/database.go:134
RELAY_NAME: nostr-rs-relay
RELAY_URL: ws://nostr-rs-relay:8080
TEST_TIMESTAMP: 2025-09-12T20:02:21+00:00
BENCHMARK_CONFIG:
Events: 10000
Workers: 8
Duration: 60s

View File

@@ -0,0 +1,104 @@
Starting Nostr Relay Benchmark
Data Directory: /tmp/benchmark_relayer-basic_8
Events: 10000, Workers: 8, Duration: 1m0s
20250912195956808180 INF /tmp/benchmark_relayer-basic_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:57
20250912195956808720 INF /tmp/benchmark_relayer-basic_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:57
20250912195956808755 INF /tmp/benchmark_relayer-basic_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:57
20250912195956809102 INF (*types.Uint32)(0xc0001bc04c)({
value: (uint32) 1
})
/build/pkg/database/migrations.go:65
20250912195956809190 INF migrating to version 1... /build/pkg/database/migrations.go:79
=== Peak Throughput Test ===
Events saved: 10000/10000 (100.0%)
Duration: 605.231707ms
Events/sec: 16522.60
Avg latency: 466.066µs
P95 latency: 514.849µs
P99 latency: 451.358µs
=== Burst Pattern Test ===
Burst completed: 1000 events in 149.715312ms
Burst completed: 1000 events in 146.385191ms
Burst completed: 1000 events in 147.010481ms
Burst completed: 1000 events in 151.671062ms
Burst completed: 1000 events in 143.215087ms
Burst completed: 1000 events in 137.331431ms
Burst completed: 1000 events in 155.735079ms
Burst completed: 1000 events in 161.246126ms
Burst completed: 1000 events in 140.174417ms
Burst completed: 1000 events in 144.819799ms
Burst test completed: 10000 events in 6.503155987s
Events/sec: 1537.71
=== Mixed Read/Write Test ===
Pre-populating database for read tests...
Mixed test completed: 5000 writes, 5000 reads in 37.45410417s
Combined ops/sec: 266.99
================================================================================
BENCHMARK REPORT
================================================================================
Test: Peak Throughput
Duration: 605.231707ms
Total Events: 10000
Events/sec: 16522.60
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 152 MB
Avg Latency: 466.066µs
P95 Latency: 514.849µs
P99 Latency: 451.358µs
----------------------------------------
Test: Burst Pattern
Duration: 6.503155987s
Total Events: 10000
Events/sec: 1537.71
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 203 MB
Avg Latency: 215.609µs
P95 Latency: 141.91µs
P99 Latency: 204.819µs
----------------------------------------
Test: Mixed Read/Write
Duration: 37.45410417s
Total Events: 10000
Events/sec: 266.99
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 148 MB
Avg Latency: 9.851217ms
P95 Latency: 23.101412ms
P99 Latency: 17.889412ms
----------------------------------------
Report saved to: /tmp/benchmark_relayer-basic_8/benchmark_report.txt
20250912200041372670 INF /tmp/benchmark_relayer-basic_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:57
20250912200041686782 INF /tmp/benchmark_relayer-basic_8:
Level 0 [ ]: NumTables: 00. Size: 0 B of 0 B. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 64 MiB
Level 1 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 2 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 3 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 4 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 5 [B]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 6 [ ]: NumTables: 01. Size: 21 MiB of 21 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 4.0 MiB
Level Done
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/db.go:615 /build/pkg/database/logger.go:57
20250912200041689009 INF /tmp/benchmark_relayer-basic_8: database closed /build/pkg/database/database.go:134
RELAY_NAME: relayer-basic
RELAY_URL: ws://relayer-basic:7447
TEST_TIMESTAMP: 2025-09-12T20:00:41+00:00
BENCHMARK_CONFIG:
Events: 10000
Workers: 8
Duration: 60s

View File

@@ -0,0 +1,35 @@
= NOSTR Relay Benchmark Results
Generated from: aggregate_report.txt
[cols="1,^1,^1,^1,^1,^1,^1",options="header"]
|===
| Metric | next-orly | khatru-sqlite | khatru-badger | relayer-basic | strfry | nostr-rs-relay
| Store Events/sec
| 17901.30 | 14291.70 | 16351.11 | 16522.60 | 15346.12 | 15199.95
| Store Avg Latency #1
| 433.058µs | 545.724µs | 474.016µs | 466.066µs | 506.51µs | 508.699µs
| Store P95 Latency #1
| 456.738µs | 473.43µs | 479.03µs | 514.849µs | 590.442µs | 1.011413ms
| Query Events/sec #2
| 1504.52 | 1530.29 | 1539.25 | 1537.71 | 1534.88 | 1533.87
| Query Avg Latency #2
| 182.813µs | 205.962µs | 226.602µs | 215.609µs | 216.564µs | 217.187µs
| Query P95 Latency #2
| 152.86µs | 165.525µs | 239.525µs | 141.91µs | 267.91µs | 130.018µs
| Concurrent Store/Query Events/sec #3
| 17901.30 | 14291.70 | 16351.11 | 16522.60 | 15346.12 | 15199.95
| Concurrent Store/Query Avg Latency #3
| 9.086952ms | 9.092604ms | 9.930935ms | 9.851217ms | 9.938991ms | 9.38757ms
| Concurrent Store/Query P95 Latency #3
| 18.156339ms | 19.302571ms | 17.75358ms | 23.101412ms | 19.784708ms | 19.250416ms
|===

View File

@@ -0,0 +1,104 @@
Starting Nostr Relay Benchmark
Data Directory: /tmp/benchmark_strfry_8
Events: 10000, Workers: 8, Duration: 1m0s
20250912200046745432 INF /tmp/benchmark_strfry_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:57
20250912200046746116 INF /tmp/benchmark_strfry_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:57
20250912200046746193 INF /tmp/benchmark_strfry_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:57
20250912200046746576 INF (*types.Uint32)(0xc0002a9c4c)({
value: (uint32) 1
})
/build/pkg/database/migrations.go:65
20250912200046746636 INF migrating to version 1... /build/pkg/database/migrations.go:79
=== Peak Throughput Test ===
Events saved: 10000/10000 (100.0%)
Duration: 651.630667ms
Events/sec: 15346.12
Avg latency: 506.51µs
P95 latency: 590.442µs
P99 latency: 278.399µs
=== Burst Pattern Test ===
Burst completed: 1000 events in 148.701372ms
Burst completed: 1000 events in 161.333951ms
Burst completed: 1000 events in 146.993646ms
Burst completed: 1000 events in 155.768019ms
Burst completed: 1000 events in 143.83944ms
Burst completed: 1000 events in 156.208347ms
Burst completed: 1000 events in 150.769887ms
Burst completed: 1000 events in 140.217044ms
Burst completed: 1000 events in 150.831164ms
Burst completed: 1000 events in 135.759058ms
Burst test completed: 10000 events in 6.515183689s
Events/sec: 1534.88
=== Mixed Read/Write Test ===
Pre-populating database for read tests...
Mixed test completed: 5000 writes, 5000 reads in 37.667054484s
Combined ops/sec: 265.48
================================================================================
BENCHMARK REPORT
================================================================================
Test: Peak Throughput
Duration: 651.630667ms
Total Events: 10000
Events/sec: 15346.12
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 152 MB
Avg Latency: 506.51µs
P95 Latency: 590.442µs
P99 Latency: 278.399µs
----------------------------------------
Test: Burst Pattern
Duration: 6.515183689s
Total Events: 10000
Events/sec: 1534.88
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 203 MB
Avg Latency: 216.564µs
P95 Latency: 267.91µs
P99 Latency: 310.46µs
----------------------------------------
Test: Mixed Read/Write
Duration: 37.667054484s
Total Events: 10000
Events/sec: 265.48
Success Rate: 100.0%
Concurrent Workers: 8
Memory Used: 136 MB
Avg Latency: 9.938991ms
P95 Latency: 19.784708ms
P99 Latency: 18.788985ms
----------------------------------------
Report saved to: /tmp/benchmark_strfry_8/benchmark_report.txt
20250912200131581470 INF /tmp/benchmark_strfry_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:57
20250912200132372653 INF /tmp/benchmark_strfry_8:
Level 0 [ ]: NumTables: 00. Size: 0 B of 0 B. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 64 MiB
Level 1 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 2 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 3 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 4 [ ]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 5 [B]: NumTables: 00. Size: 0 B of 10 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 2.0 MiB
Level 6 [ ]: NumTables: 01. Size: 21 MiB of 21 MiB. Score: 0.00->0.00 StaleData: 0 B Target FileSize: 4.0 MiB
Level Done
/go/pkg/mod/github.com/dgraph-io/badger/v4@v4.8.0/db.go:615 /build/pkg/database/logger.go:57
20250912200132384548 INF /tmp/benchmark_strfry_8: database closed /build/pkg/database/database.go:134
RELAY_NAME: strfry
RELAY_URL: ws://strfry:8080
TEST_TIMESTAMP: 2025-09-12T20:01:32+00:00
BENCHMARK_CONFIG:
Events: 10000
Workers: 8
Duration: 60s

39
main.go
View File

@@ -3,15 +3,17 @@ package main
import (
"context"
"fmt"
"net/http"
"os"
"os/signal"
"time"
"lol.mleku.dev/chk"
"lol.mleku.dev/log"
"next.orly.dev/app"
"next.orly.dev/app/config"
acl "next.orly.dev/pkg/acl"
database "next.orly.dev/pkg/database"
"next.orly.dev/pkg/acl"
"next.orly.dev/pkg/database"
"next.orly.dev/pkg/version"
)
@@ -34,6 +36,39 @@ func main() {
os.Exit(1)
}
acl.Registry.Syncer()
// Start health check HTTP server if configured
var healthSrv *http.Server
if cfg.HealthPort > 0 {
mux := http.NewServeMux()
mux.HandleFunc(
"/healthz", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte("ok"))
log.I.F("health check ok")
},
)
healthSrv = &http.Server{
Addr: fmt.Sprintf(
"%s:%d", cfg.Listen, cfg.HealthPort,
), Handler: mux,
}
go func() {
log.I.F("health check server listening on %s", healthSrv.Addr)
if err := healthSrv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
log.E.F("health server error: %v", err)
}
}()
go func() {
<-ctx.Done()
shutdownCtx, cancelShutdown := context.WithTimeout(
context.Background(), 2*time.Second,
)
defer cancelShutdown()
_ = healthSrv.Shutdown(shutdownCtx)
}()
}
quit := app.Run(ctx, cfg, db)
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, os.Interrupt)