TCPIP and Other Transports for High Bandwidth Applications
TCP/IP and Other Transports for High Bandwidth Applications Back to Basics Richard Hughes-Jones The University of Manchester www. hep. man. ac. uk/~rich/ then “Talks” then look for “Brasov” Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 1
Structure of the Talks The aim is to give you a picture of how researchers are using high performance networks to support their work. u Back to Basics n Simple Introduction to Networking u TCP/IP on High Bandwidth Long Distance Networks n But TCP/IP works ! l The effect of packet loss n Advanced TCP Stacks n Fairness u Real Applications on Real Networks n Disk-2 -disk applications on real networks l Memory-2 -memory tests l Transatlantic disk-2 -disk at Gigabit speeds n Remote Computing Farms l The effect of distance n Radio Astronomy e-VLBI Thanks for allowing me to use their slides to: Sylvain Ravot CERN, Les Cottrell SLAC, Brian Tierney LBL, Robin Tasker DL Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 2
Simple Introduction to Networking Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 3
What is a Protocol Stack ? u ISO OSI (Open Systems Interconnection) Seven Layer Model defines a framework allowing development of real network protocols u A layer… n n performs unique and specific tasks only has knowledge of those layers immediately above and below uses services of layer below, and provides services to layer above the services defined by a layer are implementation independent – it’s a definition of how things work n conceptually communicates with its peer in the remote system Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 4
u Encapsulation: The Layering Principle n Each protocol layer N adds a Header to the data unit from layer N+1 n Header contains control information App data Layer 7: Application user processes Layer 6: Presentation data interpretation, code transformation SH Layer 5: Session Connection, negotiation control Layer 4: Transport End-2 -end data transfer & integrity Packet sequencing, flow control Layer 3: Network Addressing, Routing Packet sequencing, flow control Layer 2: Data Link Packet assembly/disassembly Transmission control, Error checking Layer 1: Physical Electrical, Optical, Mechanical PH App data Segment TH SH PH App data Packet NH TH SH PH App data Frame DH NH TH SH PH App data FCS Bits on the “wire” Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 5
What do the Layers do? u Transport Layer: acts as a go-between for the user and network n Provides end-to-end data movement & control n Gives the level of reliability/integrity need by the application n Can ensure a reliable service (which network layer cannot), e. g. assigns sequence numbers to identify “lost” packets u Network Layer: deals with logical addressing & the transmission of packets, mechanism for routing. u Data Link Layer: provides the synchronization and error checking for the data transmitted over a single physical link (may ensure correct delivery of frames) n �� Going down: fits packets from the network layer above into frames. n �� Going up: Groups bits from the physical layer into frames. u Physical Layer: concerned with the transmission of individual bits. Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 6
How do the “IP” Protocols fit together? Application File Transfer Protocol (FTP) RFC 559 TELNET RFC 854 Simple Mail Transfer Protocol ( Presentation (SMTP) RFC 821 Session) Transmission Control Protocol (TCP) RFC 793 Physical DNS traceroute NFS RFC 1024, 1057 and 1094 User Datagram Protocol (UDP) RFC 768 Internet Control Message Protocol (ICMP) RFC 792 Routing OSPF, BGP Address Resolution Protocols ARP: RFC 826 RARP: RFC 903 Internet Protocol IP RFC 791 Network Data Link ping SNMP RFC 1157 DNS POP 3/IMAP HTTP Transport TFTP RFC 783 ssh Ethernet Network Interface Cards Token Ring ISDN FDDI SMDS ATM SDH/SONET x. DSL Transmission Mode TP Copper Fibre Optic Satellite Microwave DWDM CWDM etc Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 7
Some of the “IP” Protocols u Transmission Control Protocol. TCP provides application programs access to the network using a reliable, connection-oriented transport layer service. u User Datagram Protocol. UDP provides unreliable, connectionless delivery service using the IP protocol to transport messages between machines. It adds the ability to distinguish among multiple destinations on a single host computer. u Internet Protocol. IP receives datagrams from the upper-layer software and transmits it to the destination host based upon a best effort, connection-less delivery service. u Internet Control Message Protocol. ICMP allows internet routers to transmit error messages and test messages. u Internet Group Message Protocol. IGMP is used with multicast to send UDP datagrams to multiple hosts. u Address Resolution Protocol. ARP translates between the 32 bit IP address and a 48 bit LAN address. u Reverse Address Resolution Protocol. RARP translates between the 48 bit LAN address and the 32 bit IP address. Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 8
The Physical Layer 1: Ethernet Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 9
The Link Layer 2: Ethernet Frame header IP Datagram FCS 12 bytes Inter Frame Gap Preamble, which is comprised of 56 bits of alternating 0 s and 1 s. The preamble provides all the nodes on the network a signal against which to synchronize. Start Frame delimiter, which marks the start of a frame. The start frame delimiter is 8 bits long with the pattern 10101011 Media Access Control (MAC) Address Every Ethernet network card has, built into its hardware, a unique six-octet (48 -bit) hexadecimal number that differentiates it from all other Ethernet cards in the universe. The DA and SA define the path across the link Length/Type field two octets long. If the value =< 1500 (0 x 05 dc hex) indicates the length of data If the value > 1500 indicates network-layer protocol : “Ethernet Types” Data, the reason the frame exists. MTU Maximum Transport Unit Frame Check Sequence to protect the frame contents 10 Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester
The Link Layer: Ethernet VLANs VLANS are logical networks built over the same physical cable plant. Distinguishes Ethernet frames between their logical networks using VLAN header VLAN is defined by the use of value 0 x 8100 in the Type field location. The next two octets are composed of the following three fields: User Priority field This field is 3 bits in length and is used to define the priority of the Ethernet frame. This is utilized to define and deliver a class of service Canonical format indicator This is 1 bit in length. Just **don’t** ask!!! VLAN Identifier field This field is 12 bits in length and contains the VLAN identifier (VID) of this frame. The original Length/Type field will then follow the inserted VLAN tag. Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 11
The Network Layer 3: IP u IP Layer properties: n Provides best effort delivery n It is unreliable l Packet may be lost l Duplicated l Out of order n Connection less n Provides logical addresses n Provides routing n Demultiplex data on protocol number Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 12
The Internet datagram Frame header IP header Transport FCS 0 24 4 8 16 19 Vers Hlen Type of serv. Total length Identification Flags Fragment offset TTL Protocol Header Checksum Source IP address Destination IP address IP Options (if any) 31 20 Bytes Padding Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 13
IP Datagram Format (cont. ) u Type of Service – TOS: now being used for Qo. S u Total length: length of datagram in bytes, includes header and data u Time to live – TTL: specifies how long datagram is allowed to remain in internet n Routers decrement by 1 n When TTL = 0 router discards datagram n Prevents infinite loops u Protocol: specifies the format of the data area n Protocol numbers administered by central authority to guarantee agreement, e. g. ICMP=1, TCP=6, UDP=17 … u Source & destination IP address: (32 bits each) contain IP address of sender and intended recipient u Options: (variable length) Mainly used to record a route, or timestamps, or specify routing Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 14
Internet Class-based addresses u An Address looks like 192. 168. 22. 123 u Class A: large number of hosts, few networks n 0 nnnnnnn hhhhhhhh l 7 network bits (0 and 127 reserved, so 126 networks), 24 host bits (> 16 M hosts/net) l Initial byte 1 -127 (decimal) u Class B: medium number of hosts and networks n 10 nnnnnn hhhhhhhh l 16, 384 class B networks, 65, 534 hosts/network l Initial byte 128 -191 (decimal) u Class C: large number of small networks n 110 nnnnnnnn hhhh l 2, 097, 152 networks, 254 hosts/network l Initial byte 192 -223 (decimal) u Class D: Multicast (See RFC 1112) n 1110 nnnnnnnn hhhh l Initial byte 224 -239 (decimal) u Class E: Reserved l Initial byte 248 -255 (decimal) Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 15
The Transport Layer 4: UDP u UDP Provides : n Connection less service over IP l No setup teardown l One packet at a time n Minimal overhead – high performance n Provides best effort delivery n It is unreliable: l Packet may be lost l Duplicated l Out of order n Application is responsible for l Data reliability l Flow control l Error handling Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 16
UDP Datagram format Frame header IP header 0 8 UDP header 16 Application data 24 Source port Destination port UDP message len Checksum (opt. ) FCS 31 8 Bytes u Source/destination port: port numbers identify sending & receiving processes n Port number & IP address allow any application on Internet to be uniquely identified n Ports can be static or dynamic l Static (< 1024) assigned centrally, known as well known ports l Dynamic u Message length: in bytes includes the UDP header and data (min 8 max 65, 535) Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 17
The Transport Layer 4: TCP u TCP RFC 768 RFC 1122 Provides : n Connection orientated service over IP l During setup the two ends agree on details l Explicit teardown l Multiple connections allowed n Reliable end-to-end Byte Stream delivery over unreliable network n It takes care of: l Lost packets l Duplicated packets l Out of order packets n TCP provides l Data buffering l Flow control l Error detection & handling l Limits network congestion Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 18
The TCP Segment Format Frame header IP header 0 4 8 Source port 10 TCP header 16 Application data 24 FCS 31 Destination port Sequence number Acknowledgement number Hlen Resv Code Window Checksum Urgent ptr Options (if any) 20 Bytes Padding Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 19
TCP Segment Format – cont. u Source/Dest port: TCP port numbers to ID applications at both ends of connection u Sequence number: First byte in segment from sender’s byte stream u Acknowledgement: identifies the number of the byte the sender of this segment expects to receive next u Code: used to determine segment purpose, e. g. SYN, ACK, FIN, URG u Window: Advertises how much data this station is willing to accept. Can depend on buffer space remaining. Source port Destination port u Options: used for window scaling, Sequence number SACK, timestamps, Acknowledgement number maximum segment size etc. Hlen Resv Code Checksum Options (if any) Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester Window Urgent ptr Padding 20
TCP – providing reliability u Positive acknowledgement (ACK) of each received segment n Sender keeps record of each segment sent n Sender awaits an ACK – “I am ready to receive byte 2048 and beyond” n Sender starts timer when it sends segment – so can re-transmit Receiver Sender Segment n Sequence 1024 Length 1024 RTT ACK of Segment n Ack 2048 Segment n+1 Sequence 2048 Length 1024 RTT ACK of Segment n +1 Ack 3072 Time u Inefficient – sender has to wait Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 21
Flow Control: Sender – Congestion Window u Uses Congestion window, cwnd, a sliding window to control the data flow n Byte count giving highest byte that can be sent with out an ACK n Transmit buffer size and Advertised Receive buffer size important. n ACK gives next sequence no to receive AND The available space in the receive buffer n Timer kept for each packet TCP Cwnd slides Data sent and ACKed Unsent Data Sent Data buffered waiting ACK may be transmitted immediately Received ACK advances trailing edge Sending host advances marker as data transmitted Data to be sent, waiting for window to open. Application writes here Receiver’s advertised window advances leading edge Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 22
Flow Control: Receiver – Lost Data Lost data Application reads here Data given to application Window slides ACKed but not given to user Next byte expected Expected sequence no. Received but not ACKed Last ACK given Receiver’s advertised window advances leading edge u If new data is received with a sequence number ≠ next byte expected Duplicate ACK is send with the expected sequence number Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 23
How it works: TCP Slowstart u Probe the network - get a rough estimate of the optimal congestion window size u The larger the window size, the higher the throughput n Throughput = Window size / Round-trip Time u exponentially increase the congestion window size until a packet is lost n cwnd initially 1 MTU then increased by 1 MTU for each ACK received l Send 1 st packet get 1 ACK increase cwnd to 2 l Send 2 packets get 2 ACKs inc cwnd to 4 l Time to reach cwnd size W = RTT*log 2 (W) n Rate doubles each RTT packet loss timeout CWND slow start: exponential increase congestion avoidance: linear increase retransmit: slow start again Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester time 24
How it works: TCP Congestion Avoidance u additive increase: starting from the rough estimate, linearly increase the congestion window size to probe for additional available bandwidth n cwnd increased by 1 /MTU for each ACK – linear increase in rate u TCP takes packet loss as indication of congestion ! u multiplicative decrease: cut the congestion window size aggressively if a packet is lost n Standard TCP reduces cwnd by 0. 5 n Slow start to Congestion avoidance transition determined by ssthresh packet loss timeout CWND slow start: exponential increase congestion avoidance: linear increase retransmit: slow start again Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester time 25
TCP Fast Retransmit & Recovery u Duplicate ACKs are due to lost segments or segments out of order. u Fast Retransmit: If the sender transmits 3 duplicate ACKs (i. e. it received 3 additional segments without getting the one expected) n Send the missing segment l l l Set ssthresh to 0. 5*cwnd – so enter congestion avoidance phase Set cwnd = (0. 5*cwnd +3 ) – the 3 dup ACKs Increase cwnd by 1 segment when get duplicate ACKs Keep sending new data if allowed by cwnd Set cwnd to half original value on new ACK n no need to go into “slow start” again u At steady state, CWND oscillates around the optimal window size u With a retransmission timeout, slow start is triggered again Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 26
TCP: Simple Tuning - Filling the Pipe u Remember, TCP has to hold a copy of data in flight u Optimal (TCP buffer) window size depends on: n Bandwidth end to end, i. e. min(BWlinks) AKA bottleneck bandwidth n Round Trip Time (RTT) u. The number of bytes in flight to fill the entire path: n Bandwidth*Delay Product BDP = RTT*BW n Can increase bandwidth by orders of magnitude u Windows also used for flow control Receiver Sender RTT ACK Segment time on wire = bits in segment/BW Time Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 27
Congestion control: ACK clocking Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 28
More Information u Lectures, tutorials etc. on TCP/IP: n n n www. nv. cc. va. us/home/joney/tcp_ip. htm www. cs. pdx. edu/~jrb/tcpip. lectures. html www. raleigh. ibm. com/cgi-bin/bookmgr/BOOKS/EZ 306200/CCONTENTS www. cisco. com/univercd/cc/td/doc/product/iaabu/centri 4/user/scf 4 ap 1. htm www. cis. ohio-state. edu/htbin/rfc 1180. html www. jbmelectronics. com/tcp. htm u Encylopaedia n http: //www. freesoft. org/CIE/index. htm u TCP/IP Resources n www. private. org. il/tcpip_rl. html u Understanding IP addresses n http: //www. 3 com. com/solutions/en_US/ncs/501302. html u Configuring TCP (RFC 1122) n ftp: //nic. merit. edu/internet/documents/rfc 1122. txt u Assigned protocols, ports etc (RFC 1010) n http: //www. es. net/pub/rfcs/rfc 1010. txt & /etc/protocols Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 29
Any Questions? Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 30
Backup Slides Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 31
More Information Some URLs u u u u u UKLight web site: http: //www. uklight. ac. uk MB-NG project web site: http: //www. mb-ng. net/ Data. TAG project web site: http: //www. datatag. org/ UDPmon / TCPmon kit + writeup: http: //www. hep. man. ac. uk/~rich/net Motherboard and NIC Tests: http: //www. hep. man. ac. uk/~rich/net/nic/Gig. Eth_tests_Boston. ppt & http: //datatag. web. cern. ch/datatag/pfldnet 2003/ “Performance of 1 and 10 Gigabit Ethernet Cards with Server Quality Motherboards” FGCS Special issue 2004 http: // www. hep. man. ac. uk/~rich/ TCP tuning information may be found at: http: //www. ncne. nlanr. net/documentation/faq/performance. html & http: //www. psc. edu/networking/perf_tune. html TCP stack comparisons: “Evaluation of Advanced TCP Stacks on Fast Long-Distance Production Networks” Journal of Grid Computing 2004 PFLDnet http: //www. ens-lyon. fr/LIP/RESO/pfldnet 2005/ Dante PERT http: //www. geant 2. net/server/show/nav. 00 d 00 h 002 Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 32
tcpdump / tcptrace u tcpdump: dump all TCP header information for a specified source/destination n ftp: //ftp. ee. lbl. gov/ u tcptrace: format tcpdump output for analysis using xplot n http: //www. tcptrace. org/ n NLANR TCP Testrig : Nice wrapper for tcpdump and tcptrace tools l http: //www. ncne. nlanr. net/TCP/testrig/ u Sample use: tcpdump -s 100 -w /tmp/tcpdump. out hostname tcptrace -Sl /tmp/tcpdump. out xplot /tmp/a 2 b_tsg. xpl Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 33
tcptrace and xplot u. X axis is time u. Y axis is sequence number uthe slope of this curve gives the throughput over time. uxplot tool make it easy to zoom in Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 34
u u Zoomed In View Green Line: ACK values received from the receiver Yellow Line tracks the receive window advertised from the receiver Green Ticks track the duplicate ACKs received. Yellow Ticks track the window advertisements that were the same as the last advertisement. u White Arrows represent segments sent. u Red Arrows (R) represent retransmitted segments Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 35
TCP Slow Start Summer School, Brasov, Romania, July 2005, R. Hughes-Jones Manchester 36
- Slides: 36