You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
•bgamari> nonmoving collector reduces the average gen1 pause of ghcide from >350ms to ~10ms
6:36 PM <mpickering> That sounds promising
6:36 PM <mpickering> How much residency is there?
6:37 PM <•bgamari> maximum goes from 1s to 60ms
6:37 PM <•bgamari> bytes copied goes down to a factor of 8
For the record, this measurement was taken by an ad hoc editing session against the lens library. I am currently working on a more systematic measurement.
I have checked again with ghc 8.10.3 and it seems to work pretty well. The crashes are gone. I have seen one crash with --nonmoving-gc -A128M enabled, but it's extremely hard to reproduce and could be something else:
ghcide: internal error: SMALL_MUT_ARR_PTRS_FROZEN_CLEAN object (0x4228156f38) entered!
(GHC version 8.10.3 for x86_64_apple_darwin)
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
I also collected some performance numbers using the benchmark suite. Overall, the timings were similar or slightly worse in most benchmarks. I wasn't able to find a set of GC flags using --nonmoving-gc that showed an improvement over the ones we use right now (-A128M -qg -I0). But I did notice that -qg, which disables the parallel GC, is a net loss - all the benchmarks are faster without it.
For the edit experiment in the lsp-types example the chart below shows the live bytes over time (as reported by -S) for various configurations over 100 samples:
@pepeiborra Thanks for looking into this. I will ask about the panic you are seeing.
Isn't the idea behind using the nonmoving-gc to reduce the pause times? This is interesting for us because if the pause happens when serving a request then the user will notice it. For example, if you hover, then a GC kicks in for 1-2s then the hover response will also be delayed. With the nonmoving-gc then the pause will be shorter and therefore a smoother experience for the user, even if it's slightly slower.
changed the title [-]Experiment using concurrent garbage collector[/-][+][documentation] Experiment using concurrent garbage collector[/+]on Jul 13, 2022
Activity
pepeiborra commentedon Apr 4, 2020
I gave
-xn -I1
a try and got all kinds of crashing after a few minutes of loading the ghcide codebase in VSCode:I also checked that these problems did not reproduce without
-xn
. I cannot repro without-I1
either, i.e. just-xn
(ghcide is built with-rtsopts -I0
)Will open tickets upstream for @bgamari and @osa1 to investigate
EDIT: Updated to account for
-I1
pepeiborra commentedon Apr 4, 2020
Backtrace from
gdb
:bgamari commentedon Apr 4, 2020
Thanks @pepeiborra! I'm looking into it (although do open a GHC ticket as well)
pepeiborra commentedon Apr 4, 2020
Raised https://gitlab.haskell.org/ghc/ghc/issues/18016
mpickering commentedon May 2, 2020
Fix is in this MR: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3186
Ben reports
bgamari commentedon May 2, 2020
For the record, this measurement was taken by an ad hoc editing session against the
lens
library. I am currently working on a more systematic measurement.jneira commentedon Oct 5, 2020
@pepeiborra the ghc mr is merged, did it fixed the problems with the concurrent garbage collector?
pepeiborra commentedon Oct 5, 2020
I haven't checked
pepeiborra commentedon Jan 3, 2021
I have checked again with ghc 8.10.3 and it seems to work pretty well. The crashes are gone. I have seen one crash with
--nonmoving-gc -A128M
enabled, but it's extremely hard to reproduce and could be something else:I also collected some performance numbers using the benchmark suite. Overall, the timings were similar or slightly worse in most benchmarks. I wasn't able to find a set of GC flags using
--nonmoving-gc
that showed an improvement over the ones we use right now (-A128M -qg -I0
). But I did notice that-qg
, which disables the parallel GC, is a net loss - all the benchmarks are faster without it.For the edit experiment in the lsp-types example the chart below shows the live bytes over time (as reported by
-S
) for various configurations over 100 samples:-A128M -qg -I0
-qg -I0
-A128M -I0
-A64M -qg -I0
--nonmoving-gc -A64M
-qg -I0 --nonmoving-gc
Branch to reproduce: https://github.com/pepeiborra/ide/tree/benchmark-rts-opts-nm
mpickering commentedon Jan 4, 2021
@pepeiborra Thanks for looking into this. I will ask about the panic you are seeing.
Isn't the idea behind using the nonmoving-gc to reduce the pause times? This is interesting for us because if the pause happens when serving a request then the user will notice it. For example, if you hover, then a GC kicks in for 1-2s then the hover response will also be delayed. With the nonmoving-gc then the pause will be shorter and therefore a smoother experience for the user, even if it's slightly slower.
pepeiborra commentedon Jan 4, 2021
Yes, that's correct. To measure pauses the benchmark suite needs to be extended to show max time (in addition to total time which it currently does).
fishtreesugar commentedon Jun 24, 2022
https://twitter.com/monadiccheng/status/1539583255317446658 by @TerrorJack
[-]Experiment using concurrent garbage collector[/-][+][documentation] Experiment using concurrent garbage collector[/+]hasufell commentedon Jul 13, 2022
Since this works, can someone raise a PR to add this to the documentation for experimentation friendly users?