Networking
latency
mesh
routing

Multi-Hop Relay Routing

Optimized routes across relays lower cross-region latency by 30-50%.

Overview

Multi-hop routing allows Tunnely to intelligently route traffic through multiple relay servers to find the fastest path between players, especially for cross-region connections. This can reduce latency by 30-50% compared to direct connections.

Quick Summary

  • Dijkstra-based route optimizer with hop penalty
  • Mesh monitoring + adaptive re-routing on degradation
  • HMAC-auth + TLS/WSS between relays
  • Self-healing; no client configuration required

How It Works

1

When you connect to a server, Tunnely measures the latency to all available relay servers in the mesh network.

2

A Dijkstra-based algorithm calculates the optimal path, considering both direct latency and the number of hops (fewer hops are preferred).

3

If the direct path has high latency (e.g., US-West to EU), the system might route through an intermediate relay (e.g., US-East) for better overall performance.

4

The mesh continuously monitors connection quality and automatically reroutes traffic if a better path becomes available or if degradation is detected.

5

All inter-relay communication is secured with HMAC authentication and TLS/WSS encryption.

Use Cases

Real-World Examples

Transatlantic Play

Player in California connecting to server in Germany routes through New York relay, reducing latency from 180ms to 120ms.

Asia-Pacific Optimization

Player in Australia to Japan server routes through Singapore relay, cutting latency from 150ms to 90ms.

Automatic Failover

Primary relay in London goes down; traffic automatically reroutes through Paris with minimal disruption.

Technical Details

  • The route optimizer runs Dijkstra's algorithm with a hop penalty to balance latency vs complexity.
  • Mesh monitoring probes run every 30 seconds to measure inter-relay latency and packet loss.
  • Adaptive rerouting triggers when latency increases by >20% or packet loss exceeds 2%.
  • Route caching prevents frequent recalculation but allows for dynamic updates when needed.
  • HMAC signatures prevent relay spoofing; only authenticated relays can participate in routing.

Best Practices

  • Multi-hop routing is automatic - no configuration needed from users.
  • The system prefers fewer hops when latency is similar to reduce complexity.
  • If experiencing lag, the system may take 30-60 seconds to detect and reroute automatically.
  • Self-hosted relay operators can join the mesh network to improve routing for their region.

Common Issues & Solutions

  • Initial connection may take slightly longer as the optimal route is calculated.
  • Very rarely, the routing algorithm might choose a suboptimal path - this auto-corrects within 60 seconds.
  • Relay outages trigger immediate rerouting but may cause a brief lag spike during transition.

TAGS

latency
mesh
routing
relays