Understanding the Stack Recall the TCP/IP Internet Architecture
End-to-End Protocols (Week 12)
FTP
HTTP
NV
80
20,21
RTP
4444
UDP
TCP 6
17
IP
Jaringan Komputer NET1
NET2
…
NETn
Fakultas Ilmu Komputer Universitas Indonesia Semester Genap 2003/2004 Versi: 1
2
Basic Transport-layer Function
Versi 1
End-to-end Communication
Network layer: end-to-end logical communication between hosts Transport layer (rely on network layer): logical communication between application-level comm. end-points Multiple application-level end-points can reside in one host Application-level end-points can be a Web browser/server, a FTP client/server, etc
Transport layer: end-to-end implementation
3
Versi 1
4
Versi 1
1
Transport-layer Service Model
Internet Transport-layer Protocols
Transport layer: logical communication between application end-point point.
UDP: connectionless multiplexing/demultiplexing error detection
multiplexing/demultiplexing
Additional services:
TCP: connection oriented
reliable data transfer (guaranteed arrival, no error, inorder) flow control (keep sender from overrunning receiver): good for myself congestion control (keep sender from overrunning network): good for everybody
multiplexing/demultiplexing reliable data transfer flow control congestion control
services not available: delay guarantees bandwidth guarantees
5
Versi 1
6
Port Numbers
How multiplexing/demultiplexing works?
Each port number is a 16-bit number, ranging from 0 to 65535. Port numbers ranging from 0 to 1023 are called wellknown port numbers and are restricted. Port number vs. socket
using port numbers each IP datagram has source IP address, destination IP address each IP datagram carries a transport-layer segment each segment has source, destination port number port number??
socket (true destination attached to app. end-point) port number (a mechanism to identify socket)
Analogy PABX system vs Internet:
dest. IP address for routing to the host; IP addresses and port numbers for going to appropriate socket in the dest. host.
7
Versi 1
Phone no ≈ Internet address Extension no ≈ Port no
Versi 1
8
Versi 1
2
Simple Demultiplexor (UDP) Unreliable and unordered datagram service Adds multiplexing 0 SrcPort No flow control Checksum Endpoints identified by ports servers have well-known ports see /etc/services on Unix
UDP: User Datagram Protocol What is a connection? 16
a group of segments between the same pair of comm. endpoints allow for shared resources, provide services more efficiently
31 DstPort
UDP is connectionless:
Length
each UDP segment handled independently of others
Data
UDP does multiplexing/demultiplexing simple error detection
Header format Optional checksum
UDP does not do
pseudo header + UDP header + data
reliable data transfer, flow control, congestion control …
Pseudo header consists of:
Protocol no (6 for TCP, 17 for UDP) Source IP Destination IP Length field
9
Versi 1
What is good about UDP?
10
Versi 1
UDP: more
TCP features may not be needed by some applications, such as? Less overhead:
Often used for streaming multimedia apps loss tolerant rate sensitive
no connection establishment (which can add delay) small segment header no congestion control: UDP can blast away as fast as desired
In general, UDP is also used when TCP features are not important What if you want a subset of features in TCP?
Simple: no connection state at sender, receiver
implemented at applicationlevel flow control and error recovery in many multimedia apps 11
Versi 1
12
Versi 1
3
End-to-End Protocols
TCP Overview
Underlying best-effort network (IP service):
Full duplex Flow control: keep sender from overrunning receiver Congestion control: keep sender from overrunning network
Connection-oriented Byte-stream
drop messages re-orders messages delivers duplicate copies of a given message limits messages to some finite size delivers messages after an arbitrarily long delay
app writes Bytes TCP sends segments app reads Bytes
Common end-to-end services: guarantee message delivery deliver messages in the same order they are sent deliver at most one copy of each message support arbitrarily large messages support synchronization allow the receiver to flow control the sender support multiple application processes on each host
Application process
Application process
…
…
Write Bytes
TCP Receive buffer
TCP Send buffer
Segment
Read Bytes
Segment
…
Segment
Transmit segments
Versi 1
14
Versi 1
Simple Reliability: send/ACK
Reliable Data Transfer
Sender
Our goal: end-to-end solution to achieve reliable data transfer What is reliable data transfer?
Receiver
Timeout
Time
ACK
Timeout (a)
Sender
Receiver
Timeout
Fram e
Where is it used in computer networks? reliable data link service on top of unreliable physical layer reliable transport service on top of unreliable IP
Timeout
Fram
16
ACK
duplication
Receiver Fram e ACK
Fram e ACK
ACK
(b) Versi 1
e
Fram e
Sender
Timeout
end-to-end solution has no control of underlying communication channel, which can be error-prone and lossy
ACK
(c)
Timeout
Why is it difficult?
Receiver Fram e
guaranteed arrival no error in order delivery
15
Sender
Fram e
Timeout
13
(d)
duplication Versi 1
4
Stop-and-Wait
Bandwidth & Latency (Review)
Problem: Overhead ACK: min. 1 RTT, sender stop Example
Kinerja jaringan diukur dalam dua kategori: Bandwidth (throughput): jumlah bits yang dapat ditransfer dalam satu periode waktu • Misalkan: 1 Mbits/detik => 1 Mbps, berarti dapat mengirimkan data 1 juta bit setiap detik; • Bandwidth 1 Mbps, diperlukan waktu 1 mikro-detik untuk mengirimkan 1 bit.
Mak. bit yang dapat dikirimkan: BW x latency. BW = Bandwidth 1.5Mbps link x 45ms latency = 67.5Kb ≈ 8KB 1KB Byte setiap 90ms => 1/16 utilisasi BW (link) Sender
Latency (delay): berapa lama waktu yang diperlukan untuk mengirimkan “message” dari satu ujung (end) ke ujung lainnya.
Receiver
Length = latency bandwidth
• Ukuran latency adalah satuan waktu. • Misalkan: latency untuk jaringan JKT – SBY: 20 milidetik (oneway). • Pengukuran lain Round-Trip Time (RTT): latency message bolak balik (two way).
Capacity = bandwidth X latency
17
Versi 1
Example: Latency Network (Review) A R1
Kemungkinan output link sedang digunakan, maka paket harus antri (queued) di dalam buffer => delay antrian
Destination
R3
Host A
R4
Host A R1 R2
TRANSP1 Q2
TRANSP1
TRANSP2
PROP1
PROP1
R2 R3
TRANSP3
PROP2
TRANSP2
R1
“Store-and-Forward” at each Router
Host B
TRANSP4
R3
Host B
Versi 1
Example: Latency Network (Review)
B
R2
Source
18
TRANSP3 PROP2
TRANSP4 PROP3
PROP3
PROP4
Actual end to end latency = ∑ (TRANSPi + PROPi + Qi )
PROP4
Minimum end to end latency = ∑ (TRANSPi + PROPi )
i
i
19
Versi 1
20
Versi 1
5
E.g. : Exercise 1.5 (Page 61) - Review
E.g. : Exercise 1.5 (Page 61) - Review
Hitung waktu transfer 1000 KB file, asumsi *RTT=100ms, ukuran paket 1KB data, dan diperlukan 2 RTT untuk handshaking awal. a) Badwidth 1.5 Mbps, dan paket data dikirim secara kontinyu (tidak terputus)
Hitung waktu transfer 1000 KB file, asumsi *RTT=100ms, ukuran paket 1KB data, dan diperlukan 2 RTT untuk handshaking awal. b) Badwidth 1.5 Mbps, dan paket data tidak dikirim secara kontinyu, tapi setiap satu paket dikirimkan sender harus menunggu 1 RTT, kemudian mengirim paket berikutnya.
-
-
Gunakan rumus latency dan perhitungkan semua faktor yang memberikan kontribusi terjadinya delay dari sender ke receiver. Latency = [handshaking] + waktu propagasi [paket 1, one way] + waktu transmisi Latency = [2 * RTT] + [RTT/2] + [BesarData/Bandwidth] Latency = [200ms] + [50 ms] + [1000KB/1.5Mbps] Latency = [200ms] + [50 ms] + [(1000*1024*8)/(1.5 * 106) s] Latency = 0.25 s + 5.46 s = 5.71 second
-
-
-
*Catatan: Di sini RTT = propagation delay
21
Versi 1
Dengan cara ini terdapat overhead 1 RTT pada paket kedua, ketiga, dst sampai paket ke-1000; paket pertama tidak perlu menunggu sehingga total delay dari 1000 paket tsb adalah 999 RTT. Latency = [handshaking] + waktu propagasi [paket 1, one way] + waktu transmisi + [total delay overhead menunggu] Latency = 5.71 s + [999 * RTT] Latency = 105.61 second.
*Catatan: Di sini RTT = propagation delay
22
Versi 1
Segment Format
Sliding Window Allow multiple outstanding (un-ACKed) Bytes Upper bound on un-ACKed Bytes, called window
0
10
4
16
31
SrcPort
Sender
DstPort
Receiver
SequenceNum Acknowledgment
…
Time
HdrLen
0
Flags
AdvertisedWindow
Checksum
UrgPtr Options (variable)
…
Data
23
Versi 1
24
Versi 1
6
Segment Format (cont)
Connection Establishment and Termination
Each connection identified with 4-tuple:
Three way handshake
(SrcPort, SrcIPAddr, DsrPort, DstIPAddr)
Sliding window + flow control
Active participant (client)
acknowledgment, SequenceNum, AdvertisedWinow
SYN, Seq
Data(SequenceNum) Sender
Passive participant (server) uence Num =
x
= y, qu e x+1 S = , K ment + AC g d N Y le S w
Receiver
Num ence
Acknowledgment + AdvertisedWindow
o Ackn ACK, Ackno wledg me
Flags SYN, FIN, RESET, PUSH, URG, ACK
Checksum
nt = y
+1
pseudo header + TCP header + data 25
Versi 1
Flow Control – Credit Allocation
26
Versi 1
Sending and Receiving Perspectives
[STAL00] Stalling W., Data and Computer Communications 6th ed, Prentice-Hall:2000, § 17.1 1 segment = 200 octets Initial W = 7 segments (1400 octets)
27
Versi 1
28
Versi 1
7
TCP Congestion Control
Receiver vs Network Capacity
Yang lebih berperan mengendalikan kemacetan adl lapisan transport (transport layer). Kemacetan dpt dikendalikan jika data rate dikurangi, dan hal tsb merupakan porsi tugas lapisan transport.
[TAN03] Tanenbaum, A.S., Computer Networks 4th ed. Prentice-Hall: 2003, § 6.5.9. (a) A fast network feeding a low-capacity receiver 29
Versi 1
Masalah & Penyelesaiannya
Versi 1
Effective Window Size
Masalah:
Ukuran jendela yg aman menurut ES asal. Min(receiver window size, congestion window size). Jika ES tujuan menyanggupi ukuran jendela 8KB, tetapi ES asal mengetahui kapasitas jaringan hanya 4KB -> ES asal memilih jendela berukuran 4KB. Jika ES tujuan menyanggupi ukuran jendela 8KB, dan ES asal mengetahui kapasitas jaringan 32 KB -> ES asal memilih jendela berukuran 8KB.
Apakah TCP congestion control cukup jika hanya mengandalkan ukuran jendela (window size) yg ditentukan oleh End System (ES) tujuan? Lihat slide 31. Bagaimana dgn internal congestion pd slide sebelum ini?
Penyelesaiannya: Selain receiver window, perlu juga congestion window. 31
(b) A slow network feeding a high capacity network
30
Versi 1
32
Versi 1
8
Slow Start & Threshold
Algoritma Slow Start & Threshold
Mekanisme yg dilakukan ES asal utk memperkirakan kapasitas jaringan. Slow start (Jacobson 1988):
1. 2.
Congestion window bertambah besar secara eksponensial, sampai terjadi timeout atau receiver window tercapai. Penambahan congestion window terjadi jika ES asal menerima ACK dr segmen yg telah dikirimkan sebelum timeout. Bagaimana jika congestion window mencapai receiver window? 33
3.
4.
Versi 1
Slow Start & Threshold
Congestion window diberi nilai 1 segmen. Dilakukan slow start sampai congestion window mencapai threshold (pertambahan secara ekponesial). Kemudian congestion window bertambah secara linier, hingga mencapai receiver window atau terjadi timeout. Jika terjadi timeout, threshold diperkecil menjadi ½ dr congestion window terakhir. Kembali ke langkah 1.
34
Versi 1
E.g. Slow Start & Threshold
Dalam suatu koneksi TCP, ES tujuan dpt mengubah ukuran receiver window. Lihat slide 31. ICMP Source quench akan dilaporkan ke TCP & dianggap sbg timeout. Timer management sangat penting & ditentukan secara statistik.
35
Versi 1
36
Versi 1
9