You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by yu...@apache.org on 2020/10/08 05:25:31 UTC

[thrift] branch master updated: THRIFT-5240: Tweak the default go server connectivity check interval

This is an automated email from the ASF dual-hosted git repository.

yuxuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new daf6209  THRIFT-5240: Tweak the default go server connectivity check interval
daf6209 is described below

commit daf620915714b76fce517b376b963440d1f34089
Author: Yuxuan 'fishy' Wang <yu...@reddit.com>
AuthorDate: Wed Oct 7 16:28:38 2020 -0700

    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 5b7e2cd..74e142b 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 68ac394..e9fea86 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.