nym icon indicating copy to clipboard operation
nym copied to clipboard

Lower bandwidth used for topology refresh

Open jmwample opened this issue 8 months ago • 1 comments

Prevents re-pulling node descriptors that are already known while using the TopologyRefresher

What does this do

  • Adds an endpoint to the Nym API that allows pulling batches of node descriptors by node_id
  • Creates a TopologyProvider that caches topologies and only goes to network if the known topology is older than the configured cache ttl.
  • When refreshing the Topology we compare the node IDs in the cache to the node IDs in the refreshed layer assignments.
    • If the epoch has not changed no descriptors are pulled
    • if the epoch has changed layer assignments are pulled and updated in the cached topology
    • Only descriptors for node IDs in the new layer assignments that are NOT in the known topology cache are pulled.
  • Adds a Performance field to the stored RoutingNode in the Cached topology. This way the cache contains all node descriptors and queries simply filter based on the stored performance, as opposed to filtering before storing and downloading more descriptors.

What does this not do

  • Each created MixnetClient still uses an independent TopologyProvider and cached topology. This PR does not create a shared topology provider that can be used for every new connection.
  • The first refresh pulls the full topology. This PR does not pre-cache or add any topology serialization deserialization that would prevent the initial pull.
  • This PR does not change the stage at which the initial topology is pulled. As is the TopologyRefresher is created as a MixnetCient is starting up. This means that the initial topology pull doesn't happen until we have already started the process of connecting to the mixnet.
  • This does not effect the Topology information used by the VPN client. That is a different API with different data and happens in the VPN client repo.

This change is Reviewable

jmwample avatar Mar 13 '25 20:03 jmwample

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nym-explorer-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 13, 2025 9:47pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-nextra ⬜️ Ignored (Inspect) Visit Preview Mar 13, 2025 9:47pm
nym-next-explorer ⬜️ Ignored (Inspect) Visit Preview Mar 13, 2025 9:47pm

vercel[bot] avatar Mar 13 '25 21:03 vercel[bot]