taming the mobile beast
play

Taming the Mobile Beast Patrick Meenan Matt Welsh @patmeenan - PowerPoint PPT Presentation

Taming the Mobile Beast Patrick Meenan Matt Welsh @patmeenan @mdwelsh http://www.flickr.com/photos/nao-cha/2660459899/ Google, Inc. Google, Inc. Mobile is huge! 2.25B Global Internet Users 1.1B Mobile Users Source: UN/ITU


  1. Taming the Mobile Beast Patrick Meenan Matt Welsh @patmeenan @mdwelsh http://www.flickr.com/photos/nao-cha/2660459899/ Google, Inc. Google, Inc.

  2. Mobile is huge! 2.25B Global Internet Users 1.1B Mobile Users Source: UN/ITU internetworldstats.com

  3. For many, a mobile device is the only way to access the Internet Mobile-Only Internet Users Country Egypt 70% India 59% South Africa 57% Indonesia 44% United States 25% Source: OnDevice Research http://www.flickr.com/photos/43560604@N03/6845754798/

  4. ... and growing with respect to desktop

  5. Desktop Web Performance Optimization

  6. Mobile Web Performance Optimization

  7. What we'll cover today: Getting a handle on mobile web performance How to collect measurements on mobile devices Deep dive into mobile web performance issues and common gotchas Using Chrome for Android's remote debugger Mobile bookmarklets and other tools

  8. Measurement Tools

  9. Mobitest - www.blaze.io/mobile/

  10. WebPageTest - www.webpagetest.org Web Page Test now supports Android and iOS!

  11. Waterfall Basics

  12. Waterfall Components

  13. Waterfalls as seen by HARViewer DNS TCP Waiting Receiving Lookup Connect for response response

  14. Studying Mobile Waterfalls

  15. Visualizing a mobile website load (brown.edu) 75 seconds !

  16. brown.edu's mobile home page 124 KB, 1800x800 background image that is completely obscured

  17. The web was not designed for mobile Huge disparity between modern web design and mobile devices... ● Increasingly rich content ● Highly dynamic pages ● Large amount of JavaScript to manipulate the page, perform asynchronous work, fetch new content ● 3D acceleration, animations, complex graphics ... all sent using a crufty, somewhat broken protocol (HTTP) The web is not just <b>plain</b> <i> old </i> <blink>HTML</blink> anymore - it is a complete application platform.

  18. Here Be Dragons ● Making a mobile connection: Radio Resource Control ● Browser connection limits ● HTTP Pipelining ● Caching: Browsers vs. embedded HTTP libraries ● Carrier network proxying ● JavaScript execution time differences

  19. Making a Mobile Connection

  20. Typical Mobile Network Performance Country Average RTT Average Downlink Average Uplink Throughput Throughput South Korea 278 ms 1.8 Mbps 723 Kbps Vietnam 305 ms 1.9 Mbps 543 Kbps US 344 ms 1.6 Mbps 658 Kbps UK 372 ms 1.4 Mbps 782 Kbps Russia 518 ms 1.1 Mbps 439 Kbps India 654 ms 1.2 Mbps 633 Kbps Nigeria 892 ms 541 Kbps 298 Kbps Compare to typical desktop and WiFi performance: < 50 ms RTT, 5 Mbps throughput in the US Source: Ookla/Speedtest.net

  21. Typical Mobile Network Performance Country Average RTT Average Downlink Average Uplink Throughput Throughput South Korea 278 ms 1.8 Mbps 723 Kbps Vietnam 305 ms 1.9 Mbps 543 Kbps US 344 ms 1.6 Mbps 658 Kbps UK 372 ms 1.4 Mbps 782 Kbps Russia 518 ms 1.1 Mbps 439 Kbps India 654 ms 1.2 Mbps 633 Kbps Nigeria 892 ms 541 Kbps 298 Kbps Things are changing fast! LTE promises < 100 ms RTT, 50+ Mbps downlink Source: Ookla/Speedtest.net

  22. Bandwidth Impact 3G LTE 20 Top sites measured in October, 2011

  23. Latency Impact 3G LTE DSL/ Dial 20 Top sites measured in October, 2011 Cable

  24. Making a Radio Connection Before a cellular device can transmit or receive data, it has to establish a radio channel with the network. This can take several seconds! Also, if no data is transmitted or received after a timeout , the channel goes idle , requiring a new channel to be established. This behavior can wreak havoc on web page load times.

  25. Probing the Radio State Machine Try this sometime: Build a webpage that loads a small (1KB) image at increasing intervals. Watch how long it takes to load.

  26. Probing the Radio State Machine Try this sometime: Build a webpage that loads a small (1KB) image at increasing intervals. Watch how long it takes to load. Here's what it looks like on WiFi: Every image loads in ~120 ms

  27. The same thing on T-Mobile: 1 sec delay 2 sec delay 3 sec delay 4 sec delay 5 sec delay

  28. The same thing on T-Mobile: Between 2 and 3 sec, huge increase in load time

  29. Example 3G Radio Resource Control State Machine No radio Idle for 12 sec connection CELL_ IDLE FACH Buffer size > Shared threshold radio channel Transmit data Delay: 1-2 sec Idle for 5 sec CELL_ DCH The exact delays and idle timeouts depend on the carrier, which equipment they have installed, and how it is configured. Dedicated radio channel This depends on the network , not the device. Run your own test now! http://goo.gl/F5sKV Data from: http://www.eecs.umich.edu/~fengqian/paper/aro_mobisys11.pdf

  30. Browser Connection Limits

  31. Browser Connection Limits The number of parallel connections varies tremendously across mobile browsers. brown.edu on Android 2.3.5 Gingerbread: Total of 4 parallel connections

  32. Browser Connection Limits The number of parallel connections varies tremendously across mobile browsers. brown.edu on Android 4.0.4 Ice Cream Sandwich: Looks like 6 connections per domain

  33. Browser Connection Limits The number of parallel connections varies tremendously across mobile browsers. brown.edu on iOS 5: Looks like a lot of parallelism

  34. Browser Connection Limits The number of parallel connections varies tremendously across mobile browsers. brown.edu on Chrome for Android: Also 6 connections per domain

  35. Browser Connection Limits - Summary Browser Connections Per Domain Total Connections Android pre-Honeycomb 4 4 Android post-Honeycomb 6 256 iOS 4 4 30 iOS 5 6 52 Chrome for Android 6 256 Caveats: It takes a lot of experimentation and probing to get some of these numbers. iOS results, in particular, should be taken with a grain of salt.

  36. Are more connections always better? Parallel TCP connections are typically used for two purposes: 1) Saturate the network 2) Avoid head-of-line blocking On 3G, more connections are not always a good idea : - Each connection pays the cost of the TCP handshake (200+ ms on typical 3G links) - Parallel connections can adversely compete for the channel

  37. HTTP Pipelining

  38. HTTP Pipelining Been in the spec since HTTP/1.1, but largely ignored by desktop browser vendors Originally thought it would break the Internet Android 2.3.4 (Gingerbread) Android Browser has been using pipelining for a long time! Several requests with identical start times, Mobile Safari on iOS 5 is using it now, too. staggered completion times Android ICS and Chrome do not use pipelining, however.

  39. Carrier Network Proxies

  40. Carrier network proxies Most large carriers do transparent web proxying Simple page with a 1MB JavaScript file, loaded over WiFi: 976KB, as expected

  41. Carrier network proxies Most large carriers do transparent web proxying Simple page with a 1MB JavaScript file, loaded over WiFi: 976KB, as expected The same page, loaded on T-Mobile UMTS: 7.6KB !?!?!?!! T-Mobile's proxy uses gzip!

  42. JavaScript Execution Time

  43. JavaScript Execution Time JavaScript is typically a lot slower on mobile devices. SunSpider benchmark results: Dual Core Mac Pro: 266.1 ms Galaxy Nexus (stock browser): 1899 ms Galaxy Nexus (Chrome): 1574 ms iPhone 3GS (iOS 5): 4737 ms iPhone 4S (iOS 5): 2200 ms iPad 2 (iOS 5): 2097 ms

  44. Browser Caching Behavior

  45. Not all caches are created equal Mobile browsers have small caches: Android 2.3: 8 MB iOS 5: 100 MB, but not persistent! Android Chrome: 250 MB Compare to typical size of 512 MB or more for desktop browsers.

  46. Browsers != Embedded HTTP Libraries Common embedded HTTP libraries often have broken cache behavior! java.net.URLConnection java.net.HttpURLConnection org.apache.http.client.HttpClient None of these do any caching at all. android.webkit.WebView Does caching, but does not support redirection. NSURLRequest - iOS5 Does caching, but total cache size is 1 MB for small objects, 40 MB for large objects, no caching for objects > 2MB. Web Caching on Smartphones: Ideal vs. Reality by Feng Qian, Kee Shen Quah, Junxian Huang, Jeffrey Erman, Alexandre Gerber, Z. Morley Mao, Subhabrata Sen, and Oliver Spatscheck, Proceedings of ACM Mobisys 2012.

  47. Summary Mobile networks have high round-trip-times: hundreds of ms. Mobile connections can take several seconds to get established. HTTP pipelining: Coming to iOS, going away in Android. Beware carrier network proxies. JavaScript: Ain't so fast. Not all mobile caches are created equal.

  48. Roadmap Getting a handle on mobile web performance How to collect measurements on mobile devices Deep dive into mobile web performance issues and common gotchas Using Chrome for Android's remote debugger Mobile bookmarklets and other tools

  49. Remote Debugging Chrome on Android

  50. Remote Debugging Chrome on Android Chrome on Android has full support for Chrome Developer Tools Desktop Chrome USB tethering

  51. Getting Started 1) Fire up Chrome on your device 2) Settings > Developer Tools > Enable USB Web debugging

Recommend


More recommend