Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: explain more aboud MaxRoutines option #137

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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