feat!: fanout tree protocol + large-network sims + interactive sandbox#582
Open
marcus-pousette wants to merge 85 commits intomasterfrom
Open
feat!: fanout tree protocol + large-network sims + interactive sandbox#582marcus-pousette wants to merge 85 commits intomasterfrom
marcus-pousette wants to merge 85 commits intomasterfrom
Conversation
Member
Author
|
Added overlay-formation objective metrics to fanout-tree-sim (issue #585):
These are now asserted in CI via fanout-tree-sim.spec.ts to catch formation regressions early. |
Member
Author
|
Pushed a few follow-up commits to tighten the PR before merge:
|
Member
Author
|
Follow-ups:
|
Remove legacy rpc fallback for target:"all" append path and make fanout failures explicit.\nForward fanout options through Documents->SharedLog and update tests/spec notes for root-only fanout publish/control-plane behavior.
Bound route-token cache with TTL+eviction, add route announce/query/reply control messages, expose fanout helpers on Peerbit instead of DirectSub wiring, and add route/cache metrics in sims + protocol docs.
Increase timing tolerance for known flaky scenarios and bound late-drop wait to avoid callback timing hangs in CI.
Scale scenario size and widen convergence window for min-replica search test to avoid CI variance while preserving intent.
Member
Author
|
CI is green on the latest head ( What is now covered in this PR:
Follow-up issues for remaining long-term work:
|
\nBREAKING CHANGE: FanoutTree no longer uses periodic route announcements; root route resolution is now demand-driven via subtree route queries.
Deflake integration tests and refresh docs/examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Peerbit needs a pubsub mode that stays economic as the audience grows.
At large scale, subscription dissemination and redundant forwarding can dominate the payload. One common symptom we have seen is "subscribe gossip exploding".
Long-term goal: support workloads like 1 publisher -> 100k to 1M subscribers with:
What protocol are we building?
An experimental FanoutTree protocol on top of
@peerbit/stream.Today it targets a single-writer, sequence-numbered channel identified by
(root, topic). The data plane aims for near-tree cost while reliability comes from bounded, local repair.Control plane (join + discovery)
TRACKER_ANNOUNCE) and joiners query candidates (TRACKER_QUERY/TRACKER_REPLY).JOIN_REQ/JOIN_ACCEPT/JOIN_REJECTwith optional redirects).bidPerByte) for selection and optional kicking when overloaded.Data plane (bounded forwarding + bounded repair)
IHAVE+FETCH_REQ).Wire format notes live in
docs/fanout-tree-protocol.mdand the broader engineering spec lives indocs/scalable-fanout.md.Design inspiration (references)
What this PR adds
Large-network testing and sims (local + deterministic)
pubsub-topic-sim)fanout-tree-sim)Browser sandbox
TopicControlPlane(/lazysub/0.0.1) and@peerbit/streamlogic over the in-memory shim.Peerbit integration
peer.services.fanout(FanoutTree) alongsidepeer.services.pubsub(TopicControlPlane), sharing the sameTopicRootControlPlane.target: "all"uses the fanout data plane when configured; it intentionally does not fall back to legacy RPC send.Transport scalability hardening
@peerbit/streamroute caching is now explicitly bounded (LRU + truncation) to avoid OOM in large local sims; bounds are configurable viaDirectStreamOptions(routeCacheMaxFromEntries,routeCacheMaxTargetsPerFrom,routeCacheMaxRelaysPerTarget).Tracking issues
How to review
Suggested order:
docs/scalable-fanout.mddocs/fanout-tree-protocol.mdpackages/transport/pubsub/src/fanout-tree.ts(+fanout-channel.ts)packages/transport/pubsub/benchmark/*apps/peerbit-org/src/ui/FanoutProtocolSandbox.tsxHow to verify locally
pnpm run buildpnpm run test:ci:part-1pnpm run test:ci:part-2pnpm run test:ci:part-3pnpm run test:ci:part-4pnpm run test:ci:part-5Notes / non-goals for now
/peerbit/fanout-tree/0.5.0and assumes coordinated upgrades.