Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DroidCon Montreal 2015: Facebook for Android in Emerging Markets: an Overview of Recent Work and Open Source Projects

DroidCon Montreal 2015: Facebook for Android in Emerging Markets: an Overview of Recent Work and Open Source Projects

An overview for Facebook's recent work for emerging markets. It includes a discussion of our recently open-sourced projects: Device Year Class, Network Connection Class, Augmented Traffic Control and Fresco. This deck was presented at DroidCon Montreal 2015.

Alex Sourov

April 10, 2015
Tweet

More Decks by Alex Sourov

Other Decks in Programming

Transcript

  1. Alex Sourov Engineering Manager, Android Emerging Markets Team, Facebook Alex

    Petrescu Software Engineering Lead, Android Newsfeed Team, Facebook Facebook for Android: Developing for Low-End Networks
  2. • Deep dive on a couple of efforts: Device Class

    and Augmented Traffic Control • An Overview Of Our Recent “2G Field Trip” to India • Network Connection Class and Android Image Pipeline (Fresco) Overview
  3. • Device Year Class: 
 https://github.com/facebook/device-year-class • Augmented Traffic Control:

    
 https://github.com/facebook/augmented-traffic-control • Network Connection Class: 
 https://github.com/facebook/network-connection-class • Fresco (the New Image Pipeline): 
 https://github.com/facebook/fresco New Open Source Projects
  4. Year Class
 Segmentation Breaking the Past Work Up Performance Improvement

    Data Use Optimizations ATC for 
 Network Modeling Smarter Prefetching
  5. Year Class Example Moto  E Galaxy  S2 Released 2014 2011

    CPU  cores 2 2 Clock  speed 1.2  GHz 1.2  GHz RAM 1GB 1GB
  6. Year Class Example Moto  E Galaxy  S2 Released 2014 2011

    CPU  cores 2 2 Clock  speed 1.2  GHz 1.2  GHz RAM 1GB 1GB YC2011 YC2011
  7. Relative Crashiness by Year Class %  weekly  users  who  experience

     a  crash 2013 2012 2011 2010 2009 3.1x 2.2x 1.4x 1x 1x 1x 1x
  8. How does Year Class work? CPU Cores 4 or more

    2012 2 or 3 2011 1 2008 RAM > 2GB 2014 <= 2GB 2013 <= 1.5GB 2012 <= 1GB 2011 <= 512MB 2010 <= 290MB 2009 <= 192MB 2008 Maximum Clock Speed > 2GHz 2014 <= 2GHz 2013 <= 1.5GHz 2012 <= 1.2GHz 2011 <= 1GHz 2010 <= 600MHz 2009 <= 528MHz 2008
  9. • atcd: the ATC daemon responsible for setting/ unsetting traffic

    shaping. • Django apps to provide an interface to atcd, simple Web UI to control atc from mobile and save shaping profile settings ATC Components
  10. Why Do We Send Engineers to the Field? Prototype &

    Validate Ground
 Truth Model
 Networks
  11. Goals of the Trip Understand the device landscape. Explore network

    connections in a major urban area in India. Prototype tools and potential improvements.
  12. What We Did Set up mobile labs. Use apps in

    real network conditions. Do more field testing and experimentation. Collect and analyze network traces from our phones.
  13. Our modeling tools need to improve to model this intermittency.

    What We’ve Learned 2G connectivity in major urban India is highly intermittent. Latencies 
 are very 
 high.
  14. Measurement GET facebook_news_feed HTTP/1.1 200 OK content-type: image/jpeg content-length: 46470

    X-FB-Connection-Quality: rtt=470 Starting Transfer 10 kb received @ 321 kbps 10 kb received @ 353 kbps 10 kb received @ 293 kbps 5.3 kb received @ 312 kbps Transfer Complete
  15. Bandwidth Averaging Bandwidth (kbps) 0 1000 2000 3000 4000 5000

    Time Estimated Actual EXCELLENT GOOD MOD.
  16. Technology Doesn’t Imply Speed 0 1500 3000 4500 6000 WiFi

    LTE HSPA EDGE USA Brazil India Japan Britain
  17. 0 55 110 165 220 EDGE USA Brazil India Japan

    Britain 3.5X Technology Doesn’t Imply Speed
  18. Covering the Spread 6,128 Singapore LTE 5,816 Taiwan LTE 5,793

    Netherlands LTE 114 Pakistan EDGE 120 Bangladesh EDGE 132 Myanmar EDGE
  19. Stories Read Per Minute 4 5 6 7 8 9

    Bandwidth 25 350 900 1450 2000 2600 3700 4800 5900 7000 Network Connectivity Affects Consumption
  20. Connection Class A real-time measure of how fast a network

    currently is, regardless of technology Poor <150kbps Moderate 150–550kbps Good 550–2000kbps Excellent >2000kbps
  21. 0% 25% 50% 75% 100% India Mexico Poor Moderate Good

    Excellent Connection Class in Action
  22. 5% 10% 15% 20% 9/1/14 9/5/14 9/9/14 9/13/14 9/17/14 9/21/14

    9/25/14 9/29/14 10/3/14 10/7/14 10/11/14 10/15/14 10/19/14 10/23/14 10/27/14 10/31/14 11/4/14 11/8/14 11/12/14 11/16/14 11/20/14 11/24/14 11/28/14 12/2/14 Poor Moderate Sept Oct Nov Speed Throttling in Japan
  23. Connection Classes Help Us 
 Target Prefetching Poor Moderate Good

    Excellent Year Class 2010 2011 2012 2013 2014 Comments Prefetching Broken Out
  24. Videos don’t play well on bad connections...
 so let’s not

    auto-play them. Connection Class and Video Auto-Play
  25. Network Prioritization Benefits all connection classes except Excellent. Make sure

    that the most important operations go unthrottled. Idea: Throttle concurrent network requests 
 within the app when on poor connections. The right amount of throttling is also dependent on connection class!
  26. Bandwidth Averaging Bandwidth (kbps) 0 1000 2000 3000 4000 5000

    Time Estimated Actual EXCELLENT GOOD MOD.
  27. Flaky networks Disk & memory constraints Many formats Old OS

    versions Slow CPUs Image Loading on Android It’s not easy — especially in emerging markets WebP JPEG / PNG
  28. Fetching 
 (Network / Local Files) Caching 
 (Disk &

    memory) Resizing & auto- rotating Decoding Transcoding WebP JPEG / PNG What It Does ImagePipeline
  29. Animated GIFs & WebPs support Progressive 
 JPEGs support Custom

    instrumentation 
 support (via Listeners) Cancellation, prioritization, constraining Post-processing support Prefetching 
 (Disk & memory cache) Features ImagePipeline
  30. Drawee Why we built it • To make integration of

    our image pipeline possible • To provide solution for commonly used functionality • To reduce the memory footprint of the view hierarchy
  31. • Submits image requests • Releases resources • Tracks view’s

    visibility • Handles tap-to-retry • Displays the hierarchy Things It Does Drawee
  32. Hierarchy Drawee ScaleType 
 Drawable ScaleType 
 Drawable ScaleType 


    Drawable Placeholder Image Failure Image Settable Drawable Actual Image Fade Drawable
  33. Rounded corners / circle Features Drawee Placeholder / Progress bar

    Backgrounds / Overlays Failure / Retry image Scale types (per image) Fading animation F C Holder with custom DH views Multi-uri
  34. Rounded corners / circle Features Drawee Placeholder / Progress bar

    Backgrounds / Overlays Failure / Retry image Scale types (per image) F F C Holder with custom M
  35. R Features Drawee Placeholder / Progress bar Backgrounds / Overlays

    Failure / Retry image Scale types (per image) F F C Holder with custom Multi-uri
  36. R Features Drawee Placeholder / Progress bar Backgrounds / Overlays

    Failure / Retry image Scale types (per image) F F C Holder with custom M