A Library and Proxy for SPDY Interdisciplinary Project Andrey Uzunov Chair for Network Architectures and Services Department of Informatics Technische Universität München April 3, 2013 Andrey Uzunov (TUM) A Library and Proxy for SPDY 1
Agenda What is SPDY? Current SPDY usage The library The proxy Setup for the Experiments Results Future Work Andrey Uzunov (TUM) A Library and Proxy for SPDY 2
Agenda What is SPDY? Current SPDY usage The library The proxy Setup for the Experiments Results Future Work Andrey Uzunov (TUM) A Library and Proxy for SPDY 3
What is SPDY? An experimental protocol for a faster web alternative to HTTP uses one persistent TCP connection per host: only one TCP handshake and slow start traffic reduction by compressing headers pushes data to the client even before being asked for it requests have priorities, so they may be answered in different order now (almost) always used over TLS actually used are SPDY/2 and SPDY/3 SPDY/3 is the base for HTTP/2.0 Andrey Uzunov (TUM) A Library and Proxy for SPDY 4
Agenda What is SPDY? Current SPDY usage The library The proxy Setup for the Experiments Results Future Work Andrey Uzunov (TUM) A Library and Proxy for SPDY 5
Current SPDY usage Google, Facebook, Twitter,... Apache mod spdy, nginx,... Chrome, Firefox, Opera,... several libraries e.g., spdylay (http://spdylay.sourceforge.net/) supports most of the features of SPDY/2 and SPDY/3 Andrey Uzunov (TUM) A Library and Proxy for SPDY 6
Agenda What is SPDY? Current SPDY usage The library The proxy Setup for the Experiments Results Future Work Andrey Uzunov (TUM) A Library and Proxy for SPDY 7
The library libmicrospdy similar API to libmicrohttpd only server functionality single-threaded two subsystems: framing layer application layer high-level the user does not care about the framing layer, TLS, I/O operations, etc. everything for receiving and answering GET requests is implemented Andrey Uzunov (TUM) A Library and Proxy for SPDY 8
Agenda What is SPDY? Current SPDY usage The library The proxy Setup for the Experiments Results Future Work Andrey Uzunov (TUM) A Library and Proxy for SPDY 9
The proxy Everything happens in a single event loop and callback functions. uses libmicrospdy to receive client SPDY requests small changes in headers (e.g., SPDY uses only lower case, special headers : ) sends HTTP requests to localhost via libcurl multi API receives HTTP responses small changes in headers (e.g., SPDY uses only lower case, special headers : ) sends back SPDY responses No caching, nothing more Andrey Uzunov (TUM) A Library and Proxy for SPDY 10
Agenda What is SPDY? Current SPDY usage The library The proxy Setup for the Experiments Results Future Work Andrey Uzunov (TUM) A Library and Proxy for SPDY 11
Setup for the Experiments Download a real world big web page with all its resources. 1 HTML file ( 385 KB) 3 CSS files (10 30 KB each) 1311 image files of different type (100 B 30 KB each) That all is 3560921 B Andrey Uzunov (TUM) A Library and Proxy for SPDY 12
Setup for the Experiments Setup Protocol Client Server Note http/1.0 HTTP/1.0 curl Apache2 Single request per TCP connection http/1.1 HTTP/1.1 curl Apache2 Multiple requests per TCP connection https/1.0 https/1.1 HTTP/1.0 + TLS HTTP/1.1 + TLS curl Apache2 + mod ssl curl Apache2 + mod ssl Single request per TCP connection Multiple requests per TCP connection Andrey Uzunov (TUM) A Library and Proxy for SPDY 13
Setup for the Experiments Setup Protocol Client Server Note spdy/ fileserver spdy/proxy SPDY/3 + TLS SPDY/3 + TLS spdycat from libspdylay spdycat from libspdylay Web server serving files from the file system (libmicrospdy) SPDYto-HTTP proxy (libmicrospdy and libcurl) All requests in a single TCP connection All requests in a single TCP connection at the SPDY side, multiple requests per TCP connection at the HTTP side; the HTTP requests are served by Apache2 on localhost Andrey Uzunov (TUM) A Library and Proxy for SPDY 14
Setup for the Experiments Figure : Setup for the experiments. Andrey Uzunov (TUM) A Library and Proxy for SPDY 15
Agenda What is SPDY? Current SPDY usage The library The proxy Setup for the Experiments Results Future Work Andrey Uzunov (TUM) A Library and Proxy for SPDY 16
Results First Set of Experiments Simulating browser connections to one host Most of the current versions of the popular browsers use at most 6 connections per host So, we compare 6 parallel HTTP connections vs. 1 SPDY Andrey Uzunov (TUM) A Library and Proxy for SPDY 17
Results Performance on downloading the page (s) 240 220 200 180 160 140 120 100 80 60 40 20 http/1.1 https/1.1 http/1.0 https/1.0 spdy/fileserver spdy/proxy-to-http1.1 0 0 50 100 150 200 250 300 350 400 RTT (ms) Figure : Download time for the entire webpage in relation to network latency, allowing 6 parallel TCP connections for all HTTP setups. Median value of 6 runs is used. Andrey Uzunov (TUM) A Library and Proxy for SPDY 18
Results Performance on downloading the page (s) 240 220 200 180 160 140 120 100 80 60 40 20 http/1.1 https/1.1 http/1.0 https/1.0 spdy/fileserver spdy/proxy-to-http1.1 0 0 50 100 150 200 250 300 350 400 RTT (ms) Figure : Download time for the entire webpage in relation to network latency, allowing 6 parallel TCP connections for all HTTP setups. Median value of 6 runs is used. RTT deviation is set to 20% of RTT and packet loss rate is 5%. Andrey Uzunov (TUM) A Library and Proxy for SPDY 19
Results Traffic on downloading the page (MB) 7.5 7 6.5 6 5.5 5 4.5 http/1.1 https/1.1 http/1.0 https/1.0 spdy/fileserver spdy/proxy-to-http1.1 4 3.5 0 50 100 150 200 250 300 350 400 RTT (ms) Figure : Network traffic on downloading the entire webpage in relation to network latency, allowing 6 parallel TCP connections for all HTTP setups. Median value of 6 runs is used. Andrey Uzunov (TUM) A Library and Proxy for SPDY 20
Results Traffic on downloading the page (number of packets) 35000 30000 25000 20000 15000 10000 5000 http/1.1 https/1.1 http/1.0 https/1.0 spdy/fileserver spdy/proxy-to-http1.1 0 0 50 100 150 200 250 300 350 400 RTT (ms) Figure : Network traffic (in packets) on downloading the entire webpage in relation to network latency, allowing 6 parallel TCP connections for all HTTP setups. Median value of 6 runs is used. Andrey Uzunov (TUM) A Library and Proxy for SPDY 21
Results Relative performance on downloading the page (%) 100 90 80 70 60 50 40 30 20 10 spdy/fileserver to http/1.1 spdy/proxy to http/1.1 spdy/fileserver to https/1.1 spdy/proxy to https/1.1 spdy/fileserver to http/1.0 spdy/proxy to http/1.0 spdy/fileserver to https/1.0 spdy/proxy to https/1.0 0 +/-0ms loss 0% +/-4ms loss 0% +/-4ms +/-4ms loss 0.5% loss 1% +/-4ms +/-4ms loss 1.5% loss 2% +/-4ms +/-4ms loss 2.5% loss 3% +/-4ms +/-4ms loss 3.5% loss 4% +/-4ms +/-4ms loss 4.5% loss 5% Figure : Download time for the entire webpage needed by SPDY setups in relation to the time needed by HTTP setups for RTT 20ms and different packet loss rates, allowing 6 parallel TCP connections for the latter. Median value of 6 runs is used. Andrey Uzunov (TUM) A Library and Proxy for SPDY 22
Results Relative performance on downloading the page (%) 100 90 80 70 60 50 40 30 20 10 spdy/fileserver to http/1.1 spdy/proxy to http/1.1 spdy/fileserver to https/1.1 spdy/proxy to https/1.1 spdy/fileserver to http/1.0 spdy/proxy to http/1.0 spdy/fileserver to https/1.0 spdy/proxy to https/1.0 0 +/-0ms loss 0% +/-80ms loss 0% loss +/-80ms 0.5% +/-80ms loss 1% loss +/-80ms 1.5% +/-80ms loss 2% loss +/-80ms 2.5% +/-80ms loss 3% loss +/-80ms 3.5% +/-80ms loss 4% loss +/-80ms 4.5% +/-80ms loss 5% Figure : Download time for the entire webpage needed by SPDY setups in relation to the time needed by HTTP setups for RTT 400ms and different packet loss rates, allowing 6 parallel TCP connections for the latter. Median value of 6 runs is used. Andrey Uzunov (TUM) A Library and Proxy for SPDY 23
Results 100 95 spdy/fileserver to http/1.1 spdy/proxy to http/1.1 spdy/fileserver to https/1.1 spdy/proxy to https/1.1 spdy/fileserver to http/1.0 spdy/proxy to http/1.0 spdy/fileserver to https/1.0 spdy/proxy to https/1.0 Relative traffic on downloading the page (%) 90 85 80 75 70 65 60 55 50 +/-0ms loss 0% +/-4ms loss 0% +/-4ms +/-4ms loss 0.5% loss 1% +/-4ms +/-4ms loss 1.5% loss 2% +/-4ms +/-4ms loss 2.5% loss 3% +/-4ms +/-4ms loss 3.5% loss 4% +/-4ms +/-4ms loss 4.5% loss 5% Figure : Network traffic on downloading the entire webpage for SPDY setups in relation to the traffic for HTTP setups for RTT 20ms and different packet loss rates, allowing 6 parallel TCP connections for HTTP. Median value of 6 runs is used. Andrey Uzunov (TUM) A Library and Proxy for SPDY 24
Results Second Set of Experiments Simulating browser connections to more hosts Real world web pages have resources from different hosts So, we compare different number of parallel HTTP connections vs. 1 SPDY Andrey Uzunov (TUM) A Library and Proxy for SPDY 25
Results Performance on downloading the page (s) 200 180 160 140 120 100 80 60 40 http/1.1 https/1.1 http/1.0 https/1.0 spdy/fileserver spdy/proxy-to-http1.1 20 0 0 5 10 15 20 25 30 35 40 45 50 Number of parallel TCP connections for HTTP setups Figure : Download time for the entire webpage in relation to the number of parallel TCP connections for HTTP setups averaged over 2 runs for RTT 20ms. The values for SPDY setups are median values of 6 runs. (Overview.) Andrey Uzunov (TUM) A Library and Proxy for SPDY 26
Results Performance on downloading the page (s) 20 18 16 14 12 10 8 6 4 http/1.1 https/1.1 http/1.0 https/1.0 spdy/fileserver spdy/proxy-to-http1.1 2 0 0 5 10 15 20 25 30 35 40 45 50 Number of parallel TCP connections for HTTP setups Figure : Download time for the entire webpage in relation to the number of parallel TCP connections for HTTP setups averaged over 2 runs for RTT 20ms. The values for SPDY setups are median values of 6 runs. Andrey Uzunov (TUM) A Library and Proxy for SPDY 27
Results Performance on downloading the page (s) 20 18 16 14 12 10 8 6 4 http/1.1 https/1.1 http/1.0 https/1.0 spdy/fileserver spdy/proxy-to-http1.1 2 0 0 5 10 15 20 25 30 35 40 45 50 Number of parallel TCP connections for HTTP setups Figure : Download time for the entire webpage in relation to the number of parallel TCP connections for HTTP setups averaged over 2 runs for RTT 100ms. The values for SPDY setups are median values of 6 runs. Andrey Uzunov (TUM) A Library and Proxy for SPDY 28
Agenda What is SPDY? Current SPDY usage The library The proxy Setup for the Experiments Results Future Work Andrey Uzunov (TUM) A Library and Proxy for SPDY 29
Future Work Features to be implemented in libmicrospdy SPDY PING SPDY WINDOW UPDATE SPDY Settings SPDY PUSH SPDY HEADERS HTTP POST over SPDY and receiving DATA frames HTTP PUT over SPDY SPDY Credentials Andrey Uzunov (TUM) A Library and Proxy for SPDY 30
Thank you Andrey Uzunov (TUM) A Library and Proxy for SPDY 31
Additional slides Andrey Uzunov (TUM) A Library and Proxy for SPDY 32
The library in the event loop: SPDY get timeout(...); SPDY get fdset (...); select(...); SPDY run(...); user callbacks e.g., callback for received request SPDY build response(...); SPDY queue response(...); Andrey Uzunov (TUM) A Library and Proxy for SPDY 33
Setup for the Experiments Some notes on what is measured: SPDY header compression enabled only in responses No PUSH No TLS compression for any of the setups spdy/fileserver issues three headers fewer compared to all others Andrey Uzunov (TUM) A Library and Proxy for SPDY 34
Results Traffic on downloading the page (MB) 7.5 7 6.5 6 5.5 5 4.5 http/1.1 https/1.1 http/1.0 https/1.0 spdy/fileserver spdy/proxy-to-http1.1 4 3.5 0 50 100 150 200 250 300 350 400 RTT (ms) Figure : Network traffic on downloading the entire webpage in relation to network latency, allowing 6 parallel TCP connections for all HTTP setups. Median value of 6 runs is used. RTT deviation is set to 20% of RTT and packet loss rate is 5%. Andrey Uzunov (TUM) A Library and Proxy for SPDY 35
Results Traffic on downloading the page (number of packets) 35000 30000 25000 20000 15000 10000 5000 http/1.1 https/1.1 http/1.0 https/1.0 spdy/fileserver spdy/proxy-to-http1.1 0 0 50 100 150 200 250 300 350 400 RTT (ms) Figure : Network traffic (in packets) on downloading the entire webpage in relation to network latency, allowing 6 parallel TCP connections for all HTTP setups. Median value of 6 runs is used. RTT deviation is set to 20% of RTT and packet loss rate is 5%. Andrey Uzunov (TUM) A Library and Proxy for SPDY 36