Abstract
Finding efficient routes for data packets is an essential task in computer networking. The optimal routes depend greatly on the current network topology, state and traffic demand, and they can change within milliseconds. Reinforcement Learning can help to learn network representations that provide routing decisions for possibly novel situations. So far, this has commonly been done using fluid network models. We investigate their suitability for millisecond-scale adaptations with a range of traffic mixes and find that packet-level network models are necessary to capture true dynamics, in particular in the presence of TCP traffic. To this end, we present PackeRL, the first packet-level Reinforcement Learning environment for routing in generic network topologies. Our experiments confirm that learning-based strategies that have been trained in fluid environments do not generalize well to this more realistic, but more challenging setup. Hence, we also introduce two new algorithms for learning sub-second Routing Optimization. We present M-Slim, a dynamic shortest-path algorithm that excels at high traffic volumes but is computationally hard to scale to large network topologies, and FieldLines, a novel next-hop policy design that re-optimizes routing for any network topology within milliseconds without requiring any re-training. Both algorithms outperform current learning-based approaches as well as commonly used static baseline protocols, particularly in high-traffic volume scenarios. All findings are backed by extensive experiments in realistic network conditions in our fast and versatile training and evaluation framework.
Introduction
Routing optimization (RO) is a fundamental challenge in networking, where the goal is to determine the most efficient paths for data packets. Network conditions—such as traffic spikes or link failures—can shift in milliseconds. Traditional Traffic Engineering (TE) often relies on "fluid models" that treat data as a continuous stream. However, these models fail to capture the discrete nature of packets and the complex feedback loops of protocols like TCP.
This research identifies a critical gap: Reinforcement Learning (RL) agents trained in simplified fluid environments perform poorly when faced with real-world packet-level dynamics. To address this, we introduce PackeRL, a high-performance framework that bridges RL agents with the ns-3 discrete-event simulator, enabling the study of sub-second routing optimization in realistic conditions.
Methodology: PackeRL and Novel RL Policies
The core of our work is the development of environments and algorithms capable of handling millisecond-scale dynamics.
PackeRL Framework
PackeRL allows Python-based RL agents to interact with the ns-3 simulator via shared memory, ensuring near-instantaneous communication. This allows for training on packet-level dynamics that include "jitter," congestion, and protocol-specific behaviors.
M-Slim and FieldLines
We propose two new algorithms to overcome the limitations of existing RL approaches:
- M-Slim: An evolution of the MAGNNETO algorithm. While the original required iterative steps to converge on link weights, M-Slim uses a single inference pass to predict weights. However, it still requires computing All Pairs Shortest Paths (APSP) for routing updates, which can limit its scalability to very large topologies.
- FieldLines: A novel policy design using Graph Neural Networks (GNNs). Instead of global shortest paths, it assigns "ratings" to next-hop neighbors for every destination. By utilizing positional embeddings and avoiding global APSP calculations during every update, FieldLines generalizes to unseen topologies without retraining and maintains millisecond-level inference even as the network scales.
Experimental Setup
Evaluation was conducted using synnet, a module for generating diverse network scenarios. We tested topologies ranging from 6 to 250 nodes (nx-XS to nx-XL) and various traffic mixes, including different intensities and UDP/TCP ratios to see how protocol dynamics affected learning.
Key Results and Insights
Our experiments reveal that models trained in fluid environments often perform worse than static baselines when tested in packet-level simulations. They fail to account for the "burstiness" of TCP traffic. In contrast, our proposed methods show significant improvements.
As shown in the results table, both M-Slim and FieldLines outperform industry-standard protocols like EIGRP and OSPF in high-traffic scenarios. Specifically, they achieve higher goodput (received data) and lower average delays. FieldLines, in particular, maintains millisecond-level inference even as the network scales, avoiding the computational explosion seen in previous iterative RL methods.
Conclusion
This work demonstrates that packet-level modeling is essential for developing robust, learning-based routing strategies. By capturing the true dynamics of network protocols, PackeRL provides a more realistic training ground. Our proposed algorithms, M-Slim and FieldLines, offer scalable and efficient alternatives to traditional and existing RL-based routing, paving the way for sub-second optimization in modern data centers.
Summary updated