CS 5520/ECE 5590NA: Network Architecture I Spring Lecture 13: UDP and TCP

Similar documents
Transmission Control Protocol. ITS 413 Internet Technologies and Applications

05 Transmission Control Protocol (TCP)

UNIT IV -- TRANSPORT LAYER

User Datagram Protocol (UDP):

Transport Layer Protocols TCP

Chapter 2 - Part 1. The TCP/IP Protocol: The Language of the Internet

Applied Networks & Security

Outline. CS5984 Mobile Computing

Chapter 6. What happens at the Transport Layer? Services provided Transport protocols UDP TCP Flow control Congestion control

Chapter 24. Transport-Layer Protocols

Announcements Computer Networking. Outline. Transport Protocols. Transport introduction. Error recovery & flow control. Mid-semester grades

Transport Layer TCP / UDP

The Transmission Control Protocol (TCP)

Congestion Control. Daniel Zappala. CS 460 Computer Networking Brigham Young University

User Datagram Protocol

Data Link Control Protocols

Transport Protocols & TCP TCP

CS519: Computer Networks. Lecture 5, Part 4: Mar 29, 2004 Transport: TCP congestion control

ECE697AA Lecture 3. Today s lecture

CSCD 330 Network Programming Winter 2015

Computer Networking Introduction

Transport Layer. Application / Transport Interface. Transport Layer Services. Transport Layer Connections

Introduction to Networks and the Internet

Chapter 3 outline. 3.5 Connection-oriented transport: TCP. 3.6 Principles of congestion control 3.7 TCP congestion control

Stream Control Transmission Protocol

Page 1. Review: Internet Protocol Stack. Transport Layer Services EEC173B/ECS152C. Review: TCP. Transport Layer: Connectionless Service

TCP Congestion Control

TCP Congestion Control

Page 1. Review: Internet Protocol Stack. Transport Layer Services. Design Issue EEC173B/ECS152C. Review: TCP

ETSF05/ETSF10 Internet Protocols Transport Layer Protocols

Fast Retransmit. Problem: coarsegrain. timeouts lead to idle periods Fast retransmit: use duplicate ACKs to trigger retransmission

Transport Protocols and TCP: Review

TSIN02 - Internetworking

TSIN02 - Internetworking

Outline Computer Networking. Functionality Split. Transport Protocols

Networking Technologies and Applications

Lecture 4: Congestion Control

Outline Computer Networking. TCP slow start. TCP modeling. TCP details AIMD. Congestion Avoidance. Lecture 18 TCP Performance Peter Steenkiste

Transport layer. UDP: User Datagram Protocol [RFC 768] Review principles: Instantiation in the Internet UDP TCP

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 25, 2018

CNT 6885 Network Review on Transport Layer

Transport layer. Review principles: Instantiation in the Internet UDP TCP. Reliable data transfer Flow control Congestion control

CS321: Computer Networks Congestion Control in TCP

TCP so far Computer Networking Outline. How Was TCP Able to Evolve

UDP and TCP. Introduction. So far we have studied some data link layer protocols such as PPP which are responsible for getting data

Announcements. No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

CS457 Transport Protocols. CS 457 Fall 2014

Guide To TCP/IP, Second Edition UDP Header Source Port Number (16 bits) IP HEADER Protocol Field = 17 Destination Port Number (16 bit) 15 16

4.0.1 CHAPTER INTRODUCTION

Internet and Intranet Protocols and Applications

Programming Assignment 3: Transmission Control Protocol

CS 640 Introduction to Computer Networks Spring 2009

TCP. CSU CS557, Spring 2018 Instructor: Lorenzo De Carli (Slides by Christos Papadopoulos, remixed by Lorenzo De Carli)

Announcements Computer Networking. What was hard. Midterm. Lecture 16 Transport Protocols. Avg: 62 Med: 67 STD: 13.

Computer Networks and Data Systems

Transport Layer. -UDP (User Datagram Protocol) -TCP (Transport Control Protocol)

Answers to Sample Questions on Transport Layer

CS 43: Computer Networks. 19: TCP Flow and Congestion Control October 31, Nov 2, 2018

Introduction to Protocols

Lecture (11) OSI layer 4 protocols TCP/UDP protocols

CCNA Exploration Network Fundamentals. Chapter 04 OSI Transport Layer

Transport Layer TCP & UDP Week 7. Module : Computer Networks Lecturers : Lucy White Office : 324

Congestion / Flow Control in TCP

TCP/IP Protocol Suite 1

CMPE 257: Wireless and Mobile Networking

CSC 634: Networks Programming

Connectionless and Connection-Oriented Protocols OSI Layer 4 Common feature: Multiplexing Using. The Transmission Control Protocol (TCP)

6.1 Internet Transport Layer Architecture 6.2 UDP (User Datagram Protocol) 6.3 TCP (Transmission Control Protocol) 6. Transport Layer 6-1

Internet Applications and the Application Layer Material from Kurose and Ross, Chapter 2: The Application Layer

Overview. TCP & router queuing Computer Networking. TCP details. Workloads. TCP Performance. TCP Performance. Lecture 10 TCP & Routers

Lecture 20 Overview. Last Lecture. This Lecture. Next Lecture. Transport Control Protocol (1) Transport Control Protocol (2) Source: chapters 23, 24

COMP/ELEC 429/556 Introduction to Computer Networks

Multiple unconnected networks

No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 21: Network Protocols (and 2 Phase Commit)

EECS 122, Lecture 19. Reliable Delivery. An Example. Improving over Stop & Wait. Picture of Go-back-n/Sliding Window. Send Window Maintenance

CSCI Topics: Internet Programming Fall 2008

image 3.8 KB Figure 1.6: Example Web Page

Review problems (for no credit): Transport and Network Layer

Sequence Number. Acknowledgment Number. Data

TSIN02 - Internetworking

Network Protocols. Transmission Control Protocol (TCP) TDC375 Autumn 2009/10 John Kristoff DePaul University 1

Chapter III: Transport Layer

Transport Protocols and TCP

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2. Goals for Todayʼs Lecture. Role of Transport Layer

ECE 650 Systems Programming & Engineering. Spring 2018

Introduction to Open System Interconnection Reference Model

TCP: Flow and Error Control

ECE 435 Network Engineering Lecture 10

Lecture 3: The Transport Layer: UDP and TCP

Lecture 11. Transport Layer (cont d) Transport Layer 1

Wireless TCP Performance Issues

CS4700/CS5700 Fundamentals of Computer Networks

Overview. TCP congestion control Computer Networking. TCP modern loss recovery. TCP modeling. TCP Congestion Control AIMD

NWEN 243. Networked Applications. Layer 4 TCP and UDP

Transport Protocols. ISO Defined Types of Network Service: rate and acceptable rate of signaled failures.

TSIN02 - Internetworking

TCP based Receiver Assistant Congestion Control

ETSF10 Internet Protocols Transport Layer Protocols

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, steam: r Development of reliable protocol r Sliding window protocols

Transcription:

CS 5520/ECE 5590NA: Network Architecture I Spring 2008 Lecture 13: UDP and TCP Most recent lectures discussed mechanisms to make better use of the IP address space, Internet control messages, and layering principles in more detail. This lecture provides an overview of the two main transport layer protocols, UDP and TCP. Chapter 11 - User Datagram Protocol (UDP) I. Transport Layer Protocols The purpose of this class is not to study transport layer protocols in detail. Left to CS 521, especially from an analysis standpoint. These protocols are used extensively, however, and basic knowledge of them will be important as other topics are discussed for the remainder of the semester. Two protocols are of interest. 1. User Datagram Protocol (UDP) 2. Transmission Control Protocol (TCP) II. User Datagram Protocol (UDP) IP only specifies the destination host for a datagram. But each machine contains multiple abstract destination points called protocol ports. Identified by positive integers. The local operating system provides an interface mechanism to those ports. In general, ports are buffered. Packets for a particular port are buffered. A process extracts packets when it is ready. The sender needs to know both the IP address and the port number. Lecture 13, Page 1 of 16

The User Datagram Protocol (UDP) provides a message format to also indicate port numbers. As a transport protocol sent in the IP datagram payload. Port numbers can be indicated for both source and destination. But only for the source port if it is a port to which replies are to be sent. UDP provides no additional reliability to IP. It is unreliable. Delivery is not assured. It is connectionless. Packets are sent individually. So, for what uses might UDP be a good choice? Note that much more overhead would need to be added to a transport protocol (as with TCP) to provide reliable delivery (acknowledgements, retransmissions, congestion control, handshaking to setup and tear down sessions, etc.). Control messages Audio/video where there is no time to wait for retransmissions. Instant messaging. UDP only provides two functions. 1. Port numbers 2. A checksum that checks for errors in the UDP header and UDP payload. The raw data from the application is transferred in the UDP payload. Checksum computation uses the same one's complement method as in the IP header. Lecture 13, Page 2 of 16

Checksum does not have to be used. - All 0 s in the checksum field says the checksum is not to be used. UDP provides an interface for a user (or application) to send a simple datagram. Port numbers Hence, the name User Datagram Protocol. Each application program must negotiate with the operating system to obtain a protocol port and port number. Two computers need to agree on and know each other s port numbers before they can interoperate. For example, when computer A wishes to obtain a file from computer B, it needs to know the port that the file transfer program on computer B uses. Some port numbers are used on a regular basis. Called well-known port assignments. Below are some of the UDP port numbers. TCP has its own set of well-known port assignments. UDP and TCP use the same numbers for services that are accessible from both UDP and TCP. Lecture 13, Page 3 of 16

Here are some of the TCP port numbers. Chapter 12 - Reliable Stream Transport Service (TCP) III. The Need for Reliable Stream Delivery Without a service for reliable delivery, each application would have to provide it. Error detection Recovery Lecture 13, Page 4 of 16

Five properties of the Reliable Delivery Service provided by TCP/IP 1. Stream Orientation Individual packets are usually part of a larger unit of data. Data is sent as a stream and is delivered in exactly the same order to the receiving application. - The receiving service must put packets back in order before giving them to the application. 2. Virtual Circuit Connection Before transfer starts, sending and receiving programs establish a connection, a virtual, logical connection with no resources reserved. So the endpoints can cooperate in providing reliability. 3. Buffered Transfer Applications send data to the service. The sending service packages the data into packets. - Waits until enough data has been received from the sending application. - Too little data in a packet is wasteful. - Because a high proportion of the packet would be the header. - Data is kept in buffers until it is sent. Sometimes applications will wish to force data to be sent immediately. - A push mechanism. - Does not wait to fill buffers. - This is necessary for real-time applications, to make sure data arrives within a required amount of time. 4. Unstructured stream Does not follow defined data structures. Data is just bytes. - For simplicity sake. 5. Full Duplex Communication Two independent streams can be flowing in opposite directions. Can add control information to the data sent in the reverse direction (piggybacking). Lecture 13, Page 5 of 16

Providing Reliability How can the protocol software provide reliable transfer if the underlying communication system offers only unreliable delivery? One approach for reliable protocols is to use positive acknowledgement with retransmission. Recipient sends acknowledgements (ACK's). Positive acknowledgements indicate which packets have been received. As compared to negative acknowledgements. - Sent when a packet is not received. Sender keeps a timer - Retransmits if a timer expires before an expected ACK is received. - Time proceeds downward as in the following diagram. Sequence numbers are used. - Duplicates can arise. - Such as when retransmissions occur and the original packets that are still in transit also arrive at the destination. - Sequence numbers allow receivers to discard duplicates, reassemble data streams, and let senders know what to send next. Lecture 13, Page 6 of 16

Sliding Windows A simple positive acknowledgement protocol wastes substantial time. Send a packet Then senders sit idle until an acknowledgement for that packet is received. Sometimes called a stop and wait protocol. Speed of light limitations cause a minimum delay that cannot be avoided. - Plus additional delays are incurred for service times of packets, packet processing times, and queueing delays. A sliding window mechanism allows multiple packets to be sent while awaiting ACK's. Here eight packets are sent before any acknowledgements are required. Once the acknowledgement for packet #1 is received, the window "slides". - Packet #9 can now be sent. - The lowest numbered packet in the window is the one which must be acknowledged. Lecture 13, Page 7 of 16

Example: 155 Mbps fiber optic link 1000 km long 1000 octet segments (8000 bits) Say the pulses travel along the link at 0.1c (3 x 10 7 m/s) 1000 km => 33.3 msec. With a window size of 8000 (one segment): Send a packet, wait for an acknowledgement. Time to clock packet onto the link = (8000 bits)/(622 Mbps) = 0.013 msec Propagation delay to the end = 33.333 msec Propagation delay back = 33.333 msec Total minimum delay = 66.679 msec Can send 8000 bits every 66.68 msec => 120.0 kbps on a 155 Mbps link! To get 155 Mbps, we want to send x bits every 66.67 msec (x/66.67e-3) = 155e6 => x = 10.3 Mbits Window size is 10.3 Mbits (1292 segments) So, we send 1292 segments before any acknowledgements are expected. Otherwise, we sit idle part of the time. Lecture 13, Page 8 of 16

IV. Transmission Control Protocol (TCP) A major piece of the TCP/IP protocol suite. Provides many important specifications. How TCP distinguishes among multiple destinations on a given machine (ports). Formats of data and acknowledgements. Procedures to follow for ensuring data arrives correctly. Recovery from lost or duplicated packets. Establishment and ending of connections. Response to congestion. TCP uses the concept of a "connection." A connection is defined by two endpoints and their ports. Like with UDP. Can have multiple connections to a destination port. From different sources. Since a connection is a source-destination pair, one can have the same destination from multiple sources. Well known ports can have many connections. How could a host have multiple connections to the same destination and destination port? Use different source ports. TCP divides data into segments. To be placed into IP. That are then placed into physical network. Lecture 13, Page 9 of 16

TCP uses sliding windows 1. For efficient transmission To avoid overrunning an endpoint. An endpoint advertises how much buffer space it has available to receive data. - Called the receiver advertisement. The sender establishes a sliding window to constrain itself to send only what the receiver can handle. 2. For flow control. To limit the amount of data that is sent to the amount that the intermediate routers can handle. - When congestion is present. Called the congestion window. Sizes of sliding windows adapt to changing conditions. The sender uses the smaller of the two values (receiver advertisement and congestion window) for its window size. Windows sizes can and will change with time. TCP Segment Format We will not study this in detail. The TCP Header includes a checksum as did UDP for the entire segment. Lecture 13, Page 10 of 16

The TCP Header includes the ACKNOWLEDGEMENT NUMBER. The receiver tells the. In terms of an octet number (not segment number). So this tells the source what group of data has been received. An ACK can be sent to cover multiple packets that have been received. - For example, from the sliding window figure above. - An ACK can be sent to indicate that the first octet of packet #5 is the next octet that is expected. - Covers packets #1 through #4. This scheme is cumulative because it reports how much of the stream has been accumulated successfully. Advantages Easy to generate Unambiguous Lost acknowledgements do not force retransmission next ACK will cover a missed ACK. Disadvantage Do not know about all successful transmissions, only those in a continuous block. There is no way for the receiver to tell the sender about other segments that have also been received. Lecture 13, Page 11 of 16

A sender can respond in two different ways after a timeout. Keeping in mind that it now needs to send the segment that includes the octet expected by the receiver. 1. Retransmit the single segment that was not received. - Must stop and wait for the acknowledgement for that segment. - It may only be able to slide the window by one packet when the ACK is received if others were also not received. - But if that was the only packet that was missing, then an ACK may be received for a large set of received packets. - If other segments also need to be resent, this approach adds lots of delay. 2. Retransmit the complete window. - May be very wasteful if only a few retransmitted segments are needed. Ideally, a selective repeat function would be used. It would tell the exact segments that need to be retransmitted. But this would require a negative acknowledgement approach. - That would tell what was not acknowledged. - And positive acknowledgements would still be needed, to be sure that data has been received successfully. The accepted standard is to follow the first approach. Only send the one segment that is needed at the time. Assumes fairly low incidence of data loss. - Might need to use a different environment in a lossy environment, like wireless. A Selective Acknowledgement (SACK) extension was developed. RFC 2018. Allows a receiver to add extra data to a TCP segment - Will list all blocks of data that have been received properly. - Still is a positive ACK approach. - Then the sender can retransmit those that are missing (after timeout). Lecture 13, Page 12 of 16

Explicit Congestion Notification (ECN) Here IP routers use the two unused bits not used by Diffserv in the TYPE OF SERVICE field in the IP header. - Routers set those bits if congestion occurs as they send packets to the destination. Then the destination sends a message back to the source using bits in the TCP header to indicate that congestion. TCP has 2 very important performance control parameters. Timeout. To know when to retransmit if no ACK is received. Congestion window size. To know how much data to send. Both should adapt to changing network conditions. Both are subjects of extensive research. Will be studied in detail in CS 521. Timeout Too large Hurts throughput, too much unnecessary waiting. Too small Injects unnecessary retransmissions into the network. Retransmission can aggravate congestion that has already delayed packets. Lecture 13, Page 13 of 16

Even more retransmissions could occur as previous retransmissions made congestion worse. Could result in congestion collapse. Window Sizes Reduction in window sizes will reduce congestion. By slowing down injection of traffic into the network. And will be very helpful if all TCP sources implement this behavior. The TCP standard recommends two techniques. Multiplicative decrease. - Cut the congestion window in half each time a segment is lost. - Causes quick reduction in traffic rates. - Transmission rates are effectively cut in half. - This happens every time a timeout occurs. Additive increase - Not multiplicative increase because that would cause wild oscillations. - Use additive increase - Each acknowledgement allows window size slowly to increase by one segment size. This was proposed by Jacobsen in 1988 to correct congestion collapse problems in the Internet and has become famous and known as AIMD (Additive Increase, Multiplicative Decrease). Slow-start Start the window size at one immediately after a timeout. Increase exponentially. Up until it reaches ½ of the previous window size for multiplicative decrease. Lecture 13, Page 14 of 16

Illustration of the behavior from a textbook from Tanenbaum: At the timeout, the threshold is reduced from 40 to 20 multiplicative decrease. - When the timeout occurs, slow start happens where the window size is reduced to 1. - Then it increases exponentially by a factor of 2 (1, 2, 4, 8, etc.) up to the threshold. - But to go above the threshold, it only increases by one for each ACK additive increase. - So, the above plot is not just AIMD, but also slow start. Why use slow start? To adapt if congestion is very bad TCP can vary its rates quite substantially. Many proposals have been made to stabilize this behavior. One idea: Not using slow start. Some of the most popular TCP variants have been named after cities in Nevada TCP Tahoe, TCP Reno, and TCP Vegas. - TCP Reno uses for retransmission if three ACK s Lecture 13, Page 15 of 16

arrive that still ask for the same segment, retransmit before waiting for a timeout. Multiplicative decrease and additive increase have improved TCP performance by factors from 2 to 10 times. By reducing problems with congestion collapse. Early browsers used to show this change in rates by the TCP sources. Note that UDP does not perform these congestion control adaptations. TCP Friendly Rate Control has been proposed for UDP, so that UDP uses packet loss indications to vary its sending rate. Tail Drop and RED Now, with fuller understanding, we can see more clearly the potential problem of global synchronization with TCP. And the value of AQM for TCP traffic. 100% Queue Utilization Time 3 Traffic Flows Start at Different Times Tail Drop Summary of TCP and UDP Port numbers. Another Traffic Flow Starts at this Point UDP does nothing else except for an overall checksum. TCP implements reliable communication. Positive acknowledgements, sequence numbers, sliding windows TCP uses adaptive timeouts and window sizes to adapt to congestion. Using slow start and AIMD. AQM can be used with TCP to avoid synchronized responses by many sources. Next lecture: Internet routing protocols (IS-IS, RIP, OSPF, BGP). Lecture 13, Page 16 of 16