mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-08 07:58:40 +00:00
add --bal.prefetchworkers flag to parameterize state loading concurrency when executing with BALs
This commit is contained in:
parent
5c101bba03
commit
10314a1fe1
3 changed files with 13 additions and 1 deletions
|
|
@ -159,6 +159,7 @@ var (
|
|||
utils.BeaconCheckpointFlag,
|
||||
utils.BeaconCheckpointFileFlag,
|
||||
utils.LogSlowBlockFlag,
|
||||
utils.PrefetchWorkersFlag,
|
||||
}, utils.NetworkFlags, utils.DatabaseFlags)
|
||||
|
||||
rpcFlags = []cli.Flag{
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
godebug "runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -713,6 +714,13 @@ var (
|
|||
Category: flags.MiscCategory,
|
||||
}
|
||||
|
||||
PrefetchWorkersFlag = &cli.UintFlag{
|
||||
Name: "bal.prefetchworkers",
|
||||
Usage: "The number of concurrent state loading tasks to perform when prefetching BAL state. Default to the number of cpus",
|
||||
Value: uint(runtime.NumCPU()),
|
||||
Category: flags.MiscCategory,
|
||||
}
|
||||
|
||||
// RPC settings
|
||||
IPCDisabledFlag = &cli.BoolFlag{
|
||||
Name: "ipcdisable",
|
||||
|
|
@ -2459,6 +2467,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
|
|||
TrienodeHistory: ctx.Int64(TrienodeHistoryFlag.Name),
|
||||
NodeFullValueCheckpoint: uint32(ctx.Uint(TrienodeHistoryFullValueCheckpointFlag.Name)),
|
||||
|
||||
PrefetchWorkers: int(ctx.Uint(PrefetchWorkersFlag.Name)),
|
||||
// Disable transaction indexing/unindexing.
|
||||
TxLookupLimit: -1,
|
||||
|
||||
|
|
|
|||
|
|
@ -211,6 +211,8 @@ type BlockChainConfig struct {
|
|||
Overrides *ChainOverrides // Optional chain config overrides
|
||||
VmConfig vm.Config // Config options for the EVM Interpreter
|
||||
|
||||
PrefetchWorkers int // number of concurrent go-routines for BAL state prefetching
|
||||
|
||||
// TxLookupLimit specifies the maximum number of blocks from head for which
|
||||
// transaction hashes will be indexed.
|
||||
//
|
||||
|
|
@ -597,7 +599,7 @@ func (bc *BlockChain) processBlockWithAccessList(parentRoot common.Hash, block *
|
|||
useAsyncReads := bc.cfg.BALExecutionMode != bal.BALExecutionNoBatchIO
|
||||
al := block.AccessList() // TODO: make the return of this method not be a pointer
|
||||
accessListReader := bal.NewAccessListReader(*al)
|
||||
prefetchReader, err := sdb.ReaderEIP7928(parentRoot, accessListReader.StorageKeys(useAsyncReads), runtime.NumCPU())
|
||||
prefetchReader, err := sdb.ReaderEIP7928(parentRoot, accessListReader.StorageKeys(useAsyncReads), bc.cfg.PrefetchWorkers)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue