mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-10-13 07:46:15 -08:00
Public relays create many mostly empty maps for each foreign network. DashMap defaults to 128 shards on a 24-CPU host, allocating about 1.26 GiB of shard arrays for 2,421 networks before peer/session state. Cap these maps at eight shards and retain the four-shard default on single-CPU hosts. Cache the shard count once and keep global indexes on their existing default. Apply the same cap to peer connection maps and route synchronization version maps. Replace nested peer/network DashSets with HashSets protected by their existing outer map or an entry mutex. Keep cross-index updates under the manager lock. Use a plain HashMap for the local route graph index. Validation: 245 peer/RPC tests and eight three-node integration tests passed, along with workspace fmt and clippy with full features.