Giter Site home page Giter Site logo

tendto / ns3-tahoe-vs-reno Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 0.0 78 KB

Highly configurable simulation made using ns3 to compare two of the oldest TCP variants, Tahoe and Reno.

CMake 2.02% C++ 97.98%
ns3 tcp network-analysis ns3-simulation ns3-simulator

ns3-tahoe-vs-reno's Introduction

TCP comparison

This is a comparison between two old TCP variants: TCP Tahoe and TCP Reno, using the ns-3 simulator.

TCP variants

Over the years, many TCP variants have been developed, each trying to improve the performance of the predecessor, given the right conditions. Most of them have become highly sophisticated. Still, it can be interesting to look at two of the first TCP variants: TCP Tahoe and TCP Reno and see the basic components of any TCP variant.

TCP Tahoe

TCP Tahoe is the first TCP variant to consider the issue of congestion. It's mechanism is very simple and can be easily understood. This makes it a good starting point to understand how TCP works. It uses

  • slow start: it doubles the congestion window every RTT.
  • congestion avoidance: it increases the congestion window by 1 every RTT.
  • fast retransmit: it detects packet loss by checking if the next packet is received.

TCP Reno

TCP Reno is the first TCP variant to be standardized. It is a newer TCP variant than TCP Tahoe and uses a more complex mechanism to handle congestion. Apart from the slow start and congestion avoidance mechanisms, it uses:

  • fast recovery: it recovers from packet loss by halving the congestion window instead of going straight in the slow start phase.

Installation

Requirements

The simulation uses the ns-3 simulator, and has been developed and tested with the version 3.37.

Build

First, make sure you have already completed all the step required for the installation of the simulator shown here.
The directory structure should look something like this:

.
└── ns-allinone-3.37/
    └── ns-3.37/
        ├── ns3
        ├── examples/
        ├── src/
        ├── scratch/
        └── ...

Move to the scratch folder and clone the repository:

cd ns-allinone-3.37/ns-3.37/scratch
git clone [email protected]:TendTo/ns3-Tahoe-vs-Reno.git

Lastly, move back to the ns-3.37 folder and build the simulation:

cd ..
./ns3 run "p2p-project --PrintHelp"

Usage

The simulation is highly configurable. The following options are available:

Usage: ./ns3 run "p2p-project [options]"

Program Options:
    --n_tcp_tahoe:         Number of Tcp Tahoe nodes [1]
    --n_tcp_reno:          Number of Tcp Reno nodes [1]
    --s_buf_size:          Sender buffer size (bytes) [131072]
    --r_buf_size:          Receiver buffer size (bytes) [131072]
    --cwnd:                Initial congestion window (segments) [1]
    --ssthresh:            Initial slow start threshold (segments) [65535]
    --mtu:                 Size of IP packets to send (bytes) [1500]
    --sack:                Enable SACK [true]
    --nagle:               Enable Nagle algorithm [false]
    --error_p:             Packet error rate [0]
    --s_bandwidth:         Sender link bandwidth [10Mbps]
    --s_delay:             Sender link delay [40ms]
    --r_bandwidth:         Receiver link bandwidth [10Mbps]
    --r_delay:             Receiver link delay [40ms]
    --tcp_queue_size:      TCP queue size (packets) [25]
    --run:                 Run id [0]
    --duration:            Duration of the simulation (s) [3]
    --max_mbytes_to_send:  Maximum number of megabytes to send (MB) [0]
    --prefix_file_name:    Prefix file name [P2P-project]
    --graph_output:        The type of image to output: png, svg [png]
    --ascii_tracing:       Enable ASCII tracing [false]
    --pcap_tracing:        Enable Pcap tracing [false]

General Arguments:
    --PrintGlobals:              Print the list of globals.
    --PrintGroups:               Print the list of groups.
    --PrintGroup=[group]:        Print all TypeIds of group.
    --PrintTypeIds:              Print all TypeIds.
    --PrintAttributes=[typeid]:  Print all attributes of typeid.
    --PrintVersion:              Print the ns-3 version.
    --PrintHelp:                 Print this help message.

Example usages

The following are some example usages of the simulation with the output graphs.

Scenario 1

./ns3 run "p2p-project --n_tcp_tahoe=1 --n_tcp_reno=0 --error_p=0.001 --run=0 --duration=10"
flowchart LR
r{{router}}
n0[Node 0\nTCP Tahoe]
i((Receiver))

    r <--Random loss--> i
    n0 <----> r

Graph 1

Scenario 2

./ns3 run "p2p-project --n_tcp_tahoe=0 --n_tcp_reno=1 --error_p=0.001 --run=0 --duration=10"
flowchart LR
r{{router}}
n0[Node 0\nTCP Reno]
i((Receiver))

    r <--Random loss--> i
    n0 <----> r

Graph 2

Scenario 3

./ns3 run "p2p-project --n_tcp_tahoe=1 --n_tcp_reno=1 --error_p=0.002 --run=1 --duration=10"
flowchart LR
r{{router}}
n0[Node 0\nTCP Tahoe]
n1[Node 1\nTCP Reno]
i((Receiver))

    r <--Random loss--> i
    n0 <----> r
    n1 <----> r

Graph 3

Scenario 4

./ns3 run "p2p-project --n_tcp_tahoe=2 --n_tcp_reno=2 --run=0 --duration=10"
flowchart LR
r{{router}}
n0[Node 0\nTCP Tahoe]
n1[Node 1\nTCP Tahoe]
n2[Node 2\nTCP Reno]
n3[Node 3\nTCP Reno]
i((Receiver))

    r <----> i
    n0 <----> r
    n1 <----> r
    n2 <----> r
    n3 <----> r

Graph 4

Conclusion

TCP Tahoe and TCP Reno are very similar. The main difference is that TCP Reno uses a fast retransmit mechanism to detect packet loss and a fast recovery mechanism to recover from packet loss and follows up with a fast recovery phase.
This means that, in most cases, TCP Reno outperforms TCP Tahoe.

References

ns3-tahoe-vs-reno's People

Contributors

tendto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.