Skip to main content

Study the Impact of Initial Congestion Window on TCP Startup Throughput

Study the Impact of Initial Congestion Window on TCP Startup Throughput


Aim:

To study the impact of the initial congestion window (IW) on TCP startup throughput using NS-3 simulation.

Objectives:

  • To analyze TCP performance during the slow start phase.
  • To compare throughput for different values of initial congestion window (IW).
  • To observe how quickly TCP reaches optimal bandwidth utilization for different IW values.

Simulation Parameters:

  • Simulator: NS-3
  • TCP Variant: TCP NewReno (default)
  • Simulation Time: 3 seconds
  • Topology: Point-to-Point (2 nodes)
  • Bandwidth: 1 Mbps
  • Delay: 100 ms
  • Packet Size: Default
  • Application: BulkSend Application
  • IW Values Tested: 1, 2, 4, 10 segments

Source Code:

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/flow-monitor-module.h"
#include <fstream>

using namespace ns3;

int main ()
{
    std::vector<uint32_t> cwndValues = {1, 2, 4, 10};

    // Create data file
    std::ofstream outfile("cwnd.data");

    for (uint32_t cwnd : cwndValues)
    {
        std::cout << "\n===== Running for IW = " << cwnd << " =====\n";

        Config::SetDefault ("ns3::TcpSocket::InitialCwnd", UintegerValue (cwnd));

        // Nodes
        NodeContainer nodes;
        nodes.Create (2);

        // Link (slow to highlight effect)
        PointToPointHelper p2p;
        p2p.SetDeviceAttribute ("DataRate", StringValue ("1Mbps"));
        p2p.SetChannelAttribute ("Delay", StringValue ("100ms"));

        NetDeviceContainer devices = p2p.Install (nodes);

        // Internet stack
        InternetStackHelper stack;
        stack.Install (nodes);

        // IP assignment
        Ipv4AddressHelper address;
        address.SetBase ("10.1.1.0", "255.255.255.0");
        Ipv4InterfaceContainer interfaces = address.Assign (devices);

        uint16_t port = 8080;

        // Receiver
        PacketSinkHelper sink ("ns3::TcpSocketFactory",
            InetSocketAddress (Ipv4Address::GetAny (), port));
        ApplicationContainer sinkApp = sink.Install (nodes.Get (1));
        sinkApp.Start (Seconds (0.0));
        sinkApp.Stop (Seconds (3.0));

        // Sender
        BulkSendHelper source ("ns3::TcpSocketFactory",
            InetSocketAddress (interfaces.GetAddress (1), port));
        source.SetAttribute ("MaxBytes", UintegerValue (0));

        ApplicationContainer sourceApp = source.Install (nodes.Get (0));
        sourceApp.Start (Seconds (0.0));
        sourceApp.Stop (Seconds (3.0));

        // Flow Monitor
        FlowMonitorHelper flowmon;
        Ptr<FlowMonitor> monitor = flowmon.InstallAll();

        Simulator::Stop (Seconds (3.0));
        Simulator::Run ();

        monitor->CheckForLostPackets();
        std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats();

        double throughput = 0.0;

        for (auto &flow : stats)
        {
            // Ignore small ACK/control flows
            if (flow.second.rxBytes < 50000) continue;

            throughput = flow.second.rxBytes * 8.0 / (3.0 * 1000000.0);
        }

        // Print output
        std::cout << "IW = " << cwnd
                  << " → Throughput = "
                  << throughput << " Mbps\n";

        // Save to file
        outfile << cwnd << "\t" << throughput << std::endl;

        Simulator::Destroy ();
    }

    // Close file
    outfile.close();
    return 0;
}

Output:

Simulation Terminal Output

Graph:

Throughput vs Initial Congestion Window Graph

Result

The simulation results show that the throughput increases with the increase in the initial congestion window (IW). For lower IW values, the TCP connection experiences a slower startup, resulting in lower throughput. As the IW increases, more packets are transmitted in the initial phase, which improves the throughput significantly.

However, the increase in throughput becomes gradual at higher IW values, indicating that the network bandwidth is being approached. The results demonstrate that a larger IW improves TCP startup performance, but excessive values may lead to congestion in real network conditions.

Key Observations

  • The throughput of the TCP connection increases as the initial congestion window (IW) increases.
  • For small IW values (e.g., IW = 1), the TCP connection starts slowly, resulting in lower initial throughput.
  • As IW increases (e.g., IW = 2 and IW = 4), the startup phase becomes faster, leading to moderate improvement in throughput.
  • For larger IW values (e.g., IW = 10), the sender is able to transmit more data in the initial phase, resulting in higher throughput.
  • The rate of increase in throughput gradually reduces at higher IW values, indicating that the network is approaching its bandwidth limit.
  • Very large IW values may lead to congestion and potential packet loss, especially in networks with limited bandwidth and higher delay.

Implications from Graph

  • The graph shows a clear increase in throughput as the initial congestion window (IW) increases, indicating that TCP startup performance improves with higher IW values.
  • At lower IW values, the curve rises slowly, which reflects the slow start behavior of TCP where data transmission begins conservatively.
  • As IW increases, the curve becomes steeper, showing that more data is transmitted in the initial phase, leading to faster bandwidth utilization.
  • At higher IW values, the graph begins to flatten, indicating that the throughput is approaching the maximum available network bandwidth.
  • The diminishing slope at higher IW values suggests that increasing IW beyond a certain point yields only marginal improvement in throughput.
  • The graph highlights a trade-off between performance and stability, where higher IW improves speed but may increase the risk of congestion in real network scenarios.
  • Overall, the graph implies that selecting an optimal IW value is crucial to achieving a balance between fast startup and controlled congestion.

Conclusion

  • The initial congestion window (IW) has a significant impact on TCP startup performance and overall throughput.
  • Increasing the IW allows the sender to transmit more data at the beginning of the connection, thereby improving throughput and reducing startup delay.
  • However, excessively large IW values can lead to network congestion, packet loss, and reduced efficiency.
  • Therefore, an optimal IW value provides a balance between fast startup and controlled congestion.
  • In this experiment, higher IW values resulted in improved throughput, confirming that tuning IW is an important factor in optimizing TCP performance.

Comments

Popular posts from this blog

How to Create Ubuntu 24.04 Bootable USB Using Rufus [Step-by-Step Guide]

How to Create Ubuntu 24.04 Bootable USB Using Rufus [Step-by-Step Guide] Are you planning to install or try Ubuntu 24.04 LTS ? The easiest and most reliable method is to create a bootable USB drive using Rufus on a Windows system. This detailed guide will help you create a Ubuntu 24.04 USB bootloader using Rufus with easy-to-follow steps and screenshots (optional). Here is the complete video of the bootloader creation and OS installation in Windows 11. 🧰 Requirements A USB flash drive (minimum 8GB recommended) A Windows PC Ubuntu 24.04 LTS ISO file Rufus USB creation tool 🧾 Steps to Create a Ubuntu 24.04 Bootable USB Using Rufus ✅ Step 1: Download Ubuntu 24.04 ISO Visit the official Ubuntu website and download the Ubuntu 24.04 LTS ISO file . ✅ Step 2: Download and Run Rufus Head to Rufus official site and download the latest version. Open the executable file (no installation required). ✅ Step 3: Insert USB Drive Plug in your USB drive. Rufus ...

Installing ns3 in Ubuntu 22.04 | Complete Instructions

In this post, we are going to see how to install ns-3.36.1 in Ubuntu 22.04. You can follow the video for complete details Tools used in this simulation: NS3 version ns-3.36.1  OS Used: Ubuntu 22.04 LTS Installation of NS3 (ns-3.36.1) There are some changes in the ns3 installation procedure and the dependencies. So open a terminal and issue the following commands Step 1:  Prerequisites $ sudo apt update In the following packages, all the required dependencies are taken care and you can install all these packages for the complete use of ns3. $ sudo apt install g++ python3 python3-dev pkg-config sqlite3 cmake python3-setuptools git qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf cvs bzr unrar gsl-bin libgsl-dev libgslcblas0 wireshark tcpdump sqlite sqlite3 libsqlite3-dev  libxml2 libxml2-dev libc6-dev libc6-dev-i386 libc...

NS2 (NS-2.35) Installation in Ubuntu 11.10

This post will help you in installing Network Simulator 2 version NS2.35 in Ubuntu 11.10 Instructions Install Ubuntu Download NS-2.35 ( http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download ) Unzip or untar it to any folder (recommended is /home/ loginname) using the following commands one by one sudo apt-get update sudo apt-get install build-essential autoconf automake libxmu-dev tar zxvf ns-allinone-2.35.tar.gz cd ns-allinone-2.35 ./install Once installed the PATH information will be provided to you. Copy the PATH and LD_LIBRARY_PATH Variable to .bashrc (see a dot in the beginning) Input the path information in .bashrc file like this export PATH=$PATH:<Place your paths here> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: <place the LD_LIBRARY_PATHS> here. Once done, save the file and close execute the command source .bashrc try ns or nam to see whether your installation succeeded.