cmd/utils, eth/ethconfig: change default cache settings (#33975)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

This PR fixes a regression introduced in https://github.com/ethereum/go-ethereum/pull/33836/changes

Before PR 33836, running mainnet would automatically bump the cache size
to 4GB and trigger a cache re-calculation, specifically setting the key-value 
database cache to 2GB.
 
After PR 33836, this logic was removed, and the cache value is no longer
recomputed if no command line flags are specified. The default key-value 
database cache is 512MB.

This PR bumps the default key-value database cache size alongside the
default cache size for other components (such as snapshot) accordingly.
This commit is contained in:
rjl493456442 2026-03-09 23:18:18 +08:00 committed by GitHub
parent b08aac1dbc
commit b8a3fa7d06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 11 deletions

View file

@ -218,17 +218,11 @@ var (
Usage: "Max number of elements (0 = no limit)", Usage: "Max number of elements (0 = no limit)",
Value: 0, Value: 0,
} }
TopFlag = &cli.IntFlag{
Name: "top",
Usage: "Print the top N results",
Value: 5,
}
OutputFileFlag = &cli.StringFlag{ OutputFileFlag = &cli.StringFlag{
Name: "output", Name: "output",
Usage: "Writes the result in json to the output", Usage: "Writes the result in json to the output",
Value: "", Value: "",
} }
SnapshotFlag = &cli.BoolFlag{ SnapshotFlag = &cli.BoolFlag{
Name: "snapshot", Name: "snapshot",
Usage: `Enables snapshot-database mode (default = enable)`, Usage: `Enables snapshot-database mode (default = enable)`,
@ -490,7 +484,7 @@ var (
// Performance tuning settings // Performance tuning settings
CacheFlag = &cli.IntFlag{ CacheFlag = &cli.IntFlag{
Name: "cache", Name: "cache",
Usage: "Megabytes of memory allocated to internal caching (default = 4096 mainnet full node, 128 light mode)", Usage: "Megabytes of memory allocated to internal caching",
Value: 4096, Value: 4096,
Category: flags.PerfCategory, Category: flags.PerfCategory,
} }

View file

@ -59,11 +59,11 @@ var Defaults = Config{
StateHistory: pathdb.Defaults.StateHistory, StateHistory: pathdb.Defaults.StateHistory,
TrienodeHistory: pathdb.Defaults.TrienodeHistory, TrienodeHistory: pathdb.Defaults.TrienodeHistory,
NodeFullValueCheckpoint: pathdb.Defaults.FullValueCheckpoint, NodeFullValueCheckpoint: pathdb.Defaults.FullValueCheckpoint,
DatabaseCache: 512, DatabaseCache: 2048,
TrieCleanCache: 154, TrieCleanCache: 614,
TrieDirtyCache: 256, TrieDirtyCache: 1024,
SnapshotCache: 409,
TrieTimeout: 60 * time.Minute, TrieTimeout: 60 * time.Minute,
SnapshotCache: 102,
FilterLogCacheSize: 32, FilterLogCacheSize: 32,
LogQueryLimit: 1000, LogQueryLimit: 1000,
Miner: miner.DefaultConfig, Miner: miner.DefaultConfig,