This repository offers the Sage framework, initially introduced in our SIGCOMM'23 paper. You can check out a 10-min recorded presentation of Sage here.
- What Is Included
- Prerequisites
- Installing Kernel Patches
- Installing Mahimahi Patches
- Installing Sage
- Running Sage
- Creating Dataset
- Training Sage
- Citation Guidelines
This repository includes various elements:
- Linux Kernel Debian packages implementing Sage (TCP Pure), along with Orca, DeepCC, C2TCP, & NATCP.
- Sage's source code including the Data-Driven RL module, general representation block, and policy enforcer.
- A pre-trained Sage model which is the outcome of a 7-day training session.
- Tools for dataset generation (compatible with Sage training).
- Necessary codes to generate Sage-governed flows, collect results, and create figures.
- A standalone version of Sage's server/client application.
Initial setup involves the following steps:
- Installation of a patched Linux kernel to enable TCP PURE.
- Installation of a patched version of the emulator Mahimahi.
- Installation of required packages for Sage.
cd ~ && git clone https://github.com/soheil-ab/sage.git
The provided patch has been tested on Ubuntu 16.04. Thus, it's recommended to install Ubuntu 16.04 as the base and then apply the Sage Kernel patch.
To install Sage's Kernel, simply follow these steps:
cd ~/sage/linux-patch/
sudo dpkg -i linux-image-4.19.112-0062_4.19.112-0062-10.00.Custom_amd64.deb
sudo dpkg -i linux-headers-4.19.112-0062_4.19.112-0062-10.00.Custom_amd64.deb
sudo reboot
After installing the Sage's kernel and restarting your system, check if the system is using the new kernel:
uname -r
If the output isn't 4.19.112-0062, you should prioritize the installed Kernel in the grub list. For instance, you can use the grub-customizer application. Install the grub-customizer using the following. Then, move the 4.19.112-0062 kernel to the top of the list (first row).
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer
sudo grub-customizer
Install the required Mahimahi patches as per the instructions provided in ccBench. Make sure to update Mahimahi (with the provided patches) before running Sage.
Sage is developed and tested on Python 3.6, and built on top of TensorFlow 2.
Begin by installing necessary system tools:
bash install_packages.sh
To install the required Python packages and manage the dependencies, set up a Python environment using a virtual environment.
virtualenv --python=python3.6 ~/venvpy36
Now, activate the environment:
source ~/venvpy36/bin/activate
Then, install required packages:
cd ~/sage
pip install --upgrade pip
pip install --no-deps -r requirements.txt
pip install -r requirements.txt
Now, install sage module:
cd ~/sage
pip install -e .
Compile/Build Sage and set the system parameters:
cd ~/sage/sage_rl
bash build.sh
bash set_sysctl.sh
Here, a standalone Sage implementation is provided as a server and client application and the models
directory contains a pre-trained model from a 7-day training session.
To use the provided model for a standalone evaluation, first copy the model to the desired path.
cd ~/sage/sage_rl
bash cp_models.sh
Do a sanity check to make sure that the model can be loaded correctly:
python rl_module/test_loading_sage_model.py
To run an experiment with Sage, for example in a 24Mbps link with 20ms min RTT, run the following:
cd ~/sage/sage_rl
bash run_sample.sh
Dataset creating involves two main steps:
- Using the Policy Collector to generate the raw dataset.
- Converting the raw dataset to the format required by Sage's data-driven training.
To start, we need to install the Policy Collector. We have provided a version of Policy Collector as part of our pantheon-modified repository. To install it, simply follow the instructions provided there.
Now, let's generate a simple dataset representing TCP Vegas' behavior in a scenario. In particular, we will bring up a network with 48Mbps link capacity, minimum RTT of 20ms, and a fifo bottleneck queue with a size of 1000 packets. Then, we will send one flow for the 30s using TCP Vegas as its CC scheme.
cd ~/pantheon-modified/src/experiments/
./cc_dataset_gen_solo.sh vegas single-flow-scenario 1 1 0 10 1000 0 48 30 48 48
After running the above, you can inspect the generated raw dataset:
vi ~/pantheon-modified/third_party/tcpdatagen/dataset/vegas_wired48_10_1000_0_cwnd.txt
Moreover, you can find the general log of the experiment at ~/pantheon-modified/src/experiments/data/single-flow-scenario-vegas-wired48-10-1000-0/
Assuming the data is located at ~/raw_dataset/*.txt.
, we need to convert it to the format Sage's data-driven training requires:
cd ~sage/sage_rl/offline
python gen_offline_data.py --in_data_dir=~/raw_dataset --dataset_name=~/final_dataset/ --config=configs/config-rl-offline.yaml
The final dataset will be saved at ~/final_dataset/
. You can find the configuration file at ./configs/config-rl-offline.yaml
and customize it to match your needs.
After creating the final dataset (e.g., ~/final_dataset/*.txt.
), you can train a Sage model using the generated dataset:
cd ~sage/sage_rl/offline
python offline_agent.py --dataset_name=~/final_dataset --config=configs/config-rl-offline.yaml
Once again, you can find the configuration file at ./configs/config-rl-offline.yaml
and customize it to match your needs. Training logs will be stored in the designated folder.
Please use the following citation format to cite this repository:
@inproceedings{sage,
title={Computers Can Learn from the Heuristic Designs and Master Internet Congestion Control},
author={Yen, Chen-Yu and Abbasloo, Soheil and Chao, H Jonathan},
booktitle={ACM SIGCOMM 2023 Conference (ACM SIGCOMM '23)},
year={2023}
}