Skip to content

Commit

Permalink
Log when using larger than default pruning cache (#7066)
Browse files Browse the repository at this point in the history
  • Loading branch information
asdacap committed May 23, 2024
1 parent 06b25d3 commit 44d31c1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Nethermind/Nethermind.Init/InitializeStateDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public Task Execute(CancellationToken cancellationToken)

if (pruningConfig.PruningBoundary < 64)
{
if (_logger.IsWarn) _logger.Warn($"Prunig boundary must be at least 64. Setting to 64.");
if (_logger.IsWarn) _logger.Warn($"Pruning boundary must be at least 64. Setting to 64.");
pruningConfig.PruningBoundary = 64;
}

Expand All @@ -98,6 +98,12 @@ public Task Execute(CancellationToken cancellationToken)
persistenceStrategy = persistenceStrategy.Or(triggerPersistenceStrategy);
}

if ((_api.NodeStorageFactory.CurrentKeyScheme != INodeStorage.KeyScheme.Hash || initConfig.StateDbKeyScheme == INodeStorage.KeyScheme.HalfPath)
&& pruningConfig.CacheMb > 2000)
{
if (_logger.IsWarn) _logger.Warn($"Detected {pruningConfig.CacheMb}MB of pruning cache config. Pruning cache more than 2000MB is not recommended as it may cause long memory pruning time which affect attestation.");
}

pruningStrategy = Prune
.WhenCacheReaches(pruningConfig.CacheMb.MB())
// Use of ratio, as the effectiveness highly correlate with the amount of keys per snapshot save which
Expand Down

0 comments on commit 44d31c1

Please sign in to comment.