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:
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
Post a Comment