1 / 45

Achieving Link Reliability

Achieving Link Reliability. GZ01 Networked Systems Kyle Jamieson Lecture 5 Department of Computer Science University College London. Achieving reliability: the story so far. Apply forward error correction (FEC) at physical layer Apply error detection at higher layers.

yukio
Download Presentation

Achieving Link Reliability

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Achieving Link Reliability GZ01 Networked Systems Kyle Jamieson Lecture 5 Department of Computer Science University College London

  2. Achieving reliability: the story so far • Apply forward error correction (FEC) at physical layer • Apply error detection at higher layers

  3. Choosing the amount of FEC to apply • Adding parity bits: • Increases number of bit errors receiver can correct • Increases overhead k bits n−k bits FECS FECR Network Sender Receiver data bits parity bits

  4. How much FEC do we need to apply? FLR n = 320 (40 bytes) n = 104 (1250 bytes) Bit error rate(p)

  5. How much FEC do we need to apply? • Goal: Frame loss rate (FLR) < ≈10-3 • Suppose after applying FEC, probability of a bit error is p • Pr[Frame of length n bits delivered] = (1 − p)n • Assumption: Independence between bit errors (worst case) • Frame loss rate (FLR): 1 − Pr[Frame delivered] • Add enough FEC to keep FLR below knee, but no more (wastes bits on the channel) • For small x, binomial expansion of (1+x)n ≈ 1 + nx • FLR = 1 − (1 − p)n ≈ n × (BER)  BER / n < 10-3 • BER before FEC of some links (wireless) can be as high as 10-2 (wired much less) • For data packet of 1250 bytes (104 bits), need BER after FEC of 10-7 FLR n = 320 (40 bytes) n = 104 (1250 bytes) Bit error rate(p)

  6. Some errors are too severe to be corrected • No matter how many parity bits we add, the network could flip them and data bits, causing errors! • Error detection (CRC) then discards these frames How to ensure that links are reliable? FECS FECR Network Sender Receiver

  7. Reliable delivery: Plan • Goal: ensure every packet is received exactly once • Exactly-once delivery • Pipelining for performance • Handling retransmissions intelligently • Congestion in the Internet • Culmination: the Transmission Control Protocol

  8. Today • Designing reliable transfer from first principles: the Stop and Wait protocol • Performance calculations: link utilization • Making stop and wait reliable transfer fast: the Go Back N protocol

  9. Reliable transfer over an unreliable network • Classic networking problem, recurs at many different layers • Our approach will be abstract • Functionality split between sender and receiver • Task: Design sender and receiver sides of a reliable data transfer (rdt) protocol, using unreliable data transfer (udt) protocol rdt_send(data) deliver_data(data) Reliable data transfer protocol (sender side) Reliable data transfer protocol (receiver side) udt_send(pkt) rdt_recv(pkt) Transport Layer Link Layer Physical Layer Network Layer Unreliable channel

  10. Approach • Plan: derive reliable transfer from first principles • Goal: exactly once, in-order delivery of every packet • Unidirectional at first; same principles can generalize to bidirectional data transfer Assumptions: • Channel can not introduce bit errors into packets • Channel can not fail to deliver packets • Channel can not delay packets • Channel can not reorder packets • Gradually relax these assumptions, one by one

  11. Reliable data transfer (rdt) v1.0 • Independent state machines at sender, receiver • No need for feedback (underlying channel is reliable) • No flow control in this protocol Sender state machine: Receiver state machine:

  12. Assumptions • Channel can introduce bit errors into packets • Channel (sender to receiver) can introduce bit errors • Channel (receiver to sender) can not introduce bit errors • Channel can not fail to deliver packets • Channel can not delay packets • Channel can not reorder packets

  13. Idea: Receiver requests re-sends • Three fundamental mechanisms: • Error detection: typically a packet checksum (like the CRC) • Acknowledgements: small control frame (ACK) transmitted from the receiver back to the sender • Positive ACKs acknowledge correct receipt • Negative ACKs inform sender of incorrect receipt • Timeouts: sender waits a reasonable amount of time, then retransmits the frame • Protocols using these techniques are called automatic repeat request (ARQ) protocols • Surprisingly challenging to apply correctly! Three loaves of bread, OK. A dozen eggs, Sorry? A dozen eggs,

  14. Reliable data transfer under bit errors rdt v2.0 sender state machine: rdt v2.0 receiver state machine:

  15. Reliable data transfer v2.0 analysis Sender Receiver • Stop-and-wait protocol: Sender doesn’t send more data until sure original data received • e.g. rdt v2.0 • Performance depends on sender-receiver delay, and throughput • Two cases: • Data arrives okay • ACK comes back immediately • Sender sends next packet • Data arrives corrupted • NACK comes back immediately • Sender retransmits corrupted packet • Exactly once, in-order delivery IDLE ACK wait Data A ACK IDLE ACK wait Data B NACK IDLE ACK wait Data B ACK

  16. Assumptions • Channel can introduce bit errors into packets • Channel (sender to receiver) can introduce bit errors • Channel (receiver to sender) can introduce bit errors • Channel can not fail to deliver packets • Channel can not delay packets arbitrarily • Channel can not reorder packets

  17. Human approach to feedback errors • Idea: Apply ARQ in reverse • Request retransmits of corrupted feedback • If corrupt, receiver doesn’t know if forward-link packets are data or feedback retransmit requests • Clearly heading down a difficult path! Three loaves of bread, OK. Sorry? Sorry? Sorry? …

  18. Idea: Add checksums to feedback rdt v2.0 (with checksums) sender state machine: rdt v2.0 (with checksums) receiver state machine:

  19. Problem for rdt v2.0: duplicates Sender Receiver • Three cases: • Data okay, ACK okay • Data corrupted • NACK comes back immediately • Sender retransmits corrupted packet • Data okay, ACK corrupted • ACK comes back immediately • Sender resends same packet • Result: At least once, in-order delivery IDLE ACK wait Data B NACK IDLE ACK wait Data B ACK IDLE ACK wait Data B ACK

  20. Assumptions • Channel can introduce bit errors into packets • Channel (sender to receiver) can introduce bit errors • Channel (receiver to sender) can introduce bit errors • Channel can not fail to deliver packets • Channel can not delay packets arbitrarily • Channel can not reorder packets • Sender or channel can duplicate packets

  21. From at least once to exactly once • Idea: add sequence numbers to data packets • Sequence number allows receiver to suppress duplicates rdt v2.1 sender state machine:

  22. From at least once to exactly once • Two states at receiver: one for expecting seqno=1; the other for expecting seqno=0 rdt v2.1 receiver state machine:

  23. rdt v2.1 error-free operation • Sender: send data, wait for reply • Receiver: deliver data, send ACK • Sender: send next data, wait • Receiver: deliver data, send ACK • Sender: transition to Idle State 0 Sender state machine: Sender Receiver Data, seqno=0 I0 DW 0 AW0 DW 1 Receiver state machine: ACK I1 Data, seqno=1 AW1 DW 0 ACK I0

  24. rdt v2.1: bit errors on the forward link • Sender: send data, wait for reply • Receiver: checksum fails; NACK • Sender: resend seqno=0 data • Receiver: deliver data; send ACK • Sender: transition to Idle State 1 Sender state machine: Sender Receiver I0 DW 0 Data, seqno=0 AW0 DW 0 Receiver state machine: NACK Data, seqno=0 AW0 DW 1 ACK I1

  25. rdt v2.1: bit errors on the reverse link • Sender: send data, wait for reply • Receiver: deliver data; send ACK • Sender: resend seqno=0 data • Receiver: dup. data; resend ACK • Sender: transition to Idle State 1 Sender state machine: Sender Receiver I0 DW 0 Data, seqno=0 AW0 DW 1 Receiver state machine: ACK Data, seqno=0 AW0 DW 1 ACK I1

  26. rdt v2.1: dropped packets • Sender: send data, wait for reply (result: deadlock) Sender state machine: Sender Receiver I0 DW 0 Data, seqno=0 AW0 Receiver state machine:

  27. rdt v2.2: Getting rid of NACKs • Different packets in feedback direction (ACK, NACK) • Instead, we can add sequence numbers to ACKs • Sequence number in ACK corresponds to data it acknowledges • First time in DW 0 state, receiver could send ACK 1 or nothing (as in text) Sender state machine: Sender Receiver I0 DW 0 Data, seqno=0 AW0 DW 0 Receiver state machine: ACK 1 I1 Data, seqno=0 AW0 DW 1 ACK 0

  28. Assumptions • Channel can introduce bit errors into packets • Channel (sender to receiver) can introduce bit errors • Channel (receiver to sender) can introduce bit errors • Channel can fail to deliver packets • Channel can delay packets arbitrarily • Channel can not reorder packets • Sender or channel can duplicate packets

  29. Retransmission timer breaks deadlock rdt v3.0 sender state machine: Timer start Timer stop

  30. rdt v3.0 receiver rdt v3.0 receiver state machine:

  31. rdt v3.0: recovering lost packets • Sender: send, start timer, wait/reply • Receiver: deliver; send ACK 0 (lost) • Sender: timeout, resend, start timer • Receiver: dup. data; resend ACK 0 • Sender: stop timer, go to Idle State 1 Sender state machine: Sender Receiver I0 DW 0 Data, seqno=0 AW0 DW 1 Receiver state machine: ACK 0 Timeout Data, seqno=0 AW0 DW 1 ACK 0 I1

  32. rdt v3.0: delays in the network • Sender: send, start timer, wait/reply • Receiver: deliver; send ACK (delayed) • Sender: timeout, resend, start timer • Sender: stop timer, go to Idle State 1 • Receiver: dup. data, resend ACK 0 • Sender: recv. dup. ACK 0, do nothing Sender state machine: Sender Receiver I0 DW 0 Data, seqno=0 AW0 DW 1 Receiver state machine: Timeout ACK 0 Data, seqno=0 AW0 DW 1 I1 ACK 0 I1

  33. Stop-and-wait performance Packet size L, link bitrate R sender receiver First bit transmitted, t = 0 Last bit transmitted, t = L/R First bit arrives RTT Last bit arrives, send ACK ACK arrives, send next packet, t = RTT + L/R

  34. Packet size L, link bitrate R; utilization Internet e.g.: 8000 bit packet; 1 Gbit/s link, 30 ms RTT: WiFi e.g.: 8000 bit packet; 54 Mbit/s link, 100 ns RTT Performance of stop and wait protocols (not including other unrelated overheads) When packet time << RTT, stop-and-wait underperforms.

  35. Pipelining: sender allows multiple unacknowledged packets “in-flight” from sender to receiver Range of sequence numbers must be increased Buffering at sender and/or receiver Two generic forms of pipelined protocols: Go-Back-N, Selective Repeat Idea: Pipelined protocols

  36. Pipelining: increased utilization sender receiver First bit sent, t = 0 Last bit sent, t = L / R RTT last bit of 1st packet, send ACK last bit of 2nd packet, send ACK last bit of 3rd packet, send ACK ACK arrives, send next packet, t = RTT + L / R

  37. The Bandwidth-Delay product • When do we get maximum link utilization? sender receiver RTT Number of bits “in flight” Delay × Bandwidth product

  38. Today • Designing reliable transfer from first principles: the Stop and Wait protocol • Performance calculations: link utilization • Making stop and wait reliable transfer fast: the Go Back N protocol

  39. Assumptions • Channel can introduce bit errors into packets • Channel (sender to receiver) can introduce bit errors • Channel (receiver to sender) can introduce bit errors • Channel can fail to deliver packets • Channel can delay packets arbitrarily • Channel can reorder packets in forward direction • Sender or channel can duplicate packets

  40. The Go-Back-N (GBN) protocol • Sender: send without waiting for an acknowledgement • Up to N unacked packets “in flight” at any time • Why limit to N? Flow control at receiver, congestion control in the network • Timer for oldest unacknowledged packet • Timer expire: retransmit all unacknowledged packets (sender can “go back” up to N packets) • Receiver: sends cumulative acknowledgement: acknowledge receipt of all packets up to and including packet n:ACK(n) • Sequence numbers • k-bit seqno; sequence number space: [0, 2k−1] • All arithmetic modulo 2k: wrap-around 1 0 2k−1 2

  41. GBN: at the sender rdt_send(data): if nextseqnum < send_base + N: sndpkt[nextseqnum] = make_pkt send data with nextseqnum nextseqnum++ else: (refuse data) timeout: send(sndpkt[base]) send(sndpkt[base+1]) … send(sndpkt[nextseqnum−1]) rdt_recv(ackpkt): send_base = ackpkt.seqno + 1 • GBN: A type of Sliding Window Protocol (Timer code not shown)

  42. GBN: at the receiver • Maintain expectedseqnum variable: sequence number of the next in-order packet • send_base ≤ expectedseqnum < nextseqnum • Incoming data packet with seqno=n • n = expectedseqnum: send ACK(n), increment expectedseqnum • n <> expectedseqnum: discard packet, send ACK(expectedseqnum − 1) • Nothing more, because in the event of loss, the sender will go back to expectedseqnum! • Could buffer correctly-received out-of-order packets, but the sender will transmit them later anyway expectedseqnum

  43. GBN (N = 4) in operation Sender Receiver Send packet 0 Receive 0; send ACK 0 Send packet 1 Receive 1; send ACK 1 Send packet 2 Send packet 3 (wait) Receive 3; discard; send ACK 1 Receive ACK 0; send 4 Receive 4; discard; send ACK 1 Receive ACK 1; send 5 (wait) Receive 5; discard; send ACK 1 Timeout; resend 2 Receive 2; send ACK 2 Resend packet 3 Receive 3; send ACK 3 Resend packet 4 Receive 4; send ACK 4 Resend packet 5 Receive 5; send ACK 5

  44. The role of the retransmission timer • Keeps track of time at sender since the oldest unacknowledged packet was sent • This is the packet to which send_base points • Issue: Choosing a reasonable timer value • Compare to RTT of one packet: • Too small causes unnecessary retransmissions • Too big wastes time • Later: we will see how TCP solves this problem robustly

  45. Next time • No lecture this Thursday, 21st October

More Related