You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
node: idle warm connections hold dispatch permits for 30 s and can fill max_concurrent_handlers at scale #2541
Since #2475 a node keeps one warm cdn/dht/v1 connection per peer and one warm cdn/client/v1 connection per upstream. The DHT server waits 30 s between streams before it closes an idle connection (IDLE_BETWEEN_STREAMS, equal to the cdn/client/v1 reaper APP_IDLE_TIMEOUT), then flushes conn.closed() for up to 3 s.
The dispatch permit is acquired once per connection and held for the whole serve (crates/node/src/handlers/dht.rs, handlers/client/dispatch.rs). One ConnectionLimiter is shared by the probe, DHT and client handlers, with max_concurrent_handlers defaulting to 256. Before #2475 a node-to-node permit was held for about one RTT; now an idle warm connection holds it for 30 s.
Problem
Each peer pair holds about two idle permits in steady state (one per ALPN per direction). Republish sweeps and bucket refresh reach most of the routing table, so above roughly 128 active nodes idle node-to-node connections alone can take all 256 permits. A paying client then gets global-full. The project rule is that drop-cases must hold at every scale, so this cannot stay a post-deploy metric watch.
Options
Acquire the DHT permit per stream rather than per connection. The DHT serve loop is sequential, so a per-stream permit still bounds concurrent work; an idle warm connection then costs no permit.
Give idle warm connections a small pool of their own, separate from the client cap.
Have the requester close a pooled DHT connection after a shorter idle time of its own, well under 30 s.
Option 1 is the smallest change and keeps the #845 permit-hygiene argument (the 256-request and 5-minute caps stay).
Watch meanwhile
max_over_time(decdn_dispatch_in_flight[1d]) on the testnet after #2475 deploys; expect headroom under 256 at 7 nodes, which says nothing about scale.
Activity