Spikard.GrpcConfig (spikard v0.15.6-rc.4)

Copy Markdown

Configuration for gRPC support

Controls how the server handles gRPC requests, including compression, timeouts, and protocol settings.

Stream Limits

This configuration enforces message-level size limits but delegates concurrent stream limiting to the HTTP/2 transport layer:

  • Message Size Limits: The max_message_size field is enforced per individual message (request or response) in both unary and streaming RPCs. When a single message exceeds this limit, the request is rejected with PAYLOAD_TOO_LARGE (HTTP 413).

  • Concurrent Stream Limits: The max_concurrent_streams is an advisory configuration passed to the HTTP/2 layer for connection-level stream negotiation. The HTTP/2 transport automatically enforces this limit and returns GOAWAY frames when exceeded. Applications should not rely on custom enforcement of this limit.

  • Stream Response Size Limits: The max_stream_response_bytes field caps the total encoded bytes emitted across a server-streaming or bidi-streaming response. When the cumulative size exceeds the limit, the stream is terminated with tonic::Status::resource_exhausted. Defaults to None (unbounded).

Example

let mut config = GrpcConfig::default();
config.max_message_size = 10 * 1024 * 1024; // 10MB per message
config.max_concurrent_streams = 50; // Advised to HTTP/2 layer

Summary

Types

t()

Configuration for gRPC support

Types

t()

@type t() :: %Spikard.GrpcConfig{
  enable_compression: boolean(),
  enable_keepalive: boolean(),
  enabled: boolean(),
  keepalive_interval: non_neg_integer(),
  keepalive_timeout: non_neg_integer(),
  max_concurrent_streams: non_neg_integer(),
  max_message_size: non_neg_integer(),
  max_stream_response_bytes: non_neg_integer() | nil,
  request_timeout: non_neg_integer() | nil
}

Configuration for gRPC support