add map size setter (#1050)

Add a bound the txpool db, rather than leaving it as the default of 2TB.
This is to reduce the page file profile when running multiple nodes from
around 3.5GB per txpool instance.

The current pool map side is set to 512MB - which seems reasonable with
16MB increments
This commit is contained in:
Mark Holt 2023-07-17 20:48:43 +01:00 committed by GitHub
parent 738be553b6
commit 32df191e7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,6 +105,7 @@ func AllComponents(ctx context.Context, cfg txpoolcfg.Config, cache kvcache.Cach
txPoolDB, err := mdbx.NewMDBX(log.New()).Label(kv.TxPoolDB).Path(cfg.DBDir). txPoolDB, err := mdbx.NewMDBX(log.New()).Label(kv.TxPoolDB).Path(cfg.DBDir).
WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TxpoolTablesCfg }). WithTableCfg(func(defaultBuckets kv.TableCfg) kv.TableCfg { return kv.TxpoolTablesCfg }).
Flags(func(f uint) uint { return f ^ mdbx2.Durable | mdbx2.SafeNoSync }). Flags(func(f uint) uint { return f ^ mdbx2.Durable | mdbx2.SafeNoSync }).
MapSize(512 * datasize.MB).
GrowthStep(16 * datasize.MB). GrowthStep(16 * datasize.MB).
SyncPeriod(30 * time.Second). SyncPeriod(30 * time.Second).
Open() Open()