Closed ouvaa closed 6 months ago
for current version, please init NListener/NPoller in config when NewEngine:
g := nbio.NewEngine(nbio.Config{
Network: "tcp",
Addrs: []string{"localhost:8888"},
NPoller: M,
NListener: N,
})
go build -ldflags "-w -s" server.go
# command-line-arguments
./server.go:30:9: unknown field NListener in struct literal of type nbio.Config
1 event loop is worst performing, 3 seems ideal, how many should i have? how to set this optimally other than test it all the time?
usally, defalt configurations is good enough, if you want to optimize for your hardware specification, you need to do some test yourself.
another point, if you want to handle io with the balance between multi pollers goroutines, you can try to set nbio.Engine.NPoller=1 and nbio.Engine.AsyncRead=true, then the poller handle io event only, the reading will be handled in another goroutine pool, you can also customize the io goroutine pool by setting nbio.Engine.IOExecute func. that can avoid different num of connections handled in different pollers and cause different loads for each poller goroutine.
whatever you do to opt the performance, you should test it in your own env, because different env, input and output leads to different result.
@lesismal thank you
original
limited to 3 eventloops currently. Set NPoller but
changed to
how to resolve? want NPoller = NumCPU actually so 12 or more.