Closed Bug 1632139 Opened 5 years ago Closed 5 years ago

Recalculate heap thresholds only once at the end of GC

Categories

(Core :: JavaScript: GC, task, P1)

task

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: jonco, Assigned: jonco)

Details

Attachments

(1 file)

Currently the GC heap thresholds for each zone are recalculated:

  1. Once when we finish foreground sweeping in the zone, and then
  2. Periodically when sweeping background things in the zone

Since the threashold is based on the retained GC bytes in the zone and this value is not correct until background sweeping has finished, the value calculated for a zone changes substantially over the course of a single GC. Specifically, there is a large increase in the threshold when forground sweeping finishes and then it falls linearly as more data is freed until it reaches its final value.

It would make more sense to calculate this once at the end, when the size of retained data is know, but when we tried that we discovered that some benchmarks (mainly splay latency) rely on the current behaviour.

Splay is a benchmark that contantly allocates, yet the size of reachable data remains roughly constant. Currently we end up triggering incremental GC slices which allows us to have a resonable score on the latency part of the benchmark.

The effect of only recalculating zone thresholds at the end of the GC is that we exceed the non-incremental threshold during the GC, and this introduces pauses that greatly reduce our latency score. This is because the initial increase in the threshold prevents non-incremental GC from kicking in while we are sweeping.

The solution to all of this is probably to raise the non-incremental threshold, but I don't want to do that until we've got some fallback in place to make sure the GC is keeping up with allocation. Instead the aim of this bug is to calculate the thresholds once at the end but add an explicit hack to increase the non-incremental threshold during background sweeping so that we don't regress our benchmark scores.

Attachment #9142381 - Attachment description: Bug 1632139 - Recalculate GC thresholds once at the end of GC r?sfink → Bug 1632139 - Recalculate GC thresholds once at the end of GC r=sfink!
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/48fa3b9b098e Recalculate GC thresholds once at the end of GC r=sfink
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: