SlideShare a Scribd company logo
1 of 39
TCP Theory


                    Mark Handley
   Professor of Networked Systems
     UCL Computer Science Dept.
What is TCP?
   Transmission Control Protocol
      Standardized in 1981 in RFC 793
      Tweaked endlessly ever since.


   Provides a reliable bytestream abstraction end-to-end across
    an unreliable packet network.

   Transfers the vast majority of the traffic in the Internet.
      Email, ftp, WWW, ssh, telnet, Kazaa, BGP routing,
       X windows, and many others are all built on top of TCP.
TCP/IP

   IP handles addressing (and some other stuff).
      Routers look at the IP headers to move packets from sender
       A to receiver B.
      Sometimes the routers will break, or get congested, or
       re-route your traffic over a piece of wet string, and then
       they’ll drop packets.

   TCP packets are carried in IP packets.
      The routers don’t look at TCP.
TCP/IP   File to be sent




         File received
So what can go wrong?

   Packets can get corrupted.
   Packets can get lost.
   Packets can get delayed.
   Packets can arrive in a different order than the order in which
    they were sent.
   Sender tries to send faster than receiver can receive.
   End systems try to send more than the available network
    capacity.
So what can go wrong?
   Packets can get corrupted.
      TCP checksum discards bad packets.
      But beware: it’s not very strong!


   Packets can get lost.
      TCP will retransmit.


   Packets can get delayed.
      TCP uses adaptive timers to try and avoid retransmitting
       unnecessarily.
      Get this wrong, and you have congestion collapse.
So what can go wrong?
   Packets can arrive in a different order than the order in which
    they were sent.
      TCP uses sequence numbers to restore original order


     But most implementations will perform badly with a lot of
      reordering: treat this as signal of loss (congestion).
     Can be a big problem if you want to do load balancing.
So what can go wrong?
   Sender trys to send faster than receiver can receive.
      A TCP receiver continuously signals to the TCP sender
       how much receiver buffer space is available.
      Sender never sends more than the receiver can store.


   End systems try to send more than the available network
    capacity.
      TCP does end-to-end congestion control.
TCP Congestion Control
Congestion Control

End-to-end congestion control serves several purposes:
    Divides bandwidth between network flows in a "reasonably
     fair" manner without requiring per-flow scheduling by
     routers.
    Prevents congestion collapse of the network by matching
     demand to supply to ensure overall goodput remains
     reasonably high.
Congestion Collapse

Congestion collapse occurs when the network is increasingly
busy, but little useful work is getting done.

Problem: Classical congestion collapse:
   Paths clogged with unnecessarily-retransmitted packets
   [Nagle 84].
Fix:
   Modern TCP retransmit timer and congestion control
   algorithms [Jacobson 88].
Congestion collapse from undelivered packets
Problem: Paths clogged with packets that are discarded before
    they reach the receiver [Floyd and Fall, 1999].
Fix: Either end-to-end congestion control, or a ``virtual-circuit''
    style of guarantee that packets that enter the network will be
    delivered to the receiver.
Congestion Control

Since 1988, the Internet has remained functional despite
exponential growth, routers that are sometimes buggy or
misconfigured, rapidly changing applications and usage patterns,
and flash crowds.
   This is largely because most applications use TCP, and TCP
   implements end-to-end congestion control.
TCP Congestion Control
   TCP is ack-clocked.
      When an Acknowledgement arrives back at the sender, it
       indicates a packet has left the network.
      The sender can then send another packet.


   TCP does this by keeping a window of the packets currently in
    the network.
      This is inherently stable: can only send as quickly as
       packets can get through the bottleneck link.
      Should something go wrong, and a queue start increasing,
       TCP’s constant window will cause the transmission rate to
       decrease.
TCP Adaptive Congestion Control
 Basic behaviour: Additive Increase, Multiplicative Decrease.
  Maintain a window of the packets in flight:
     Each round-trip time, increase that window by one packet.
     If a packet is lost, halve the window.


TCP’s
Window




                                                      Time (RTTs)
Flow x
TCP Fairness
 Flow y’s
 window        Flow y
                              Queue



                x = y (fairness)




                           x+y = l+qmax
                           (queue overflows)
                               Flow x’s
                               window
TCP (Details)
   TCP congestion control uses AIMD:
      Increase the congestion window by one packet every
        round-trip time (RTT) that no packet is lost.
      Decrease the congestion window by half every RTT that a
        packet loss occurs.
   In heavy congestion, when a retransmitted packet is itself
    dropped or when there aren't enough packets to run an ACK-
    clock, use a retransmit timer, which is exponential backed off
    if repeated losses occur.
   Slow-start: start by doubling the congestion window every
    roundtrip time.
TCP Modelling: The "Steady State" Model
The model: Packet size B bytes, round-trip time R secs, no queue.
 A packet is dropped each time the window reaches W packets.
 TCP’s congestion window:




   The maximum sending rate in packets per roundtrip time: W
   The maximum sending rate in bytes/sec: W B / R
   The average sending rate T: T = (3/4)W B / R

   The packet drop rate p:

   The result:
An Improved "Steady State" Model
A pretty good improved model of TCP Reno, including timeouts,
from Padhye et al, Sigcomm 1998:
Verifying the Models
TCP Variants

   Four mainstream TCP variants
      TCP Tahoe
      TCP Reno
      TCP NewReno
      TCP Sack
   Tahoe and Reno are obsolete.
   NewReno and Sack are current.
      Sack sends selective acknowledgements, so much more
       robust to multiple losses in one window of data.
TCP and Network Queuing
Queuing

   The primary purpose of a queue in an IP router is to smooth
    out bursty arrivals, so that the network utilization can be high.

   But queues add delay and cause jitter.
      Understanding and controlling network queues is key to
       getting good performance.
TCP Throughput and Queue Size
Window (Packets)




                              Time (RTTs)
TCP and Queues

   TCP needs one delay-bandwidth product of buffer space at the
    bottleneck link for a TCP flow to fill the link and achieve 100%
    utilization.

   Thus, when everything is configured correctly, the peak delay
    is twice the underlying network delay.
      Links are often overbuffered, because the actual RTT is
        unknown to the link operator.
      Increased RTT => slower convergence.
Two TCP Flows (Effects of Phase)
Multiple TCP flows and Queues

   If multiple flows all back-off in phase, the router still
    needs a delay-bandwidth product of buffering.

   If multiple flows back-off out of phase, high
    utilization can be maintained with smaller queues.
      How to keep the flows out of phase?
Active Queue Management
Goals of Active Queue Management
   The primary goal: Controlling average queuing delay, while
    still maintaining high link utilization.
   Secondary goals:
      Improving fairness (e.g., by reducing biases against bursty
        low-bandwidth flows).
      Reducing unnecessary packet drops.
      Reducing global synchronization (i.e., for environments
        with small-scale statistical multiplexing).
      Accommodating transient congestion (lasting less than a
        round-trip time).
Random Early Detection (RED)

    As queue builds up, randomly drop or mark packets with
    increasing probability (before queue gets full).
   Advantages:
      Lower average queuing delay.
      Avoids penalizing streams with large bursts.
      Desynchronizes co-existing flows.
RED Algorithm
for each packet arrival
    calculate the new average queue size         qavg
    if   minth < qavg < maxth
         calculate probability    pa
         with probability pa:
            mark/drop the arriving packet
    else if maxth > qavg
       drop the arriving packet

Variables:                        Parameters:
    qavg : average queue size        minth : minimum threshold for
    pa : packet marking or                   queue
           dropping probability      maxth : maximum threshold for
                                             queue
RED Drop Probabilities
Probability




              1
Drop




        ax p
       m
           0
                           th
                    th




                          ax




                                Average Queue
                   in
                  m




                         m




                                Size
The argument for using the average
queue size in AQM

To be robust against transient bursts:
    When there is a transient burst, to drop just enough
     packets for end-to-end congestion control to come
     into play.
    To avoid biases against bursty low-bandwidth
     flows.
    To avoid unnecessary packet drops from the
     transient burst of a TCP connection slow-starting.
The problem with RED
   Parameter sensitivity
      How to set minth, maxth and maxp?
   Goal is to maintain mean queue size below the midpoint
    between minth and maxth in times of normal congestion.
      maxth needs to be significantly below the maximum queue
        size, because short-term transients peak well above the
        average.
      maxp primarily determines the drop rate. Needs to be
        significantly higher than the drop rate rfequired to keep the
        flows under control.
   In reality it’s hard to set the parameters robustly, even if you
    know what you’re doing.
RED Drop Probabilities (Gentle Mode)
Probability




              1
Drop




        ax p
       m
           0
                           th




                                    th
                    th




                          ax




                                   ax    Average Queue
                   in
                  m




                         m




                                  m
                                         Size
                                2*
Other AQM schemes.

   Adaptive RED (ARED)
   Proportional Integral (PI)
   Virtual Queue (VQ)
   Random Exponential Marking (REM)
   Dynamic-RED (DRED)
   Blue
   Many other variants... (a lot of PhDs in this area!)
Explicit Congestion Notification
Explicit Congestion Notification (ECN)
   Standard TCP:
      Losses needed to detect congestion
      Wasteful and unnecessary
   ECN:
      Routers mark packets instead of dropping them.
      Receiver returns marks to sender in ACK packets.
      Sender adjusts it’s window as it would have done if the
       packet had been dropped.
   Advantages:
      Bandwidth up to bottleneck not wasted.
      No delay imposed by retransmission.
TCP Summary
   TCP performs a number of roles.
      Need to get everything right to work well.
   Adaptive congestion control is critical.
      Even if you think you don’t need it, when something breaks
       you’ll be glad it’s there.
   Interaction between TCP and Queuing is important.
   TCP response function isn’t set in stone.
      A lot of current research as to how to do better with high
       delay-bandwidth products.
      No clear consensus on how to agree what the future of
       congestion control is.

More Related Content

What's hot

Tcp Udp Icmp And The Transport Layer
Tcp Udp Icmp And The Transport LayerTcp Udp Icmp And The Transport Layer
Tcp Udp Icmp And The Transport Layertmavroidis
 
TCP - IP Presentation
TCP - IP PresentationTCP - IP Presentation
TCP - IP PresentationHarish Chand
 
the transport layer
the transport layerthe transport layer
the transport layertumetr1
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocolMohd Arif
 
transport layer
transport layer transport layer
transport layer usman19
 
Tcp vs udp difference and comparison diffen
Tcp vs udp   difference and comparison   diffenTcp vs udp   difference and comparison   diffen
Tcp vs udp difference and comparison diffenHarikiran Raju
 
UDP - User Datagram Protocol
UDP - User Datagram ProtocolUDP - User Datagram Protocol
UDP - User Datagram ProtocolPeter R. Egli
 
User datagram protocol (udp)
User datagram protocol (udp)User datagram protocol (udp)
User datagram protocol (udp)Ramola Dhande
 
Transport services
Transport servicesTransport services
Transport servicesNavin Kumar
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocolIshtdeep Hora
 
transport layer protocols
transport layer protocolstransport layer protocols
transport layer protocolsBE Smârt
 
Introduction of tcp, ip & udp
Introduction of tcp, ip & udpIntroduction of tcp, ip & udp
Introduction of tcp, ip & udprahul kundu
 

What's hot (20)

TCP Vs UDP
TCP Vs UDP TCP Vs UDP
TCP Vs UDP
 
Tcp Udp Icmp And The Transport Layer
Tcp Udp Icmp And The Transport LayerTcp Udp Icmp And The Transport Layer
Tcp Udp Icmp And The Transport Layer
 
TCP - IP Presentation
TCP - IP PresentationTCP - IP Presentation
TCP - IP Presentation
 
Transport Layer
Transport LayerTransport Layer
Transport Layer
 
the transport layer
the transport layerthe transport layer
the transport layer
 
Tcp
TcpTcp
Tcp
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocol
 
transport layer
transport layer transport layer
transport layer
 
Tcp vs udp difference and comparison diffen
Tcp vs udp   difference and comparison   diffenTcp vs udp   difference and comparison   diffen
Tcp vs udp difference and comparison diffen
 
Transport layer protocol
Transport layer protocolTransport layer protocol
Transport layer protocol
 
TCP Model
TCP ModelTCP Model
TCP Model
 
Transportlayer tanenbaum
Transportlayer tanenbaumTransportlayer tanenbaum
Transportlayer tanenbaum
 
UDP - User Datagram Protocol
UDP - User Datagram ProtocolUDP - User Datagram Protocol
UDP - User Datagram Protocol
 
TCP and UDP
TCP and UDP TCP and UDP
TCP and UDP
 
User datagram protocol (udp)
User datagram protocol (udp)User datagram protocol (udp)
User datagram protocol (udp)
 
TCP/IP
TCP/IPTCP/IP
TCP/IP
 
Transport services
Transport servicesTransport services
Transport services
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocol
 
transport layer protocols
transport layer protocolstransport layer protocols
transport layer protocols
 
Introduction of tcp, ip & udp
Introduction of tcp, ip & udpIntroduction of tcp, ip & udp
Introduction of tcp, ip & udp
 

Similar to TCP Theory

Lecture 19 22. transport protocol for ad-hoc
Lecture 19 22. transport protocol for ad-hoc Lecture 19 22. transport protocol for ad-hoc
Lecture 19 22. transport protocol for ad-hoc Chandra Meena
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion AvoidanceRam Dutt Shukla
 
Analytical Research of TCP Variants in Terms of Maximum Throughput
Analytical Research of TCP Variants in Terms of Maximum ThroughputAnalytical Research of TCP Variants in Terms of Maximum Throughput
Analytical Research of TCP Variants in Terms of Maximum ThroughputIJLT EMAS
 
Computer network (13)
Computer network (13)Computer network (13)
Computer network (13)NYversity
 
Mobile Transpot Layer
Mobile Transpot LayerMobile Transpot Layer
Mobile Transpot LayerMaulik Patel
 
Congestion control in tcp
Congestion control in tcpCongestion control in tcp
Congestion control in tcpsamarai_apoc
 
Congestion avoidance in TCP
Congestion avoidance in TCPCongestion avoidance in TCP
Congestion avoidance in TCPselvakumar_b1985
 
TLS in manet
TLS in manetTLS in manet
TLS in manetJay Patel
 
chapter 3.2 TCP.pptx
chapter 3.2 TCP.pptxchapter 3.2 TCP.pptx
chapter 3.2 TCP.pptxTekle12
 
High Performance Networking with Advanced TCP
High Performance Networking with Advanced TCPHigh Performance Networking with Advanced TCP
High Performance Networking with Advanced TCPDilum Bandara
 
Tcp congestion control
Tcp congestion controlTcp congestion control
Tcp congestion controlAbdo sayed
 
Tcp congestion control (1)
Tcp congestion control (1)Tcp congestion control (1)
Tcp congestion control (1)Abdo sayed
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...ijceronline
 
Troubleshooting TCP/IP
Troubleshooting TCP/IPTroubleshooting TCP/IP
Troubleshooting TCP/IPvijai s
 
tcp congestion .pptx
tcp congestion .pptxtcp congestion .pptx
tcp congestion .pptxECE01AJAYS
 
Congestion control algorithms.pptx
Congestion control algorithms.pptxCongestion control algorithms.pptx
Congestion control algorithms.pptxujjwalmatoliya
 

Similar to TCP Theory (20)

Lecture 19 22. transport protocol for ad-hoc
Lecture 19 22. transport protocol for ad-hoc Lecture 19 22. transport protocol for ad-hoc
Lecture 19 22. transport protocol for ad-hoc
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion Avoidance
 
Analytical Research of TCP Variants in Terms of Maximum Throughput
Analytical Research of TCP Variants in Terms of Maximum ThroughputAnalytical Research of TCP Variants in Terms of Maximum Throughput
Analytical Research of TCP Variants in Terms of Maximum Throughput
 
Computer network (13)
Computer network (13)Computer network (13)
Computer network (13)
 
Mobile Transpot Layer
Mobile Transpot LayerMobile Transpot Layer
Mobile Transpot Layer
 
Congestion control in tcp
Congestion control in tcpCongestion control in tcp
Congestion control in tcp
 
Tcp congestion avoidance
Tcp congestion avoidanceTcp congestion avoidance
Tcp congestion avoidance
 
Congestion avoidance in TCP
Congestion avoidance in TCPCongestion avoidance in TCP
Congestion avoidance in TCP
 
TLS in manet
TLS in manetTLS in manet
TLS in manet
 
chapter 3.2 TCP.pptx
chapter 3.2 TCP.pptxchapter 3.2 TCP.pptx
chapter 3.2 TCP.pptx
 
High Performance Networking with Advanced TCP
High Performance Networking with Advanced TCPHigh Performance Networking with Advanced TCP
High Performance Networking with Advanced TCP
 
Tcp congestion control
Tcp congestion controlTcp congestion control
Tcp congestion control
 
Tcp congestion control (1)
Tcp congestion control (1)Tcp congestion control (1)
Tcp congestion control (1)
 
Conjestion control
Conjestion controlConjestion control
Conjestion control
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
 
Troubleshooting TCP/IP
Troubleshooting TCP/IPTroubleshooting TCP/IP
Troubleshooting TCP/IP
 
Tcp periodic modeling
Tcp periodic modelingTcp periodic modeling
Tcp periodic modeling
 
tcp congestion .pptx
tcp congestion .pptxtcp congestion .pptx
tcp congestion .pptx
 
Congestion control algorithms.pptx
Congestion control algorithms.pptxCongestion control algorithms.pptx
Congestion control algorithms.pptx
 
Congestion control in TCP
Congestion control in TCPCongestion control in TCP
Congestion control in TCP
 

Recently uploaded

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 

Recently uploaded (20)

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

TCP Theory

  • 1. TCP Theory Mark Handley Professor of Networked Systems UCL Computer Science Dept.
  • 2. What is TCP?  Transmission Control Protocol  Standardized in 1981 in RFC 793  Tweaked endlessly ever since.  Provides a reliable bytestream abstraction end-to-end across an unreliable packet network.  Transfers the vast majority of the traffic in the Internet.  Email, ftp, WWW, ssh, telnet, Kazaa, BGP routing, X windows, and many others are all built on top of TCP.
  • 3. TCP/IP  IP handles addressing (and some other stuff).  Routers look at the IP headers to move packets from sender A to receiver B.  Sometimes the routers will break, or get congested, or re-route your traffic over a piece of wet string, and then they’ll drop packets.  TCP packets are carried in IP packets.  The routers don’t look at TCP.
  • 4. TCP/IP File to be sent File received
  • 5. So what can go wrong?  Packets can get corrupted.  Packets can get lost.  Packets can get delayed.  Packets can arrive in a different order than the order in which they were sent.  Sender tries to send faster than receiver can receive.  End systems try to send more than the available network capacity.
  • 6. So what can go wrong?  Packets can get corrupted.  TCP checksum discards bad packets.  But beware: it’s not very strong!  Packets can get lost.  TCP will retransmit.  Packets can get delayed.  TCP uses adaptive timers to try and avoid retransmitting unnecessarily.  Get this wrong, and you have congestion collapse.
  • 7. So what can go wrong?  Packets can arrive in a different order than the order in which they were sent.  TCP uses sequence numbers to restore original order  But most implementations will perform badly with a lot of reordering: treat this as signal of loss (congestion).  Can be a big problem if you want to do load balancing.
  • 8. So what can go wrong?  Sender trys to send faster than receiver can receive.  A TCP receiver continuously signals to the TCP sender how much receiver buffer space is available.  Sender never sends more than the receiver can store.  End systems try to send more than the available network capacity.  TCP does end-to-end congestion control.
  • 10. Congestion Control End-to-end congestion control serves several purposes:  Divides bandwidth between network flows in a "reasonably fair" manner without requiring per-flow scheduling by routers.  Prevents congestion collapse of the network by matching demand to supply to ensure overall goodput remains reasonably high.
  • 11. Congestion Collapse Congestion collapse occurs when the network is increasingly busy, but little useful work is getting done. Problem: Classical congestion collapse: Paths clogged with unnecessarily-retransmitted packets [Nagle 84]. Fix: Modern TCP retransmit timer and congestion control algorithms [Jacobson 88].
  • 12. Congestion collapse from undelivered packets Problem: Paths clogged with packets that are discarded before they reach the receiver [Floyd and Fall, 1999]. Fix: Either end-to-end congestion control, or a ``virtual-circuit'' style of guarantee that packets that enter the network will be delivered to the receiver.
  • 13. Congestion Control Since 1988, the Internet has remained functional despite exponential growth, routers that are sometimes buggy or misconfigured, rapidly changing applications and usage patterns, and flash crowds. This is largely because most applications use TCP, and TCP implements end-to-end congestion control.
  • 14. TCP Congestion Control  TCP is ack-clocked.  When an Acknowledgement arrives back at the sender, it indicates a packet has left the network.  The sender can then send another packet.  TCP does this by keeping a window of the packets currently in the network.  This is inherently stable: can only send as quickly as packets can get through the bottleneck link.  Should something go wrong, and a queue start increasing, TCP’s constant window will cause the transmission rate to decrease.
  • 15. TCP Adaptive Congestion Control Basic behaviour: Additive Increase, Multiplicative Decrease.  Maintain a window of the packets in flight:  Each round-trip time, increase that window by one packet.  If a packet is lost, halve the window. TCP’s Window Time (RTTs)
  • 16. Flow x TCP Fairness Flow y’s window Flow y Queue x = y (fairness) x+y = l+qmax (queue overflows) Flow x’s window
  • 17. TCP (Details)  TCP congestion control uses AIMD:  Increase the congestion window by one packet every round-trip time (RTT) that no packet is lost.  Decrease the congestion window by half every RTT that a packet loss occurs.  In heavy congestion, when a retransmitted packet is itself dropped or when there aren't enough packets to run an ACK- clock, use a retransmit timer, which is exponential backed off if repeated losses occur.  Slow-start: start by doubling the congestion window every roundtrip time.
  • 18. TCP Modelling: The "Steady State" Model The model: Packet size B bytes, round-trip time R secs, no queue.  A packet is dropped each time the window reaches W packets.  TCP’s congestion window:  The maximum sending rate in packets per roundtrip time: W  The maximum sending rate in bytes/sec: W B / R  The average sending rate T: T = (3/4)W B / R  The packet drop rate p:  The result:
  • 19. An Improved "Steady State" Model A pretty good improved model of TCP Reno, including timeouts, from Padhye et al, Sigcomm 1998:
  • 21. TCP Variants  Four mainstream TCP variants  TCP Tahoe  TCP Reno  TCP NewReno  TCP Sack  Tahoe and Reno are obsolete.  NewReno and Sack are current.  Sack sends selective acknowledgements, so much more robust to multiple losses in one window of data.
  • 22. TCP and Network Queuing
  • 23. Queuing  The primary purpose of a queue in an IP router is to smooth out bursty arrivals, so that the network utilization can be high.  But queues add delay and cause jitter.  Understanding and controlling network queues is key to getting good performance.
  • 24. TCP Throughput and Queue Size Window (Packets) Time (RTTs)
  • 25. TCP and Queues  TCP needs one delay-bandwidth product of buffer space at the bottleneck link for a TCP flow to fill the link and achieve 100% utilization.  Thus, when everything is configured correctly, the peak delay is twice the underlying network delay.  Links are often overbuffered, because the actual RTT is unknown to the link operator.  Increased RTT => slower convergence.
  • 26. Two TCP Flows (Effects of Phase)
  • 27. Multiple TCP flows and Queues  If multiple flows all back-off in phase, the router still needs a delay-bandwidth product of buffering.  If multiple flows back-off out of phase, high utilization can be maintained with smaller queues.  How to keep the flows out of phase?
  • 29. Goals of Active Queue Management  The primary goal: Controlling average queuing delay, while still maintaining high link utilization.  Secondary goals:  Improving fairness (e.g., by reducing biases against bursty low-bandwidth flows).  Reducing unnecessary packet drops.  Reducing global synchronization (i.e., for environments with small-scale statistical multiplexing).  Accommodating transient congestion (lasting less than a round-trip time).
  • 30. Random Early Detection (RED)  As queue builds up, randomly drop or mark packets with increasing probability (before queue gets full).  Advantages:  Lower average queuing delay.  Avoids penalizing streams with large bursts.  Desynchronizes co-existing flows.
  • 31. RED Algorithm for each packet arrival calculate the new average queue size qavg if minth < qavg < maxth calculate probability pa with probability pa: mark/drop the arriving packet else if maxth > qavg drop the arriving packet Variables: Parameters: qavg : average queue size minth : minimum threshold for pa : packet marking or queue dropping probability maxth : maximum threshold for queue
  • 32. RED Drop Probabilities Probability 1 Drop ax p m 0 th th ax Average Queue in m m Size
  • 33. The argument for using the average queue size in AQM To be robust against transient bursts:  When there is a transient burst, to drop just enough packets for end-to-end congestion control to come into play.  To avoid biases against bursty low-bandwidth flows.  To avoid unnecessary packet drops from the transient burst of a TCP connection slow-starting.
  • 34. The problem with RED  Parameter sensitivity  How to set minth, maxth and maxp?  Goal is to maintain mean queue size below the midpoint between minth and maxth in times of normal congestion.  maxth needs to be significantly below the maximum queue size, because short-term transients peak well above the average.  maxp primarily determines the drop rate. Needs to be significantly higher than the drop rate rfequired to keep the flows under control.  In reality it’s hard to set the parameters robustly, even if you know what you’re doing.
  • 35. RED Drop Probabilities (Gentle Mode) Probability 1 Drop ax p m 0 th th th ax ax Average Queue in m m m Size 2*
  • 36. Other AQM schemes.  Adaptive RED (ARED)  Proportional Integral (PI)  Virtual Queue (VQ)  Random Exponential Marking (REM)  Dynamic-RED (DRED)  Blue  Many other variants... (a lot of PhDs in this area!)
  • 38. Explicit Congestion Notification (ECN)  Standard TCP:  Losses needed to detect congestion  Wasteful and unnecessary  ECN:  Routers mark packets instead of dropping them.  Receiver returns marks to sender in ACK packets.  Sender adjusts it’s window as it would have done if the packet had been dropped.  Advantages:  Bandwidth up to bottleneck not wasted.  No delay imposed by retransmission.
  • 39. TCP Summary  TCP performs a number of roles.  Need to get everything right to work well.  Adaptive congestion control is critical.  Even if you think you don’t need it, when something breaks you’ll be glad it’s there.  Interaction between TCP and Queuing is important.  TCP response function isn’t set in stone.  A lot of current research as to how to do better with high delay-bandwidth products.  No clear consensus on how to agree what the future of congestion control is.