資料通訊 Week 2 (9/20) Instructor: Ling-Jyh Chen General Information Time: Tuesday 2:10pm~5:00pm Place: S203 Instructor: 陳伶志 Ling-Jyh Chen TA: 李威賢 walker1202@gmail.com Course Website: Phone: 02-27883799 ext. 1702 Email: cclljj@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~cclljj/teaching/ Google Groups: NTNU-2011-data-communication Textbook Required: Data Networks, 2nd edition, Dimitri Bertsekas and Robert Gallager, Prentice Hall, 1992. (新月圖書代理) Recommended: An Engineering Approach to Computer Networking, S. Keshav, Addision-Wesley. Computer Networks, 4th ed., Andrew S. Tanenbaum, Prentice-Hall. Schedule Grading In-Class Participation: 5% Homework: 30% Midterm (closed book): 30% Final (open book): 35% Week 2 Textbook: Section 2.3, 2.4 Additional materials FEC Adaptive ARQ 6 Sec 2.3 Error Detection Question: How to detect errors? Error Detection Techniques 1. Single Parity Checks The parity check bit (c) is the sum k, modulo j, of the bit values in the original bit string. 2. Horizontal and Vertical Parity Checks Arrange a string of data bits in a two-dimensional array. Apply single parity checks to each row and column of the 2D array. Ex: Cyclic Redundancy Checks (CRC) 7 Sec 2.3 Error Detection (cont.) code: refers to the transmission itself code word: refers to an encoded bit string (data K + parity checks L) K + L = frame length The effectiveness of a code is measured by 1. The min distance d of the code (ps: 2/4 for method 1/2) => error correction can be possible if there are fewer than d/2 errors 2. The burst-detecting capability 3. The prob. that a completely random string will be accepted as error-free 8 Sec 2.4 ARQ Question: how to deal with errors? ARQ: Automatic Retransmission reQuest retransmit the erroneous packets/frames There is always a trade-off for data transmission: correctness vs efficiency Three types of ARQ Stop and wait ARQ Go back n ARQ Selective repeat ARQ 9 Sec 2.4 ARQ (cont.) Stop and wait ARQ (1/4) Time at A Node A Ack Node B Packet 0 Time at B Packet 0 or 1? * We need Sequence Number (SN) in the data packets. 10 Sec 2.4 ARQ (cont.) Stop and wait ARQ (2/4) 0 0 1 ? ? Time at A 2 Node A Ack Node B Packet 0 Ack Nak Time at B * We need Request Number (RN) in the ACK packets. 11 Sec 2.4 ARQ (cont.) Stop and wait ARQ (3/4) 0 0 1 2 3 Node A Node B 1 0 1 2 1 3 2 3 12 Sec 2.4 ARQ (cont.) Stop and wait ARQ (4/4) S&W ARQ is safe: it never produces incorrect results. S&W ARQ is live: it can continue forever to produce results. 0,0 Even numbered packet received at B Request for even packet received at A 1,0 0,1 Odd numbered packet received at B Request for odd packet received at A 1,1 state: (SN mode 2, RN mode 2) 13 Sec 2.4 ARQ (cont.) Go back n ARQ (1/6) S&W ARQ is simple, but ineffective. Go back n ARQ is the most popular scheme. Idea: several successive packets can be sent w/o waiting for the next packet to be requested. a.k.a. sliding window ARQ 14 Sec 2.4 ARQ (cont.) Go back n ARQ (2/6) No errors (n=7) [0,6] 0 1 2 3 [1,7] [2,8] 4 5 [3,9] [5,11] 6 Node A Node B 0 0 0 1 1 2 2 5 3 3 4 5 5 15 Sec 2.4 ARQ (cont.) Go back n ARQ (3/6) Errors in the forward direction (n=4) timeout [0,3] 0 1 [1,4] 2 3 [2,5] 4 1 2 3 4 Node A Node B 0 1 0 1 1 1 1 2 1 3 2 3 16 Sec 2.4 ARQ (cont.) Go back n ARQ (4/6) Errors in the backward direction (n=4) timeout [0,3] 0 1 [2,5] 2 3 4 [4,7] 5 2 [5,8] 4 5 Node A Node B 0 1 0 2 1 3 2 4 3 5 4 5 6 17 Sec 2.4 ARQ (cont.) Go back n ARQ (5/6) Long delay in the backward direction (n=4) timeout [0,3] 0 1 [1,4] 2 3 [3,6] 4 1 3 4 [4,7] 3 4 5 Node A Node B 0 1 0 1 2 3 4 5 18 Sec 2.4 ARQ (cont.) Go back n ARQ (6/6) Go back n ARQ is safe and live when SN and RN are integers modulo m, for m > n. The timeout value should be chosen long enough to include round-trip propagation and processing delay plus transmission time for two MAX length packets in the reverse direction. Go back n ARQ with buffers -> Selective repeat ARQ 19 Sec 2.4 ARQ (cont.) Selective repeat ARQ 0 1 … b 0 b+1 … 2b 0 b+1 Node A Node B 0 … 0 0 … 0 1 0 1 0 … 0 0 … 0 b … b 0 0 b+1 … 2b 2b+1 Node A Node B 0 0 1 … 0 b 0 0 0 b+1 … 20 FEC: Forward Error Correction FEC: using redundancy to provide capabilities of correcting minor bit errors in a packet Example: IEEE 802.11a, Bluetooth Pros: using FEC to correct minor errors in a packet -> reduce the number of retransmissions Cons: FEC causes overhead -> reduce effectiveness Solution: adaptation!! 21 Adaptive ARQ We use Bluetooth as the examples. Example 1: Adaptive Packet Type (ICC’04) Example 2: Adaptive ARQ Timeout (MNSA’04) 22 Enhancing Bluetooth TCP Throughput via Packet Type Adaptation Ling-Jyh Chen, Rohit Kapoor, M. Y. Sanadidi, Mario Gerla Dept. of Computer Science, UCLA Outline of the Talk The problem: Wireless interference and bit errors severely affect TCP efficiency. The opportunity: Bluetooth offers multiple packet type options with different FEC and packet lengths. Moreover, the link layer API provides link error quality information. Opportunity for cross-layer adaptation. Key idea: dynamically select packet type based on measured link quality. The results: we show that the “Adaptive Packet Type” approach in Bluetooth can effectively enhance TCP performance. 24 Who still remembers Bluetooth? Personal Area Network Designed for “cable” replacement Application Examples Automatic synchronization of calendars, address books, business cards Proximity operation (camera to cellphone, etc) 25 Bluetooth Overview The “enabler” of Personal Area Network (PAN) Low power, low cost, and smaller chips Packet Mode FEC Size (bytes) Length (slots) Symmetric Throughput (kbps) Asymmetric Throughput (kbps) DM1 yes 17 1 108.8 108.8 108.8 DM3 yes 121 3 258.1 387.2 54.4 DM5 yes 227 5 286.7 477.8 36.3 DH1 no 27 1 172.8 172.8 172.8 DH3 no 183 3 390.4 585.6 86.4 DH5 no 339 5 433.9 723.2 57.6 26 Bluetooth packet types DH: Stop and Wait ARQ DM: ARQ as well as 2/3 FEC codes to correct single bit errors FEC coding scheme: (15, 10) Hamming code, each block of 10 information bits is encoded into a 15 bit codeword can correcting a single bit error in each block. 27 Throughput Analysis DH mode: (ARQ) PER: P 1 (1 B) S T ' T (1 P) T ( 1 B)S kbps 1 hop Throughput: DM mode: (ARQ+FEC) PER: P 1 (1 B) 15B(1 B) 14 S / 15 15 1 hop Throughput: T ' T (1 B)15 15B(1 B)14 S / 15 kbps P: Packet Error Rate, B: Bit Error Rate, S: Packet Size, T: Max Throughput 28 PER vs BER 29 Bluetooth Throughput Mode BER range DH5 <0.0001529 DM5 >0.0001529, and <0.0060795 DM3 >0.0060695, and <0.0157813 DM1 >0.0157813 30 Proposed Approach Adaptive Packet Type (APT): In BT specs, the function call, Get_Link_Quality, returns the Quality of the specified Link. We read the returned link Quality Value, and adapt packet type so as to optimize throughput. 31 Simulation 1: Fixed BER Time: 600 seconds TCP Packet Size: 500 bytes Buffer Size: 9000 bytes 32 Simulation 2: Varying BER Time: 600 seconds TCP Packet Size: 500 bytes Buffer Size: 9000 bytes BER: changes between 0.0001 and 0.0005 every 1 second 33 Conclusions In Bluetooth, TCP throughput collapses with BER above 0.03% (eg, BER caused by near 802.11 interference) APT (Adaptive Packet Type) approach can restore TCP throughput to acceptable values for much higher BER (we tested up to .3%) APT technique can be applied to any wireless link with packet length and FEC options, and with link quality (ie BER) feedback. 34 Audio Streaming over Bluetooth: An Adaptive ARQ Timeout Approach Ling-Jyh Chen, Rohit Kapoor, Kevin Lee, M. Y. Sanadidi, Mario Gerla Department of Computer Science, University of California at Los Angeles Introduction Wireless PAN is becoming popular nowadays. Digital media, such as audio/video streaming, is becoming more desired than before. The varying nature of the wireless link makes audio streaming over wireless become a challenging problem. A well-designed solution should minimize the packet loss rate and delay of perceived streaming data. 36 Retransmission - ARQ Stop-and-wait ARQ: retransmit a packet until either the acknowledgement of a successful reception is received or the retransmission timeout is exceeded. Decrease delay Low Increase reliability Retransmission timeout More packets will be dropped, and the streaming quality will become poor High Enlarge the delay, and degrade the streaming quality 37 Proposed Approach Adaptive ARQ Timeout in Bluetooth Problem: The deployed stop and wait ARQ is harmful to real-time streaming audio over Bluetooth, especially in the error prone environment. Aim: to reduce the audio packet delay and loss rate Ideas: If we spent too much time on sending packet n, then we should decrease RTO on packet n+1 If we save some time on sending packet n, then we should increase RTO on packet n+1 If we drop at least two of the last 5 packets, then we should reset RTO 38 RTO Update Equation Initialization Update SRTT RTT RTO 80 Max((MaxBufferSize UsedBufferSize) 75%,2) SRTT' (1 ) SRTT RTT RTO ; if RT T SRT T RTO' RTO; if RT T SRT T RTO; if packetdropped min RTO 80 ( MaxBufferSize UsedBufferSize) 75% 0.25 ; 1.1 ; 0.9 Reset RTO 80 Max((MaxBufferSize UsedBufferSize) 75%,2) 39 Implementation Audio Client RTP Packet Average Delay RTP Packet Loss Rate BlueZ Audio Server 128kbps MP3 80 ms/RTP packet BNEP BNEP L2CAP L2CAP HCI HCI RTP Packet Buffer Flush Timeout Packets Bluetooth Device Baseband Baseband RTP Packet RTT DH5 packet Link Quality 40 Experiments 41 1400 RTT RTO drop 1200 1000 800 600 400 200 0 400 450 500 550 600 RTP seqno 42 100 90 80 70 60 50 40 30 Adapt pkt Fixed 160 pkt 20 Fixed 400 pkt Fixed 1200 pkt 10 0 0.0005 0.001 0.0015 0.002 0.0025 0.003 0.0035 0.004 0.0045 Bit Error Rate 43 400 Adapt delay Fixed 160 delay Fixed 400 delay 350 Fixed 1200 delay 300 250 200 150 100 0 0.0005 0.001 0.0015 0.002 0.0025 0.003 0.0035 0.004 0.0045 Bit Error Rate 44 Conclusion Such cross-layer optimization can significantly improve application performance in PAN. Our proposed approach is simple and applicable to other wireless technologies. 45 Summary In today’s lecture, we have studied Error detection schemes Three basic ARQ schemes Two adaptive schemes by combining ARQ and FEC What’s next? We will discuss “delay model” in the next three weeks. 46