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

nsqd: add support for customise output-buffer-timeout #1125

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
1 change: 1 addition & 0 deletions apps/nsqd/nsqd.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func nsqdFlagSet(opts *nsqd.Options) *flag.FlagSet {
flagSet.Int64("max-rdy-count", opts.MaxRdyCount, "maximum RDY count for a client")
flagSet.Int64("max-output-buffer-size", opts.MaxOutputBufferSize, "maximum client configurable size (in bytes) for a client output buffer")
flagSet.Duration("max-output-buffer-timeout", opts.MaxOutputBufferTimeout, "maximum client configurable duration of time between flushing to a client")
flagSet.Duration("output-buffer-timeout", opts.OutputBufferTimeout, "default duration of time between flushing data to clients")

// statsd integration options
flagSet.String("statsd-address", opts.StatsdAddress, "UDP <addr>:<port> of a statsd daemon for pushing stats")
Expand Down
2 changes: 1 addition & 1 deletion nsqd/client_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func newClientV2(id int64, conn net.Conn, ctx *context) *clientV2 {
Writer: bufio.NewWriterSize(conn, defaultBufferSize),

OutputBufferSize: defaultBufferSize,
OutputBufferTimeout: 250 * time.Millisecond,
OutputBufferTimeout: ctx.nsqd.getOpts().OutputBufferTimeout,

MsgTimeout: ctx.nsqd.getOpts().MsgTimeout,

Expand Down
2 changes: 2 additions & 0 deletions nsqd/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type Options struct {
MaxRdyCount int64 `flag:"max-rdy-count"`
MaxOutputBufferSize int64 `flag:"max-output-buffer-size"`
MaxOutputBufferTimeout time.Duration `flag:"max-output-buffer-timeout"`
OutputBufferTimeout time.Duration `flag:"output-buffer-timeout"`

// statsd integration
StatsdAddress string `flag:"statsd-address"`
Expand Down Expand Up @@ -130,6 +131,7 @@ func NewOptions() *Options {
MaxRdyCount: 2500,
MaxOutputBufferSize: 64 * 1024,
MaxOutputBufferTimeout: 1 * time.Second,
OutputBufferTimeout: 250 * time.Millisecond,

StatsdPrefix: "nsq.%s",
StatsdInterval: 60 * time.Second,
Expand Down