mirror of
https://github.com/grassrootseconomics/eth-tracker.git
synced 2026-05-16 18:05:20 +02:00
perf: increase worker pool queue buffer size 1 -> ~4k
* Previosuly the worker queue pool buffer size was 1 which applies a backpressure on the fast missing blocks producer * Define our queue size and why we chose this value
This commit is contained in:
17
cmd/main.go
17
cmd/main.go
@@ -27,7 +27,12 @@ import (
|
||||
"github.com/knadh/koanf/v2"
|
||||
)
|
||||
|
||||
const defaultGracefulShutdownPeriod = time.Second * 30
|
||||
const (
|
||||
defaultGracefulShutdownPeriod = time.Second * 30
|
||||
|
||||
// 24 hrs worth of blocks
|
||||
defaultMaxQueueSize = 17_280
|
||||
)
|
||||
|
||||
var (
|
||||
build = "dev"
|
||||
@@ -113,8 +118,11 @@ func main() {
|
||||
poolOpts := pool.PoolOpts{
|
||||
Logg: lo,
|
||||
WorkerCount: ko.Int("core.pool_size"),
|
||||
// Immidiately allow processing of upto 6 hrs of missing blocks
|
||||
BlocksBuffer: defaultMaxQueueSize / 4,
|
||||
}
|
||||
if ko.Int("core.pool_size") <= 0 {
|
||||
// TODO: Benchamrk to determine optimum size
|
||||
poolOpts.WorkerCount = runtime.NumCPU() * 3
|
||||
}
|
||||
workerPool := pool.NewPool(poolOpts)
|
||||
@@ -155,9 +163,10 @@ func main() {
|
||||
}
|
||||
|
||||
backfiller := backfiller.New(backfiller.BackfillerOpts{
|
||||
DB: db,
|
||||
Logg: lo,
|
||||
Queue: queue,
|
||||
MaxQueueSize: defaultMaxQueueSize,
|
||||
DB: db,
|
||||
Logg: lo,
|
||||
Queue: queue,
|
||||
})
|
||||
|
||||
apiServer := &http.Server{
|
||||
|
||||
Reference in New Issue
Block a user