From a5a3efa7ae6f7288d88b8fce9a1b19deb04835d8 Mon Sep 17 00:00:00 2001 From: Yuxuan 'fishy' Wang Date: Wed, 7 Oct 2020 16:28:38 -0700 Subject: [PATCH] THRIFT-5240: Tweak the default go server connectivity check interval Client: go This is a follow up to 4db7a0af13ac9614e3e9758d42b2791040f4dc7e. 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]: https://github.com/golang/go/issues/27707 --- lib/go/README.md | 5 +++++ lib/go/thrift/simple_server.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/go/README.md b/lib/go/README.md index 5b7e2cd464..74e142b0f0 100644 --- a/lib/go/README.md +++ b/lib/go/README.md @@ -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. diff --git a/lib/go/thrift/simple_server.go b/lib/go/thrift/simple_server.go index 68ac394c6c..e9fea86d24 100644 --- a/lib/go/thrift/simple_server.go +++ b/lib/go/thrift/simple_server.go @@ -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.