Machine Learning and Communication Systems
Machine-Learning-Based Congestion Prediction and Adaptive Control in Datagram Networks
Department of Electronics and Communication Engineering, R. V. College of Engineering, Bengaluru, India
Published December 2026
Abstract
Datagram networks can experience congestion when multiple traffic sources compete for limited bottleneck bandwidth, leading to packet loss, delay, jitter, and reduced throughput. This paper presents a simulation-to-learning workflow for predicting congestion severity and exploring adaptive control. A dumbbell topology is modeled in ns-3 under six traffic scenarios and three queue disciplines: FIFO/DropTail, Random Early Detection (RED), and Controlled Delay (CoDel). FlowMonitor measurements are assembled into a dataset, and Logistic Regression, Decision Tree, and Random Forest classifiers are compared. A Streamlit dashboard presents network metrics and model predictions, and writes a recommended action to a control file for the next simulation run. The workflow connects network simulation, supervised learning, visualization, and feedback-based parameter adjustment. The evaluation is interpreted cautiously because the train/test protocol and consistency of scenario settings are not documented well enough to establish generalization.
Keywords: congestion prediction; datagram networks; ns-3; FlowMonitor; machine learning; active queue management; adaptive control
1Introduction
Packet-switched networks support cloud services, campus and enterprise systems, Internet of Things deployments, and real-time applications. When several senders share a constrained link, router queues grow and the network may experience packet drops, increased delay and jitter, reduced throughput, and degraded quality of service (QoS) [6, 7]. The problem is particularly visible when traffic converges on a bottleneck.
Congestion-control and queue-management mechanisms such as TCP congestion-control algorithms and active queue management (AQM) help limit network degradation [3–5]. This study examines whether simulation-derived measurements can support congestion-severity prediction and selection of control actions for a subsequent simulation cycle. The proposed workflow uses ns-3 for traffic generation, FlowMonitor for per-flow measurements, Python-based classifiers, and Streamlit for interactive analysis [1, 2, 11, 12].
This work makes the following contributions:
- a dumbbell datagram-network simulation with a shared bottleneck;
- six traffic scenarios using FIFO/DropTail, RED, and CoDel;
- automated collection of FlowMonitor statistics for dataset construction;
- a comparison of Logistic Regression, Decision Tree, and Random Forest models; and
- a dashboard and file-based feedback path for proposing parameter changes between runs.
2Related background
Controlled simulation allows network parameters—including link capacity, delay, queue discipline, packet size, traffic intensity, and client count—to be varied systematically [1, 2]. Dumbbell topologies are useful for bottleneck experiments because flows from multiple senders converge on a shared link. FIFO/DropTail serves packets in arrival order and drops them when the queue is full. RED probabilistically drops or marks packets before the queue overflows [3, 15]; CoDel uses queue sojourn time to control persistent buffering delay [4, 16]. IETF guidance recommends AQM as a way to manage queues, while Explicit Congestion Notification can signal congestion through packet marking when supported by the endpoints [15, 18]. FQ-CoDel combines per-flow scheduling with CoDel, although it is not one of the disciplines evaluated here [17]. Machine learning has also been applied to congestion-state ininference in other simulated settings. Diez et al. study transport-visible features for congestion inference over ns-3 mmWave 5G channels [13]; Falahatraftar et al. evaluate supervised congestion-warning classification for heterogeneous vehicular networks [14]. These settings differ from the wired dumbbell topology and next-run file feedback considered here, so their results are related context rather than directly comparable benchmarks. This work combines queue-management mechanisms with supervised classification of simulation-derived measurements.
3Proposed architecture
The workflow consists of scenario configuration, ns-3 execution, FlowMonitor and NetAnim output, dataset generation, model training and selection, dashboard prediction, and a recommended control action. The action is read by the next simulation run, closing a file-mediated feedback loop. Figure 1 summarizes the process. This is an experimental, next-run feedback loop rather than a real-time controller for a deployed network.
| ID | Traffic | Configuration summary |
|---|---|---|
| A | Light | 5 clients, 10 Mbps, 2 ms, FIFO |
| B | Medium | 10 clients, 5 Mbps, RED |
| C | Heavy | 20 clients, 2 Mbps, RED |
| D | Extreme | 50 clients, 500 Kbps, CoDel |
| E | Variable | Variable bandwidth and delay; bursty traffic |
| F | Mixed | Different packet sizes and send intervals |
4Network model and simulation setup
4.1Topology
The simulated network follows a dumbbell arrangement: multiple UDP clients communicate through Router A, a bottleneck link, and Router B with a destination server. Clients generate traffic using OnOffApplication; the server receives it using PacketSink. Bottleneck capacity, delay, queue discipline, and traffic parameters are varied across scenarios [1, 6].
4.2Queue disciplines and scenarios
The queue disciplines considered are FIFO/DropTail, RED, and CoDel. Six traffic scenarios are used, with their summarized configurations shown in Table 1. Variable and mixed cases vary multiple parameters to broaden the generated traffic conditions.
The simulator varies client count, bandwidth, delay, packet size, sending interval, queue discipline, simulation duration, traffic pattern, and run identifier. Queue thresholds are selected using the bandwidth–delay product (BDP). For bottleneck capacity 𝐶 bits/s, one-way delay 𝑑 seconds, and packet size 𝐿 bytes, the sizing rules are
The per-client UDP application rate derived from packet size and sending interval T is
5Dataset generation
FlowMonitor collects per-flow measurements including transmitted and received packets, delay, jitter, and throughput [2]. The dataset contains the scenario, client count and ID, source and destination IP addresses, packet size, interval, bandwidth, delay, jitter, transmitted/received/lost packets, loss percentage, throughput, efficiency, and simulation time.
Using Tx and Rx for transmitted and received packet counts, respectively, the derived measures are
The packet-ratio metrics require Tx > 0; average delay requires Rx > 0; and the stated jitter expression requires Rx > 1. The treatment of zero-duration flows and flows outside these metric domains is not specified. High loss, delay, or jitter and low throughput are treated as indicators of more severe congestion.
6Machine-learning method
The study compares Logistic Regression, Decision Tree, and Random Forest classifiers [8, 9, 11]. Logistic Regression provides a linear baseline, a Decision Tree offers rule-based predictions, and Random Forest combines tree predictions. Evaluation metrics include accuracy, precision, recall, F1-score, ROC-AUC, a confusion matrix, and feature importance.
The congestion label combines normalized loss, inefficiency, and jitter:
When all jitter values are equal, the normalization denominator is zero and the normalized jitter term is undefined; the handling of this case is not specified. The final score is mapped to three classes:
Numerical features are standardized as xscaled = (𝑥 − 𝜇)/𝜎. The selected model is saved as best_model.pkl, and evaluation metrics are saved as model_metrics.json.
The congestion label is calculated from loss, efficiency, and jitter, while the dataset also contains these measurements as candidate features. Their inclusion can expose the label to the classifiers and inflate apparent performance [24]. The evaluation description does not specify which features were used or how samples were divided. Because flows from the same simulation run share conditions, placing them in separate partitions can also produce optimistic estimates; the effect of label leakage and run-level dependence therefore remains unknown [22].
7Dashboard and adaptive control
The Streamlit dashboard provides a summary, charts, manual prediction, and scenario exploration. It presents throughput, delay, packet loss, congestion probability, scenario information, and a recommended action. The possible actions are NORMAL, REDUCE, INCREASE BANDWIDTH, INCREASE INTERVAL, and REDUCE PACKET SIZE. The dashboard writes its recommendation to control.txt; the simulator reads the action during a later run and adjusts parameters. The displayed prediction confidence is
The resulting sequence is prediction, action, next simulation, new measurements, and (where configured) model retraining. Because the action is written to a file and applied on a subsequent run, this is not a live network controller.
8Workflow and implementation
Simulation and workflow components are organized as follows: congestion.cc runs the ns-3 simulation, scenario_runner.py executes scenarios, dataset.csv stores collected data, ml_model.py trains the classifiers, dashboard.py provides visualization, and control.txt carries feedback to a later run. NetAnim output (animation.xml) visualizes nodes and packet movement, while FlowMonitor output (flowmon.xml) records flow statistics. The selected model and evaluation metrics are saved as best_model.pkl and model_metrics.json, respectively.
To diversify repeated runs, selected scenario parameters are varied within bounded random ranges:
where p is the variation fraction. The values of p and the parameter bounds, along with random seeds, ns-3 version, and run counts, are unspecified, limiting exact reproduction of the experiments.
8.1End-to-end procedure
- 1. Initialize the topology, queue discipline, and traffic parameters.
- 2. For each scenario, configure clients, bandwidth, delay, packet size, interval, and duration.
- 3. Run the ns-3 simulation and collect FlowMonitor and NetAnim outputs.
- 4. Append flow-level measurements to the dataset and prepare features and labels.
- 5. Train the three candidate classifiers and evaluate them using a documented split protocol.
- 6. Select and save a model; expose predictions and summaries in the dashboard.
- 7. Write the selected control action and apply it in a subsequent simulation run.
9Results and discussion
The dashboard summarizes throughput, delay, packet loss, jitter, congestion probability, and a recommended control action. Its plots suggest that light-traffic runs have higher delivery efficiency, while
| Class | Prec. | Recall | F1 | Support |
|---|---|---|---|---|
| Healthy | 0.97 | 0.92 | 0.94 | 37 |
| Moderate | 0.66 | 0.76 | 0.70 | 25 |
| Severe | 0.99 | 0.98 | 0.99 | 579 |
| Accuracy | 0.97 | 641 | ||
| Macro avg. | 0.87 | 0.89 | 0.88 | 641 |
| Weighted avg. | 0.97 | 0.97 | 0.97 | 641 |
| Healthy | Moderate | Severe | |
|---|---|---|---|
| Healthy | 34 | 1 | 2 |
| Moderate | 1 | 19 | 5 |
| Severe | 0 | 9 | 570 |
heavy and extreme scenarios experience greater delay and packet loss as more clients contend for the bottleneck. Recommended actions include increasing bandwidth or the sending interval, reducing packet size, or reducing traffic intensity. Scenario-level numerical comparisons are not tabulated, so these observations remain qualitative and do not quantify performance gains.
Table 2 lists the Random Forest classification metrics, and Table 3 gives its confusion matrix. The evaluation contains 641 examples, of which 579 are labeled Severe, indicating a strongly imbalanced set. The evaluation details do not identify the split strategy, whether test examples are independent of training data, or whether flows from one simulation run appear in both partitions. The class-wise precision and recall in the table give a more informative view of the minority classes than accuracy alone; precision–recall analysis is also useful for imbalanced binary or one-vs-rest views [23]. The 97% accuracy applies to this evaluation only and does not establish generalization, since the split strategy and run separation are undocumented.
The confusion matrix shows that most evaluated examples belong to the Severe class, while errors are concentrated in the smaller Healthy and Moderate classes. The macro-averaged scores and per-class results therefore provide useful context alongside accuracy. Feature importance is also presented, but its interpretation is limited because the feature set and training procedure are not fully documented and potential label leakage has not been ruled out.
10Advantages, limitations, and applications
The system combines simulation, automatic measurement collection, model-based classification, dashboard visualization, and a repeatable feedback path. It can support experiments in ISP planning, data centers, smart cities, industrial networks, cloud and campus networks, and research laboratories. It is also a useful teaching environment for examining traffic load, queue management, and network performance.
Current limitations include reliance on simulation and generated training data, a static topology, a limited scenario set, and predefined control actions. The model-splitting protocol and run-to-run variability are not documented, and the evaluation is class-imbalanced. These limitations restrict conclusions about behavior on unseen topologies, real hardware, or operational traffic.
11Future work
Future work can evaluate time-series models such as LSTM or CNN architectures and reinforcement learning for adaptive parameter selection. Prior congestion-control research explores generated endpoint policies (Remy), performance-oriented online adaptation (PCC), and deep reinforcement-learning policies (Aurora) [19–21]; these are useful comparisons for moving beyond the current classifier and next-run control-file workflow. Additional extensions include Software Defined Networking (SDN), real IoT traffic traces, cloud deployment, live monitoring, 5G/6G scenarios, and dynamic routing. Future evaluations can document dataset generation, report scenario- and run-level results, and test on held-out simulation runs using class-aware metrics.
12Conclusion
This paper presents an ML-assisted workflow for congestion analysis in datagram networks. ns-3 models traffic over a dumbbell topology; FlowMonitor supplies measurements; three supervised classifiers estimate congestion severity; and a Streamlit dashboard presents predictions and writes a recommended action for a subsequent simulation. The Random Forest evaluation achieves 97% accuracy, but its class imbalance and undocumented split protocol prevent conclusions about generalization. The available results are limited to this evaluation and do not establish generalization across simulation runs or scenario settings. Despite these limits, the workflow provides a practical experimental framework for studying congestion and candidate control actions.
References
- [1]Riley GF, Henderson TR. The ns-3 network simulator. In: Modeling and Tools for Network Simulation. Berlin: Springer; 2010. p. 15–34.
- [2]Carneiro G, Fortuna P, Ricardo M. FlowMonitor: a network monitoring framework for the network simulator 3 (NS-3). In: Proceedings of the 4th International ICST Conference on Performance Evaluation Methodologies and Tools (SIMUTools); 2009.
- [3]Floyd S, Jacobson V. Random early detection gateways for congestion avoidance. IEEE/ACM Trans Netw. 1993;1(4):397–413. https://doi.org/10.1109/90.251892
- [4]Nichols K, Jacobson V. Controlling queue delay. Commun ACM. 2012;55(7):42–50. https://doi.org/10.1145/2209249.2209264
- [5]Jacobson V. Congestion avoidance and control. In: Proceedings of ACM SIGCOMM; 1988. p. 314–329. https://doi.org/10.1145/52324.52356
- [6]Kurose JF, Ross KW. Computer Networking: A Top-Down Approach. 8th ed. Hoboken (NJ): Pearson; 2021.
- [7]Tanenbaum AS, Feamster N, Wetherall D. Computer Networks. 6th ed. Hoboken (NJ): Pearson; 2021.
- [8]Breiman L. Random forests. Mach Learn. 2001;45(1):5–32. https://doi.org/10.1023/A:1010933404324
- [9]Bishop CM. Pattern Recognition and Machine Learning. New York: Springer; 2006.
- [10]Géron A. Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow. 3rd ed. Sebastopol (CA): O’Reilly Media; 2022.
- [11]Pedregosa F, et al. Scikit-learn: machine learning in Python. J Mach Learn Res. 2011;12:2825–2830.
- [12]Treuille A, Teixeira T, Kelly A. Streamlit: the fastest way to build data apps in Python [Internet]. Streamlit Inc.; 2019. https://streamlit.io
- [13]Diez L, Fernández A, Khan M, Zaki Y, Agüero R. Can we exploit machine learning to predict congestion over mmWave 5G channels? Appl Sci. 2020;10(18):6164. https://doi.org/10.3390/app10186164
- [14]Falahatraftar F, Pierre S, Chamberland S. A centralized and dynamic network congestion classification approach for heterogeneous vehicular networks. IEEE Access. 2021;9:122284–122298. https://doi.org/10.1109/ACCESS.2021.3109400
- [15]Baker F, Fairhurst G. IETF recommendations regarding active queue management. RFC 7567. Internet Engineering Task Force; 2015 Jul. https://doi.org/10.17487/RFC7567
- [16]Nichols K, Jacobson V, McGregor A, Iyengar J. Controlled delay active queue management. RFC 8289. Internet Engineering Task Force; 2018 Jan. https://doi.org/10.17487/RFC8289
- [17]Høiland-Jørgensen T, McKenney P, Taht D, Gettys J, Dumazet E. The flow queue CoDel packet scheduler and active queue management algorithm. RFC 8290. Internet Engineering Task Force; 2018 Jan. https://doi.org/10.17487/RFC8290
- [18]Ramakrishnan KK, Floyd S, Black D. The addition of explicit congestion notification (ECN) to IP. RFC 3168. Internet Engineering Task Force; 2001 Sep. https://doi.org/10.17487/RFC3168
- [19]Winstein K, Balakrishnan H. TCP ex Machina: computer-generated congestion control. In: Proceedings of ACM SIGCOMM; 2013. p. 123–134. https://doi.org/10.1145/2486001.2486020
- [20]Dong M, Li Q, Zarchy D, Godfrey PB, Schapira M. PCC: re-architecting congestion control for consistent high performance. In: Proceedings of the 12th USENIX Symposium on Networked Systems Design and Implementation (NSDI); 2015. p. 395–408.
- [21]Jay N, Rotman N, Godfrey B, Schapira M, Tamar A. A deep reinforcement learning perspective on Internet congestion control. In: Proceedings of the 36th International Conference on Machine Learning. PMLR; 2019. Vol. 97, p. 3050–3059.
- [22]Roberts DR, et al. Cross-validation strategies for data with temporal, spatial, hierarchical, or phylogenetic structure. Ecography. 2017;40(8):913–929. https://doi.org/10.1111/ecog.02881
- [23]Saito T, Rehmsmeier M. The precision-recall plot is more informative than the ROC plot when evaluating binary classifiers on imbalanced datasets. PLoS One. 2015;10(3):e0118432. https://doi.org/10.1371/journal.pone.0118432
- [24]Kapoor S, Narayanan A. Leakage and the reproducibility crisis in machine-learning-based science. Patterns. 2023;4(9):100804. https://doi.org/10.1016/j.patter.2023.100804