Add new command line option --database-handles (#16796)

This allows tuning the go-leveldb OpenFilesCacheCapacity (capacity of
the open files) and thus improve performance by reducing the number of
open/close syscalls.
This commit is contained in:
Juergen Hoetzel 2018-09-06 18:55:37 +02:00
parent 580145e96d
commit d23ad53cb4
3 changed files with 9 additions and 1 deletions

View file

@ -92,6 +92,7 @@ var (
utils.CacheDatabaseFlag, utils.CacheDatabaseFlag,
utils.CacheGCFlag, utils.CacheGCFlag,
utils.TrieCacheGenFlag, utils.TrieCacheGenFlag,
utils.DatabaseHandles,
utils.ListenPortFlag, utils.ListenPortFlag,
utils.MaxPeersFlag, utils.MaxPeersFlag,
utils.MaxPendingPeersFlag, utils.MaxPendingPeersFlag,

View file

@ -134,6 +134,7 @@ var AppHelpFlagGroups = []flagGroup{
utils.CacheDatabaseFlag, utils.CacheDatabaseFlag,
utils.CacheGCFlag, utils.CacheGCFlag,
utils.TrieCacheGenFlag, utils.TrieCacheGenFlag,
utils.DatabaseHandles,
}, },
}, },
{ {

View file

@ -307,6 +307,11 @@ var (
Usage: "Number of trie node generations to keep in memory", Usage: "Number of trie node generations to keep in memory",
Value: int(state.MaxTrieCacheGen), Value: int(state.MaxTrieCacheGen),
} }
DatabaseHandles = cli.IntFlag{
Name: "database-handles",
Usage: "Number of file handles to use for database io",
Value: makeDatabaseHandles(),
}
// Miner settings // Miner settings
MiningEnabledFlag = cli.BoolFlag{ MiningEnabledFlag = cli.BoolFlag{
Name: "mine", Name: "mine",
@ -1136,7 +1141,8 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheDatabaseFlag.Name) { if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheDatabaseFlag.Name) {
cfg.DatabaseCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheDatabaseFlag.Name) / 100 cfg.DatabaseCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheDatabaseFlag.Name) / 100
} }
cfg.DatabaseHandles = makeDatabaseHandles()
cfg.DatabaseHandles = ctx.GlobalInt(DatabaseHandles.Name)
if gcmode := ctx.GlobalString(GCModeFlag.Name); gcmode != "full" && gcmode != "archive" { if gcmode := ctx.GlobalString(GCModeFlag.Name); gcmode != "full" && gcmode != "archive" {
Fatalf("--%s must be either 'full' or 'archive'", GCModeFlag.Name) Fatalf("--%s must be either 'full' or 'archive'", GCModeFlag.Name)