Skip to content

Commit

Permalink
design: add initial conditions section to GC pacer redesign
Browse files Browse the repository at this point in the history
I realized I neglected to talk about initial conditions, even though all
the simulations clearly set *something*.

For golang/go#44167.

Change-Id: Ia1727d5c068847e9192bf87bc1b6a5f0bb832303
Reviewed-on: https://go-review.googlesource.com/c/proposal/+/295509
Reviewed-by: Michael Pratt <mpratt@google.com>
  • Loading branch information
mknyszek committed Feb 23, 2021
1 parent 34a9c69 commit e46d17d
Show file tree
Hide file tree
Showing 39 changed files with 48 additions and 1 deletion.
23 changes: 22 additions & 1 deletion design/44167-gc-pacer-redesign.md
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,27 @@ condition to include these limits.
It's not important to put these limits in the rest of the pacer because it no
longer tries to compute the trigger point ahead of time.

### Initial conditions

Like today, the pacer has to start somewhere for the first GC.
I propose we carry forward what we already do today: set the trigger point at
7/8ths of the first heap goal, which will always be the minimum heap size.
If GC 1 is the first GC, then in terms of the math above, we choose to avoid
defining ![`M_0`](44167/inl27.png), and instead directly define

![Equation 8](44167/eqn8.png)

The definition of ![`P_0`](44167/inl28.png) is necessary for the GC assist
pacer.

Furthermore, the PI controller's state will be initialized to zero otherwise.

These choices are somewhat arbitrary, but the fact is that the pacer has no
knowledge of the progam's past behavior for the first GC.
Naturally the behavior of the GC will always be a little odd, but it should, in
general, stabilize quite quickly (note that this is the case in each scenario
for the [simulations](#simulations).

## A note about CPU utilization

This document uses the term "GC CPU utilization" quite frequently, but so far
Expand All @@ -591,7 +612,7 @@ time all goroutines spend in GC assists.
The latter is computed directly, but is just the difference between the start
and end time in the critical section; it does not try to account for context
switches forced by the underlying system, or anything like that.
Now take this value we just computed and divide it by ![`T`](44167/inl27.png).
Now take this value we just computed and divide it by ![`T`](44167/inl29.png).
That's our GC CPU utilization.

This approximation is mostly accurate in the common case, but is prone to skew
Expand Down
Binary file modified design/44167/eqn1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/eqn2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/eqn3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/eqn4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/eqn5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/eqn6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/eqn7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/eqn8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions design/44167/gc-pacer-redesign.src.md
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,32 @@ condition to include these limits.
It's not important to put these limits in the rest of the pacer because it no
longer tries to compute the trigger point ahead of time.

### Initial conditions

Like today, the pacer has to start somewhere for the first GC.
I propose we carry forward what we already do today: set the trigger point at
7/8ths of the first heap goal, which will always be the minimum heap size.
If GC 1 is the first GC, then in terms of the math above, we choose to avoid
defining `$M_0$`, and instead directly define

```render-latex
\begin{aligned}
N_1 & = \textrm{minimum heap size} \\
T_1 & = \frac{7}{8} N_1 \\
P_0 & = 0
\end{aligned}
```

The definition of `$P_0$` is necessary for the GC assist pacer.

Furthermore, the PI controller's state will be initialized to zero otherwise.

These choices are somewhat arbitrary, but the fact is that the pacer has no
knowledge of the progam's past behavior for the first GC.
Naturally the behavior of the GC will always be a little odd, but it should, in
general, stabilize quite quickly (note that this is the case in each scenario
for the [simulations](#simulations).

## A note about CPU utilization

This document uses the term "GC CPU utilization" quite frequently, but so far
Expand Down
Binary file modified design/44167/inl1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl21.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl23.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/44167/inl25.png
Binary file modified design/44167/inl26.png
Binary file added design/44167/inl27.png
Binary file added design/44167/inl28.png
Binary file added design/44167/inl29.png
Binary file modified design/44167/inl3.png
Binary file modified design/44167/inl4.png
Binary file modified design/44167/inl5.png
Binary file modified design/44167/inl6.png
Binary file modified design/44167/inl7.png
Binary file modified design/44167/inl8.png
Binary file modified design/44167/inl9.png

0 comments on commit e46d17d

Please sign in to comment.