chapter 6: the transport layer ( 传输层)
DESCRIPTION
CHAPTER 6: THE TRANSPORT LAYER ( 传输层). The Transport Service ( 传输服务 ) Elements of Transport Protocols ( 传输协议的若干问题 ) A Simple Transport Protocol ( 简单传输协议 ) The Internet Transport Protocols (Internet 传输协议 ): UDP The Internet Transport Protocols (Internet 传输协议 ): TCP - PowerPoint PPT PresentationTRANSCRIPT
CHAPTER 6: THE TRANSPORT LAYER( 传输层 )
The Transport Service (The Transport Service ( 传输服务传输服务 )) Elements of Transport Protocols (Elements of Transport Protocols ( 传输协议的若干问题传输协议的若干问题 )) A Simple Transport Protocol A Simple Transport Protocol (( 简单传输协议简单传输协议 )) The Internet Transport Protocols (InternetThe Internet Transport Protocols (Internet 传输协议传输协议 ): UDP): UDP The Internet Transport Protocols (InternetThe Internet Transport Protocols (Internet 传输协议传输协议 ): TCP): TCP Performance Issues (Performance Issues ( 性能问题性能问题 ))
THE TRANSPORT SERVICE( 传输服务 )
Services Provided to the Upper LayersServices Provided to the Upper Layers Transport Service Primitives (Transport Service Primitives ( 简单传输服务原语简单传输服务原语 )) Berkeley Sockets (Berkeley Sockets ( 套接字套接字 )) An Example of Socket Programming: An Example of Socket Programming:
An Internet File ServerAn Internet File Server
The Transport Service: Services Transport layer services (Transport layer services ( 传输服务传输服务 ) : ) :
To provide efficient, reliable, and cost-effective To provide efficient, reliable, and cost-effective service to its users, normally processes in the service to its users, normally processes in the application layer. application layer.
To make use of the services provided by the network To make use of the services provided by the network layer.layer.
The transport entity (The transport entity ( 传输实体传输实体 )): the hardware and/or : the hardware and/or software within the transport layer that does the work. software within the transport layer that does the work. Its positions: Its positions: In the OS kernel, in a separate user process, in a In the OS kernel, in a separate user process, in a
library package bound to network applications, orlibrary package bound to network applications, or On the network interface card. On the network interface card.
The Transport Service: ServicesThe network, transport and application layersThe network, transport and application layers
The Transport Service: Services There are two types transport servicesThere are two types transport services
Connection-oriented transport serviceConnection-oriented transport service Connectionless Connectionless transport servicetransport service
The similarities between transport services and network The similarities between transport services and network servicesservices The connection–oriented service is similar to the The connection–oriented service is similar to the
connection-oriented network service in many ways:connection-oriented network service in many ways:Establishment, Establishment, data transfer, data transfer, release; release; Addressing; Addressing; Flow controlFlow control
The connectionless transport service is also similar to The connectionless transport service is also similar to the connectionless network service. the connectionless network service.
The Transport Service: Services The differencesThe differences between transport services and network between transport services and network
services. Why are there two distinct layers?services. Why are there two distinct layers? The transport code runs entirely on the user’s The transport code runs entirely on the user’s
machines, but the network layer mostly runs on the machines, but the network layer mostly runs on the routers which are usually operated by the carrier. routers which are usually operated by the carrier.
Network layer has problems (losing packets, router Network layer has problems (losing packets, router crashing, …)crashing, …)
The transport layer improves the QOS of the network The transport layer improves the QOS of the network layer.layer.
The transport service is more reliable than the The transport service is more reliable than the network service.network service.
Applications programmers can write code according Applications programmers can write code according to a standard set of transport service primitives and to a standard set of transport service primitives and have these programs work on a wide variety of have these programs work on a wide variety of networks.networks.
The Transport Service: Hypothetical Primitives
The transport layer provides some operations to applications The transport layer provides some operations to applications programs, i.e., a transport service interface.programs, i.e., a transport service interface.
Each transport service has its own interface. Each transport service has its own interface. The transport service is similar to the network service, but The transport service is similar to the network service, but
there are also some important differences:there are also some important differences: Network service models real network Network service models real network unreliable. unreliable.
Transport services improves real network Transport services improves real network reliable. reliable. Network services are for network developers.Network services are for network developers. Transport services are for application developers.Transport services are for application developers.
The Transport Service: Hypothetical Primitives
The Transport Service: Hypothetical Primitives How to use these primitives for an application?How to use these primitives for an application? Server App: LISTENServer App: LISTEN Client App: CONNECTClient App: CONNECT Client Client SEND/RECEIVESEND/RECEIVE Server Server Client Transport Client Transport TPDU TPDU Server Transport Server Transport
Client network layer Client network layer Packets Packets Server network layer Server network layer Client data link layer Client data link layer Frames Frames Server data link layer Server data link layer
Client/Server: DISCONNECTClient/Server: DISCONNECT
The Transport Service: Hypothetical Primitives Nesting of TPDUs, packets, and framesNesting of TPDUs, packets, and frames
The Transport Service: Hypothetical Primitives Connection establishment and connection releaseConnection establishment and connection release
The Transport Service: Berkeley Sockets
The Transport Service: Berkeley Sockets The C/S ApplicationThe C/S Application
Server: SOCKET/Server: SOCKET/BINDBIND/LISTEN/ACCEPT/LISTEN/ACCEPT Client: SOCKET/CONNECTClient: SOCKET/CONNECT
C/S: SEND/RECEIVEC/S: SEND/RECEIVE
C/S: CLOSE (symmetric)C/S: CLOSE (symmetric)
The Transport Service: An example IFServer.cIFServer.c IFClient.cIFClient.c
ELEMENTS OFTRANSPORT PROTOCOLS AddressingAddressing Connection EstablishmentConnection Establishment Connection ReleaseConnection Release Flow Control and BufferingFlow Control and Buffering MultiplexingMultiplexing Crash RecoveryCrash Recovery
Elements of Transport ProtocolsTransport protocol and data link protocolTransport protocol and data link protocol Similarities: Error control, sequencing, and flow controlSimilarities: Error control, sequencing, and flow control DifferencesDifferences
Environment: physical communication channel/subnetEnvironment: physical communication channel/subnet Addressing: implicit/explicitAddressing: implicit/explicit Connection establishment: simple/complicatedConnection establishment: simple/complicated Storage capacity: no/yes (unpredictable/predictable)Storage capacity: no/yes (unpredictable/predictable) Buffering and flow control: amountBuffering and flow control: amount
Elements of Transport Protocols: Addressing
How to address?How to address?
Elements of Transport Protocols: Addressing NSAP: Network service access pointsNSAP: Network service access points
IP (32 bits) IP (32 bits) TSAP: Transport service access pointTSAP: Transport service access point
Port (16 bits)Port (16 bits) How to find out the server’s TSAPHow to find out the server’s TSAP
Some TSAP addresses are so famous that they are Some TSAP addresses are so famous that they are fixed. fixed.
Process serverProcess serverTo listen to a set of TSAPs at the same time. To listen to a set of TSAPs at the same time. To dispatch the request to the right server. To dispatch the request to the right server.
Process server + name server (directory server, 114)Process server + name server (directory server, 114)
Elements of Transport Protocols: Addressing
Elements of Transport Protocols: Connection Establishment
Connection establishment sounds easy, but …Connection establishment sounds easy, but … Naïve approach: Naïve approach:
One sends a CONNECTION REQUEST TPDU to the One sends a CONNECTION REQUEST TPDU to the other and wait for a CONNECTION ACCEPTED reply. other and wait for a CONNECTION ACCEPTED reply.
If ok, done; otherwise, retry.If ok, done; otherwise, retry. Possible nightmare: Possible nightmare:
A user establishes a connection with a bank, sends A user establishes a connection with a bank, sends messages telling the bank to transfer a large amount of messages telling the bank to transfer a large amount of money to the account of a not-entirely-trustworthy money to the account of a not-entirely-trustworthy person, and then releases the connection. person, and then releases the connection.
Moreover, assume each packet in scenario is Moreover, assume each packet in scenario is duplicatedduplicated and stored in the subnet. and stored in the subnet.
delayed duplicatesdelayed duplicates. .
Elements of Transport Protocols: Connection EstablishmentPossible solutions for solving Possible solutions for solving delayed duplicatesdelayed duplicates To give each connection a connection identifier (i.e., a To give each connection a connection identifier (i.e., a
sequence number incremented for each connection sequence number incremented for each connection established) chosen by the initiating party and put in established) chosen by the initiating party and put in each TPDU, including the one requesting the each TPDU, including the one requesting the connection.connection.
To use throw away transport addresses. Each time a To use throw away transport addresses. Each time a transport address is needed, a new one is generated. transport address is needed, a new one is generated. When a connection is released, the address is discarded When a connection is released, the address is discarded and never used again. and never used again.
To use sequence number and ageTo use sequence number and age To limit packet lifetime. To limit packet lifetime. To use the sequence numberTo use the sequence number
Elements of Transport Protocols: Connection Establishment Packet lifetime can be restricted to a known maximum Packet lifetime can be restricted to a known maximum
using one of the following techniques using one of the following techniques Restricted subnet design. Restricted subnet design. Putting a hop counter in each packet. Putting a hop counter in each packet. Timestamping each packet. (router synchronization Timestamping each packet. (router synchronization
problem)problem) In practice, we will need to guarantee not only that a In practice, we will need to guarantee not only that a
packet is dead, but also that all acknowledgements to it packet is dead, but also that all acknowledgements to it are also dead, so we will now introduce are also dead, so we will now introduce TT, which is , which is some small multiple of the true maximum packet some small multiple of the true maximum packet lifetime. lifetime.
Elements of Transport Protocols: Connection EstablishmentTo ensure that two identically numbered TPDUs To ensure that two identically numbered TPDUs
are never outstanding at the same time:are never outstanding at the same time: 1. To equip each host with a time-of-day clock 1. To equip each host with a time-of-day clock
Each clock is assumed to take the form of a binary Each clock is assumed to take the form of a binary counter that increments itself at uniform intervals.counter that increments itself at uniform intervals.
The number of bits in the counter must equal or The number of bits in the counter must equal or exceed the number of bits in the sequence exceed the number of bits in the sequence numbers.numbers.
The clock is assumed to continue running even if The clock is assumed to continue running even if the host goes down. the host goes down.
The clocks at different hosts need not be The clocks at different hosts need not be synchronized. synchronized.
Elements of Transport Protocols: Connection EstablishmentTo ensure that two identically numbered To ensure that two identically numbered
TPDUs are never outstanding at the same TPDUs are never outstanding at the same time:time: 2. When a connection is setup, the low order k bits of 2. When a connection is setup, the low order k bits of
the clock are used as the initial sequence number the clock are used as the initial sequence number ( also k bits). Each connection starts numbering its ( also k bits). Each connection starts numbering its TPDUs with a different initial sequence number. The TPDUs with a different initial sequence number. The sequence space should be so large that by the time sequence space should be so large that by the time sequence numbers wrap around, old TPDUs with the sequence numbers wrap around, old TPDUs with the same sequence number are long gone. same sequence number are long gone.
3. Once both transport entities have agreed on the 3. Once both transport entities have agreed on the initial sequence number, any sliding window protocol initial sequence number, any sliding window protocol can be used for data flow control. can be used for data flow control.
Elements of Transport Protocols: Connection EstablishmentA problem occurs when a host crashes. When it A problem occurs when a host crashes. When it
comes up again, its transport entity does not comes up again, its transport entity does not know where it was in the sequence space.know where it was in the sequence space. To require the transport entities to be idle for T To require the transport entities to be idle for T
seconds after a recovery to let all old TPDUs die off. seconds after a recovery to let all old TPDUs die off. (In a complex internetwork, (In a complex internetwork, TT may be large, so this may be large, so this strategy is unattractive.)strategy is unattractive.)
To avoid requiring To avoid requiring TT sec of dead time after a crash, it sec of dead time after a crash, it is necessary to introduce a new restriction on the use is necessary to introduce a new restriction on the use of sequence numbers.of sequence numbers.
Elements of Transport Protocols: Connection Establishment: The forbidden regionRestriction on the sequence numbers ?Restriction on the sequence numbers ? Let Let TT (the maximum packet lifetime) be 60 sec and let the (the maximum packet lifetime) be 60 sec and let the
clock tick once per second. The initial sequence number clock tick once per second. The initial sequence number for a connection opened at time for a connection opened at time xx will be will be xx. .
At At t=t=30sec, an ordinary data TPDU being sent on (a 30sec, an ordinary data TPDU being sent on (a previously opened) connection 5 (called as TPDU X) is previously opened) connection 5 (called as TPDU X) is given sequence number 80. given sequence number 80.
After sending TPDU X, the host crashes and then quickly After sending TPDU X, the host crashes and then quickly restarts.restarts.
At At t = t = 60sec, it begins reopening connections 0 through 4. 60sec, it begins reopening connections 0 through 4.
Elements of Transport Protocols: Connection Establishment: The forbidden region
At At tt = 70sec, it reopens connection using initial sequence = 70sec, it reopens connection using initial sequence number 70 as required. number 70 as required.
During the next 15 sec it sends data TPDUs 70 through 80. During the next 15 sec it sends data TPDUs 70 through 80. Thus at Thus at tt=85sec, a new TPDU with sequence number 80 and =85sec, a new TPDU with sequence number 80 and connection 5 has been injected into the subnet. connection 5 has been injected into the subnet.
TPDU X and TPDU 80.TPDU X and TPDU 80. To prevent sequence numbers from being used for a To prevent sequence numbers from being used for a
time time TT before their potential use as initial sequence before their potential use as initial sequence numbers. The illegal combinations of time and sequence numbers. The illegal combinations of time and sequence number are called as the forbidden region. Before number are called as the forbidden region. Before sending any TPDU on any connection, the transport sending any TPDU on any connection, the transport entity must read the clock and check to see that it is no entity must read the clock and check to see that it is no in the forbidden region. in the forbidden region.
Elements of Transport Protocols: Connection Establishment
Elements of Transport Protocols: Connection Establishment: The forbidden region Too fastToo fast Too slowToo slow (Solution for the delayed TPDU) (Solution for the delayed TPDU)
Before sending every TPDU, Before sending every TPDU, the transport entity must check to see if it is the transport entity must check to see if it is
about to enter the forbidden region, about to enter the forbidden region, and if so, either delay the TPDU for T sec or and if so, either delay the TPDU for T sec or
resynchronize the sequence numbers.resynchronize the sequence numbers.
Elements of Transport Protocols: Connection Establishment Three-way handshake for connection establishmentThree-way handshake for connection establishment
Normal operation. Normal operation. Old duplicate CONNECTION REQUEST appearing Old duplicate CONNECTION REQUEST appearing
out of nowhere. out of nowhere. Duplicate CONNECTION REQUEST and duplicate Duplicate CONNECTION REQUEST and duplicate
ACK. ACK. Conclusion: there is no combination of old Conclusion: there is no combination of old
CONNECTION REQUEST, CONNECTION CONNECTION REQUEST, CONNECTION ACCEPTED, or other TPDUs that can cause the ACCEPTED, or other TPDUs that can cause the protocol to fail and have a connection setup by accident protocol to fail and have a connection setup by accident when no one wants it. when no one wants it.
Elements of Transport Protocols: Connection Establishment
Elements of Transport Protocols: Connection Release Asymmetric release and symmetric releaseAsymmetric release and symmetric release
Asymmetric release: When one part hangs up, the Asymmetric release: When one part hangs up, the connection is broken. connection is broken.
Symmetric release: to treat the connection as two Symmetric release: to treat the connection as two separate unidirectional connections and require each separate unidirectional connections and require each one to be released separately.one to be released separately.
Asymmetric release is abrupt and may result in data loss Asymmetric release is abrupt and may result in data loss (See the next slide)(See the next slide)
One way to avoid data loss is to use symmetric release. One way to avoid data loss is to use symmetric release.
Elements of Transport Protocols: Connection Release Abrupt disconnection with loss of dataAbrupt disconnection with loss of data
Elements of Transport Protocols: Connection Release
Symmetric release does the job when each process has a Symmetric release does the job when each process has a fixed amount of data to send and clearly knows when it has fixed amount of data to send and clearly knows when it has sent it.sent it.
Symmetric release has its problems if determining that all Symmetric release has its problems if determining that all the work has been done and the connection should be the work has been done and the connection should be terminated is not so obvious.terminated is not so obvious.
The two The two army army problemproblem
Elements of Transport Protocols: Connection Release
Two army-problem: A white army is encamped in a valley. Two army-problem: A white army is encamped in a valley. On both of the surrounding hillsides are blue armies. On both of the surrounding hillsides are blue armies.
one blue army < white army < two blue armiesone blue army < white army < two blue armies Does a a protocol exist that allows the blue armies to win?Does a a protocol exist that allows the blue armies to win?
Two-way handshakeTwo-way handshakeThe commander of blue army #1: “I propose we attack at down on The commander of blue army #1: “I propose we attack at down on
March 29. How about it?”March 29. How about it?”The commander of blue army #2: “OK.”The commander of blue army #2: “OK.” Will the attack happen?Will the attack happen?
Three-way handshakeThree-way handshake , , …… N-way handshakeN-way handshake No protocol exists that works.No protocol exists that works.
Substitute “disconnect” for “attack”. Substitute “disconnect” for “attack”. If neither side is prepared If neither side is prepared to disconnect until it is convinced that the other side is prepared to to disconnect until it is convinced that the other side is prepared to disconnect too, the disconnection will never happen. disconnect too, the disconnection will never happen.
Elements of Transport Protocols: Connection Release(a) Normal case of three-way handshake(a) Normal case of three-way handshake(b) Final ACK lost(b) Final ACK lost
Elements of Transport Protocols: Connection Release(c) Response lost(c) Response lost(d) Response lost and subsequent DRs Lost(d) Response lost and subsequent DRs Lost
Elements of Transport Protocols: Connection Release Automatic disconnect ruleAutomatic disconnect rule
If no TPDUs have arrived for a certain number of If no TPDUs have arrived for a certain number of seconds, the connection is then automatically seconds, the connection is then automatically disconnect.disconnect.
Thus, if one side ever disconnects, the other side will Thus, if one side ever disconnects, the other side will detect the lack of activity and also disconnect. detect the lack of activity and also disconnect.
Conclusion: releasing a connection without data loss is Conclusion: releasing a connection without data loss is not nearly as simple as it first appears. not nearly as simple as it first appears.
Elements of Transport Protocols: Flow control and buffering (Two buffering)
Flow control in data link layer and transport layerFlow control in data link layer and transport layer Similarity: In both layers a sliding window or other scheme Similarity: In both layers a sliding window or other scheme
is needed on each connection to keep a fast transmitter from is needed on each connection to keep a fast transmitter from overrunning a slow receiver. overrunning a slow receiver.
Difference: A router usually has relative few lines, whereas Difference: A router usually has relative few lines, whereas a host may have numerous connections. a host may have numerous connections.
BufferingBuffering The sender: The sender must buffer all TPDUs sent if the The sender: The sender must buffer all TPDUs sent if the
network service is unreliable. The sender must buffer all network service is unreliable. The sender must buffer all TPDUs sent if the receiver cannot guarantee that every TPDUs sent if the receiver cannot guarantee that every incoming TPDU will be accepted. incoming TPDU will be accepted.
The receiver: If the receiver has agreed to do the buffering, The receiver: If the receiver has agreed to do the buffering, there still remains the question of the buffer size. there still remains the question of the buffer size.
Elements of Transport Protocols: Flow control and buffering: (The receiver buffering)Buffer sizes
(a) Chained fixed-size buffers. (b) Chained variable-sized buffers. (c) One large circular buffer per connection.
Elements of Transport Protocols: Flow control and buffering The optimum trade-off between sender buffering The optimum trade-off between sender buffering
and receiver bufferingand receiver buffering depends on the type of traffic depends on the type of traffic carried by the connection. carried by the connection. For low-bandwidth bursty traffic, it is better to buffer For low-bandwidth bursty traffic, it is better to buffer
at the sender, at the sender, For high-bandwidth smooth traffic, it is better to For high-bandwidth smooth traffic, it is better to
buffer at the receiver. buffer at the receiver. As connections are opened and closed, and as the As connections are opened and closed, and as the
traffic pattern changes, the sender and receiver need traffic pattern changes, the sender and receiver need to dynamically adjust their buffer allocation. to dynamically adjust their buffer allocation.
Dynamic buffer allocation. Dynamic buffer allocation.
Elements of Transport Protocols: Flow control and bufferingDynamic buffer allocation (receiver’s buffering capacity).Dynamic buffer allocation (receiver’s buffering capacity).
Elements of Transport Protocols: Flow control and buffering When buffer space no longer limits the maximum flow, When buffer space no longer limits the maximum flow,
another bottleneck will appear: the carrying capacity of another bottleneck will appear: the carrying capacity of the subnet. the subnet. The sender dynamically adjusts the window size to The sender dynamically adjusts the window size to
match the network's carrying capacity. match the network's carrying capacity. In order to adjust the window size periodically, the In order to adjust the window size periodically, the
sender could monitor both parameters and then sender could monitor both parameters and then compute the desired window size. compute the desired window size.
Elements of Transport Protocols: Multiplexing Multiplexing and demultiplexingMultiplexing and demultiplexing
Multiplexing: Application layer Multiplexing: Application layer Transport layer Transport layer Network layer Network layer Data link layer Data link layer Physical layerPhysical layer
Demultiplexing: Physical layer Demultiplexing: Physical layer Data link layer Data link layer Network layer Network layer Transport layer Transport layer Application Application layerlayer
Two multiplexing: Two multiplexing: Upward multiplexing Upward multiplexing Downward multiplexing (See the next slide)Downward multiplexing (See the next slide)
Elements of Transport Protocols: Multiplexing
Elements of Transport Protocols: Crash Recovery Recovery from network and router crash is Recovery from network and router crash is
straightforward. straightforward. Recovery from host crash is difficult. Recovery from host crash is difficult. Assume that a client is sending a long file to a file Assume that a client is sending a long file to a file
server using a simple stop-and -wait protocol. server using a simple stop-and -wait protocol. Part way through the transmission, the server crashes.Part way through the transmission, the server crashes. The server might send a broadcast TPDU to all other The server might send a broadcast TPDU to all other
hosts, announcing that it had just crashed and hosts, announcing that it had just crashed and requesting that its clients inform it of the status of all requesting that its clients inform it of the status of all open connections. open connections.
Each client can be in one of two states: one TPDU Each client can be in one of two states: one TPDU outstanding, outstanding, S1S1, or no TPDUs outstanding, , or no TPDUs outstanding, S0S0..
Elements of Transport Protocols: Crash Recovery Some situationsSome situations
The client should retransmit only if has an The client should retransmit only if has an unacknowledged TPDU outstanding (S1) when it unacknowledged TPDU outstanding (S1) when it learns the crash. learns the crash.
If a crash occurs after the acknowledgement has If a crash occurs after the acknowledgement has been sent but before the write has been done, the been sent but before the write has been done, the client will receive the acknowledgement and thus client will receive the acknowledgement and thus be in state S0. be in state S0. LOST. Problem! LOST. Problem!
If a crash occurs after the write has been done but If a crash occurs after the write has been done but before the acknowledgement has been sent, the before the acknowledgement has been sent, the client will not receive the acknowledgement and client will not receive the acknowledgement and thus be in state S1. thus be in state S1. Dup. Problem! Dup. Problem!
For more, see the next slideFor more, see the next slide
Elements of Transport Protocols: Crash Recovery
Elements of Transport Protocols: Crash Recovery
No matter how the sender and receive are programmed, No matter how the sender and receive are programmed, there are always situations where the protocol fails to there are always situations where the protocol fails to recover properly. recover properly.
In more general terms, recovery from a layer N In more general terms, recovery from a layer N crash can only be done by layer N+1 and only if the crash can only be done by layer N+1 and only if the higher layer retains enough status information.higher layer retains enough status information.
A SIMPLE TRANSPORT PROTOCOL
The Example Service PrimitivesThe Example Service Primitives
The Example Transport EntityThe Example Transport Entity
The Example as a Finite State MachineThe Example as a Finite State Machine
A Simple Transport Protocol: The Example service Primitives To establish a connectionTo establish a connection
listen and connectlisten and connect To release a connectionTo release a connection
disconnectdisconnect To exchange informationTo exchange information
send/receivesend/receive The primitivesThe primitives
int listen (transport_address t);int listen (transport_address t);int connect(transport_address l, transport_address r);int connect(transport_address l, transport_address r);int send (int cid, unsigned char bufptr[], int bytes);int send (int cid, unsigned char bufptr[], int bytes);int receive(int cid, unsigned char bufptr[], int *bytes);int receive(int cid, unsigned char bufptr[], int *bytes);int disconnect(int cid);int disconnect(int cid);
A Simple Transport Protocol: The Example Transport Entity For pedagogical purposes (lacking features such as For pedagogical purposes (lacking features such as
extensive error checking)extensive error checking) To use the network service primitives to send and receive To use the network service primitives to send and receive
TPDUs.TPDUs. To use connection-oriented, reliable network service To use connection-oriented, reliable network service
rather than connection-less, unreliable network service. rather than connection-less, unreliable network service. For using connection-less, unreliable network, see the For using connection-less, unreliable network, see the
data link protocols.data link protocols. The transport entity can be part of the host’s OS, or it The transport entity can be part of the host’s OS, or it
may be a package of library routines running within the may be a package of library routines running within the user’s address space. user’s address space.
A Simple Transport Protocol: The Example Transport Entity
void to_net (void to_net (int cid, int cid, // connection id// connection idint q, int q, // control message or not// control message or notint m, int m, // more message or not// more message or notpkt_type pt, pkt_type pt, // CALL REQUEST/ACCEPTED// CALL REQUEST/ACCEPTED
// CLEAR REQUEST/ CONFIRMATION// CLEAR REQUEST/ CONFIRMATION// DATA, CREDIT// DATA, CREDIT
unsigned char *p, // dataunsigned char *p, // dataint bytesint bytes // data length );// data length );
void from_net (int *cid, int *q, int *m, pkt_type *pt, void from_net (int *cid, int *q, int *m, pkt_type *pt, unsigned char *p, int *bytes);unsigned char *p, int *bytes);
A Simple Transport Protocol: The Example Transport Entity
Supporting functionsSupporting functions : : enable_transport_layer/disable_transport_layerenable_transport_layer/disable_transport_layer , , sleep/wakeupsleep/wakeup
Connection statesConnection states IDLE:IDLE: connection not established yetconnection not established yet WAITING:WAITING: connect has been executed connect has been executed
and CALL REQUEST sentand CALL REQUEST sent QUEUED:QUEUED: A CALL REQUEST has arrived; A CALL REQUEST has arrived;
no LISTEN yetno LISTEN yet ESTABLISHED:ESTABLISHED: The connection has been establishedThe connection has been established SENDING:SENDING: The user is waiting for permission to The user is waiting for permission to send a packetsend a packet RECEIVING:RECEIVING: A RECEIVE has been doneA RECEIVE has been done DISCONNECTING:DISCONNECTING: A DISCONNECT has been done locallyA DISCONNECT has been done locally
A Simple Transport Protocol: The Example Transport Entity : struct conn
struct conn {struct conn { transport_address transport_address local_address, remote_addresslocal_address, remote_address;; cstate cstate statestate; ; /* state of this connection *//* state of this connection */ unsigned char * unsigned char * user_buf_addr user_buf_addr; ; /* pointer to receive buffer *//* pointer to receive buffer */ int int byte_countbyte_count; ; /* send/receive count *//* send/receive count */ int int clr_req_receivedclr_req_received; /* set when CLEAR_REQ packet received */; /* set when CLEAR_REQ packet received */ int int timertimer; ; /* used to time out CALL_REQ packets *//* used to time out CALL_REQ packets */ int int creditscredits; ; /* number of messages that may be sent *//* number of messages that may be sent */}}
packet_arrival, clock packet_arrival, clock (Interrupt Service Routine)(Interrupt Service Routine)listen, connect, send, receive, disconnectlisten, connect, send, receive, disconnect
A Simple Transport Protocol: The Example Transport Entity : listen
int listen(transport_address t)int listen(transport_address t){ int i, found = 0;{ int i, found = 0; for (i = 1; i <= MAX_CONN; i++) for (i = 1; i <= MAX_CONN; i++) if (conn[i].state==QUEUED && conn[i].local_address==t) if (conn[i].state==QUEUED && conn[i].local_address==t) { found = i; break; }{ found = i; break; }
if (found==0) { listen_address = t; sleep(); i = listen_conn ; }if (found==0) { listen_address = t; sleep(); i = listen_conn ; }
conn[i].state=ESTABLISHED; conn[i].timer=0;conn[i].state=ESTABLISHED; conn[i].timer=0; listen_conn=0; to_net(i, 0, 0, CALL_ACC, data, 0); listen_conn=0; to_net(i, 0, 0, CALL_ACC, data, 0); return(i);return(i);}}
A Simple Transport Protocol: The Example Transport Entity : connect
int connect(transport_address l, transport_address r)int connect(transport_address l, transport_address r){ int i; struct conn *cptr;{ int i; struct conn *cptr; data[0] = r; data[1] = l; i = MAX_CONN; data[0] = r; data[1] = l; i = MAX_CONN; while (conn[i].state != IDLE && i > 1) i = i - 1;while (conn[i].state != IDLE && i > 1) i = i - 1; if (conn[i].state <> IDLE) return(ERR_FULL);}if (conn[i].state <> IDLE) return(ERR_FULL);}
cptr = &conn[i]; // fill in the fields for cptr. cptr = &conn[i]; // fill in the fields for cptr. to_net(i, 0, 0, CALL_REQ, data, 2); sleep(); to_net(i, 0, 0, CALL_REQ, data, 2); sleep(); if (cptr->state == ESTABLISHED) return(i);if (cptr->state == ESTABLISHED) return(i); if (cptr->clr_req_received) if (cptr->clr_req_received) {cptr->state = IDLE; to_net(i, 0, 0, CLEAR_CONF, data, 0);{cptr->state = IDLE; to_net(i, 0, 0, CLEAR_CONF, data, 0); return(ERR_REJECT);}return(ERR_REJECT);}}}
A Simple Transport Protocol: The Example Transport Entity :TransportEntity.c
For more, please see the code For more, please see the code
TransportEntity.cTransportEntity.c
A Simple Transport Protocol: The Example as a Finite State MachineThe example protocol as a
finite state machine. Each entry has an optional predicate, an optional action, and the new state. The tilde indicates that no major action is taken. An overbar above a predicate indicates the negation of the predicate. Blank entries correspond to impossible or invalid events.
A Simple Transport Protocol: The Example as a Finite State MachineThe example protocol in
graphical form. Transitions that leave the connection state unchanged have been omitted for simplicity
THE INTERNET TRANSPORT PROTOCOLS: UDP, RPC, RTP
Two main transport protocols in the InternetTwo main transport protocols in the Internet Connectionless protocol (UDP)Connectionless protocol (UDP) Connection-oriented protocol (TCP)Connection-oriented protocol (TCP)
UDP (User Datagram protocol)UDP (User Datagram protocol) RPC (Remote Procedure Call)RPC (Remote Procedure Call) RTP (Real-time Transport Protocol)RTP (Real-time Transport Protocol)
The Internet Transport Protocols: UDP
UDP (RFC768) provides a way for applications toUDP (RFC768) provides a way for applications to send encapsulated IP datagrams and send encapsulated IP datagrams and send them without having to establish a connection. send them without having to establish a connection.
UDP transmits segments consisting of an 8-byte header UDP transmits segments consisting of an 8-byte header followed by the payload.followed by the payload.
UDPUDP Multiplexing and demultiplexing using ports.Multiplexing and demultiplexing using ports. No flow control, error control or retransmission.No flow control, error control or retransmission. Applications: RPC, RTP, DNS (Domain Name System)Applications: RPC, RTP, DNS (Domain Name System)
The Internet Transport Protocols: RPC/UDP RPC (Remote Procedure Call) allows programs to call RPC (Remote Procedure Call) allows programs to call
procedures located on remote hosts. procedures located on remote hosts. When a process on machine 1 calls a procedure on When a process on machine 1 calls a procedure on
machine 2, the calling process on 1 is suspended and machine 2, the calling process on 1 is suspended and execution of the called procedure takes place on 2execution of the called procedure takes place on 2
Information can be transported from the caller to the Information can be transported from the caller to the callee in the parameters and can come back in the callee in the parameters and can come back in the procedure result. procedure result.
No message passing is visible to the programmer.No message passing is visible to the programmer. The idea behind RPC is to make a remote procedure The idea behind RPC is to make a remote procedure
call look as much as possible like a local one. call look as much as possible like a local one. Client Proc Client Proc Client Stub Client Stub Server Stub Server Stub
Server procServer proc
The Internet Transport Protocols: RPC/UDP
The Internet Transport Protocols: RPC/UDPThe steps in making an RPCThe steps in making an RPC Step 1 is the client calling the client stub. Step 1 is the client calling the client stub. Step 2 is the client stub packing the parameters into a Step 2 is the client stub packing the parameters into a
message (marshaling) and making a system call to send message (marshaling) and making a system call to send the message. the message.
Step 3 is the kernel sending the message from the client Step 3 is the kernel sending the message from the client machine to the server machine. machine to the server machine.
Step 4 is the kernel passing the incoming packet to the Step 4 is the kernel passing the incoming packet to the server stub and unpacking the packet to extract the server stub and unpacking the packet to extract the parameters (unmarshaling).parameters (unmarshaling).
Step 5 is the server stub calling the server procedure with Step 5 is the server stub calling the server procedure with the unmarshaled parameters.the unmarshaled parameters.
The reply traces the same path in the other direction. The reply traces the same path in the other direction.
The Internet Transport Protocols: RPC/UDP A few snakes hiding under the grass (RPC)A few snakes hiding under the grass (RPC)
The use of pointer parameters.The use of pointer parameters. Some problems for weakly-typed languages (The Some problems for weakly-typed languages (The
length of an array).length of an array). It is not always possible to deduce the types of the It is not always possible to deduce the types of the
parameters, not even from a formal specification or parameters, not even from a formal specification or the code itself. (printf)the code itself. (printf)
The use of global variables.The use of global variables. Some restrictions are needed to make RPC work Some restrictions are needed to make RPC work
well in practice.well in practice. RPC/TCP vs RPC/UDPRPC/TCP vs RPC/UDP
The Internet Transport Protocols: RTP/UDP Multimedia applications such as Internet radio, Internet Multimedia applications such as Internet radio, Internet
telephony, music-on-demand, videoconferencing, video-on-telephony, music-on-demand, videoconferencing, video-on-demand, require real-time transport protocols. demand, require real-time transport protocols. RTP RTP (Real-time Transport Protocol) (RFC1889)(Real-time Transport Protocol) (RFC1889)
The RTP is in user space and runs over UDP. The RTP Ops:The RTP is in user space and runs over UDP. The RTP Ops: The multimedia applications consists of multiple audio, The multimedia applications consists of multiple audio,
video, text, and possibly other streams. These are fed into video, text, and possibly other streams. These are fed into the RTP library. the RTP library.
This library then multiplexes the streams and encodes This library then multiplexes the streams and encodes them in RTP packets, which it then puts into a socket. them in RTP packets, which it then puts into a socket.
UDP packets are generated and embedded in IP packets. UDP packets are generated and embedded in IP packets. The IP packet are then put in frames for transmission.The IP packet are then put in frames for transmission. … …
The Internet Transport Protocols: RTP/UDP
(a)The position of RTP in the protocol stack (a)The position of RTP in the protocol stack (b) packet nesting(b) packet nesting
The Internet Transport Protocols: RTP/UDP RTP is a transport protocol realized in the application layer. RTP is a transport protocol realized in the application layer. RTP is to multiplex several real-time data streams onto a RTP is to multiplex several real-time data streams onto a
single stream of UDP packets and unicast or multicast the single stream of UDP packets and unicast or multicast the UDP packets.UDP packets.
Each RTP packet is given a number one higher than its Each RTP packet is given a number one higher than its predecessor. RTP has no flow control, no error control, no predecessor. RTP has no flow control, no error control, no acknowledgements, and no retransmission support.acknowledgements, and no retransmission support.
Each RTP payload may contain multiple samples and they Each RTP payload may contain multiple samples and they can be coded any way that the application wants. For can be coded any way that the application wants. For example a single audio stream may be encoded as 8-bit example a single audio stream may be encoded as 8-bit PCM samples at 8kHz, delta encoding, predictive encoding, PCM samples at 8kHz, delta encoding, predictive encoding, GSM encoding, MP3, and so on. GSM encoding, MP3, and so on.
RTP allows timestamping. RTP allows timestamping.
The Internet Transport Protocols: RTP/UDP
The Internet Transport Protocols: RTP/UDP Version: 2 bits, already at 2.Version: 2 bits, already at 2. The P bit: padded to a multiple of 4 bytes or not.The P bit: padded to a multiple of 4 bytes or not. The X bit: an extension header or not.The X bit: an extension header or not. CC: how many contributing sources are present (0-15).CC: how many contributing sources are present (0-15). The M bit: marker bit.The M bit: marker bit. Payload type: which encoding algorithm has been used. Payload type: which encoding algorithm has been used. Sequence number: incremented on each RTP packet sent. Sequence number: incremented on each RTP packet sent. Timestamp: reducing jitter.Timestamp: reducing jitter. Synchronization source identifier: which stream the Synchronization source identifier: which stream the
packet belongs to.packet belongs to. Contributing source identifiers.Contributing source identifiers.
The Internet Transport Protocols: RTP/UDP RTCP (Real-time Transport Control Protocol) is a little RTCP (Real-time Transport Control Protocol) is a little
sister protocol (little sibling protocol?) for RTP.sister protocol (little sibling protocol?) for RTP. Does not transport any dataDoes not transport any data To handle feedback, synchronization, and the user To handle feedback, synchronization, and the user
interfaceinterface To handle interstream synchronization.To handle interstream synchronization. To name the various sources. To name the various sources.
For more information about RTP, For more information about RTP, RTP: Audio and RTP: Audio and Video for the InternetVideo for the Internet (Perkins, C.E. 2002, Addison- (Perkins, C.E. 2002, Addison-Wesley)Wesley)
THE INTERNET TRANSPORT PROTOCOLS: TCP
Introduction to TCPIntroduction to TCP The TCP Service ModelThe TCP Service Model The TCP ProtocolThe TCP Protocol The TCP Segment HeaderThe TCP Segment Header TCP Connection EstablishmentTCP Connection Establishment TCP Connection ReleaseTCP Connection Release TCP Connection Management ModelingTCP Connection Management Modeling TCP Transmission PolicyTCP Transmission Policy TCP Congestion ControlTCP Congestion Control TCP Timer ManagementTCP Timer Management Wireless TCP and UDPWireless TCP and UDP Transactional TCPTransactional TCP
TCP: Introduction TCP (Transmission Control Protocol) provides a TCP (Transmission Control Protocol) provides a
reliable end-to-end byte stream over an unreliable reliable end-to-end byte stream over an unreliable internetwork. For TCP, see RFC 793, 1122, 1323.internetwork. For TCP, see RFC 793, 1122, 1323.
The communication between TCP entitiesThe communication between TCP entities A TCP entity accepts user data streams from local A TCP entity accepts user data streams from local
processes, breaks them up into pieces not exceeding processes, breaks them up into pieces not exceeding 64KB (in practice, often 1500-20-20 data bytes), 64KB (in practice, often 1500-20-20 data bytes), sends each piece as a separate IP datagram. sends each piece as a separate IP datagram.
When datagrams containing TCP data arrive at a When datagrams containing TCP data arrive at a machine, they are given to the TCP entity, which machine, they are given to the TCP entity, which constructs the original byte streams. constructs the original byte streams.
TCP must furnish the reliability that most users TCP must furnish the reliability that most users want and that IP does not provide. want and that IP does not provide.
TCP: The Service Model For any TCP service to be obtained, a connection must For any TCP service to be obtained, a connection must
be explicitly established between a socket on the be explicitly established between a socket on the sending machine and a socket on the receiving machine. sending machine and a socket on the receiving machine. Connections are identified by the socket identifiers at Connections are identified by the socket identifiers at
both ends, that is, (socket1, socket2)both ends, that is, (socket1, socket2) A socket number (address) consisting of the IP A socket number (address) consisting of the IP
address of the host and a 16-bit number local to that address of the host and a 16-bit number local to that host, called a port. host, called a port.
Port numbers below 1024 are called well-known Port numbers below 1024 are called well-known ports and are reserved for standard services. (see the ports and are reserved for standard services. (see the next slide.)next slide.)
TCP: The Service Model Some well-known portsSome well-known ports
Port Protocol Use21 FTP File transfer23 Telnet Remote login25 SMTP E-mail69 TFTP Trivial File Transfer Protocol79 Finger Lookup info about a user80 HTTP World Wide Web
110 POP-3 Remote e-mail access119 NNTP USENET news
TCP: The Service Model To have many daemons standbyTo have many daemons standby To have one master daemon inetd or xinetd standbyTo have one master daemon inetd or xinetd standby
The master daemon attaches itself to multiple ports and The master daemon attaches itself to multiple ports and wait for the first incoming connectionwait for the first incoming connection
When one incoming connection request arrives, inetd When one incoming connection request arrives, inetd or xinetd forks off a new process and executes the or xinetd forks off a new process and executes the appropriate daemon on it, letting that daemon handle appropriate daemon on it, letting that daemon handle the request. the request.
All TCP connections are full duplex and point-point. All TCP connections are full duplex and point-point. A TCP connection is a byte stream, not a message queue. A TCP connection is a byte stream, not a message queue.
Message boundaries are not preserved end to end. Message boundaries are not preserved end to end.
TCP: The Service Model
((a) Four 512-byte segments sent as separate IP datagrams.a) Four 512-byte segments sent as separate IP datagrams.(b) The 2048 bytes of data delivered to the application in a single (b) The 2048 bytes of data delivered to the application in a single
READ CALL.READ CALL.
TCP: The Service Model When an application passes data to TCP, TCP may send When an application passes data to TCP, TCP may send
it immediately or buffer it at its own discretion. it immediately or buffer it at its own discretion. To force data out, applications can use the PUSH flag, To force data out, applications can use the PUSH flag,
which tells TCP not to delay the transmission.which tells TCP not to delay the transmission. TCP supports urgent data. TCP supports urgent data.
When the urgent data are received at the destination, When the urgent data are received at the destination, the receiving application is interrupted (e.g, given a the receiving application is interrupted (e.g, given a signal in UNIX terms) so it can stop whatever it was signal in UNIX terms) so it can stop whatever it was doing and read the data stream to find the urgent data. doing and read the data stream to find the urgent data.
The end of the urgent data is marked so the The end of the urgent data is marked so the application know when it is over. application know when it is over.
The start of the urgent data is not marked. It is up to The start of the urgent data is not marked. It is up to the application to figure that out. the application to figure that out.
TCP: The Overview Every byte on a TCP connection has its own 32-bit Every byte on a TCP connection has its own 32-bit
sequence number.sequence number. The sending and receiving TCP entities exchange data in The sending and receiving TCP entities exchange data in
the form of segments. the form of segments. Each segment, including the TCP header, must fit in the Each segment, including the TCP header, must fit in the
65515 (=65535-20) byte IP payload.65515 (=65535-20) byte IP payload. Each network has a maximum transfer unit or MTU Each network has a maximum transfer unit or MTU
(1500 for the Ethernet).(1500 for the Ethernet). The TCP entities use the sliding window protocolThe TCP entities use the sliding window protocol
Segments can arrive out of order. Segments can arrive out of order. Segments can be delayed.Segments can be delayed. The retransmissions may include different byte ranges The retransmissions may include different byte ranges
than the original transmission. than the original transmission.
TCP: The Header
TCP: The Header Source port and destination port: to identify the local Source port and destination port: to identify the local
end points of the connection. A port plus its host’s IP end points of the connection. A port plus its host’s IP address forms a 48-bit unique end point. The source and address forms a 48-bit unique end point. The source and destination end points together identify the connection.destination end points together identify the connection.
Sequence number and acknowledgement number: 32 Sequence number and acknowledgement number: 32 bits long (every byte of data is numbered in a TCP bits long (every byte of data is numbered in a TCP stream).stream).
TCP header length: how many 32-bit words are TCP header length: how many 32-bit words are contained in the TCP header. contained in the TCP header.
6-bit field not used.6-bit field not used. URG bit: the Urgent pointer is in use or not.URG bit: the Urgent pointer is in use or not. ACK bit: the Acknowledgement number is valid or not.ACK bit: the Acknowledgement number is valid or not.
TCP: The Header PSH bit: PUSHed data or not.PSH bit: PUSHed data or not. RST bit: to reset a connection that has become confused RST bit: to reset a connection that has become confused
due to a host crash or some other reason. due to a host crash or some other reason. SYN bit: to used to establish connections. (In essence SYN bit: to used to establish connections. (In essence
the SYN bit is used to denote CONNECTION the SYN bit is used to denote CONNECTION REQUEST and CONNECTION ACCEPTED, with the REQUEST and CONNECTION ACCEPTED, with the ACK bit used to distinguish between those two ACK bit used to distinguish between those two possibilities).possibilities).
FIN bit: used to release a connection. FIN bit: used to release a connection. Window size: to tell how many bytes may be sent Window size: to tell how many bytes may be sent
starting at the byte acknowledged.starting at the byte acknowledged.
TCP: The Header Checksum: provided for extra reliability.Checksum: provided for extra reliability.
Urgent pointer: used to indicate a byte offset from the current Urgent pointer: used to indicate a byte offset from the current sequence number at which urgent data are to be found. sequence number at which urgent data are to be found.
Options: Options: To allow each host to specify the maximum TCP payload To allow each host to specify the maximum TCP payload
it is willing to acceptit is willing to accept Window scale optionWindow scale option To use selective repeat instead of go back n protocolTo use selective repeat instead of go back n protocol
TCP: Connection Establishment
TCP: Connection Release TCP connections are full duplex and can be treated as a TCP connections are full duplex and can be treated as a
pair of simplex connections.pair of simplex connections. Each simplex connection is released independently of Each simplex connection is released independently of
its sibling. its sibling. To release a connection, a party can send a TCP To release a connection, a party can send a TCP
segment with the FIN bit set, which means that it has segment with the FIN bit set, which means that it has no more data to transmit.no more data to transmit.
When the FIN is acknowledged, that direction is shut When the FIN is acknowledged, that direction is shut down for the new data. down for the new data.
When both directions have been shut down, the When both directions have been shut down, the connection is released. connection is released.
To avoid the two-army problem, timers are used. To avoid the two-army problem, timers are used.
TCP: Connection Management Policy
TCP: Connection Management PolicyTCP connection management finite state machine. The heavy solid line is the normal path for a client. The heavy dashed line is the normal path for a server. The light lines are unusual events. Each transition is labeled by the event causing it and the action resulting from it, separated by a slash.
TCP: Transmission Policy
TCP: Transmission Policy Nagle’s algorithmNagle’s algorithm
Consider a telnet connection to an interactive editor that Consider a telnet connection to an interactive editor that reacts on every keystroke.reacts on every keystroke.
Solution 1: to delay acknowledgements and window Solution 1: to delay acknowledgements and window updates for 500 msec in the hope of acquiring some data updates for 500 msec in the hope of acquiring some data on which to hitch a free ride. on which to hitch a free ride.
Solution 2: Nagle’s algithmSolution 2: Nagle’s algithmWhen data come into the sender one byte at a time, When data come into the sender one byte at a time,
just send the first byte and buffer all the rest until the just send the first byte and buffer all the rest until the outstanding byte is acknowledged. Then send all the outstanding byte is acknowledged. Then send all the buffered characters in one TCP segment and start buffered characters in one TCP segment and start buffering again until they are acknowledged. buffering again until they are acknowledged.
TCP: Transmission Policy Clark’s solution for silly window syndromeClark’s solution for silly window syndrome
To prevent the receiver from sending a window update for 1 byte.To prevent the receiver from sending a window update for 1 byte.
TCP: Congestion Control There are two windows: congestion window and There are two windows: congestion window and
receiver window.receiver window.
TCP: Congestion Control
An example of the Internet congestion algorithm.An example of the Internet congestion algorithm.
TCP: Timer Management((a) Probability density of ACK arrival times in the data a) Probability density of ACK arrival times in the data
link layer. link layer. (b) Probability density of ACK arrival times for TCP.(b) Probability density of ACK arrival times for TCP.
TCP: Timer Management Retransmission timerRetransmission timer
RTT (Round-Trip Time)RTT (Round-Trip Time)RTT = alpha RTT + (1-alpha)MRTT = alpha RTT + (1-alpha)M
Mean deviationMean deviationD = alpha D + (1-alpha) | RTT –M |D = alpha D + (1-alpha) | RTT –M |
TimeoutTimeout= RTT + 4 x D= RTT + 4 x D
Persistence timerPersistence timer: to prevent the deadlock. : to prevent the deadlock. Keepalive timerKeepalive timer: to check whether the other side is still : to check whether the other side is still
there.there. Other timers such as the one used in the TIMED WAIT Other timers such as the one used in the TIMED WAIT
state.state.
TCP: Wireless TCP and UDP Congestion controlCongestion control
Wired TCP: to slow down and send less.Wired TCP: to slow down and send less. Wireless TCP: to send ASAP.Wireless TCP: to send ASAP. Wired and Wireless TCPWired and Wireless TCP
Indirect TCPIndirect TCP
Snooping agent for sending to mobile hostsSnooping agent for sending to mobile hosts
TCP: Transactional TCP
PERFORMANCE ISSUES
Performance Problems in Computer NetworksPerformance Problems in Computer Networks Network Performance MeasurementNetwork Performance Measurement System Design for Better PerformanceSystem Design for Better Performance Fast TPDU ProcessingFast TPDU Processing Protocols for Gigabit NetworksProtocols for Gigabit Networks
Performance Issues: Performance Problems
Some performance problems, such as congestion, are Some performance problems, such as congestion, are caused by temporary resource overloads.caused by temporary resource overloads.
Performance also degrades when there is a structural Performance also degrades when there is a structural resource imbalance. resource imbalance.
Overloads can also be synchronously triggered. Overloads can also be synchronously triggered. Broadcast storm due to errors. Broadcast storm due to errors. DHCP after an electrical power failure.DHCP after an electrical power failure.
Poor performance can occur due to lack of system Poor performance can occur due to lack of system tuning. tuning. Low priority for network processingLow priority for network processing Less buffers for network processingLess buffers for network processing Setting timeouts incorrectly Setting timeouts incorrectly
Performance Issues: Performance Problems
Gigabit networks bring with them new performance Gigabit networks bring with them new performance problems. problems. The state of transmitting one megabit from San Diego to BostonThe state of transmitting one megabit from San Diego to Boston(a)(a) At t = 0, At t = 0, (b)(b) After 500 After 500 μμsec, sec, (c)(c) After 20 msec, After 20 msec, (d)(d) after 40 msec. after 40 msec.
Performance Issues: Performance Measurement
The basic loop for improving network The basic loop for improving network performance. performance. Measure relevant network parameters and Measure relevant network parameters and
performance. performance. Try to understand what is going on.Try to understand what is going on. Change one parameter to .Change one parameter to .
These steps are repeated until the performance is These steps are repeated until the performance is good enough or it is clear that the last drop of good enough or it is clear that the last drop of improvement has been squeezed out. improvement has been squeezed out.
Performance Issues: Performance Measurement
Make sure that the sample size is large enough. Make sure that the sample size is large enough. Make sure that the samples are representative. Make sure that the samples are representative. Be careful when using a coarse-grained clock. Be careful when using a coarse-grained clock. Be sure that nothing unexpected is going on during your Be sure that nothing unexpected is going on during your
tests. tests. Caching can wreak havoc with measurements. Caching can wreak havoc with measurements. Understand what you are measuring. Understand what you are measuring. Be careful about extrapolating the results Be careful about extrapolating the results
Performance Issues: Performance Measurement
Performance Issues: Design for Better Performance CPU speed is more important than network speed. CPU speed is more important than network speed. Reduce packet count to reduce software overhead.Reduce packet count to reduce software overhead.
Nagle’s algorithm and Clark’s solution.Nagle’s algorithm and Clark’s solution. Minimize context switches. Minimize context switches.
Four context switches to handle one packet Four context switches to handle one packet
Performance Issues: Design for Better Performance Minimize copying: Minimize copying:
On a 50-MIPS machine, making three copies of each On a 50-MIPS machine, making three copies of each packet at five instructions per 32-bit word copied packet at five instructions per 32-bit word copied requires 75 nsec per incoming byte. => 107Mbps requires 75 nsec per incoming byte. => 107Mbps
Overhead for header processing, interrupt handling, Overhead for header processing, interrupt handling, and context switches => 50Mbps and context switches => 50Mbps
Memory operations (not register-register operations) Memory operations (not register-register operations) => 16Mbps => 16Mbps
You can buy more bandwidth but not lower delay. You can buy more bandwidth but not lower delay. Avoiding congestion is better than recover it (An ounce Avoiding congestion is better than recover it (An ounce
of prevention is worth a pound of cure). of prevention is worth a pound of cure). Avoid timeouts. Avoid timeouts.
Performance Issues: Fast TPDU Processing
The fast path from sender to receiver is shown with The fast path from sender to receiver is shown with a heavy line.a heavy line.
The processing steps on this path are shaded.The processing steps on this path are shaded.
Performance Issues: Fast TPDU Processing
(a)(a) TCP header. TCP header. (b)(b) IP header. In both cases, the shaded fields are IP header. In both cases, the shaded fields are
taken from the prototype without change.taken from the prototype without change.
Performance Issues: Fast TPDU Processing
A timing wheel.A timing wheel.
Performance Issues: Gigabit Network Protocols The problems with gigabit network:The problems with gigabit network:
Many protocols use 32-bit sequence numbersMany protocols use 32-bit sequence numbersFor 56 kbps, the wrap time is over 1 week.For 56 kbps, the wrap time is over 1 week.For 10Mbps, the wrap time is 57 minute.For 10Mbps, the wrap time is 57 minute.For 1 Gbps, the wrap time is 34 seconds.For 1 Gbps, the wrap time is 34 seconds.
Communication speeds have improved much faster Communication speeds have improved much faster then computing speeds.then computing speeds.
The go back n protocol performs poly on lines with a The go back n protocol performs poly on lines with a large bandwidth-delay product. large bandwidth-delay product.
Gigabit lines are fundamentally different from Gigabit lines are fundamentally different from megabit lines. megabit lines.
The variance in the packet arrival times is as The variance in the packet arrival times is as important as the mean delay itself. important as the mean delay itself.
Performance Issues: Gigabit Network Protocols
Performance Issues: Gigabit Network Protocols
SolutionsSolutions Design for speed, not for bandwidth optimization.Design for speed, not for bandwidth optimization. To use a rate-based protocol rather than a sliding To use a rate-based protocol rather than a sliding
window protocol.window protocol. Packets should be well layout. Packets should be well layout. The header and data should be separately The header and data should be separately
checksummed. checksummed. The maximum data size should be large. The maximum data size should be large. To send a normal amount of data along with the To send a normal amount of data along with the
connection request. connection request. ……
Homework 6.6.33 6.66.6 6.136.13 6.146.14 6.166.16 6.206.20 6.256.25 6.306.30 6.336.33 6.366.36