Repository navigation
Prevent GC during NewPayload - #5381
LukaszRozmej wants to merge 28 commits into
Conversation
kkokosa
left a comment
There was a problem hiding this comment.
Definitely worth trying IMHO. We can play with different totalSize to observe the result.
The only tricky thing is this API is tricky, likes to throw exceptions. Especially EndNoGCRegion throws InvalidOperationException when:
-
The garbage collector is not in no GC region latency mode
-
The no GC region latency mode was ended previously because a garbage collection was induced
-
A memory allocation exceeded the amount specified in the call to the TryStartNoGCRegion method
As docs are saying, the more safe approach is always to:
if (GCSettings.LatencyMode == GCLatencyMode.NoGCRegion)
GC.EndNoGCRegion();But maybe I'd put it in separe try-catch, just in case 😇
|
Some stats: During sync - we want to have GC running fairly normally as it needs to run when it needs to run, we allocate too much. Having this during sync slowed the sync times about 30%, so I created the strategy and don't do anything during sync. With this change we stay happily at 6-8GB of memory, making Nethermind staking at 16GB memory a viable option. |
|
How long does it take per GC btw? |
There was a problem hiding this comment.
I think it would be great to run two nodes with and without this PR on similar hardware for a bit longer time. From my observation, we could sometimes have and don't have spikes on the node, and the observation after restarting with changes might be not correct. Of course, PR looks very interesting
|
Ok so summary: Without compacting the total memory usage creeps over time, with it, it stays quite contained. So I will advocate for being aggressive now and loose if we find anything wrong with this setup. I would like to merge it now. Feel free to experiment with it and tune it if you think it is needed. I''ve taken some dottrace sessions but they don't work for me, getting some error when opening them :/ |
Co-authored-by: Ben Adams <[email protected]>
|
We can disable this by default first and still merge it. |
Agreed :) |
|
Merging with feature flag disabled by default seems safe but there are some minor changes not covered by this flag, like in |
reduces default GC generation to 1, renames
|
With Gen2 compacting collections GC took 2% of the time of node operation. |
|
Some collected observations during a weekend. On sepolia and goerli I tested GC1 and GC2 approach Seems like GC2 collection works better on weak setup (goerli and sepolia are running on quite weak hardware). Issue found during testing - Nethermind process stops responding at all. Also it appeared on mainnet validator (setup by @matilote). On Validator node with not best hardware (details below) it got freezed in around 15 minutes so this is really worrying for users which are running on weak or ARM setups. |
|
I want to mention #5457 that looks to be trimming allocs a bit. Will be report further after running it for a full day. |
Allow compacting LOH, Add constants
|
Mean execution times go from 700+ to 500+ms. Spikes while still there are less likely and generally lower, they are not totally eliminated though. |
Decrease the delays to 100ms Only force GC when LatencyMode is not NoGCRegion
|
Closing in favor of #5504 due to dotnet runtime bug hanging all the threads because of |




Changes
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Metrics