Bài giảng Mạng máy tính - Chương 3: Giao thức tầng giao vận (transport layer) - Trần Quang Hải Bằng

Transport Layer Services & Principles.

2. Multiplexing/Demultiplexing.

3. Connectionless Transport (UDP).

4. Principles of Reliable Data Transfer (RDT).

5. Connection-oriented Transport (TCP).

6. Congestion Control.

7. Sử dụng TCP hay UDP

pdf43 trang | Chia sẻ: phuongt97 | Lượt xem: 355 | Lượt tải: 1download
Bạn đang xem trước 20 trang nội dung tài liệu Bài giảng Mạng máy tính - Chương 3: Giao thức tầng giao vận (transport layer) - Trần Quang Hải Bằng, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
tiếp. Chương 3. Giao thức tầng giao vận (transport layer) 6106/02- 24/03/2012 TCP Connection management  TCP: Connection-oriented.  Khởi tạo các giá trị:  sequence number.  buffers, flow control information.  Client:Connection initiator (khởi tạo liên kết: socket).  Server: Chấp nhận kết nối. Three way handshaking:  Bước 1: client gửi TCP SYN control segment tới server.  Bước 2: server nhận SYN segment rồi trả lời bằng SYNACK segment.  Bước 3: client nhận SYNACK segment và trả lời bằng ACK segment (có thể có dữ liệu đi kèm). Chương 3. Giao thức tầng giao vận (transport layer) 6206/02- 24/03/2012 Chương 3. Giao thức tầng giao vận (transport layer) 6306/02- 24/03/2012 TCP Connection management: ngắt liên kết  Bước 1: client (phía muốn ngắt liên kết) gửi TCP FIN segment.  Bước 2: server (phía còn lại) nhận được FIN, gửi ACK, ngắt liên kết, gửi tiếp FIN segment.  Bước 3: client nhận FIN, trả lời bằng ACK. timed wait (chờ một lúc nữa cho tới khi liên kết đóng hẳn).  Bước 4: server nhận ACK, đóng liên kết. client FIN server ACK ACK FIN closing closing closed ti m ed w ai t closed Chương 3. Giao thức tầng giao vận (transport layer) 6406/02- 24/03/2012 TCP client lifecycle TCP server lifecycle TCP Connection management (cont.) Chương 3. Giao thức tầng giao vận (transport layer) 6506/02- 24/03/2012 Ch3. The Transport Layer 1. Transport Layer Services & Principles. 2. Multiplexing/Demultiplexing. 3. Connectionless Transport (UDP). 4. Principles of Reliable Data Transfer (RDT). 5. Connection-oriented Transport (TCP). 6. Congestion Control. 7. Sử dụng TCP hay UDP Chương 3. Giao thức tầng giao vận (transport layer) 6606/02- 24/03/2012 Congestion control  Nghẽn mạng là điều khó tránh khỏi!!!  Khi mạng bị nghẽn, các gói tin có thể bị trễ hay bị mất.  Hai hướng tiếp cận:  End-end congestion control: Thông tin về mức độ nghẽn mạng được suy ra từ lượng tin bị mất mát trong quá trình truyền.  Network-assited congestion control: Routers cung cấp các thông tin phản hồi về tình trạng nghẽn mạng tới end systems.  Bit thông báo nghẽn mạng đừng gửi nữa hoăc xin chờ một lát.  Tốc độ tối đa cho phép gửi (maximum rate allowed).  TCP sử dụng phương pháp end-end congestion control. Chương 3. Giao thức tầng giao vận (transport layer) 6706/02- 24/03/2012 Causes/costs of congestion: scenario 1  2 senders, 2 receivers  01 router, buffers vô hạn  no retransmission  large delays when congested  maximum achievable throughput unlimited shared output link buffers Host A λin : original data Host B λout Chương 3. Giao thức tầng giao vận (transport layer) 6806/02- 24/03/2012 Causes/costs of congestion: scenario 2  one router, buffers có hạn  sender gửi lại các packet bị mất finite shared output link buffers Host A λin : original data Host B λout λ'in : original data, plus retransmitted data Chương 3. Giao thức tầng giao vận (transport layer) 6906/02- 24/03/2012  always: (goodput)  “perfect” retransmission only when loss:  retransmission of delayed (not lost) packet makes larger (than perfect case) for same λ in λ out = λ in λ out > λ in λ out “costs” of congestion:  more work (retrans) for given “goodput”  unneeded retransmissions: link carries multiple copies of pkt Causes/costs of congestion: scenario 2 Chương 3. Giao thức tầng giao vận (transport layer) 7006/02- 24/03/2012 Causes/costs of congestion: scenario 3  4 senders  multihop paths  timeout/retransmit λ in Q: what happens as and increase ?λ in finite shared output link buffers Host A λin : original data Host B λout λ'in : original data, plus retransmitted data Chương 3. Giao thức tầng giao vận (transport layer) 7106/02- 24/03/2012 Causes/costs of congestion: scenario 3 Another “cost” of congestion:  Khi thực hiện drop các packet trên đường truyền  dung lượng đường truyền đã sử dụng để gửi tin tới điểm bị drop là vô ích. H o s t A H o s t B λ o u t Chương 3. Giao thức tầng giao vận (transport layer) 7206/02- 24/03/2012 TCP Congestion Control  end-end control (no network assistance)  Sender điều khiển lượng dữ liệu gửi đi theo quy tắc: LastByteSent-LastByteAcked ≤ min {CongWin, ReceiverWnd}  Công thức xấp xỉ:  Giá trị CongWin luôn biến đổi và được tính toán theo khả năng truyền tải của mạng. Làm thế nào sender đánh giá được tình trạng nghẽn?  loss event = timeout or 3 duplicate ACKs  TCP sender reduces rate (CongWin) after loss event Cơ chế đánh giá nghẽn:  AIMD  Slow start  conservative after timeout events rate = CongWin RTT Bytes/sec Chương 3. Giao thức tầng giao vận (transport layer) 7306/02- 24/03/2012 8 Kbytes 16 Kbytes 24 Kbytes time congestion window multiplicative decrease: cut CongWin in half after loss event additive increase: increase CongWin by 1 MSS every RTT in the absence of loss events: probing Long-lived TCP connection TCP AIMD (additive-increase, multiplicative-decrease) Chương 3. Giao thức tầng giao vận (transport layer) 7406/02- 24/03/2012 TCP Slow Start  When connection begins, CongWin = 1 MSS  Example: MSS = 500 bytes & RTT = 200 msec  initial rate = 20 kbps  Available bandwidth may be >> MSS/RTT  desirable to quickly ramp up to respectable rate  When connection begins, increase rate exponentially fast until first loss event Chương 3. Giao thức tầng giao vận (transport layer) 7506/02- 24/03/2012 TCP Slow Start (more)  When connection begins, increase rate exponentially until first loss event:  double CongWin every RTT  done by incrementing CongWin for every ACK received  Summary: initial rate is slow but ramps up exponentially fast Host A one segment R T T Host B time two segments four segments Chương 3. Giao thức tầng giao vận (transport layer) 7606/02- 24/03/2012 Refinement  After 3 dup ACKs:  CongWin is cut in half  window then grows linearly  But after timeout event:  CongWin instead set to 1 MSS;  window then grows exponentially  to a threshold, then grows linearly • 3 dup ACKs indicates network capable of delivering some segments • timeout before 3 dup ACKs is “more alarming” Philosophy: Chương 3. Giao thức tầng giao vận (transport layer) 7706/02- 24/03/2012 Q: When should the exponential increase switch to linear? A: When CongWin gets to 1/2 of its value before timeout. Implementation:  Variable Threshold  At loss event, Threshold is set to 1/2 of CongWin just before loss event Refinement (more) Chương 3. Giao thức tầng giao vận (transport layer) 7806/02- 24/03/2012  When CongWin is below Threshold, sender in slow- start phase, window grows exponentially.  When CongWin is above Threshold, sender is in congestion-avoidance phase, window grows linearly.  When a triple duplicate ACK occurs, Threshold set to CongWin/2 and CongWin set to Threshold.  When timeout occurs, Threshold set to CongWin/2 and CongWin is set to 1 MSS. Summary: TCP Congestion Control Chương 3. Giao thức tầng giao vận (transport layer) 7906/02- 24/03/2012 TCP throughput (or transmission rate)  Gía trị throughout (số packet gửi đi / giây) của TCP tính theo Window size và RTT là bao nhiêu? Không tính giai đoạn slowstart  Gọi W là giá trị window size khi xuất hiện mất gói. Khi window size = W, throughput = W/RTT Ngay sau khi có nghẽn (lost), window size giảm xuống = W/2  throughput = W/2RTT.  Throughout trung bình là: 0.75 W/RTT Throughout TB = 3W/4RTT Chương 3. Giao thức tầng giao vận (transport layer) 8006/02- 24/03/2012 TCP Futures  Hỏi: Giả sử MSS = 1500 byte, RTT = 100µs , Cần gửi đi với tốc độ là 10 Gbps (throughput=109 bps). Vậy giá trị Windowsize phải là bao nhiêu ?  Trả lời: window size W = 83,333 in-flight segments  Throughput tính theo loss rate:  Trong đó L = loss rate LRTT MSS⋅22.1 Chương 3. Giao thức tầng giao vận (transport layer) 8106/02- 24/03/2012 Delay modeling Q: How long does it take to receive an object from a Web server after sending a request? Ignoring congestion, delay is influenced by:  TCP connection establishment  data transmission delay  slow start Notation, assumptions:  Assume one link between client and server of rate R  S: MSS (bits)  O: object size (bits)  no retransmissions (no loss, no corruption) Window size:  First assume: fixed congestion window, W segments  Then dynamic window, modeling slow start Chương 3. Giao thức tầng giao vận (transport layer) 8206/02- 24/03/2012 Fixed congestion window (1) First case: WS/R > RTT + S/R: ACK for first segment in window returns before window’s worth of data sent delay = 2RTT + O/R Chương 3. Giao thức tầng giao vận (transport layer) 8306/02- 24/03/2012 Transport Layer 3-83 Fixed congestion window (2) Second case:  WS/R < RTT + S/R: wait for ACK after sending window’s worth of data sent delay = 2RTT + O/R + (K-1)[S/R + RTT - WS/R] Chương 3. Giao thức tầng giao vận (transport layer) 8406/02- 24/03/2012 Ch3. The Transport Layer 1. Transport Layer Services & Principles. 2. Multiplexing/Demultiplexing. 3. Connectionless Transport (UDP). 4. Principles of Reliable Data Transfer (RDT). 5. Connection-oriented Transport (TCP). 6. Congestion Control. 7. Sử dụng TCP hay UDP Chương 3. Giao thức tầng giao vận (transport layer) 8506/02- 24/03/2012 Một số so sánh TCP/UDP  Có liên kết, lưu trữ trạng thái liên kết (quản lý liên kết).  Điểm-điểm  Có độ trễ (delay): thiết lập, quản lý liên kết, luồng, nghẽn  Segment header lớn (20 bytes)  Bị giới hạn tốc độ truyền (congestion control)  Không liên kết, không lưu trữ trạng thái.  Điểm-điểm, quảng bá.  Độ trễ thấp.  Segment header nhỏ (8 bytes)  Không giới hạn tốc độ truyền. Chương 3. Giao thức tầng giao vận (transport layer) 8606/02- 24/03/2012 Các app thực tế typically UDPDNSName translation typically UDPRIPRouting protocol typically UDPSNMPNetwork management typically UDPproprietaryInternet telephony typically UDPproprietaryStreaming multimedia typically UDPNFSRemote file server TCPFTPFile transfer TCPHTTPWeb TCPTelnetRemote terminal access TCPSMTPElectronic mail Transport protocolApp protocolApplication

Các file đính kèm theo tài liệu này:

  • pdfbai_giang_mang_may_tinh_chuong_3_giao_thuc_tang_giao_van_tra.pdf
Tài liệu liên quan