mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
Revert "Revert "apply --db.read.concurrency flag value when open embedded db "" (#5559)
This commit is contained in:
parent
e4ad73bcb4
commit
3c5625c72a
@ -384,7 +384,7 @@ var (
|
||||
DBReadConcurrencyFlag = cli.IntFlag{
|
||||
Name: "db.read.concurrency",
|
||||
Usage: "Does limit amount of parallel db reads. Default: equal to GOMAXPROCS (or number of CPU)",
|
||||
Value: cmp.Max(10, runtime.GOMAXPROCS(-1)*2),
|
||||
Value: cmp.Max(10, runtime.GOMAXPROCS(-1)*4),
|
||||
}
|
||||
RpcAccessListFlag = cli.StringFlag{
|
||||
Name: "rpc.accessList",
|
||||
|
@ -30,6 +30,7 @@ import (
|
||||
"github.com/c2h5oh/datasize"
|
||||
"github.com/ledgerwatch/erigon/node/nodecfg"
|
||||
"github.com/ledgerwatch/erigon/params"
|
||||
"golang.org/x/sync/semaphore"
|
||||
|
||||
"github.com/gofrs/flock"
|
||||
"github.com/ledgerwatch/erigon-lib/kv"
|
||||
@ -319,7 +320,12 @@ func OpenDatabase(config *nodecfg.Config, logger log.Logger, label kv.Label) (kv
|
||||
var openFunc func(exclusive bool) (kv.RwDB, error)
|
||||
log.Info("Opening Database", "label", name, "path", dbPath)
|
||||
openFunc = func(exclusive bool) (kv.RwDB, error) {
|
||||
opts := mdbx.NewMDBX(logger).Path(dbPath).Label(label).DBVerbosity(config.DatabaseVerbosity)
|
||||
roTxLimit := int64(16)
|
||||
if config.Http.DBReadConcurrency > 0 {
|
||||
roTxLimit = int64(config.Http.DBReadConcurrency)
|
||||
}
|
||||
roTxsLimiter := semaphore.NewWeighted(roTxLimit) // 1 less than max to allow unlocking to happen
|
||||
opts := mdbx.NewMDBX(logger).Path(dbPath).Label(label).DBVerbosity(config.DatabaseVerbosity).RoTxsLimiter(roTxsLimiter)
|
||||
if exclusive {
|
||||
opts = opts.Exclusive()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user