diff --git a/config.go b/config.go index bfa2441..6ea24e6 100644 --- a/config.go +++ b/config.go @@ -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. diff --git a/server/options.go b/server/options.go index 55d9907..177a05d 100644 --- a/server/options.go +++ b/server/options.go @@ -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))