Introduction of severe congestion issues as the Internet gained popularity leading to a congestion collapse.
Goodput dropped precipitously more than a factor of 100.
Early efforts at congestion control led by Van Jacobson in 1988.
Challenges in TCP Implementation
Aim: Implement congestion control with minimal modifications to the existing protocol.
Packet loss acts as a binary signal for congestion.
Timeout mechanisms were introduced to detect packet loss and tune CWnd accordingly.
ACK-Based Control Mechanisms
Utilization of ACK in Congestion Control
Use of Acknowledgements (ACKs) for monitoring transmission rates.
ACK returns approximately at the rate packets can be transmitted over the slowest link, triggering CWnd adjustments accordingly.
This adjustment follows the AIMD strategy.
Slow Start Mechanism in TCP
Slow Start Principle
The Slow Start mechanism allows for exponential growth in sending rate to avoid excessively slow convergence to an optimal state.
CWnd Doubling: CWnd is doubled every RTT.
Calculation of Appropriate CWnd
Example Scenario: On a 10 Mbps link with 100 ms RTT,
- Appropriate CWnd = Bandwidth-Delay Product (BDP) = 1 Mbit (or 1250 bytes), needing approximately 100 packets to reach BDP.
- Slow start from 1 packet requires 100 RTTs (approx. 10 seconds) before reaching moderate rates.
Operation of Slow Start
Each ACK permits two additional segments to be sent.
For segments acknowledged before the retransmission timer elapses, one segment's worth of bytes is added to CWnd.
Threshold Management
A threshold known as slow start threshold (ssthresh) prevents excessive packet sending from the start.
- Initially set to BDP, it is adjusted (halved) upon detecting a packet loss (RTO).
Congestion Avoidance and Additive Increase
Transition to Additive Increase
When ssthresh is crossed, TCP transitions from Slow Start to Additive Increase.
Augmentation of CWnd is implemented incrementally based on received ACKs, not just per RTT.
- Approximation formula: extCWnd=extCWnd+extMSSimesextMSS
- MSS: Maximum Segment Size
Packet-Wise Approximation Under Additive Increase
Described through examples with ACKs and TCP sender/receiver dynamics illustrating increment patterns over consecutive RTTs.
Triggering Congestion Notifications
Methods of Initiating Congestion Control
RTO (Retransmission Timeout): Indicates congestion; however, it is time-consuming.
Duplicate ACK (DUPACK): Sent when out-of-order segments are received. TCP presumes 3 DUPACKs indicate packet loss.
- Fast retransmission process initiated to recover the lost packet based on the sequence.
Fast Retransmission and Recovery Techniques
Handling of Packets After Duplicate ACK Detection
Triggers: Upon receiving 3 DUPACKs:
1. Retransmit the lost packet (requires one RTT).
2. Adjust ssthresh to half of the current CWnd.
3. Set CWnd to 1 MSS.
Fast Recovery Mechanism (TCP Reno)
Set ssthresh to half of CWnd.
Immediately retransmit the lost segment.
For each additional duplicate ACK received, increment CWnd by 1 and send new data segments if permissible based on CWnd value.
Exit fast recovery upon receiving a new ACK that acknowledges all segments sent in the interim.
Visualization of Fast Recovery
Graphs and diagrams may provide insights into how the congestion window behaves through different phases of Fast Recovery and Slow Start.
User Datagram Protocol (UDP)
Overview of UDP
Characteristics:
- Connectionless and unreliable protocol.
- Simple design with minimal overhead besides message transmission.
Use Cases:
- Suitable for quick, short messaging without the need for buffering like TCP.
UDP Header Structure
Consists of the following fields:
- Source Port, Destination Port, Length, and Checksum.
Applications of UDP
Specific UDP Protocols
DNS (Domain Name System): Faster simple request-response mechanism compared to TCP.
BOOTP/DHCP: Assists with network configuration rapidly through minimal messaging traffic.
TFTP (Trivial File Transfer Protocol): Lightweight protocol for transferring small files.
SNMP (Simple Network Management Protocol): Facilitates network management tasks more easily through lower congestion.
QUIC (Quick UDP Internet Connections): Provides encryption and direct access to IP, developed for efficient transport protocols.
QUIC Protocol
Handshake Mechanism
Handshake Types:
- Initial Handshake with 0-RTT and 1-RTT connections being possible.
- Encrypted request and response tops this further.
Multi-Stream Support
Illustrates how QUIC handles multiple streams look into avoiding head-of-line blocking, allowing more flexible communication channels.
Socket Programming
Introduction to Sockets
Sockets provide the system calls to utilize TCP/IP functionalities within the OS kernel.
Types of Sockets:
- Stream Socket (SOCK_STREAM): Reliable and connection-oriented (TCP-based).
- Datagram Socket (SOCK_DGRAM): Unreliable service (UDP-based).
Socket API Usage
Example calls for creating sockets and binding them to local addresses are provided with explanations of related structures (e.g., sockaddr_in).
Connection Management in Sockets
Active Open: Client initiates the connection when required.
Passive Open: Server listens for incoming connections and waits until a request comes in.
Data Transfer and Socket Operations
Detailed commands for transferring data through both SOCK_STREAM and SOCK_DGRAM are outlined, showcasing read/write functionalities.
Handling Concurrent Connections
Iterative Server vs. Concurrent Server: Explains the advantages of using concurrency through threads or multiplexer functions such as select() to handle multiple connections efficiently, minimizing blocking conditions.
Understanding the select() Call
Function Definition: extintselect(intnfds,fdset∗readfds,fdset∗writefds,fdset∗exceptfds,structtimeval∗timeout)
- Tracks activity over file descriptors, including timeout settings.
Explanation of how to manipulate file descriptor sets and the eventual return values indicating the status of those sockets monitored.
Conclusion
The comprehensive exploration of TCP and UDP highlights foundational principles in computer networking, particularly in connection management, data transfer efficiency, and handling congestion in dynamic environments. Further references and detailed coding implementations can be accessed through provided examples and tutorials.