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)
| 633 | // Notice: This API is EXPERIMENTAL and may be changed or removed in a |
| 634 | // later release. |
| 635 | func 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 |