-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime: 1.13.5 continuous CPU consumption with memory balast #36374
Comments
That 10 GiB ballast is freed (notice that inuse is 0) because the compiler determines the ballast value is no longer live before the sleep. The scavenger is trying to reclaim the space, so that object is not actually a ballast because it gets garbage collected. This is all WAI. It takes a while to return 10 GiB of memory back to the OS (pacing is 1 page per ms, in this case 4 KiB per ms => ~43 minutes) if the system doesn't support transparent huge pages, which darwin does not. I'm not sure why you're seeing 30% CPU utilization specifically, but when running any non-trivial application we haven't seen additional costs associated with the scavenger on that order of magnitude (in fact, it's paced to try to use about 1% of 1 CPU, which is consistent with performance regressions I've encountered). I suspect the increased CPU utilization is actually coming from the fact that scavenging prints very often in If you modify the program to instead be:
you'll notice that with |
@mknyszek ok thanks As a side note I have to mention that running without |
@pmalekn Interesting. I notice that you're running this inside docker (and maybe a linux image?)? It may be that docker's indirection makes the syscalls to return memory to the OS much more expensive, since running a linux image in docker on darwin spins up a VM. If I run it directly on darwin, I instead see utilization on the order of 6-7%. Still higher than expected but not as bad as 30%. |
@pmalekn I forgot to finish my last comment. On a separate note, in Go 1.14, the scavenger is now paced according to how long each scavenging operation actually took, so it's more likely to be close to 1%. Trying this out with Go 1.14 and the scavenger actually... halts. Sigh. This is related to #35788. But anyway the high utilization you're seeing is gone. |
@mknyszek I can confirm that running on MacOS it seems to be fixed. Without
and with
|
Same inside the container:
and inside the container with
|
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes (1.13.5)
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Run the following snippet
under
go1.13.5
andgo1.12.14
What did you expect to see?
No CPU being consumed on both versions
What did you see instead?
Continuous CPU consumption on
go1.13.5
.after adding
GODEBUG=gctrace=1
one can observe scavenger prints:The text was updated successfully, but these errors were encountered: