Leveraging Program Analysis to Reduce User-Perceived Latency in Mobile Applications

Leveraging Program Analysis to Reduce User-Perceived Latency in Mobile Applications

Presentation slides of the paper "Leveraging Program Analysis to Reduce User-Perceived Latency in Mobile Applications" at International Conference on Software Engineering (ICSE) 2018.

The presentation can be found at: https://youtu.be/8KUPsG4bByU

E4ec94f3e536e3066279a59adc0cf14d?s=128

Yixue Zhao

May 30, 2018
Tweet

Transcript

  1. 1.

    Leveraging Program Analysis to Reduce User-Perceived Latency in Mobile Applications

    Yixue Zhao, Marcelo Schmitt Laser, Yingjun Lyu, and Nenad Medvidović University of Southern California May 30, 2018
  2. 8.

    Outline • Existing prefetching techniques • Novel prefetching technique: PALOMA

    • Give me an example • How well does PALOMA do? • Summary & takeaways
  3. 11.

    Existing Prefetching Techniques Existing approaches: • Server-based à not accessible

    • Human-based à manual & error-prone • History-based • Domain-based
  4. 12.

    Existing Prefetching Techniques Existing approaches: • Server-based à not accessible

    • Human-based à manual & error-prone • History-based à time-consuming • Domain-based
  5. 13.

    Existing Prefetching Techniques Existing approaches: • Server-based à not accessible

    • Human-based à manual & error-prone • History-based à time-consuming • Domain-based à not general
  6. 14.

    Novel Prefetching Technique: PALOMA • Server-based • Human-based • History-based

    • Domain-based Client-only Automatic No historical data Domain-independent
  7. 15.

    Meet PALOMA J Program Analysis for Latency Optimization of Mobile

    Apps • Client-only • Automatic • No historical data • Domain-independent
  8. 16.
  9. 18.

    Original App Workflow Origin Server Latency! Original App • App

    interacts with server • Network latency
  10. 19.

    PALOMA Workflow Static Analysis App Instrumentation Optimized App String Analysis

    Callback Analysis Original App Proxy Runtime Prefetching Origin Server offline online
  11. 20.

    PALOMA Workflow Static Analysis App Instrumentation Optimized App String Analysis

    Callback Analysis Original App Proxy Runtime Prefetching Origin Server offline online “what”
  12. 21.

    PALOMA Workflow Static Analysis App Instrumentation Optimized App String Analysis

    Callback Analysis Original App Proxy Runtime Prefetching Origin Server offline online “when”
  13. 22.

    PALOMA Workflow Static Analysis App Instrumentation Optimized App String Analysis

    Callback Analysis Original App Proxy Runtime Prefetching Origin Server offline online
  14. 23.

    PALOMA Workflow Static Analysis App Instrumentation Optimized App String Analysis

    Callback Analysis Original App Proxy Runtime Prefetching Origin Server offline online
  15. 24.

    Outline • Existing prefetching techniques • Novel prefetching technique: PALOMA

    Ø Give me an example • How well does PALOMA do? • Summary & takeaways
  16. 26.

    Illustrating Example • Event app: 1. choose city name 2.

    click submit to get event information
  17. 27.

    Illustrating Example • Event app: 1. choose city name 2.

    click submit to get event information
  18. 28.

    Illustrating Example • Event app: 1. choose city name 2.

    click submit to get event information FINALE The original aesthetic and unconventional Do-it-Yourself attitude of the show creates a raw energy that simmers through a haze of confetti, smoke and pulsing lights.
  19. 29.

    Illustrating Example • Event app: 1. choose city name 2.

    click submit to get event information • Objective: send event query before clicking submit button
  20. 30.

    1 class MainActivity{ 2 String cityName; 3 protected void onCreate(){

    4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse(connection.getInputStream()); 17 }}); 18 } 19 }
  21. 31.

    1 class MainActivity{ 2 String cityName; 3 protected void onCreate(){

    4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse(connection.getInputStream()); 17 }}); 18 } 19 }
  22. 32.

    1 class MainActivity{ 2 String cityName; 3 protected void onCreate(){

    4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse(connection.getInputStream()); 17 }}); 18 } 19 }
  23. 33.

    1 class MainActivity{ 2 String cityName; 3 protected void onCreate(){

    4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse(connection.getInputStream()); 17 }}); 18 } 19 }
  24. 34.

    Static Analysis App Instrumentation Optimized App String Analysis Callback Analysis

    PALOMA Workflow Original App Proxy Runtime Prefetching Origin Server offline online
  25. 35.

    String Analysis Callback Analysis Static Analysis Phase Answer “when” to

    prefetch Answer “what” to prefetch * Yellow = terms defined in the paper
  26. 36.

    String Analysis Static Analysis Phase Answer “when” to prefetch Answer

    “what” to prefetch • Identify URL Spot * Yellow = terms defined in the paper Callback Analysis
  27. 37.

    String Analysis Static Analysis Phase Answer “when” to prefetch Answer

    “what” to prefetch • Identify URL Spot • Static URL string value analysis Interpret concrete values * Yellow = terms defined in the paper Callback Analysis
  28. 38.

    String Analysis Static Analysis Phase Answer “when” to prefetch Answer

    “what” to prefetch • Identify URL Spot • Static URL string value analysis Interpret concrete values • Dynamic URL string value analysis Identify Definition Spots * Yellow = terms defined in the paper Callback Analysis
  29. 39.

    String Analysis Static Analysis Phase Answer “when” to prefetch Answer

    “what” to prefetch • Identify URL Spot • Static URL string value analysis Interpret concrete values • Dynamic URL string value analysis Identify Definition Spots • Output à URL Map { url1: [ “http://event?&cityName=”, Line7] } * Yellow = terms defined in the paper Callback Analysis
  30. 40.

    String Analysis Static Analysis Phase Answer “when” to prefetch •

    Identify Target Callback * Yellow = terms defined in the paper Answer “what” to prefetch • Identify URL Spot • Static URL string value analysis Interpret concrete values • Dynamic URL string value analysis Identify Definition Spots • Output à URL Map { url1: [ “http://event?&cityName=”, Line7] } Callback Analysis
  31. 41.

    String Analysis Static Analysis Phase Answer “when” to prefetch •

    Identify Target Callback • Extract Callback Control Flow Graph (CCFG) * Yellow = terms defined in the paper { url1: [ “http://event?&cityName=”, Line7] } Answer “what” to prefetch • Identify URL Spot • Static URL string value analysis Interpret concrete values • Dynamic URL string value analysis Identify Definition Spots • Output à URL Map Callback Analysis
  32. 42.

    String Analysis Static Analysis Phase Answer “when” to prefetch •

    Identify Target Callback • Extract Callback Control Flow Graph (CCFG) • Identify Trigger Callback * Yellow = terms defined in the paper Answer “what” to prefetch • Identify URL Spot • Static URL string value analysis Interpret concrete values • Dynamic URL string value analysis Identify Definition Spots • Output à URL Map { url1: [ “http://event?&cityName=”, Line7] } Callback Analysis
  33. 43.

    String Analysis Static Analysis Phase Answer “when” to prefetch •

    Identify Target Callback • Extract Callback Control Flow Graph (CCFG) • Identify Trigger Callback • Output à Trigger Map { [ onCreate ]: [ url1 ] } { [ onItemSelected ]: [ url1 ] } * Yellow = terms defined in the paper Answer “what” to prefetch • Identify URL Spot • Static URL string value analysis Interpret concrete values • Dynamic URL string value analysis Identify Definition Spots • Output à URL Map { url1: [ “http://event?&cityName=”, Line7] } Callback Analysis
  34. 45.

    Static Analysis App Instrumentation Optimized App String Analysis Callback Analysis

    PALOMA Workflow Original App Proxy Runtime Prefetching Origin Server offline online
  35. 46.

    Automatically enable prefetching 1. Update URL Map 2. Trigger prefetching

    3. Redirect Requests • Output à Optimized App App Instrumentation Phase { [ onCreate ]: [ url1 ] } { [ onItemSelected ]: [ url1 ] } { url1: [ “http://event?&cityName=”, Line7] }
  36. 47.

    App Instrumentation Phase Automatically enable prefetching 1. Update URL Map

    2. Trigger prefetching 3. Redirect Requests • Output à Optimized App { [ onCreate ]: [ url1 ] } { [ onItemSelected ]: [ url1 ] } { url1: [ “http://event?&cityName=”, Line7] }
  37. 48.

    { url1: [ “http://event?&cityName=”, Line7] } App Instrumentation 1 class

    MainActivity{ 2 String cityName; 3 protected void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse(connection.getInputStream()); 17 }}); 18 } 19 } 1. Update URL Map 2. Trigger prefetching 3. Redirect Requests Definition Spot
  38. 49.

    1 class MainActivity{ 2 String cityName; 3 protected void onCreate(){

    4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse(connection.getInputStream()); 17 }}); 18 } 19 } App Instrumentation { url1: [ “http://event?&cityName=”, Line7] } 1. Update URL Map 2. Trigger prefetching 3. Redirect Requests
  39. 50.

    App Instrumentation 1. Update URL Map 2. Trigger prefetching 3.

    Redirect Requests { [ onCreate ]: [ url1 ] } { [ onItemSelected ]: [ url1 ] }
  40. 51.

    1 class MainActivity{ 2 String cityName; 3 protected void onCreate(){

    4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse(connection.getInputStream()); 17 }}); 18 } 19 } App Instrumentation { [ onCreate ]: [ url1 ] } { [ onItemSelected ]: [ url1 ] } 1. Update URL Map 2. Trigger prefetching 3. Redirect Requests Trigger Callback
  41. 52.

    1 class MainActivity{ 2 String cityName; 3 protected void onCreate(){

    4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse(connection.getInputStream()); 17 }}); triggerPrefetch(url1); 18 } 19 } App Instrumentation { [ onCreate ]: [ url1 ] } { [ onItemSelected ]: [ url1 ] } 1. Update URL Map 2. Trigger prefetching 3. Redirect Requests
  42. 53.

    { [ onCreate ]: [ url1 ] } { [

    onItemSelected ]: [ url1 ] } App Instrumentation 1 class MainActivity{ 2 String cityName; 3 protected void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse(connection.getInputStream()); 17 }}); triggerPrefetch(url1); 18 } 19 } 1. Update URL Map 2. Trigger prefetching 3. Redirect Requests
  43. 54.

    App Instrumentation { [ onCreate ]: [ url1 ] }

    { [ onItemSelected ]: [ url1 ] } 1 class MainActivity{ 2 String cityName; 3 protected void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse(connection.getInputStream()); 17 }}); triggerPrefetch(url1); 18 } 19 } 1. Update URL Map 2. Trigger prefetching 3. Redirect Requests
  44. 56.

    App Instrumentation 1 class MainActivity{ 2 String cityName; 3 protected

    void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse(connection.getInputStream()); 17 }}); triggerPrefetch(url1); 18 } 19 } 1. Update URL Map 2. Trigger prefetching 3. Redirect Requests
  45. 57.

    App Instrumentation 1 class MainActivity{ 2 String cityName; 3 protected

    void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse( fetchFromProxy(connection) ); 17 }}); triggerPrefetch(url1); 18 } 19 } 1. Update URL Map 2. Trigger prefetching 3. Redirect Requests
  46. 58.

    Static Analysis App Instrumentation Optimized App String Analysis Callback Analysis

    PALOMA Workflow Original App Proxy Runtime Prefetching Origin Server offline online
  47. 62.

    1 class MainActivity{ 2 String cityName; 3 protected void onCreate(){

    4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse( fetchFromProxy(connection) ); 17 }}); triggerPrefetch(url1); 18 } 19 } Runtime Prefetching Phase empty cache { url1: [ “http://event?&cityName=”, Line7] }
  48. 63.

    Runtime Prefetching Phase 1 class MainActivity{ 2 String cityName; 3

    protected void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse( fetchFromProxy(connection) ); 17 }}); triggerPrefetch(url1); 18 } 19 } empty cache { url1: [ “http://event?&cityName=”, Line7] }
  49. 64.

    1 class MainActivity{ 2 String cityName; 3 protected void onCreate(){

    4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse( fetchFromProxy(connection) ); 17 }}); triggerPrefetch(url1); 18 } 19 } Unknown Runtime Prefetching Phase empty cache { url1: [ “http://event?&cityName=”, Line7] }
  50. 67.

    1 class MainActivity{ 2 String cityName; 3 protected void onCreate(){

    4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse( fetchFromProxy(connection) ); 17 }}); triggerPrefetch(url1); 18 } 19 } Runtime Prefetching Phase empty cache { url1: [ “http://event?&cityName=”, Line7] }
  51. 68.

    Runtime Prefetching Phase 1 class MainActivity{ 2 String cityName; 3

    protected void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse( fetchFromProxy(connection) ); 17 }}); triggerPrefetch(url1); 18 } 19 } empty cache { url1: [ “http://event?&cityName=”, Line7] }
  52. 69.

    Runtime Prefetching Phase 1 class MainActivity{ 2 String cityName; 3

    protected void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse( fetchFromProxy(connection) ); 17 }}); triggerPrefetch(url1); 18 } 19 } empty cache { url1: [ “http://event?&cityName=”, “Berlin”] }
  53. 70.

    Runtime Prefetching Phase 1 class MainActivity{ 2 String cityName; 3

    protected void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse( fetchFromProxy(connection) ); 17 }}); triggerPrefetch(url1); 18 } 19 } empty cache { url1: [ “http://event?&cityName=”, “Berlin”] }
  54. 71.

    Runtime Prefetching Phase 1 class MainActivity{ 2 String cityName; 3

    protected void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse( fetchFromProxy(connection) ); 17 }}); triggerPrefetch(url1); 18 } 19 } empty cache { url1: [ “http://event?&cityName=Berlin”] }
  55. 72.

    url1’s response Runtime Prefetching Phase 1 class MainActivity{ 2 String

    cityName; 3 protected void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse( fetchFromProxy(connection) ); 17 }}); triggerPrefetch(url1); 18 } 19 }
  56. 74.

    Runtime Prefetching Phase url1’s response 1 class MainActivity{ 2 String

    cityName; 3 protected void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse( fetchFromProxy(connection) ); 17 }}); triggerPrefetch(url1); 18 } 19 }
  57. 75.

    Runtime Prefetching Phase url1’s response 1 class MainActivity{ 2 String

    cityName; 3 protected void onCreate(){ 4 //register onItemSelected event 5 cityNameSpinner.setOnItemSelectedListener(new View.OnItemSelectedListener(){ 6 public void onItemSelected() { 7 cityName = cityNameSpinner.getSelectedItem().toString(); sendDefinition(cityName, url1, 2); triggerPrefetch(url1); 8 }}); 9 //register onClick event 10 submitBtn.setOnClickListener(new View.OnClickListener(){ 11 public void onClick(){ 12 //initialize URL 13 URL url1 = new URL("http://event?&cityName="+cityName); 14 //send HTTP request 15 URLConnection connection = url1.openConnection(); 16 Parse( fetchFromProxy(connection) ); 17 }}); triggerPrefetch(url1); 18 } 19 }
  58. 76.

    FINALE The original aesthetic and unconventional Do-it-Yourself attitude of the

    show creates a raw energy that simmers through a haze of confetti, smoke and pulsing lights. Runtime Prefetching Phase url1’s response
  59. 77.

    Outline • Existing prefetching techniques • Novel prefetching technique: PALOMA

    • Give me an example Ø How well does PALOMA do? • Summary & takeaways
  60. 79.

    Evaluation – Microbenchmark DS1,1 1 - H DS1,1 2 -

    NP DS1,2 DS1,1 DS1,1 4 - NH DS1,2 DS1,2 5 - NP DS1,1 DS2,1 8 - NP DS1,1 DS1,1 6 - H DS2,1 DS1,1 7 - NP DS2,1 DS2,1 DS1,1 11 - NP DS2,2 DS1,1 15 - NP DS2,2 DS2,1 DS1,1 DS2,1 12 - NH DS2,2 DS1,1 13 - NP DS2,2 DS2,1 DS2,2 DS1,1 14 - NP DS2,1 DS2,1 DS2,2 DS1,2 DS1,1 DS2,2 19 - NP DS2,1 DS1,2 DS1,1 17 - NP DS2,1 DS2,2 DS1,2 DS1,1 DS1,1 18 - NP DS2,2 DS2,1 DS1,2 DS2,1 22 - NP DS2,2 DS1,2 DS1,1 DS2,2 DS2,1 DS1,2 DS1,1 DS1,1 24 - NH DS2,2 DS2,1 DS1,2 DS1,2 DS1,1 DS2,1 DS2,2 DS1,1 21 - NH DS2,1 DS2,2 DS1,2 DS1,1 10 - H DS2,2 DS2,1 DS1,1 DS2,2 9 - NP 3 - H 16 - H 20 - NP 23 - NH • 25 Test Cases # of dynamic values ≤ 2 # of Definition Spots (DS) ≤ 2
  61. 80.

    Evaluation – Microbenchmark DS1,1 1 - H DS1,1 2 -

    NP DS1,2 DS1,1 DS1,1 4 - NH DS1,2 DS1,2 5 - NP DS1,1 DS2,1 8 - NP DS1,1 DS1,1 6 - H DS2,1 DS1,1 7 - NP DS2,1 DS2,1 DS1,1 11 - NP DS2,2 DS1,1 15 - NP DS2,2 DS2,1 DS1,1 DS2,1 12 - NH DS2,2 DS1,1 13 - NP DS2,2 DS2,1 DS2,2 DS1,1 14 - NP DS2,1 DS2,1 DS2,2 DS1,2 DS1,1 DS2,2 19 - NP DS2,1 DS1,2 DS1,1 17 - NP DS2,1 DS2,2 DS1,2 DS1,1 DS1,1 18 - NP DS2,2 DS2,1 DS1,2 DS2,1 22 - NP DS2,2 DS1,2 DS1,1 DS2,2 DS2,1 DS1,2 DS1,1 DS1,1 24 - NH DS2,2 DS2,1 DS1,2 DS1,2 DS1,1 DS2,1 DS2,2 DS1,1 21 - NH DS2,1 DS2,2 DS1,2 DS1,1 10 - H DS2,2 DS2,1 DS1,1 DS2,2 9 - NP 3 - H 16 - H 20 - NP 23 - NH • 25 Test Cases # of dynamic values ≤ 2 # of Definition Spots (DS) ≤ 2 • The location of DS Prefetchable Non Prefetchable (NP) Hit (H) Non Hit (NH) Trigger Point
  62. 81.

    • 25 Test Cases # of dynamic values ≤ 2

    # of Definition Spots (DS) ≤ 2 • The location of DS Evaluation – Microbenchmark DS1,1 1 - H DS1,1 2 - NP DS1,2 DS1,1 DS1,1 4 - NH DS1,2 DS1,2 5 - NP DS1,1 DS2,1 8 - NP DS1,1 DS1,1 6 - H DS2,1 DS1,1 7 - NP DS2,1 DS2,1 DS1,1 11 - NP DS2,2 DS1,1 15 - NP DS2,2 DS2,1 DS1,1 DS2,1 12 - NH DS2,2 DS1,1 13 - NP DS2,2 DS2,1 DS2,2 DS1,1 14 - NP DS2,1 DS2,1 DS2,2 DS1,2 DS1,1 DS2,2 19 - NP DS2,1 DS1,2 DS1,1 17 - NP DS2,1 DS2,2 DS1,2 DS1,1 DS1,1 18 - NP DS2,2 DS2,1 DS1,2 DS2,1 22 - NP DS2,2 DS1,2 DS1,1 DS2,2 DS2,1 DS1,2 DS1,1 DS1,1 24 - NH DS2,2 DS2,1 DS1,2 DS1,2 DS1,1 DS2,1 DS2,2 DS1,1 21 - NH DS2,1 DS2,2 DS1,2 DS1,1 10 - H DS2,2 DS2,1 DS1,1 DS2,2 9 - NP 3 - H 16 - H 20 - NP 23 - NH Trigger Point Prefetchable Non Prefetchable (NP) Hit (H) Non Hit (NH)
  63. 82.

    Evaluation – Microbenchmark DS1,1 1 - H DS1,1 2 -

    NP DS1,2 DS1,1 DS1,1 4 - NH DS1,2 DS1,2 5 - NP DS1,1 DS2,1 8 - NP DS1,1 DS1,1 6 - H DS2,1 DS1,1 7 - NP DS2,1 DS2,1 DS1,1 11 - NP DS2,2 DS1,1 15 - NP DS2,2 DS2,1 DS1,1 DS2,1 12 - NH DS2,2 DS1,1 13 - NP DS2,2 DS2,1 DS2,2 DS1,1 14 - NP DS2,1 DS2,1 DS2,2 DS1,2 DS1,1 DS2,2 19 - NP DS2,1 DS1,2 DS1,1 17 - NP DS2,1 DS2,2 DS1,2 DS1,1 DS1,1 18 - NP DS2,2 DS2,1 DS1,2 DS2,1 22 - NP DS2,2 DS1,2 DS1,1 DS2,2 DS2,1 DS1,2 DS1,1 DS1,1 24 - NH DS2,2 DS2,1 DS1,2 DS1,2 DS1,1 DS2,1 DS2,2 DS1,1 21 - NH DS2,1 DS2,2 DS1,2 DS1,1 10 - H DS2,2 DS2,1 DS1,1 DS2,2 9 - NP 3 - H 16 - H 20 - NP 23 - NH Prefetchable Non Prefetchable (NP) Hit (H) Non Hit (NH) • 25 Test Cases # of dynamic values ≤ 2 # of Definition Spots (DS) ≤ 2 • The location of DS Trigger Point
  64. 83.

    Evaluation – Microbenchmark DS1,1 1 - H DS1,1 2 -

    NP DS1,2 DS1,1 DS1,1 4 - NH DS1,2 DS1,2 5 - NP DS1,1 DS2,1 8 - NP DS1,1 DS1,1 6 - H DS2,1 DS1,1 7 - NP DS2,1 DS2,1 DS1,1 11 - NP DS2,2 DS1,1 15 - NP DS2,2 DS2,1 DS1,1 DS2,1 12 - NH DS2,2 DS1,1 13 - NP DS2,2 DS2,1 DS2,2 DS1,1 14 - NP DS2,1 DS2,1 DS2,2 DS1,2 DS1,1 DS2,2 19 - NP DS2,1 DS1,2 DS1,1 17 - NP DS2,1 DS2,2 DS1,2 DS1,1 DS1,1 18 - NP DS2,2 DS2,1 DS1,2 DS2,1 22 - NP DS2,2 DS1,2 DS1,1 DS2,2 DS2,1 DS1,2 DS1,1 DS1,1 24 - NH DS2,2 DS2,1 DS1,2 DS1,2 DS1,1 DS2,1 DS2,2 DS1,1 21 - NH DS2,1 DS2,2 DS1,2 DS1,1 10 - H DS2,2 DS2,1 DS1,1 DS2,2 9 - NP 3 - H 16 - H 20 - NP 23 - NH • 25 Test Cases # of dynamic values ≤ 2 # of Definition Spots (DS) ≤ 2 • The location of DS Prefetchable Non Prefetchable (NP) Hit (H) Non Hit (NH) Trigger Point
  65. 85.

    Evaluation – Microbenchmark • Accuracy Precision: 100% (All prefetched requests

    are prefetchable) Recall: 100% (All prefetchable requests are prefetched)
  66. 86.

    Evaluation – Microbenchmark • Accuracy Precision: 100% (All prefetched requests

    are prefetchable) Recall: 100% (All prefetchable requests are prefetched) • Effectiveness Average latency reduction: 99.47% (across all Hit cases) Average overhead: 6.44ms (across all 25 cases)
  67. 87.

    Evaluation – Market Apps • 32 subject apps from Google

    Play • 11 app categories • App size from 312 KB to 17.8 MB • 2 Android users exposed to all app options • 4G network setting
  68. 88.

    Evaluation – Market Apps • Results across the 32 subject

    apps Min. Max. Avg. Std. Dev. Runtime Requests 1 64 13.28 14.41 Hit Rate 7.7% 100% 47.76% 28.81% Latency Reduction 87.41% 99.97% 98.82% 2.3%
  69. 89.
  70. 93.

    Takeaways Program Analysis for Latency Optimization in Mobile Apps: •

    Client-only • Automatic • Domain-independent • No historical data required
  71. 94.

    Takeaways Program Analysis for Latency Optimization in Mobile Apps: •

    Significant latency reduction • Negligible overhead
  72. 95.

    Takeaways Program Analysis for Latency Optimization in Mobile Apps: •

    Foundation • Rigorous formulation of prefetching scenarios • Comprehensive & reusable microbenchmark