Skip to content

Commit

Permalink
Add gRPC initial win size of 4MB for less latency
Browse files Browse the repository at this point in the history
  • Loading branch information
Emad Mohamadi committed Jan 10, 2023
1 parent d8d76ca commit 37e23b3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions carbonserver/carbonserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2084,14 +2084,16 @@ func (listener *CarbonserverListener) ListenGRPC(listen string) error {
}

var opts []grpc.ServerOption
opts = append(opts, grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
MinTime: 10 * time.Second,
PermitWithoutStream: true,
}))
opts = append(opts, grpc.KeepaliveParams(keepalive.ServerParameters{
Time: 60 * time.Second,
Timeout: 20 * time.Second,
}))
opts = append(opts,
grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
MinTime: 10 * time.Second,
PermitWithoutStream: true,
}),
grpc.KeepaliveParams(keepalive.ServerParameters{
Time: 60 * time.Second,
Timeout: 20 * time.Second,
}))
opts = append(opts, grpc.InitialWindowSize(4*1024*1024), grpc.InitialConnWindowSize(4*1024*1024))
opts = append(opts, grpc.ChainStreamInterceptor(
grpcutil.StreamServerTimeHandler(listener.bucketRequestTimesGRPC),
grpcutil.StreamServerStatusMetricHandler(statusCodes, listener.prometheus.request),
Expand Down

0 comments on commit 37e23b3

Please sign in to comment.