Magnitude Relay: The Fastest Nostr Relay
Vector now runs on its own Nostr relay. Real Vector traffic is answered 38× faster, Community messages land 72× sooner, and the same data takes less than half the disk.
Relays are the servers that carry Vector's encrypted messages between devices. They can't read your DMs or Communities (everything is gift-wrapped), but they decide how fast those load, sync and arrive.
Vector's relays ran strfry, the workhorse of Nostr. It served us well, but it's built for every kind of Nostr traffic, and Vector's is specific: gift-wrapped DMs, Concord Communities, negentropy sync and live typing indicators. So we built a relay for exactly that: Magnitude Relay, sibling to Magnitude, our media server. It took over both of Vector's relays on 21–22 October. Nobody had to update a thing.
DMs and Communities Load up to 10× Faster
Same machine, same two CPU cores, the same million Vector-shaped events, every answer checked. Here's how long each relay takes to answer what Vector asks.
The last row counts most. We replayed 951 requests built from jskitty.com's 4.9 million real events against both relays side by side. The answers matched, except for messages their senders or recipients had asked to delete, which strfry was still serving. Magnitude Relay averaged 0.45 ms; strfry, 17.4 ms.
How
Messages live in one append-only log that's regrouped in the background, so each DM inbox and each Community sits together on disk: a 500-message inbox is one short read, not 500 scattered ones. Indexes are compressed, checksummed blocks behind a filter that rules out misses without reading a block, and the hot paths parse JSON and hex with SIMD.
Sync up to 6.7× Faster
After time offline, Vector catches up with negentropy (NIP-77): the app and relay compare compact fingerprints, and only what's missing is sent. Magnitude Relay builds those fingerprints from its index alone, without opening a single message.
The relays sync each other the same way, so a message sent to jskitty.com in Helsinki reaches Vector Asia in Kuala Lumpur in under a second.
Community Messages Arrive 72× Sooner
When someone posts in a Community, the relay stores the message and pushes it to every member online. That gap is the relay's whole share of how instant chat feels.
Both lanes in true proportion, slowed down 500×.
sooner for a typical message: 0.58 ms vs 41.9 ms.
sooner for the slowest 1 in 100: 6.1 ms vs 111 ms.
strfry picks up new messages for delivery in small batches, which adds tens of milliseconds to each one. Magnitude Relay delivers the moment a message is safely on disk.
Ready to Scale
Today each Vector relay averages about 34 requests and 3 new messages a second. On just two CPU cores, Magnitude Relay handles over 11,000 DM inbox loads and 29,000 new messages a second: more than 300× today's reads and 9,000× today's writes.
Every message reaches each relay more than once (Vector sends to several, and the relays sync each other), so skipping duplicates 24× faster frees the relay for real work.
Proven in Production
Vector's two relays, in the 30 hours after their latest update on 22–23 October:
requests answered
average time to a complete answer
events delivered to apps
connections served
A switch with zero downtime
No downtime, a way back at every step, no message lost.
- Dress rehearsal. A hidden copy of Magnitude Relay, fed every new event live, answers real requests side by side with strfry, and catches two bugs before any user could.
- jskitty.com switches. 4,877,620 events copied over, one web server reload, strfry kept in sync behind it as a way back. Nobody is cut off.
- Vector Asia switches. The two relays now sync each other directly, typing indicators included.
- strfry retires on both servers after a quiet night.
Updates roll out one relay at a time, each back online in about half a second. A release that isn't healthy within 30 seconds is rolled back automatically.
Built for Self-Hosters
Our rule: maximum speed on minimum hardware. Every change that cost resources had to prove it made the relay faster.
Most relays, strfry included, slow down once the database outgrows memory; this summer, that happened to jskitty.com. So we tested Magnitude Relay with 13 GB of real data and only 1 GB of memory:
to open the 50 busiest DM inboxes in the dataset
busy inboxes served, 50× more than with the data in arrival order
In production each relay uses 190–370 MB of its own memory while serving over a thousand connections. After loading a million events, its total footprint was 1.2 GB against strfry's 3.1 GB, 61% less (most of both is cached database the system can reclaim).
- One program, one settings file.
magnitude-relay initwrites a commented one. - Moves in from strfry. Imports strfry exports directly, checking every signature, and can sync with a running strfry while you try it.
- HTTPS built in. Fetches and renews its own certificates, or sits behind nginx on a local socket.
- Live backups. A consistent copy of the store without stopping the relay.
- Dashboard and metrics. The page above, plus Prometheus metrics.
- Relay-to-relay sync. Keep several relays complete with NIP-77, as jskitty.com and Vector Asia do.
Magnitude Relay is open source under the AGPL-3.0: run your own from github.com/VectorPrivacy/magnitude-relay.
Private by Design
A relay can't read gift-wrapped messages, but it decides what's kept, and whether delete means delete.
What Happens to Your Data
| On Vector's relays | strfry (before) | Magnitude Relay |
|---|---|---|
| "Request to Vanish" honoured NIP-62: erase everything I sent | No | Yes |
| Deleted messages wiped from disk not just hidden | Not guaranteed | Overwritten |
| Typing indicators & push requests ephemeral events | Stored 5 min | Never stored |
| What it accepts | Anything | Vector's kinds only |
| Publishes its Tor & I2P addresses | No | Built in |
Moving jskitty.com over, we found 38 vanish requests and 24 deletions strfry had never applied, covering over a thousand events. Magnitude Relay applied them all on import, and now overwrites deleted data on disk. Both relays also serve Tor and I2P, as gateways to the relay only.
Standing on the Shoulders of Giants
- strfry and Doug Hoyte, for carrying Vector's messages from the start, and for negentropy, the sync protocol both relays still speak
- The Nostr community, for an open protocol anyone can build a relay for
- Rust and Tokio, for making fast and safe the same thing
Like Open-Source DOOM, Magnitude Relay was built as a collaboration between a human developer and an AI (Claude, by Anthropic).
Vector needed a relay as fast as its client.
So we built one.
Join the Vector Community
Get connected with the Vector Community, where you can meet other like-minded privacy advocates and make friends from around the world. Get the latest updates in development, insights, and some teasers only dropped in the Vector Community!
Join Community