Chronicle gRPC message size configuration
Increase a Chronicle .NET client’s gRPC message limit when a request or response exceeds its configured size. Client send and receive limits default to 100 MiB each; the kernel has separate limits, so changing the client alone may not let a large message through.
Default Settings
Section titled “Default Settings”The .NET client’s MaxReceiveMessageSize and MaxSendMessageSize each default to 104,857,600 bytes (100 MiB). They limit individual messages, not the total data transferred over a connection.
A request must fit both the client’s send limit and the kernel’s receive limit. A response must fit the kernel’s send limit, if set, and the client’s receive limit.
Configuring Message Sizes
Section titled “Configuring Message Sizes”Set the limits in ChronicleOptions before creating the client. This example raises both client limits to 200 MiB:
public static class GrpcMessageSizeConfiguration{ public static ChronicleClient Create() { var options = new ChronicleOptions { ConnectionString = "chronicle://localhost:35000", MaxReceiveMessageSize = 200 * 1024 * 1024, // 200 MB MaxSendMessageSize = 200 * 1024 * 1024 // 200 MB };
return new ChronicleClient(options); }}import io.cratis.chronicle.ChronicleOptions
fun optionsWithLargerMessages(): ChronicleOptions = ChronicleOptions.fromConnectionString("chronicle://localhost:35000") .withMaxReceiveMessageSize(200 * 1024 * 1024) // 200 MBimport io.cratis.chronicle.ChronicleOptions;
class MessageSizeConfiguration { ChronicleOptions create() { return ChronicleOptions.fromConnectionString("chronicle://localhost:35000") .withMaxReceiveMessageSize(200 * 1024 * 1024); // 200 MB }}Elixir does not support this workflow yet.import { ChronicleOptions } from '@cratis/chronicle';
function createOptionsWithLargerMessages(): ChronicleOptions { return ChronicleOptions.fromConnectionString('chronicle://localhost:35000', { maxReceiveMessageSize: 200 * 1024 * 1024, // 200 MB maxSendMessageSize: 200 * 1024 * 1024 // 200 MB });}Configuration via appsettings.json
Section titled “Configuration via appsettings.json”For a hosted .NET application, set the same properties under Cratis:Chronicle in appsettings.json. These settings are bound when you register Chronicle with AddCratisChronicle:
{ "Cratis": { "Chronicle": { "ConnectionString": "chronicle://localhost:35000", "MaxReceiveMessageSize": 209715200, "MaxSendMessageSize": 209715200 } }}Configuration via Environment Variables
Section titled “Configuration via Environment Variables”To change the client’s limits through its environment, use the following keys. .NET maps __ to nested configuration sections:
Cratis__Chronicle__MaxReceiveMessageSize=209715200Cratis__Chronicle__MaxSendMessageSize=209715200Server limits
Section titled “Server limits”The kernel’s receive limit defaults to 100 MiB. If you increase the client’s send limit to 200 MiB, also increase the kernel’s receive limit before sending messages that large.
Set these values in the kernel’s configuration, not the application’s client configuration:
{ "maxReceiveMessageSize": 209715200, "maxSendMessageSize": 209715200}Cratis__Chronicle__MaxReceiveMessageSize=209715200Cratis__Chronicle__MaxSendMessageSize=209715200The kernel’s send size is unlimited unless you set it. The environment-variable names match the client’s names, but must be applied to the kernel process to change its limits. See Root Properties.
Understanding the Error
Section titled “Understanding the Error”A size-limit failure can appear as:
Status(StatusCode="ResourceExhausted", Detail="Received message exceeds the maximum configured message size.")Identify which process is receiving the message before changing a setting. For a response arriving at your application, check the client’s MaxReceiveMessageSize. For an append request arriving at the kernel, check the kernel’s maxReceiveMessageSize. Reduce the message size or raise that receiver’s limit, then check the sender’s limit too.
Recommendations
Section titled “Recommendations”Choose an explicit bound that fits the payloads you expect and the memory available to both processes. Raising a limit allows larger messages to be held in memory; it does not make them cheaper to send or process. Splitting a large event batch can avoid increasing the limit.
Once you choose a size, check both ends of the transfer using Server limits. See Client Configuration if you need to change how the application supplies its options.
Null Values
Section titled “Null Values”Setting either property to null removes that client-side limit. It does not restore gRPC’s default receive limit. Keep an explicit bound unless you intend to allow messages without a client-side size limit.
The .NET snippet below has stale comments saying null uses a 4 MB default. Those comments are incorrect: each assignment removes its corresponding client-side limit.
public static class GrpcMessageSizeNullValues{ public static ChronicleOptions Create() => new() { MaxReceiveMessageSize = null, // Uses gRPC default of 4 MB - not recommended MaxSendMessageSize = null // Uses gRPC default of 4 MB - not recommended };}import io.cratis.chronicle.ChronicleOptions
fun optionsWithGrpcDefaults(): ChronicleOptions = ChronicleOptions.fromConnectionString("chronicle://localhost:35000") .withMaxReceiveMessageSize(null) // Uses gRPC default of 4 MB - not recommendedimport io.cratis.chronicle.ChronicleOptions;
class MessageSizeGrpcDefaults { ChronicleOptions create() { return ChronicleOptions.fromConnectionString("chronicle://localhost:35000") .withMaxReceiveMessageSize(null); // Uses gRPC default of 4 MB - not recommended }}Elixir does not support this workflow yet.import { ChronicleOptions } from '@cratis/chronicle';
function createOptionsWithGrpcDefaults(): ChronicleOptions { return ChronicleOptions.fromConnectionString('chronicle://localhost:35000', { maxReceiveMessageSize: null, // Uses gRPC default of 4 MB - not recommended maxSendMessageSize: null });}