Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
An attempt to do something about #32472 and #28986 (also helps #29740 a bit).
In #28986, we basically see a live size alternating between x and 2x, and each x->2x transition was triggering an unnecessary full collection. What I'd like to do instead is full collect if (1) the heap has grown a lot since the last full collection, and (2) minor collections are not succeeding at reducing it. I tried to implement that by monitoring the
live_bytes
variable and looking for growth that lasts a couple minor collections.In #32472 we have very long pause times (for both major and minor, some nearly 500ms on my system), probably due to marking large numbers of Tasks. We have been keeping the collection interval a fairly small constant as long as minor collections are succeeding at freeing all new objects. That makes sense if minor collections are basically free, but if they get slow we need to back off the interval. I've been trying to do something timing-based, but it gets fairly unpredictable and complex. A simple approach I found was to allow the minor collect interval to be some fraction (half) of live_bytes. In many workloads, the collect interval is actually much larger than the number of live bytes, so allowing it to scale this way seems reasonably conservative to me.
Finally, for some reason we were resetting the interval to
default_collect_interval / 2
. Does anybody know why? I traced that to 7c8acce (5 years ago). I mean, it's calleddefault_collect_interval
, nottwice_default_collect_interval
.