Browse Source

fix too many pings

pull/7566/head
Chris Lu 5 days ago
parent
commit
2af1f24264
  1. 2
      other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java
  2. 6
      weed/pb/grpc_client_server.go

2
other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java

@ -81,7 +81,7 @@ public class FilerGrpcClient {
.flowControlWindow(16 * 1024 * 1024) .flowControlWindow(16 * 1024 * 1024)
.initialFlowControlWindow(16 * 1024 * 1024) .initialFlowControlWindow(16 * 1024 * 1024)
.maxHeaderListSize(16 * 1024 * 1024) .maxHeaderListSize(16 * 1024 * 1024)
.keepAliveTime(30, TimeUnit.SECONDS)
.keepAliveTime(60, TimeUnit.SECONDS)
.keepAliveTimeout(10, TimeUnit.SECONDS) .keepAliveTimeout(10, TimeUnit.SECONDS)
.keepAliveWithoutCalls(true) .keepAliveWithoutCalls(true)
.withOption(io.grpc.netty.shaded.io.netty.channel.ChannelOption.SO_RCVBUF, 16 * 1024 * 1024) .withOption(io.grpc.netty.shaded.io.netty.channel.ChannelOption.SO_RCVBUF, 16 * 1024 * 1024)

6
weed/pb/grpc_client_server.go

@ -52,12 +52,12 @@ func NewGrpcServer(opts ...grpc.ServerOption) *grpc.Server {
var options []grpc.ServerOption var options []grpc.ServerOption
options = append(options, options = append(options,
grpc.KeepaliveParams(keepalive.ServerParameters{ grpc.KeepaliveParams(keepalive.ServerParameters{
Time: 30 * time.Second, // wait time before ping if no activity (match client)
Time: 60 * time.Second, // wait time before ping if no activity (match client)
Timeout: 20 * time.Second, // ping timeout Timeout: 20 * time.Second, // ping timeout
// MaxConnectionAge: 10 * time.Hour, // MaxConnectionAge: 10 * time.Hour,
}), }),
grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
MinTime: 30 * time.Second, // min time a client should wait before sending a ping (match client)
MinTime: 60 * time.Second, // min time a client should wait before sending a ping (match client)
PermitWithoutStream: true, PermitWithoutStream: true,
}), }),
grpc.MaxRecvMsgSize(Max_Message_Size), grpc.MaxRecvMsgSize(Max_Message_Size),
@ -89,7 +89,7 @@ func GrpcDial(ctx context.Context, address string, waitForReady bool, opts ...gr
grpc.WaitForReady(waitForReady), grpc.WaitForReady(waitForReady),
), ),
grpc.WithKeepaliveParams(keepalive.ClientParameters{ grpc.WithKeepaliveParams(keepalive.ClientParameters{
Time: 30 * time.Second, // client ping server if no activity for this long
Time: 60 * time.Second, // client ping server if no activity for this long
Timeout: 20 * time.Second, Timeout: 20 * time.Second,
PermitWithoutStream: true, PermitWithoutStream: true,
})) }))

Loading…
Cancel
Save