Skip to content

Commit

Permalink
THRIFT-5240: Tweak the default go server connectivity check interval
Browse files Browse the repository at this point in the history
Client: go

This is a follow up to 4db7a0a.

Because of the Go runtime bug [1], the previous default value of 1ms is
not a great default as it could cause excessive cpu usage. Use 5ms
instead as a balance between being useful and not causing too much cpu
overhead.

It's still configurable.

[1]: golang/go#27707
  • Loading branch information
fishy committed Oct 8, 2020
1 parent 6d57026 commit daf6209
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,9 @@ main function:

thrift.ServerConnectivityCheckInterval = 0

Please be advised that due to a
[Go runtime bug](https://github.com/golang/go/issues/27707), currently
if this interval is set to a value too low (for example, 1ms), it might cause
excessive cpu overhead.

This feature is also only enabled on non-oneway endpoints.
2 changes: 1 addition & 1 deletion lib/go/thrift/simple_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var ErrAbandonRequest = errors.New("request abandoned")
// implementations can change its value to control the behavior.
//
// If it's changed to <=0, the feature will be disabled.
var ServerConnectivityCheckInterval = time.Millisecond
var ServerConnectivityCheckInterval = time.Millisecond * 5

/*
* This is not a typical TSimpleServer as it is not blocked after accept a socket.
Expand Down

0 comments on commit daf6209

Please sign in to comment.