build up space for GC and main thread/statsd

This commit is contained in:
Andre Medeiros 2021-07-07 22:34:57 -04:00
parent ff6bbf2a6f
commit e56483dbb7

View file

@ -30,7 +30,7 @@ type application struct {
} }
var ( var (
workers int = runtime.NumCPU() * 6 workers int = runtime.NumCPU() * 4
rate float64 = 0.1 rate float64 = 0.1
backoff int = 5 backoff int = 5
) )
@ -209,8 +209,8 @@ func main() {
) )
// This is a very conservative value -- seen as most of the work that is done in these jobs is // This is a very conservative value -- seen as most of the work that is done in these jobs is
// // waiting around for IO.
runtime.GOMAXPROCS(workers) runtime.GOMAXPROCS(workers + 2) // + 2 for main thread and GC.
quitCh := make(chan bool, workers) quitCh := make(chan bool, workers)
for i := 0; i < workers; i++ { for i := 0; i < workers; i++ {
go accountWorker(i, rc, db, logger, statsd, quitCh) go accountWorker(i, rc, db, logger, statsd, quitCh)