CStream: Neighborhood Bandwidth Aggregation For Better Video Streaming Thangam Vedagiri Seenivasan Advisor: Mark Claypool Reader: Robert Kinicki M.S. Thesis Presentation 1 Motivation • Increasing popularity of video streaming[Cisco survey 09’] Video traffic Video traffic 25% 2009 [Internet traffic] Other traffic Other traffic 75% • High definition videos 50% 50% 2012 [Internet traffic] Encoding rate: 8 Mbps to 20 Mbps • Clients still have limited Internet bandwidth Dialup, DSL 3G 128 Kbps to 3 Mbps 384 Kbps to 2 Mbps Video streaming still a challenge 2 Motivation High density of Internet connections even in this room!! Idle users = spare bandwidth Potential unused bandwidth most of the time 3 Motivation • Devices have multiple network interfaces Can form ad-hoc networks Device can connect to nearby nodes at the same time it is connected to Internet 4 CStream – Collaborative Streaming Aggregates bandwidth from multiple clients in a neighborhood for video streaming Frame 2 Internet CStream Video Server Frame 3 Frame 1 CStream Video Player 5 Related Work • Download Accelerators [Rodriguez et al. 00’] – Multiple connections to mirrored servers • Multi-homing [Chebrolu et al. 06’] – Multi-homed devices, with multiple interfaces – Aggregate bandwidth from multiple interfaces • COMBINE [Ananthanarayanan et al. 07’] – Aggregate bandwidth in phones for HTTP download of large files • Link Alike [Jakubczak et al. 08’] – Improve client upload capacity for file transfer 6 Outline • • • • • • • Motivation Challenges Design Implementation Evaluation Future Work Conclusion 7 Challenges • Neighbor discovery and maintenance – Find and connect to neighbors – Updated knowledge of neighbor status • Multi-path streaming – Stream through multiple nodes – Frame distribution across links – Effectively utilize available bandwidth 8 Challenges • Handle dynamically changing neighborhood – Adapt to neighbors joining and leaving – Use the bandwidth of new neighbors joining – Tolerant to neighbors leaving abruptly • Buffering and Playing – Buffering mechanism – Discard late frames (I-policy) or Wait for late frames (E-policy) 9 Outline • • • • • • • Motivation Challenges Design Implementation Evaluation Future Work Conclusion 10 Design Video Server Video Database Plan Handler Video query Request Plan Plan Video Frame Distributor Frames Frames Neighbor Meta data Video Player Buffer Manager Proxy Video Plan Manager Frames Helper Manager Update Frames Neighbor Manager I-CAN-HELP Client Wireless ad-hoc network 11 Client • Neighbor manager Video Player Buffer Manager Video Plan Manager Frames Update Neighbor Manager – Keeps updated knowledge of active neighbors – Informs the Video Plan Manager about change in neighborhood – Receives frames from the neighbor and forwards to the Buffer Manager • Video Plan Manager – Informs the server about the active neighbors (IP Address, Port to stream) - streaming plan – Dynamically updates streaming plan based on input from Neighbor Manager 12 Client • Buffer Manager Video Player Buffer Manager Video Plan Manager Frames Update Neighbor Manager – Receives frames from the server – Receives frames from the neighbor through the Neighbor Manager – Maintains playout buffer • Video Player – Extracts frames from the Buffer Manager and plays it – Implements E-policy (wait for late frames) 13 Design Video Server Video Database Plan Handler Video query Video Player Plan Plan Buffer Manager Video Frame Distributor Frames Frames Proxy Video Plan Manager Frames Neighbor Helper Manager Update Frames Neighbor Manager I-CAN-HELP Client Wireless ad-hoc network 14 Neighbor Proxy Helper Manager • Proxy – Receives frames from the server – Sends to the client • Helper Manager – Sends periodic I-CAN-HELP messages that it is willing to collaborate – Stops when there is user and network activity 15 Design Video Server Video Database Plan Handler Video query Video Player Plan Plan Buffer Manager Video Frame Distributor Frames Frames Proxy Video Plan Manager Frames Neighbor Helper Manager Update Frames Neighbor Manager I-CAN-HELP Client Wireless ad-hoc network 16 Video Database Video Server • Frame Distributor Plan Handler Plan Video Frame Distributor – Runs a frame assignment module – Sends assigned frames to client and neighbors – Assignment adapts to the bandwidth of each client • Plan Handler – Receives dynamic plan about active neighbors from the client – Updates the Frame Distributor to adapt streaming to the changing neighborhood 17 Outline • • • • • • • Motivation Challenges Design Implementation Evaluation Future Work Conclusion 18 Implementation • Neighbor Management • Frame Distribution • Adapting to changing neighborhood – Neighbor joining – Neighbor leaving • Buffering and Playing 19 Neighbor Management Video Server Frames I-CAN-HELP Frames Plan Frames I-CAN-HELP REQUEST SSID: CStream Ad-hoc network Ad-hoc network Client 20 Frame Distribution Frames 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Neighbors N1 and N2 Thread - N1 Thread - C Thread - N2 1 6 2 5 4 3 TCP 1 1 6 2 4 5 1 3 2 4 5 21 Neighbor Joining 22 Neighbor Joining Frames 7 8 9 10 11 12 13 14 New neighbor N3 Thread - N1 Thread - C Thread - N2 Thread – N3 7 TCP 1 6 2 4 5 1 3 7 2 4 5 23 Neighbor Leaving 24 Neighbor Leaving Frames 6 8 9 10 11 12 13 14 Neighbor N1 left Last Frame Received - 1 Thread - N1 Thread - C Thread - N2 Thread – N3 CStream is fault-tolerant 6 TCP 6 5 6 1 3 7 2 4 5 25 Buffering Policy (E-policy) • Initial Buffering before first frame played – Playout buffer: n seconds (2 sec in our implementation) – Wait till (n * encodedFrameRate) frames buffered • Stop and Rebuffering – frame to be played, not arrived • Resume video after rebuffering – 2 seconds of frames from the current frame to be played received 26 Outline • • • • • • • Motivation Challenges Design Implementation Evaluation Future Work Conclusion 27 CStream • Built the complete system – Video Server, Neighbor, Client Video Player • C# .NET – 3000 lines of code • AVI Video Library [C. John, CodeProject] – Extract frame by frame from avi files 28 Experimental Setup SERVER Netem, CBQ WPI LAN BRIDGE Ethernet Ad-hoc network NEIGHBOR Ad-hoc network CLIENT NEIGHBOR29 Experiment Parameters • Bandwidth from the video server – Class based queuing discipline, Netem – 250 Kbps, 500 Kbps, 1 Mbps, 2 Mbps, 3 Mbps, 5 Mbps – Equal bandwidth, Unequal bandwidth for nodes • Number of neighbor nodes – 0, 1, 2 • Location of neighbor nodes – Signal Strength: Excellent, Good, Weak • Video Content – Short Video – Long Video 30 Video Content Short Video cartoon_dog.avi Long Video foreman.avi Length 8 seconds 33 seconds Size 10 MB 26 MB Encoded bitrate 10Mbps 6.3Mbps Frames per second 15 12 Average Frame Size 85 KB 68 KB Total Frames 120 400 Resolution 320×240 176×144 31 Performance Metrics • Aggregate Throughput (Kbps) – Application throughput at the client node • Playout Time – Total time to play the entire video • Startup Delay – Time taken to play the first frame • Rebuffer Events – Number of stop and buffer events • Frame Distribution – Contribution of each node vs. ratio of bandwidth 32 Throughput (Short Video) 11047 11000 10000 Per Host Capacity Constraint 9000 7396 Throughput (Kbps) 8000 7096 7000 Almost 2x improvement with 1 neighbor 5411 Almost 3x improvement with 2 neighbors 5047 5000 6000 3754 3472 3000 2806 2576 1767 1000 938 477 239 0 0 500 Kbps 1 Mbps 2 Mbps 4000 2000 250 Kbps 1854 3 Mbps 5 Mbps 1430 962 486 1 Number of Neighbors Client and Neighbors have same bandwidth Neighbors had excellent signal strength to the client 734 2 33 Throughput (Long Video) 10925 Throughput (Kbps) 10000 8000 7437 7624 Per Host Capacity Constraint 250 Kbps 6000 5338 1 Mbps 5045 3902 4000 2 Mbps 3558 2778 2611 2000 1777 932 476 0 500 Kbps 3 Mbps 5 Mbps 1854 1434 955 483 726 238 0 1 Number of Neighbors Client and Neighbors have same bandwidth Neighbors had excellent signal strength to the client 2 34 Playout Time 900 898.88 800 Playout time (s) 700 600 250 Kbps 500 448.28 500 Kbps 442.59 1 Mbps 400 294.7 300 230.2 3 Mbps 224.75 5 Mbps 200 150.08 121.36 100 2 Mbps 83.44 56.04 0 0 116.6 61.13 43.44 35.32 1 Number of Neighbors 77.42 40.56 34.85 35.57 2 35 Startup Delay 52.97 50 Startup Delay (s) 40 250 Kbps 30 500 Kbps 26.4 26.69 1 Mbps 20 13.94 10 3 Mbps 13.68 5 Mbps 9.57 7.58 6.33 0 2 Mbps 17.9 3.65 0 7.32 4 2.94 2.12 1 Number of Neighbors 5.12 2.95 2.37 1.65 2 36 Rebuffer Events Maximum Rebuffer Events - 15 Neighbors Bandwidth 0 1 2 250 Kbps 15 14.3 14 500 Kbps 15 13 12 1 Mbps 13 11 9 2 Mbps 11 6.6 2 3 Mbps 9 2.6 0 5 Mbps 6 0 0 Need three 3 Mbps links or two 5Mbps links to stream without rebuffering 37 Frame Distribution Expected Actual Expected Actual Client – 2 Mbps Neighbor– 2 Mbps Client– 2 Mbps Neighbor– 1 Mbps Expected Actual Client– 2 Mbps Neighbor1 – 2 Mbps Neighbor2– 2 Mbps Expected Actual Client – 3 Mbps Neighbor1– 2 Mbps Neighbor2 – 1 Mbps 38 Short Video – 0 Neighbors Experiment Client – 2 Mbps 39 Short Video – 1 Neighbor Experiment Client – 2 Mbps Neighbor1 – 2 Mbps 40 Short Video – 2 Neighbors Experiment Client – 2 Mbps Neighbor1 – 2 Mbps Neighbor2 – 2Mbps 41 Neighbors Joining 7000 5747 kbps Throughput (last 20 frames) Kbps 6000 5000 1st Neighbor joined 4000 3576 kbps 3000 1787 kbps 2000 2nd Neighbor joined 1000 0 0 10 20 30 40 50 60 70 80 Time (s) Experiment: Long Video, Client – 2 Mbps, Neighbor1 – 2 Mbps, Neighbor2 – 2 Mbps 42 Neighbor Leaving Throughput (last 20 frames) Kbps 7000 1st Neighbor left 5653 kbps 6000 2nd Neighbor left 5000 3773 kbps 4000 3000 1781kbps 2000 1000 0 0 10 20 30 40 Time (s) 50 60 70 Experiment: Long Video, Client – 2 Mbps, Neighbor1 – 2 Mbps, Neighbor2 – 2 Mbps 43 Neighbor Joining and Leaving Experiment Client – 3 Mbps Neighbor1 – 3 Mbps 44 Impact of Wireless Aggregate Throughput (Kbps) 3500 Experiment Client – 2 Mbps Neighbor1 – 2 Mbps 3509 3000 2395 2500 1977 2000 1500 1000 500 0 Excellent Iperf – 13 Mbps Good Iperf – 980 Kbps Poor Iperf – 520 Kbps Wireless Signal Strength Bandwidth contributed = Min (Internet Bandwidth, Wireless Bandwidth) by Neighbor 45 Future Work • Better frame distribution algorithm – Solve out of order frame reception • • • • Other video types (MPEG) Include audio stream Extend CStream to support video scaling CStream system for smart phones – Aggregate the 3G internet bandwidth 46 Conclusion • Designed and built CStream – Aggregate bandwidth from neighbors for better video streaming • Effectively utilizes available bandwidth • Dynamically handles changes in neighborhood • Detailed evaluation – Throughput, Playout Time, Startup Delay, Rebuffer Events, Frame Distribution 47 Thank You Questions? 48 Backup 49 Short Video 50 Throughput 7354 7000 7096 6000 Throughput (Kbps) 5150 5000 5411 Per Host Capacity Constraint 5047 250 Kbps 500 Kbps 4000 2739 1 Mbps 3472 3000 2806 2576 2000 1767 1000 938 477 239 0 0 2 Mbps 3 Mbps 1854 1430 5 Mbps 962 486 1 Number of Neighbors 734 2 51 Playout Time 350 300 Playout time (s) 250 250 Kbps 200 500 Kbps 1 Mbps 150 2 Mbps 3 Mbps 100 5 Mbps 50 0 0 1 Number of Neighbors 2 52 Startup Delay 80 Startup Delay (s) 70 60 250 Kbps 50 500 Kbps 40 1 Mbps 2 Mbps 30 3 Mbps 20 5 Mbps 10 0 0 1 Number of Neighbors 2 53 Rebuffer Events Neighbors Bandwidth 0 1 2 250 Kbps 3 3 3 500 Kbps 3 3 3 1 Mbps 3 3 2 2 Mbps 3 2 1 3 Mbps 2 1.3 1 5 Mbps 2 1 0 Maximum Rebuffer Events - 3 54 Frame Distribution Expected Actual Expected Actual Client – 2 Mbps Neighbor– 2 Mbps Client– 2 Mbps Neighbor– 1 Mbps Expected Actual Client– 2 Mbps Neighbor1 – 2 Mbps Neighbor2– 2 Mbps Expected Actual Client – 3 Mbps Neighbor1– 2 Mbps Neighbor2 – 1 Mbps 55