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

Empirically Assessing Opportunities for Prefetching and Caching in Mobile Apps

Yixue Zhao
September 06, 2018

Empirically Assessing Opportunities for Prefetching and Caching in Mobile Apps

Presentation slides of the paper "Empirically Assessing Opportunities for Prefetching and Caching in Mobile Apps" at the International Conference on Automated Software Engineering (ASE) 2018.

The presentation can be found at https://youtu.be/iT1pNy370ZM

Yixue Zhao

September 06, 2018
Tweet

More Decks by Yixue Zhao

Other Decks in Research

Transcript

  1. Empirically Assessing Opportunities for
    Prefetching and Caching in Mobile Apps
    Yixue Zhao, Paul Wat, Marcelo Schmitt Laser, and Nenad Medvidović
    University of Southern California
    September 6, 2018 @Montpellier

    View full-size slide

  2. Mobile Apps Everywhere

    View full-size slide

  3. Network Latency
    Latency!

    View full-size slide

  4. Network Latency
    Wireless network characteristics
    Ø Low bandwidth
    Ø Unstable connectivity

    View full-size slide

  5. Network Latency
    Performance Bottleneck
    Network Speed

    View full-size slide

  6. Prefetching
    Caching

    View full-size slide

  7. Prefetching & Caching
    local cache

    View full-size slide

  8. Prefetching & Caching
    immediate
    response
    local cache
    ICSE 2018. Leveraging Program Analysis to Reduce User-Perceived Latency in Mobile Applications.

    View full-size slide

  9. Browser Mobile App
    Browser vs. Mobile App
    Ø Lack of work
    Ø Large body of work
    ?

    View full-size slide

  10. Browser Mobile App
    Browser vs. Mobile App
    Ø Lack of work
    Ø “Light” requests
    Ø Large body of work
    Ø “Rich” requests
    ?

    View full-size slide

  11. Browser Mobile App
    Browser vs. Mobile App
    Ø Lack of work
    Ø “Light” requests
    Ø Single round-trip time
    Ø Large body of work
    Ø “Rich” requests
    Ø Loading multiple sub-resources
    ?

    View full-size slide

  12. Browser Mobile App
    Browser vs. Mobile App
    Ø Lack of work
    Ø “Light” requests
    Ø Single round-trip time
    Ø Prefetch separate requests
    Ø Large body of work
    Ø “Rich” requests
    Ø Loading multiple sub-resources
    Ø Prefetch sub-resources
    ?

    View full-size slide

  13. Conclusion
    Ø Browser à Mobile app
    Ø Lack of prefetching & caching in mobile apps
    Browser vs. Mobile App

    View full-size slide

  14. Empirical Study
    Can we
    prefetch & cache
    in mobile apps?

    View full-size slide

  15. Research Questions
    Ø Prefetchability of HTTP requests
    Ø Cacheability of HTTP responses
    Ø Redundancy of HTTP requests

    View full-size slide

  16. GET requests
    Ø Read-only
    Ø No side effects
    Ø Safe to prefetch
    RQ: Prefetchability
    Ø Prefetchability of HTTP requests
    Ø Cacheability of HTTP responses
    Ø Redundancy of HTTP requests

    View full-size slide

  17. 1. What is the number of GET requests per app?
    2. What is the percentage of GET requests among
    all HTTP requests?
    3. How prevalent are GET requests across different
    app categories?
    RQ: Prefetchability
    Ø Prefetchability of HTTP requests
    Ø Cacheability of HTTP responses
    Ø Redundancy of HTTP requests

    View full-size slide

  18. RQ: Cacheability
    Ø Prefetchability of HTTP requests
    Ø Cacheability of HTTP responses
    Ø Redundancy of HTTP requests

    View full-size slide

  19. Prefetchable ≠ Cacheable
    Ø Cache staleness
    Ø Rely on Expires, Cache-Control
    Ø Trustworthy?
    RQ: Cacheability
    Ø Prefetchability of HTTP requests
    Ø Cacheability of HTTP responses
    Ø Redundancy of HTTP requests

    View full-size slide

  20. 4. How prevalent are Expires headers?
    5. Are Expires headers trustworthy?
    6. How prevalent are Cache-Control headers?
    7. Are Cache-Control headers trustworthy?
    RQ: Cacheability
    Ø Prefetchability of HTTP requests
    Ø Cacheability of HTTP responses
    Ø Redundancy of HTTP requests

    View full-size slide

  21. RQ: Redundancy
    Ø Prefetchability of HTTP requests
    Ø Cacheability of HTTP responses
    Ø Redundancy of HTTP requests

    View full-size slide

  22. Redundant requests
    Ø Ostensibly redundant: same URL
    Ø Truly redundant: same URL & same response
    RQ: Redundancy
    Ø Prefetchability of HTTP requests
    Ø Cacheability of HTTP responses
    Ø Redundancy of HTTP requests
    Cache me J

    View full-size slide

  23. 8. How prevalent are redundant HTTP requests?
    9. Are the identified ostensibly redundant requests
    truly redundant?
    RQ: Redundancy
    Ø Prefetchability of HTTP requests
    Ø Cacheability of HTTP responses
    Ø Redundancy of HTTP requests

    View full-size slide

  24. Workflow Overview
    Send Requests
    t=0, 10, 30, 60s
    #req ≥ 4
    Instrumented
    Apps
    App
    Testing
    Monkey
    Exerciser
    download
    Manual
    Examination
    Initial
    Apps

    View full-size slide

  25. Ø 1,687 top-ranked apps
    Ø 33 app categories
    e.g., Beauty, Tools
    Workflow: Download
    download
    Google
    Play
    Initial
    Apps
    1,687

    View full-size slide

  26. Ø Instrumented 1,308 apps to capture needed information
    by Soot
    Ø App size: 16 KB to 103.4 MB
    Ø #Request per app: 0 to 1,243
    Workflow: Instrumentation
    download
    Google
    Play
    Initial
    Apps
    Instrumented
    Apps
    1,308
    1,687

    View full-size slide

  27. Ø 3,000 random events by Monkey
    Ø NoxPlayer emulator
    Ø Wi-Fi network settings
    Workflow: Testing
    download
    Google
    Play
    Initial
    Apps
    Instrumented
    Apps
    App
    Testing
    Monkey
    Exerciser
    1,687 1,308

    View full-size slide

  28. Workflow: Inspection
    Ø Low network usage

    View full-size slide

  29. Workflow: Inspection
    Ø Low network usage
    Ø Manual inspection
    Instrumented
    Apps
    App
    Testing
    Monkey
    Exerciser
    download
    Google
    Play
    Manual
    Examination
    Initial
    Apps

    View full-size slide

  30. Ø Low network usage
    Ø Manual inspection
    Ø 6 recurring reasons
    e.g. obfuscation
    Workflow: Inspection
    Instrumented
    Apps
    App
    Testing
    Monkey
    Exerciser
    download
    Google
    Play
    Manual
    Examination
    Initial
    Apps

    View full-size slide

  31. 1 ≤ #Requests ≤ 3
    Ø Load config files
    Ø Log in with Facebook
    Ø Monitoring services
    Workflow: Inspection
    Instrumented
    Apps
    App
    Testing
    Monkey
    Exerciser
    download
    Google
    Play
    Manual
    Examination
    Initial
    Apps

    View full-size slide

  32. #req ≥ 4
    Workflow: Final Apps
    Final apps (#req ≥ 4)
    Ø 451 apps
    Ø 33 app categories
    e.g. Beauty, Tools
    Ø #Req per app
    Avg: 35
    Max: 1,243

    View full-size slide

  33. Workflow Overview
    Send Requests
    t=0, 10, 30, 60s
    #req ≥ 4
    Instrumented
    Apps
    App
    Testing
    Monkey
    Exerciser
    download
    Google
    Play
    Manual
    Examination
    Initial
    Apps

    View full-size slide

  34. Findings
    Ø Prefetchability of HTTP requests
    Ø Cacheability of HTTP responses
    Ø Redundancy of HTTP requests

    View full-size slide

  35. Prefetchability of HTTP requests
    Ø What is the number of GET requests per app?
    Min
    0
    25
    50
    75
    100
    125
    150
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

    View full-size slide

  36. Prefetchability of HTTP requests
    Ø What is the number of GET requests per app?
    Max
    0
    25
    50
    75
    100
    125
    150
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

    View full-size slide

  37. Prefetchability of HTTP requests
    Ø What is the number of GET requests per app?
    Avg
    0
    25
    50
    75
    100
    125
    150
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

    View full-size slide

  38. Prefetchability of HTTP requests
    Ø What is the number of GET requests per app?
    0
    25
    50
    75
    100
    125
    150
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    1,243

    View full-size slide

  39. Prefetchability of HTTP requests
    Ø What is the number of GET requests per app?
    0
    25
    50
    75
    100
    125
    150
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    1,243 263 182 802 286 174 166

    View full-size slide

  40. Prefetchability of HTTP requests
    Ø What is the percentage of GET requests per app?
    0
    25
    50
    75
    100
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

    View full-size slide

  41. Prefetchability of HTTP requests
    Ø GET is pervasive à prefetching opportunity
    0
    25
    50
    75
    100
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

    View full-size slide

  42. Prefetchability of HTTP requests
    Ø GET is pervasive à prefetching opportunity
    Ø Highest avg: Beauty 94%
    Ø Lowest avg: Dating 43%
    0
    25
    50
    75
    100
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

    View full-size slide

  43. Prefetchability of HTTP requests
    0
    25
    50
    75
    100
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    Beauty
    94%

    View full-size slide

  44. Prefetchability of HTTP requests
    0
    25
    50
    75
    100
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    Dating
    43%

    View full-size slide

  45. Findings
    Ø Prefetchability of HTTP requests
    Ø Cacheability of HTTP responses
    Ø Redundancy of HTTP requests

    View full-size slide

  46. Cacheability of HTTP responses
    Ø Expires & Cache-Control response headers
    Ø Numbers
    Ø Percentages
    0
    5
    10
    15
    20
    25
    30
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
    0
    25
    50
    75
    100
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
    Percentages of Expires
    Numbers of Expires

    View full-size slide

  47. Cacheability of HTTP responses
    Avg of Expires percentages Avg of Cache-Control percentages
    0
    25
    50
    75
    100
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
    0
    25
    50
    75
    100
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33

    View full-size slide

  48. Cacheability of HTTP responses
    Ø Avg: Expires 53%, Cache-Control 65%
    Avg of Cache-Control percentages
    0
    25
    50
    75
    100
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
    0
    25
    50
    75
    100
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
    Avg of Expires percentages

    View full-size slide

  49. Cacheability of HTTP responses
    Ø Avg: Expires 53%, Cache-Control 65%
    Ø Both headers are not always included
    Avg of Cache-Control percentages
    0
    25
    50
    75
    100
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
    0
    25
    50
    75
    100
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
    Avg of Expires percentages

    View full-size slide

  50. Cacheability of HTTP responses
    Ø Are Expires and Cache-Control headers
    trustworthy?

    View full-size slide

  51. Cacheability of HTTP responses
    Instrumented
    Apps
    App
    Testing
    Manual
    Examination
    Monkey
    Exerciser
    Send Requests
    t=0, 10, 30, 60s
    #req ≥ 4
    download
    Google
    Play
    Initial
    Apps

    View full-size slide

  52. Cacheability of HTTP responses
    Ø Send original request @ time(t)
    Ø Send same request @ time(t+x), x=10, 30, 60s
    t = original time
    x = time period after t

    View full-size slide

  53. Cacheability of HTTP responses
    Ø Untrustworthy scenarios
    1. time(exp) ≤ time(t)
    2. time(t) < time(exp) ≤ time(t+x) ∧
    response@(t) = response@(t+x)
    3. time(exp) > time(t+x) ∧
    response@(t) ≠ response@(t+x)
    t = original time
    x = time period after t

    View full-size slide

  54. Cacheability of HTTP responses
    Ø Untrustworthy scenarios
    t = original time
    x = time period after t
    t t + x
    request@t
    2018 Sep 1 2018 Sep 6

    View full-size slide

  55. Cacheability of HTTP responses
    Ø Untrustworthy scenarios
    t = original time
    x = time period after t
    t t + x
    2018 Sep 1 2018 Sep 6

    View full-size slide

  56. Cacheability of HTTP responses
    Ø Untrustworthy scenarios
    t = original time
    x = time period after t
    t t + x
    expire time
    2018 Sep 1 2018 Sep 6

    View full-size slide

  57. Cacheability of HTTP responses
    Ø 1. expire before request is sent
    t = original time
    x = time period after t
    t t + x
    2018 Sep 1 2018 Sep 6
    expire time: 1999 Jan 1

    View full-size slide

  58. Cacheability of HTTP responses
    Ø 2. should expire but response is unchanged
    t = original time
    x = time period after t
    t t + x
    2018 Sep 1 2018 Sep 6
    expire time: 2018 Sep 3

    View full-size slide

  59. Cacheability of HTTP responses
    Ø 3. should not expire but response is changed
    t = original time
    x = time period after t
    t t + x
    2018 Sep 1 2018 Sep 6
    expire time: 2018 Sep 10

    View full-size slide

  60. Cacheability of HTTP responses
    Ø Avg trustworthy:
    Expires 25%, Cache-Control 77% (3x)
    Avg of trusted Expires Avg of trusted Cache-Control
    0
    25
    50
    75
    100
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
    0
    25
    50
    75
    100
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33

    View full-size slide

  61. Cacheability of HTTP responses
    Ø Avg trustworthy:
    Expires 25%, Cache-Control 77% (3x)
    Ø 0% and 100% apps
    Avg of trusted Expires Avg of trusted Cache-Control
    0
    25
    50
    75
    100
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
    0
    25
    50
    75
    100
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33

    View full-size slide

  62. Cacheability of HTTP responses
    Ø Should not depend on the headers completely

    View full-size slide

  63. Cacheability of HTTP responses
    Ø Should not depend on the headers completely
    Ø No reliable alternatives

    View full-size slide

  64. Cacheability of HTTP responses
    Ø Should not depend on the headers completely
    Ø No reliable alternatives
    Ø Research opportunities J

    View full-size slide

  65. Findings
    Ø Prefetchability of HTTP requests
    Ø Cacheability of HTTP responses
    Ø Redundancy of HTTP requests

    View full-size slide

  66. Redundancy of HTTP requests
    Ø Ostensibly redundant requests
    Ø Avg: 20%
    0
    25
    50
    75
    100
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    Percentages of ostensibly redundant requests

    View full-size slide

  67. Redundancy of HTTP requests
    Ø Truly redundant requests
    Ø Avg: 92%
    0
    25
    50
    75
    100
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    Percentages of truly redundant requests

    View full-size slide

  68. Redundancy of HTTP requests
    Ø Most redundant requests are truly redundant

    View full-size slide

  69. Redundancy of HTTP requests
    Ø Most redundant requests are truly redundant
    Ø What does this tell us?

    View full-size slide

  70. Implications for prefetching
    Ø “Avg” app
    Ø #GET request 28

    View full-size slide

  71. Implications for prefetching
    Ø “Avg” app
    Ø #GET request 28
    Ø Response time: 800ms
    Time saved: 22s

    View full-size slide

  72. Implications for caching
    Ø “Avg” app
    Ø #GET request 28
    Ø Redundant requests: 20%
    Ø Truly redundant requests: 92%
    Ø #Cacheable request: 6
    Time saved: 4s

    View full-size slide

  73. Summary
    Empirical study to understand HTTP characteristics
    in mobile apps
    Ø Prefetchability of requests
    Ø Cacheability of responses
    Ø Redundancy of requests

    View full-size slide

  74. Lessons learned
    Ø Opportunity for prefetching & caching
    Ø App-specific characteristics
    Ø Domain-specific characteristics
    Summary

    View full-size slide

  75. Summary
    Contributions
    Ø Bridge the gap between browser and mobile app domain
    Ø Guidelines for developers
    Ø Motivate future research

    View full-size slide

  76. Behind the Scene: co-authors
    Marcelo Schmitt Laser
    Paul Wat advisor: Nenad Medvidović

    View full-size slide

  77. Behind the Scene: co-authors + sponsors
    Marcelo Schmitt Laser
    Paul Wat advisor: Nenad Medvidović

    View full-size slide

  78. Contact: [email protected]
    Github: https://github.com/felicitia/PALOMA-Analysis/tree/empirical

    View full-size slide