Skip to content

Commit

Permalink
db: add comments to roLimiter field (#13921)
Browse files Browse the repository at this point in the history
ust to not worry about them in tests and small cli tools
  • Loading branch information
AskAlexSharov authored Feb 24, 2025
1 parent 0e7ed7f commit 0340631
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion erigon-lib/kv/mdbx/kv_mdbx.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ type MdbxOpts struct {
// must be in the range from 12.5% (almost empty) to 50% (half empty)
// which corresponds to the range from 8192 and to 32768 in units respectively
log log.Logger
roTxsLimiter *semaphore.Weighted
bucketsCfg TableCfgFunc
path string
syncPeriod time.Duration
Expand All @@ -78,6 +77,11 @@ type MdbxOpts struct {
label kv.Label // marker to distinct db instances - one process may open many databases. for example to collect metrics of only 1 database
inMem bool

// roTxsLimiter - without this limiter - it's possible to reach 10K threads (if 10K rotx will wait for IO) - and golang will crush https://groups.google.com/g/golang-dev/c/igMoDruWNwo
// most of db must set explicit `roTxsLimiter <= 9K`.
// There is way to increase the 10,000 thread limit: https://golang.org/pkg/runtime/debug/#SetMaxThreads
roTxsLimiter *semaphore.Weighted

metrics bool
}

Expand Down

0 comments on commit 0340631

Please sign in to comment.