Q&A: Phase 9.3 FederatedTaskRouter — routing strategies, load_score, stale_cap_ms, capabilities, custom strategies, and Grafana monitoring #308
Unanswered
web3guru888
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Q&A —
FederatedTaskRouterconfiguration and behaviourAnswers to the most common questions about the Phase 9.3
FederatedTaskRouter.Q1: Which routing strategy should I use by default?
Use
capability_firstunless you have a specific reason to switch.capability_firstconsistent_hashauctionQ2: How is
load_scoremeasured and updated?load_score(0.0–1.0) is written by each node toFederatedBlackboardunder the key"peer/{peer_id}/cap"during its heartbeat loop (typically every 2 s, same interval asFederationGatewayhealth poll).ConsistentHashStrategyskips this peer entirelyA simple implementation:
load_score = active_cycles / max_concurrent_cycles.Q3: What does
stale_cap_mscontrol?stale_cap_ms(default 5 000 ms) is the maximum age of aPeerCapSnapshotbefore it is ignored. If a peer has not written a fresh"peer/{peer_id}/cap"entry to theFederatedBlackboardwithin this window, its snapshot is discarded andasi_router_stale_snapshots_totalis incremented.Tune this to slightly above your heartbeat interval:
stale_cap_msQ4: What happens when
required_capsis an empty frozenset?An empty
required_capsmeans "any peer will do." All strategies treat every candidate as eligible.CapabilityFirstStrategy→ picks the least-loaded peerConsistentHashStrategy→ picks via rendezvous hash (ignoring caps)AuctionStrategy→ picks by lowest bid scoreQ5: How do I register my node's capabilities?
Write a
PeerCapSnapshotto theFederatedBlackboardin your startup or heartbeat loop:Q6: How do I add a custom
RoutingStrategy?Implement the
RoutingStrategyProtocol — any class with aselect(envelope, candidates) -> str | Nonemethod qualifies:Pass it to
build_task_router(strategy=PriorityFirstStrategy()).Q7: How do I monitor routing health with Grafana?
Recommended dashboard panels:
Alert rule — fallback surge:
Beta Was this translation helpful? Give feedback.
All reactions