lnd.xprv/lncfg/workers.go
Conner Fromknecht 60467bef7b
lncfg/workers: bump default read/write workers from 16 -> 100
Bumps the default read and write handlers to be well
above the average number of peers a node has. Since
the worker counts specify only a maximum number of
concurrent read/write workers, it is expected that
the actual usage would converge to the requirements
of the node anyway. However, in preparation for a
major release, this is a conservative measure to
ensure that the default values aren't too low and
improve network instability.
2019-03-26 16:40:57 -07:00

50 lines
1.4 KiB
Go

package lncfg
import "fmt"
const (
// DefaultReadWorkers is the default maximum number of concurrent
// workers used by the daemon's read pool.
DefaultReadWorkers = 100
// DefaultWriteWorkers is the default maximum number of concurrent
// workers used by the daemon's write pool.
DefaultWriteWorkers = 100
// DefaultSigWorkers is the default maximum number of concurrent workers
// used by the daemon's sig pool.
DefaultSigWorkers = 8
)
// Workers exposes CLI configuration for turning resources consumed by worker
// pools.
type Workers struct {
// Read is the maximum number of concurrent read pool workers.
Read int `long:"read" description:"Maximum number of concurrent read pool workers."`
// Write is the maximum number of concurrent write pool workers.
Write int `long:"write" description:"Maximum number of concurrent write pool workers."`
// Sig is the maximum number of concurrent sig pool workers.
Sig int `long:"sig" description:"Maximum number of concurrent sig pool workers."`
}
// Validate checks the Workers configuration to ensure that the input values are
// sane.
func (w *Workers) Validate() error {
if w.Read <= 0 {
return fmt.Errorf("number of read workers (%d) must be "+
"positive", w.Read)
}
if w.Write <= 0 {
return fmt.Errorf("number of write workers (%d) must be "+
"positive", w.Write)
}
if w.Sig <= 0 {
return fmt.Errorf("number of sig workers (%d) must be "+
"positive", w.Sig)
}
return nil
}