From e18162a63c692a5f9efcac1a6859df5ecf469716 Mon Sep 17 00:00:00 2001 From: lesismal Date: Sun, 18 Feb 2024 02:21:52 +0800 Subject: [PATCH] change default num of io eventloop to NumCPU()/4 or 1 --- nbhttp/engine.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nbhttp/engine.go b/nbhttp/engine.go index 7a32092a..09b85014 100644 --- a/nbhttp/engine.go +++ b/nbhttp/engine.go @@ -878,7 +878,10 @@ func NewEngine(conf Config) *Engine { conf.MaxLoad = DefaultMaxLoad } if conf.NPoller <= 0 { - conf.NPoller = 1 + conf.NPoller = runtime.NumCPU() / 4 + if conf.NPoller == 0 { + conf.NPoller = 1 + } } if conf.ReadLimit <= 0 { conf.ReadLimit = DefaultHTTPReadLimit