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
When you connect to a server, Tunnely measures the latency to all available relay servers in the mesh network.
A Dijkstra-based algorithm calculates the optimal path, considering both direct latency and the number of hops (fewer hops are preferred).
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.
The mesh continuously monitors connection quality and automatically reroutes traffic if a better path becomes available or if degradation is detected.
All inter-relay communication is secured with HMAC authentication and TLS/WSS encryption.
Use Cases
Real-World Examples
Transatlantic Play
Asia-Pacific Optimization
Automatic Failover
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.