Skip to content

Commit

Permalink
Add configuration XDS_CLIENT_MAX_MSG_SIZE_IN_BYTES (#797)
Browse files Browse the repository at this point in the history
* Add configuration CONFIG_GRPC_XDS_SERVER_CONNECT_RETRY_INTERVAL

Signed-off-by: Renuka Fernando <renukapiyumal@gmail.com>

* Update configuration name

Signed-off-by: Renuka Fernando <renukapiyumal@gmail.com>

---------

Signed-off-by: Renuka Fernando <renukapiyumal@gmail.com>
  • Loading branch information
renuka-fernando authored Jan 6, 2025
1 parent 38500fe commit 87adad2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -658,10 +658,14 @@ The xDS client in the Rate limit service configure Rate limit service with the p
In case of connection failures, the xDS Client retries the connection to the xDS server with exponential backoff and the backoff parameters are configurable.

1. `XDS_CLIENT_BACKOFF_JITTER`: set to `"true"` to add jitter to the exponential backoff.
2. `XDS_CLIENT_BACKOFF_INITIAL_INTERVAL`: The base amount of time the xDS client waits before retyring the connection after failure. Default: "10s"
2. `XDS_CLIENT_BACKOFF_INITIAL_INTERVAL`: The base amount of time the xDS client waits before retrying the connection after failure. Default: "10s"
3. `XDS_CLIENT_BACKOFF_MAX_INTERVAL`: The max backoff interval is the upper limit on the amount of time the xDS client will wait between retries. After reaching the max backoff interval, the next retries will continue using the max interval. Default: "60s"
4. `XDS_CLIENT_BACKOFF_RANDOM_FACTOR`: This is a factor by which the initial interval is multiplied to calculate the next backoff interval. Default: "0.5"

The followings are the gRPC connection options.

1. `XDS_CLIENT_MAX_MSG_SIZE_IN_BYTES`: The maximum message size in bytes that the xDS client can receive.

For more information on xDS protocol please refer to the [envoy proxy documentation](https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol).

You can refer to [the sample xDS configuration management server](examples/xds-sotw-config-server/README.md).
Expand Down
16 changes: 13 additions & 3 deletions src/provider/xds_grpc_sotw_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,23 @@ func (p *XdsGrpcSotwProvider) watchConfigs() {
func (p *XdsGrpcSotwProvider) getGrpcConnection() (*grpc.ClientConn, error) {
backOff := grpc_retry.BackoffLinearWithJitter(p.settings.ConfigGrpcXdsServerConnectRetryInterval, 0.5)
logger.Infof("Dialing xDS Management Server: '%s'", p.settings.ConfigGrpcXdsServerUrl)
return grpc.Dial(
p.settings.ConfigGrpcXdsServerUrl,
grpcOptions := []grpc.DialOption{
p.getGrpcTransportCredentials(),
grpc.WithBlock(),
grpc.WithStreamInterceptor(
grpc_retry.StreamClientInterceptor(grpc_retry.WithBackoff(backOff)),
))
),
}
maxRecvMsgSize := p.settings.XdsClientGrpcOptionsMaxMsgSizeInBytes
if maxRecvMsgSize != 0 {
logger.Infof("Setting xDS gRPC max receive message size to %d bytes", maxRecvMsgSize)
grpcOptions = append(grpcOptions,
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxRecvMsgSize)))
}
return grpc.Dial(
p.settings.ConfigGrpcXdsServerUrl,
grpcOptions...,
)
}

func (p *XdsGrpcSotwProvider) getGrpcTransportCredentials() grpc.DialOption {
Expand Down
3 changes: 3 additions & 0 deletions src/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ type Settings struct {
XdsClientBackoffRandomFactor float64 `envconfig:"XDS_CLIENT_BACKOFF_RANDOM_FACTOR" default:"0.5"`
XdsClientBackoffJitter bool `envconfig:"XDS_CLIENT_BACKOFF_JITTER" default:"true"`

// xDS client gRPC options
XdsClientGrpcOptionsMaxMsgSizeInBytes int `envconfig:"XDS_CLIENT_MAX_MSG_SIZE_IN_BYTES" default:""`

// Stats-related settings
UseDogStatsd bool `envconfig:"USE_DOG_STATSD" default:"false"`
UseDogStatsdMogrifiers []string `envconfig:"USE_DOG_STATSD_MOGRIFIERS" default:""`
Expand Down

0 comments on commit 87adad2

Please sign in to comment.