tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

index.rst (6116B)


      1 ====
      2 AWSY
      3 ====
      4 
      5 Are We Slim Yet project (commonly known as AWSY) tracks memory usage across builds.
      6 
      7 On treeherder, the AWSY builds are listed in subgroups of `SY`.
      8 
      9 AWSY tests consist of three types: TP5*, TP6, and Base Memory Usage.
     10 
     11 *\*TP5 tests are out of date and no longer maintained. These tests are scheduled to be removed:* https://bugzilla.mozilla.org/show_bug.cgi?id=1712406
     12 
     13 {documentation}
     14 
     15 Running AWSY Locally
     16 *********************
     17 
     18 Running tests locally is most likely only useful for debugging what is going on in a test,
     19 as the test output is only reported as raw JSON. The CLI is documented via:
     20 
     21 .. code-block:: bash
     22 
     23    ./mach awsy-test --help
     24 
     25 *Currently all tests will download TP5 even if it is not used, see:* https://bugzilla.mozilla.org/show_bug.cgi?id=1683920
     26 
     27 TP5 tests
     28 =========
     29 
     30 .. code-block:: bash
     31 
     32    ./mach awsy-test --tp5
     33 
     34 TP6 tests
     35 =========
     36 
     37 .. code-block:: bash
     38 
     39    ./mach awsy-test
     40 
     41 Base Memory Usage tests
     42 ========================
     43 
     44 .. code-block:: bash
     45 
     46    ./mach awsy-test --base
     47 
     48 Running AWSY on Try
     49 ********************
     50 
     51 AWSY runs can be generated through the mach try fuzzy finder:
     52 
     53 .. code-block:: bash
     54 
     55    ./mach try fuzzy
     56 
     57 A query for "awsy" will return all AWSY tests. The default test is TP5, TP6 and Base test names will contain `tp6` and `base`, respectively.
     58 
     59 The following documents all tests we currently run for AWSY.
     60 *The following content was migrated from* https://wiki.mozilla.org/AWSY/Tests *and will be updated to clarify TP5/TP6 tests vs Base tests:* https://bugzilla.mozilla.org/show_bug.cgi?id=1714600
     61 
     62 
     63 TP5/TP6 Tests
     64 **************
     65 
     66 The following tests exist for both TP5 and TP6. Running `./mach awsy-test` by default will run TP6 tests*.
     67 To run TP5 tests, add the `--tp5` flag: `./mach awsy-test --tp5`
     68 
     69 *\*TP5 tests are out of date and no longer maintained. These tests are scheduled to be removed:* https://bugzilla.mozilla.org/show_bug.cgi?id=1712406
     70 
     71 
     72 Explicit Memory
     73 ================
     74 
     75 * This is memory explicitly reported by a memory reporter. It includes all the memory allocated via explicit calls to heap allocation functions (such as malloc and new), and some (only that covered by memory reporters) of the memory allocated via explicit calls to non-heap allocation functions (such as mmap and VirtualAlloc).
     76 
     77 **Possible regression causes**
     78 
     79 * A regression in this usually means a new feature is using or retaining more memory and should be looked at. These are easier to diagnose because we can compare memory reports.
     80 
     81 See the `about:memory` `mdn page <https://developer.mozilla.org/docs/Mozilla/Performance/about:memory#Explicit_Allocations>`__ for more details.
     82 
     83 
     84 Heap Unclassified
     85 ==================
     86 
     87 *to do: add test definition*
     88 
     89 
     90 Images
     91 =======
     92 
     93 * This is a subset of the "explicit" measurement that focuses on memory used to render images.
     94 
     95 **Possible regression causes**
     96 
     97 * A regression in this can indicate leaks or poor memory usage in the image subsystem. In the past this was a persistent problem.
     98 
     99 
    100 JS
    101 ====
    102 
    103 *to do: add test definition*
    104 
    105 
    106 Resident Memory
    107 ================
    108 
    109 * This is a higher level measurement provided by the operating system. We sum the "resident" memory (`RSS <https://en.wikipedia.org/wiki/Resident_set_size>`_) with the `resident-unique <https://en.wikipedia.org/wiki/Unique_set_size>`_ memory of the content processes. It's pretty noisy and large so it's not very useful in detecting smaller regressions.
    110 
    111 **Possible regression causes**
    112 
    113 * Regressions in this often track regressions in explicit and heap unclassified. If we see a regression in resident, but not in other reports this can indicate we are leaking untracked memory (perhaps through shared memory, graphics allocations, file handles, etc).
    114 
    115 
    116 Base Content Tests
    117 *******************
    118 
    119 * An updated test focused on supporting Fission. This measures the base overhead of an empty content process. It tracks resident unique, heap unclassified, JS, and explicit memory metrics as well as storing full memory reports as artifacts. The median value for each metric is used from across all content processes. It has much lower thresholds for alerting and is recorded in `Perfherder <https://wiki.mozilla.org/EngineeringProductivity/Projects/Perfherder>`_.
    120 
    121 
    122 Base Content Explicit
    123 ======================
    124 
    125 **Possible regression causes**
    126 
    127 A change has caused more JavaScript to load at startup or into blank pages.
    128 
    129 * **Common solution**: lazily load any new modules you rely on
    130 * **Common solution**: Split your code out to only load what is minimally needed initially. You modified the JS engine and it's using more memory
    131 * **Common solution**: Attempt to reduce your object size for the common case, these tend to add up! You implemented a new feature in JavaScript
    132 * **Common solution**: Write the majority (or all of it) in compiled code (C++/Rust). This will reduce overhead and generally improve performance.
    133 
    134 
    135 Base Content Heap Unclassified
    136 ===============================
    137 
    138 * The "heap-unclassified" value represents heap-allocated memory that is not measured by any memory reporter. This is typically 10-20% of "explicit".
    139 
    140 
    141 **Possible regression causes**
    142 
    143 * A regression in this can indicate that we're leaking memory or that additional memory reporters should be added.
    144 * An improvement can indicate that leaks have been fixed or that we added new memory reporters.
    145 
    146 See the `about:memory` `mdn page <https://developer.mozilla.org/docs/Mozilla/Performance/about:memory#Explicit_Allocations>`__ for more details.
    147 
    148 
    149 Base Content JS
    150 ================
    151 
    152 * This is the "js-main-runtime/" value in `about:memory` which is all the memory attributed to the javascript engine.
    153 
    154 **Possible regression causes**
    155 
    156 * A regression in this number can indicate leaks in the JS engine, optimizations that take performance into consideration at the expense of more memory, or problems with the garbage collector.
    157 
    158 
    159 Base Content Resident Unique Memory
    160 ====================================
    161 
    162 *to do: add test definition*
    163 
    164 
    165 Other references
    166 -----------------
    167 
    168 `Are We Slim Yet MDN web docs <https://developer.mozilla.org/en-US/docs/Mozilla/Performance/AWSY>`_