Skip to content

Migrate eventstore to LMDB and tune WoT bootstrap fetches - #97

Merged
barrydeen merged 2 commits into
masterfrom
lmdb-migration-and-bootstrap-tuning
Apr 22, 2026
Merged

Migrate eventstore to LMDB and tune WoT bootstrap fetches#97
barrydeen merged 2 commits into
masterfrom
lmdb-migration-and-bootstrap-tuning

Conversation

@barrydeen

Copy link
Copy Markdown
Owner

Summary

  • Swap Badger for LMDB (fiatjaf.com/nostr/eventstore/lmdb) as the relay's eventstore. Formats are incompatible, so add a JSONL export/import path for existing deployments: tools/export-badger dumps a legacy Badger DB, cmd/import-jsonl loads it into a fresh LMDB store. Migration steps documented in README.
  • Tune WoT bootstrap: wotConcurrency and profileConcurrency 20 → 5, wotBatchTimeout and profileBatchTimeout 8s → 30s. Each batch already fans out a subscription to every seed relay, so 20 concurrent batches meant ~20 simultaneous subs per seed relay, tripping "too many concurrent requests" limits and silently dropping follow lists. The 8s window was also too short for slower relays to drain. Observed trust network size had fallen from ~45k to ~13k keys; this should recover most of the lost keys at the cost of a slower (but complete) refresh pass.

Test plan

  • Run tools/export-badger against an existing Badger db/ and confirm JSONL output is well-formed
  • Run cmd/import-jsonl into a fresh directory and confirm the relay starts and serves the imported events
  • Boot the relay from scratch and verify trust network size recovers toward the prior ~45k range rather than stalling near 13k
  • Watch logs during initial WoT build for a meaningful drop in "too many concurrent requests" style rejections from seed relays

🤖 Generated with Claude Code

barrydeen and others added 2 commits April 22, 2026 10:37
Switches the backend from Badger to LMDB via
fiatjaf.com/nostr/eventstore/lmdb. Adds a one-shot export tool
(tools/export-badger) and importer (cmd/import-jsonl) so existing
deployments can migrate by exporting to JSONL and reimporting into a
fresh LMDB store; documents the steps in the README.

Also tunes the WoT bootstrap: drops per-batch concurrency from 20 to 5
and raises the fetch timeout from 8s to 30s for both the graph build
and the profile refresh. Seed relays were rejecting a large fraction
of our subscriptions with "too many concurrent requests" (each batch
fans out to all 14 seed relays, so 20 batches = ~20 simultaneous subs
per relay, above typical caps), and the 8s window was cutting off slow
relays mid-drain. Trust network size had dropped from ~45k to ~13k
keys as a result.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drops the now-dead -tags badger build flag from arm64.Dockerfile (no
Go file references that tag anymore — it was only used by the old
Badger-backed code path).

Adds a Docker migration section to the README so users who run
wot-relay via docker-compose can perform the Badger → LMDB migration
without installing Go on the host: both the export and import tools
are run inside throwaway golang:bookworm containers bind-mounted at
the same ./db path that compose already uses.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@barrydeen
barrydeen merged commit 2b1a950 into master Apr 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant