OLD | NEW |
(Empty) | |
| 1 # Memory Benchmarks |
| 2 |
| 3 This document describes benchmarks available to track Chrome's and |
| 4 WebView's memory usage, where they live, what they measure, how to run them, |
| 5 and on how to diagnose regressions. |
| 6 |
| 7 [TOC] |
| 8 |
| 9 ## Glossary |
| 10 |
| 11 * **User story:** a set of actions to perform on a browser or device (e.g. |
| 12 open google homepage, type "foo", click search, scroll down, visit first |
| 13 result, etc.). |
| 14 * **Metric:** a data aggregation process that takes a Chrome trace as input |
| 15 (produced by a [Telemetry][] run) and produces a set of summary numbers as |
| 16 output (e.g. total GPU memory used). |
| 17 * **Benchmark:** a combination of (one or more) user stories and (one or |
| 18 more) metrics. |
| 19 |
| 20 [Telemetry]: https://github.com/catapult-project/catapult/blob/master/telemetry/
README.md |
| 21 |
| 22 ## System Health |
| 23 |
| 24 *System health* is an effort to unify top-level benchmarks (as opposite to |
| 25 micro-benchmarks and regression tests) that are suitable to capture |
| 26 representative user stories. |
| 27 |
| 28 ### Benchmarks |
| 29 |
| 30 System health memory benchmarks are: |
| 31 |
| 32 * [system_health.memory_mobile][system_health] - |
| 33 user stories running on Android devices. |
| 34 * [system_health.memory_desktop][system_health] - |
| 35 user stories running on desktop platforms. |
| 36 |
| 37 These benchmarks are run continuously on the [chromium.perf][] waterfall, |
| 38 collecting and reporting results on the |
| 39 [Chrome Performance Dashboard][chromeperf]. |
| 40 |
| 41 Other benchmarks maintained by the memory-infra team are discussed in the |
| 42 [appendix](#Other-benchmarks). |
| 43 |
| 44 [system_health]: https://chromium.googlesource.com/chromium/src/+/master/tools/p
erf/page_sets/system_health/ |
| 45 [chromium.perf]: https://build.chromium.org/p/chromium.perf/waterfall |
| 46 [chromeperf]: https://chromeperf.appspot.com/report |
| 47 |
| 48 ### User stories |
| 49 |
| 50 System health user stories are classified by the kind of interactions they |
| 51 perform with the browser: |
| 52 |
| 53 * `browse` stories navigate to a URL and interact with the page; e.g. |
| 54 scroll, click on elements, navigate to subpages, navigate back. |
| 55 * `load` stories just navigate to a URL and wait for the page to |
| 56 load. |
| 57 * `background` stories navigate to a URL, possibly interact with the |
| 58 page, and then bring another app to the foreground (thus pushing the |
| 59 browser to the background). |
| 60 * `long_running` stories interact with a page for a longer period |
| 61 of time (~5 mins). |
| 62 * `blank` has a single story that just navigates to **about:blank**. |
| 63 |
| 64 The full name of a story has the form `{interaction}:{category}:{site}` where: |
| 65 |
| 66 * `interaction` is one the labels given above; |
| 67 * `category` is used to group together sites with a similar purpose, |
| 68 e.g. `news`, `social`, `tools`; |
| 69 * `site` is a short name identifying the website in which the story mostly |
| 70 takes place, e.g. `cnn`, `facebook`, `gmail`. |
| 71 |
| 72 For example `browse:news:cnn` and `background:social:facebook` are two system |
| 73 health user stories. |
| 74 |
| 75 Today, for most stories a garbage collection is forced at the end of the |
| 76 story and a memory dump is then triggered. Metrics report the values |
| 77 obtained from this single measurement. |
| 78 |
| 79 ## Continuous monitoring |
| 80 |
| 81  |
| 82 |
| 83 To view data from one of the benchmarks on the |
| 84 [Chrome Performance Dashboard][chromeperf] you should select: |
| 85 |
| 86 * **Test suite:** The name of a *[benchmark](#Benchmarks)*. |
| 87 * **Bot:** The name of a *platform or device configuration*. Sign in to also |
| 88 see internal bots. |
| 89 * **Subtest (1):** The name of a *[metric](#Understanding-memory-metrics)*. |
| 90 * **Subtest (2):** The name of a *story group*; these have the form |
| 91 `{interaction}_{category}` for system health stories. |
| 92 * **Subtest (3):** The name of a *[user story](#User-stories)* |
| 93 (with `:` replaced by `_`). |
| 94 |
| 95 ## How to run the benchmarks |
| 96 |
| 97 Benchmarks may be run on a local platform/device or remotely on a try job. |
| 98 |
| 99 ### How to run locally |
| 100 |
| 101 After building, e.g. `ChromePublic.apk`, you can run a specific system health |
| 102 story with the command: |
| 103 |
| 104 ``` |
| 105 $SRC/tools/perf/run_benchmark run system_health.memory_mobile \ |
| 106 --browser android-chromium --story-filter load:search:google |
| 107 ``` |
| 108 |
| 109 This will run the story with a default of 3 repetitions and produce a |
| 110 `results.html` file comparing results from this and any previous benchmark |
| 111 runs. |
| 112 |
| 113  |
| 114 |
| 115 Other useful options for this command are: |
| 116 |
| 117 * `--pageset-repeat [n]` - override the default number of repetitions |
| 118 * `--output-format html --output-format json` - select *both* output formats |
| 119 to get individual [trace files][memory-infra] in addition to the |
| 120 `results.html` file. |
| 121 * `--reset-results` - clear results from any previous benchmark runs in the |
| 122 `results.html` file. |
| 123 * `--results-label [label]` - give meaningful names to your benchmark runs, |
| 124 this way it is easier to compare them. |
| 125 |
| 126 For WebView make sure to [replace the system WebView][webview_install] |
| 127 on your device and use `--browser android-webview`. |
| 128 |
| 129 [webview_install]: https://www.chromium.org/developers/how-tos/build-instruction
s-android-webview |
| 130 |
| 131 ### How to run a try job |
| 132 |
| 133 Given a patch on a chromium checkout, try jobs provide a convenient way to |
| 134 evaluate its memory implications on devices or platforms which |
| 135 may not be immediately available to developers. |
| 136 |
| 137 To start a try job [upload a CL][contributing] and run the command, e.g.: |
| 138 |
| 139 ``` |
| 140 $SRC/tools/perf/run_benchmark try android-nexus5 system_health.memory_mobile |
| 141 ``` |
| 142 |
| 143 This will run all of the system health stories for you, and conveniently |
| 144 provide a `results.html` file comparing measurements with/without your patch. |
| 145 Options like `--story-filter` and `--pageset-repeat` may also be passed to |
| 146 this command. |
| 147 |
| 148 To see the full list of available try bots run the command: |
| 149 |
| 150 ``` |
| 151 $SRC/tools/perf/run_benchmark try list |
| 152 ``` |
| 153 |
| 154 [contributing]: https://www.chromium.org/developers/contributing-code |
| 155 |
| 156 ## Understanding memory metrics |
| 157 |
| 158 There is a large number of [memory-infra][] metrics, breaking down usage |
| 159 attributed to different components and processes. |
| 160 |
| 161  |
| 162 |
| 163 Most memory metrics have the form |
| 164 `memory:{browser}:{processes}:{source}:{component}:{kind}` |
| 165 where: |
| 166 |
| 167 * **browser:** One of `chrome` or `webview`. |
| 168 * **processess:** One of `browser_process`, `renderer_processess`, |
| 169 `gpu_process`, or `all_processess`. |
| 170 * **source:** One of `reported_by_chrome` or `reported_by_os` |
| 171 * **component:** May be a Chrome component, e.g. `skia` or `sqlite`; |
| 172 details about a specific component, e.g. `v8:heap`; or a class of memory |
| 173 as seen by the OS, e.g. `system_memory:native_heap` or `gpu_memory`. |
| 174 * **kind:** The kind of memory being reported. For metrics reported by |
| 175 Chrome this usually is `effective_size` (others are `locked_size` |
| 176 and `allocated_objects_size`); for metrics by the OS this usually is |
| 177 `proportional_resident_size` (others are `peak_resident_size` and |
| 178 `private_dirty_size`). |
| 179 |
| 180 [memory-infra]: /memory-infra/README.md |
| 181 |
| 182 ## Appendix |
| 183 |
| 184 ### Other benchmarks |
| 185 |
| 186 Other benchmarks maintained by the memory-infra team are: |
| 187 |
| 188 * [memory.dual_browser_test][memory_py] - cycle between doing Google searches |
| 189 on a WebView-based browser (a stand-in for the Google Search app) and |
| 190 loading pages on Chrome. Runs on Android devices only. |
| 191 |
| 192 Story groups are either `on_chrome` or `on_webview`, indicating the browser |
| 193 in foreground at the moment when the memory measurement was made. |
| 194 |
| 195 * [memory.long_running_dual_browser_test][memory_py] - same as above, but the |
| 196 test is run for 60 iterations keeping both browsers alive for the whole |
| 197 duration of the test and without forcing garbage collection. Intended as a |
| 198 last-resort net to catch memory leaks not apparent on shorter tests. |
| 199 |
| 200 * [memory.top_10_mobile][memory_py] - cycle between loading a page on Chrome, |
| 201 pushing the browser to the background, and then back to the foreground. |
| 202 *(To be deprecated in favor of system_health.memory_mobile.)* |
| 203 |
| 204 Story groups are either `foreground` or `background` indicating the state |
| 205 of the browser at the time of measurement. |
| 206 |
| 207 * [memory.top_10_mobile_stress][memory_py] - same as above, but keeps a single |
| 208 instance of the browser open for 5 repetitions. *(To be deprecated.)* |
| 209 |
| 210 [memory_py]: https://chromium.googlesource.com/chromium/src/+/master/tools/perf/
benchmarks/memory.py |
OLD | NEW |