Refactor segment size computation #71178
Merged
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.
This change fixes the working set regression when running the JSON TechEmpower benchmark on Windows under a container. Here is a summary of the performance data:
Segments:
Max Working Set (MB) | 134
Regions before fix:
Max Working Set (MB) | 339
Regions after fix:
Max Working Set (MB) | 135
There is no significant difference between regions after fix and segment on other metrics we measured.
Cause of the regression:
The concept of SOH segment sizes does not exists on regions, but since the variable
soh_segment_sizeis used in various performance tuning functions, we were hard coding that to 4G for workstation GC and 1G for server GC. It was mostly okay, but in an extreme situation like in this benchmark, we have only 512MB of memory but we are running on a machine with 28 cores => 28 heaps. Thesoh_segment_sizeis reduced significantly in the segment's case but we still use the same value under the region's case. This causes the performance tuning function to behave very differently and leads to regression.Solution:
We keep the existing computation of the
soh_segment_sizelogic under regions so that it will get back to what it was.