MCPcopy
hub / github.com/grpc/grpc-go / NumStreamWorkers

Function NumStreamWorkers

server.go:635–643  ·  view source on GitHub ↗

NumStreamWorkers returns a ServerOption that sets the number of worker goroutines that should be used to process incoming streams. Setting this to zero (default) will disable workers and spawn a new goroutine for each stream. # Experimental Notice: This API is EXPERIMENTAL and may be changed or re

(numServerWorkers uint32)

Source from the content-addressed store, hash-verified

633// Notice: This API is EXPERIMENTAL and may be changed or removed in a
634// later release.
635func NumStreamWorkers(numServerWorkers uint32) ServerOption {
636 // TODO: If/when this API gets stabilized (i.e. stream workers become the
637 // only way streams are processed), change the behavior of the zero value to
638 // a sane default. Preliminary experiments suggest that a value equal to the
639 // number of CPUs available is most performant; requires thorough testing.
640 return newFuncServerOption(func(o *serverOptions) {
641 o.numServerWorkers = numServerWorkers
642 })
643}
644
645// WaitForHandlers cause Stop to wait until all outstanding method handlers have
646// exited before returning. If false, Stop will return as soon as all

Calls 1

newFuncServerOptionFunction · 0.85