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. 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. Motivating Example

  3. Motivating Example

  4. Motivating Example

  5. Motivating Example Latency!

  6. Motivating Example

  7. Motivating Example

  8. Outline • Existing prefetching techniques • Novel prefetching technique: PALOMA

    • Give me an example • How well does PALOMA do? • Summary & takeaways
  9. Existing Prefetching Techniques Existing approaches: • Server-based • Human-based •

    History-based • Domain-based
  10. Existing Prefetching Techniques Existing approaches: • Server-based à not accessible

    • Human-based • History-based • Domain-based
  11. Existing Prefetching Techniques Existing approaches: • Server-based à not accessible

    • Human-based à manual & error-prone • History-based • Domain-based
  12. Existing Prefetching Techniques Existing approaches: • Server-based à not accessible

    • Human-based à manual & error-prone • History-based à time-consuming • Domain-based
  13. Existing Prefetching Techniques Existing approaches: • Server-based à not accessible

    • Human-based à manual & error-prone • History-based à time-consuming • Domain-based à not general
  14. Novel Prefetching Technique: PALOMA • Server-based • Human-based • History-based

    • Domain-based Client-only Automatic No historical data Domain-independent
  15. Meet PALOMA J Program Analysis for Latency Optimization of Mobile

    Apps • Client-only • Automatic • No historical data • Domain-independent
  16. Key Insights • App code has useful information • “User

    think time” provides opportunities
  17. PALOMA in a Nutshell Code Analysis App Instrumentation Optimized App

  18. Original App Workflow Origin Server Latency! Original App • App

    interacts with server • Network latency
  19. PALOMA Workflow Static Analysis App Instrumentation Optimized App String Analysis

    Callback Analysis Original App Proxy Runtime Prefetching Origin Server offline online
  20. PALOMA Workflow Static Analysis App Instrumentation Optimized App String Analysis

    Callback Analysis Original App Proxy Runtime Prefetching Origin Server offline online “what”
  21. PALOMA Workflow Static Analysis App Instrumentation Optimized App String Analysis

    Callback Analysis Original App Proxy Runtime Prefetching Origin Server offline online “when”
  22. PALOMA Workflow Static Analysis App Instrumentation Optimized App String Analysis

    Callback Analysis Original App Proxy Runtime Prefetching Origin Server offline online
  23. PALOMA Workflow Static Analysis App Instrumentation Optimized App String Analysis

    Callback Analysis Original App Proxy Runtime Prefetching Origin Server offline online
  24. Outline • Existing prefetching techniques • Novel prefetching technique: PALOMA

    Ø Give me an example • How well does PALOMA do? • Summary & takeaways
  25. Illustrating Example • Event app: 1. choose city name

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

    click submit to get event information
  27. Illustrating Example • Event app: 1. choose city name 2.

    click submit to get event information
  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.
  29. Illustrating Example • Event app: 1. choose city name 2.

    click submit to get event information • Objective: send event query before clicking submit button
  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 }
  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 }
  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 }
  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 }
  34. Static Analysis App Instrumentation Optimized App String Analysis Callback Analysis

    PALOMA Workflow Original App Proxy Runtime Prefetching Origin Server offline online
  35. String Analysis Callback Analysis Static Analysis Phase Answer “when” to

    prefetch Answer “what” to prefetch * Yellow = terms defined in the paper
  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
  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
  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
  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
  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
  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
  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
  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
  44. Static Analysis Phase Push to Proxy Legend Optimized App Original

    App
  45. Static Analysis App Instrumentation Optimized App String Analysis Callback Analysis

    PALOMA Workflow Original App Proxy Runtime Prefetching Origin Server offline online
  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] }
  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] }
  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
  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
  50. App Instrumentation 1. Update URL Map 2. Trigger prefetching 3.

    Redirect Requests { [ onCreate ]: [ url1 ] } { [ onItemSelected ]: [ url1 ] }
  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
  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
  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
  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
  55. App Instrumentation 1. Update URL Map 2. Trigger prefetching 3.

    Redirect Requests
  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
  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
  58. Static Analysis App Instrumentation Optimized App String Analysis Callback Analysis

    PALOMA Workflow Original App Proxy Runtime Prefetching Origin Server offline online
  59. Proxy Runtime Prefetching Origin Server Optimized App PALOMA at runtime

  60. Runtime Prefetching Phase empty cache { url1: [ “http://event?&cityName=”, Line7]

    }
  61. Runtime Prefetching Phase empty cache { url1: [ “http://event?&cityName=”, Line7]

    }
  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] }
  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] }
  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] }
  65. Runtime Prefetching Phase empty cache { url1: [ “http://event?&cityName=”, Line7]

    }
  66. Runtime Prefetching Phase empty cache { url1: [ “http://event?&cityName=”, Line7]

    }
  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] }
  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] }
  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”] }
  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”] }
  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”] }
  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 }
  73. Runtime Prefetching Phase url1’s response

  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 }
  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 }
  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
  77. Outline • Existing prefetching techniques • Novel prefetching technique: PALOMA

    • Give me an example Ø How well does PALOMA do? • Summary & takeaways
  78. Evaluation Objectives: • Accuracy Microbenchmark • Effectiveness Microbenchmark 32 Market

    Apps
  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
  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
  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)
  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
  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
  84. Evaluation – Microbenchmark Check out our paper!

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

    are prefetchable) Recall: 100% (All prefetchable requests are prefetched)
  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)
  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
  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%
  89. Summary

  90. Summary Latency!

  91. Summary Latency! Latency! (Systems)

  92. Latency! (Systems) Summary Prefetching (Program Analysis) Latency!

  93. Takeaways Program Analysis for Latency Optimization in Mobile Apps: •

    Client-only • Automatic • Domain-independent • No historical data required
  94. Takeaways Program Analysis for Latency Optimization in Mobile Apps: •

    Significant latency reduction • Negligible overhead
  95. Takeaways Program Analysis for Latency Optimization in Mobile Apps: •

    Foundation • Rigorous formulation of prefetching scenarios • Comprehensive & reusable microbenchmark
  96. Behind the Scene: co-authors Marcelo Schmitt Laser Yingjun Lyu advisor:

    Nenad Medvidović
  97. Behind the Scene: co-authors + acknowledgement William G.J. Halfond Atanas

    (Nasko) Rountev Yuhao Zhu
  98. Contact: yixue.zhao@usc.edu PALOMA Website: softarch.usc.edu/PALOMA