From adcd245fd3e841974175485045347088600a1cf5 Mon Sep 17 00:00:00 2001 From: Alan Chiu Date: Tue, 2 Jul 2019 09:50:37 -0700 Subject: [PATCH] performance: add Android battery/cpu profiling results (#210) Android docs for the battery/cpu analysis Signed-off-by: JP Simard --- .../performance/battery_impact.rst | 31 ++++++++++++++++--- .../development/performance/cpu_impact.rst | 27 ++++++++++++++-- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/mobile/docs/root/development/performance/battery_impact.rst b/mobile/docs/root/development/performance/battery_impact.rst index f6929ba65cbb..557d02eb88b2 100644 --- a/mobile/docs/root/development/performance/battery_impact.rst +++ b/mobile/docs/root/development/performance/battery_impact.rst @@ -22,19 +22,29 @@ iOS Android ------- +We're currently using HttpURLConnection to communicate and send requests to Envoy. Envoy in it's current state is run as +a process + Getting the build: + 1. Build the library using ``bazel build android_dist --config=android`` 2. Control: ``bazel mobile-install //examples/kotlin/control:hello_control_kt`` 3. Envoy: ``bazel mobile-install //examples/kotlin/hello_world:hello_envoy_kt --fat_apk_cpu=armeabi-v7a`` Experiment steps: + 1. Set a phone's display to sleep after 30minutes of inactivity 2. Unplug the phone from any power source 3. Open up the demo app 4. Wait for the phone to sleep -5. Look at the battery drain from an application like `AccuBattery `_ +5. Look at the battery drain the battery settings in the phone to see the battery usage and drainage -* TODO: Instructions on how to use AccuBattery +Alternative profiling methods tried: + +1. `AccuBattery `_ +We were unable to get the running time of a given application on AccuBattery to more accurately identify battery usage per minute +2. `Battery Historian `_ +We were unable to get reliable data using this method. Often times, the battery usage of an application appears to use no batteries Results ~~~~~~~ @@ -45,7 +55,12 @@ iOS Android ------- -* TODO +Through running the applications for 30minutes, the results are: + +- Envoy : 0.17%/min +- Control : 0.18%/min + +The results of Envoy and Control are very similar Analysis ~~~~~~~~ @@ -58,7 +73,15 @@ iOS Android ------- -* TODO +The results of this experiment is that there isn't much of a difference between Envoy and Control every 200ms. With the :repo:`CPU analysis `, +we are able to see: + +1. Requests to s3 are being logged in Envoy +2. DNS resolution does happen every 5 seconds +3. Stats are flushed every 5 seconds + +The DNS resolution and stats flush happening every 5 seconds was a concern but updating the frequency to 1 minute, we +did not notice a big change. Open issues regarding battery usage ----------------------------------- diff --git a/mobile/docs/root/development/performance/cpu_impact.rst b/mobile/docs/root/development/performance/cpu_impact.rst index d28bddd72c1f..a151e9782829 100644 --- a/mobile/docs/root/development/performance/cpu_impact.rst +++ b/mobile/docs/root/development/performance/cpu_impact.rst @@ -18,13 +18,21 @@ iOS Android ------- +We're currently using HttpURLConnection to communicate and send requests to Envoy every 200ms. +Envoy in it's current state is run as +a process + Getting the build: + 1. Build the library using ``bazel build android_dist --config=android`` 2. Control: ``bazel mobile-install //examples/kotlin/control:hello_control_kt`` 3. Envoy: ``bazel mobile-install //examples/kotlin/hello_world:hello_envoy_kt --fat_apk_cpu=armeabi-v7a`` Experiment steps: -* TODO + +1. Run ``adb shell top -H | grep envoy`` to get the CPU usage of the application (the ``-H`` flag displays the running threads) +2. Wait 10minutes to gather a sample set of data to analyze +3. Take the average CPU% and MEM% Results ~~~~~~~ @@ -37,7 +45,15 @@ iOS Android ------- -* TODO +Envoy: + +- Avg CPU: 33.16075949% +- Avg MEM: 2.765822785% + +Control: + +- Avg CPU: 28.81012658% +- Avg MEM: 2.169620253% Analysis ~~~~~~~~ @@ -50,7 +66,12 @@ iOS Android ------- -* TODO +The results of this experiment is that there is minimal difference between Envoy and Control. By enabling trace logging +within Envoy, we are able to observe the following: + +1. Requests to s3 are being logged in Envoy +2. DNS resolution does happen every 5 seconds +3. Stats are flushed every 5 seconds Open issues regarding battery usage -----------------------------------