comparing-tcp-algorithms

Simulating TCP congestion control algorithms with ns-3 and visualizing the result with matplotlib.

View the Project on GitHub

日本語(Qiita) haltaro

Requirements

I assume Linux system. You have to install:

Hereinafter, I assume ns-3.26 is installed in ~/ns-3.26/source/ns-3.26/.

Model

Congestion state

Based on ns-3 implementation(~/ns-3.26/source/ns-3.26/src/internet/model/tcp-socket-base.cc), I assume the congestion states shown below:

congestion-state

Congestion control algorithms

Based on ns-3 implementation, I assume the congestion control algorithms shown below:

Algorithm TypeId source
NewReno TcpNewReno tcp-congestion-ops.cc
HighSpeed TcpHighSpeed tcp-highspeed.cc
Hybla TcpHybla tcp-hybla.cc
Westwood TcpWestwood tcp-westwood.cc
Westwood+ TcpWestwoodPlus tcp-westwood.cc
Vegas TcpVegas tcp-vegas.cc
Scalable TcpScalable tcp-scalable.cc
Veno TcpVeno tcp-veno.cc
Bic TcpBic tcp-bic.cc
YeAH TcpYeah tcp-yeah.cc
Illinois TcpIllinois tcp-illinois.cc
H-TCP TcpHtcp tcp-htcp.cc

Install

  1. Make a new directry ~/ns-3.26/source/ns-3.26/data

  2. Add compare-tcp-algorithms.sh and plottcpalgo.py to ~/ns-3.26/source/ns-3.26/

  3. Add execute permission to compare-tcp-algorithms.sh and plottcpalgo.py

  4. Add my-tcp-variants-comparison.cc to ~/ns-3.26/source/ns-3.26/scratch

  5. Compile my-tcp-variants-comparison.cc by the command below:

$ cd ~ns-3.26/source/ns-3.26/
$ ./waf

Codes

compare-tcp-algorithms.sh

Shell script to run ns-3 and call plottcpalgo.py.

my-tcp-variants-comparison.cc

ns-3 scenario script to simulate TCP congestion control. It’s based on tcp-variants-comparison.cc. I added tracing targets: ACK and congestion state.

plottcpalgo.py

Python script to manipulate and visualize data.

Enjoy comparison !

Just run compare-tcp-algorithms.sh.

$ cd ~/ns-3.26/source/ns-3.26
$ ./compare-tcp-algorithms.sh

All algorithms

fig/TcpAll020-cwnd.png

X-axis is time [s], and Y-axis is cwnd [segment]. The digit lines are cwnd, dotted lines are ssthresh. Colors are corresponding to congestion states: blue is OPNE, yellow is RECOVERY, and red is LOSS.

cwnd, ACK, and RTT of each algorithm

fig/TcpNewReno020-cwnd-ack-rtt.png

fig/TcpHighSpeed020-cwnd-ack-rtt.png

fig/TcpHybla020-cwnd-ack-rtt.png

fig/TcpWestwood020-cwnd-ack-rtt.png

fig/TcpWestwoodPlus020-cwnd-ack-rtt.png

fig/TcpVegas020-cwnd-ack-rtt.png

fig/TcpScalable020-cwnd-ack-rtt.png

fig/TcpVeno020-cwnd-ack-rtt.png

fig/TcpBic020-cwnd-ack-rtt.png

fig/TcpYeah020-cwnd-ack-rtt.png

fig/TcpIllinois020-cwnd-ack-rtt.png

fig/TcpHtcp020-cwnd-ack-rtt.png

License