- Docs
- Nostrfi Relay
- Operations
- Capacity and sizing
Capacity and sizing
Sizing
| Process | Idle memory | Under load |
|---|---|---|
| Relay (Go) | about 55 MB | about 270 MB peak, settling near 257 MB |
| Dashboard (Nuxt) | about 97 MB | about 250 MB |
- Size for the loaded figure. Both processes keep their high-water mark: DuckDB keeps its buffer pool, and Node's heap doesn't shrink promptly.
- CPU is the relay's constraint. The full load test kept the relay at about one busy core, mostly NIP-50 search. A dashboard page costs about 7 ms of CPU.
As a floor, the relay, dashboard, and Caddy fit in 1 GB of RAM and 1 vCPU for a relay under load with a few operators. Plan 2 vCPUs if the dashboard will also see sustained traffic, and 2 GB for headroom. The shipped Compose files set no resource limits; that is a per-deployment choice.
Measured throughput
Measured with the relay's default configuration:
| Scenario | Result |
|---|---|
| Connection ramp, 50 connections | p95 4 ms to the authentication challenge |
| Live delivery, 10 subscribers × 100 events | p50 0.3 ms, p95 208 ms |
| Negentropy full resync, 200 events | one round trip, about 4 ms |
| Unique publishes, 50 connections × 5 events/s | 250 events/s |
The per-connection publish rate limit (5 events/s by default) bounded publish throughput, not storage. Raising it is a configuration change.
Search cost
Search scans the stored content, so its cost grows roughly linearly with the number of events. With 10 concurrent searchers alongside publishing:
| Stored events | Search p50 / p95 | Publish throughput during search |
|---|---|---|
| about 7,700 | 84–150 ms / 182–267 ms | 247 events/s |
| about 28,000 | 226–350 ms / 421–559 ms | 166 events/s |
Concurrent search competes with writes: at about 28,000 events it cut publish throughput by a third. The default 5-second search budget is estimated to start binding at a few hundred thousand events, which hasn't been measured directly.
Reproducing it
The relay repository includes the load-test tool used for these numbers:
cd backend
go build -o loadtest ./cmd/loadtest
./loadtest -url ws://localhost:8080 -json results.json
Run ./loadtest -h for the scenario flags.
Not yet measured
- Repeated runs for variance, and production-class hardware
- Long soak tests (memory growth, leaks, degradation over hours)
- Larger events and tag-heavy payloads
- Multi-round Negentropy and search beyond about 28,000 events
- More than one instance
Previous
Backup and retention