Skip to content

Commit

Permalink
feat: configure default grpc server keepalive enforcement policy
Browse files Browse the repository at this point in the history
  • Loading branch information
mattisonchao committed Jan 14, 2025
1 parent 6cac0a0 commit 4cd94a7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions common/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ package container
import (
"context"
"crypto/tls"
"google.golang.org/grpc/keepalive"
"io"
"log/slog"
"net"
"os"
"time"

"github.com/streamnative/oxia/server/auth"

Expand All @@ -34,9 +36,10 @@ import (
)

const (
maxGrpcFrameSize = 256 * 1024 * 1024

ReadinessProbeService = "oxia-readiness"
maxGrpcFrameSize = 256 * 1024 * 1024
DefaultGrpcKeepAliveMinTime = 5 * time.Second
DefaultGrpcKeepPermitWithoutStream = true
ReadinessProbeService = "oxia-readiness"
)

type GrpcServer interface {
Expand Down Expand Up @@ -102,6 +105,10 @@ func newDefaultGrpcProvider(name, bindAddress string, registerFunc func(grpc.Ser
grpc.ChainStreamInterceptor(streamInterceptors...),
grpc.ChainUnaryInterceptor(unaryInterceptors...),
grpc.MaxRecvMsgSize(maxGrpcFrameSize),
grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
MinTime: DefaultGrpcKeepAliveMinTime,
PermitWithoutStream: DefaultGrpcKeepPermitWithoutStream,
}),
),
}
registerFunc(c.server)
Expand Down

0 comments on commit 4cd94a7

Please sign in to comment.