Increase limit for internal blocking IO vs num cores.

Will help in slow IO situations and lots of expire cache calls.

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2023-02-13 18:44:25 +02:00
parent 1e3c2810f4
commit e2f9fb73a9

View File

@@ -30,7 +30,6 @@ import (
"net"
"os"
"path/filepath"
"runtime"
"sort"
"strings"
"sync"
@@ -6449,12 +6448,8 @@ var dios chan struct{}
// Used to setup our simplistic counting semaphore using buffered channels.
// golang.org's semaphore seemed a bit heavy.
func init() {
// Minimum for blocking disk IO calls.
const minNIO = 4
nIO := runtime.GOMAXPROCS(0)
if nIO < minNIO {
nIO = minNIO
}
// Based on Go max threads of 10k, limit ourselves to a max of 1k blocking IO calls.
const nIO = 1024
dios = make(chan struct{}, nIO)
// Fill it up to start.
for i := 0; i < nIO; i++ {