Skip to content

Commit

Permalink
server: explain more aboud MaxRoutines option (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
tocrafty authored Nov 13, 2023
1 parent c2bdf24 commit 3fde950
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,9 @@ type ServiceConfig struct {
TLSCert string `yaml:"tls_cert"` // Server TLS certificate.
CACert string `yaml:"ca_cert"` // CA certificate to validate client certificate.
ServerAsync *bool `yaml:"server_async,omitempty"` // Whether to enable server asynchronous mode.
// Maximum number of goroutines for server asynchronous mode.
// MaxRoutines is the maximum number of goroutines for server asynchronous mode.
// Requests exceeding MaxRoutines will be queued. Prolonged overages may lead to OOM!
// MaxRoutines is not the solution to alleviate server overloading.
MaxRoutines int `yaml:"max_routines"`
Writev *bool `yaml:"writev,omitempty"` // Whether to enable writev.
Transport string `yaml:"transport"` // Transport type.
Expand Down
2 changes: 2 additions & 0 deletions server/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ func WithWritev(writev bool) Option {
// MaxRoutines should be set to twice as expected number of routines (can be calculated by expected QPS),
// and larger than MAXPROCS.
// If MaxRoutines is not set or set to 0, it will be set to (1<<31 - 1).
// Requests exceeding MaxRoutines will be queued. Prolonged overages may lead to OOM!
// MaxRoutines is not the solution to alleviate server overloading.
func WithMaxRoutines(routines int) Option {
return func(o *Options) {
o.ServeOptions = append(o.ServeOptions, transport.WithMaxRoutines(routines))
Expand Down

0 comments on commit 3fde950

Please sign in to comment.