Table of Contents

gRPC Message Size

Large event batches or queries that return many events can exceed gRPC message limits. Chronicle provides configuration options to adjust the maximum send and receive message sizes.

Default Settings

By default, Chronicle sets both MaxReceiveMessageSize and MaxSendMessageSize to 100 MB (104,857,600 bytes). This is higher than the gRPC default of 4 MB and is suitable for most scenarios involving large event collections.

Configuring Message Sizes

You can configure the message sizes when creating a ChronicleClient or through options:

var options = new ChronicleOptions
{
    Url = new ChronicleConnectionString("chronicle://localhost:35000"),
    MaxReceiveMessageSize = 200 * 1024 * 1024, // 200 MB
    MaxSendMessageSize = 200 * 1024 * 1024      // 200 MB
};

var client = new ChronicleClient(options);

Configuration via appsettings.json

For ASP.NET Core applications, configure message sizes in appsettings.json:

{
  "Chronicle": {
    "Url": "chronicle://localhost:35000",
    "MaxReceiveMessageSize": 209715200,
    "MaxSendMessageSize": 209715200
  }
}

Configuration via Environment Variables

Message sizes can also be set using environment variables:

Chronicle__MaxReceiveMessageSize=209715200
Chronicle__MaxSendMessageSize=209715200

Understanding the Error

If you encounter an error like:

Status(StatusCode="ResourceExhausted", Detail="Received message exceeds the maximum configured message size.")

This indicates that the response from the server exceeds MaxReceiveMessageSize. Increase this value to accommodate larger responses.

Recommendations

  • Default (100 MB): Suitable for most applications with moderate event batch sizes
  • 200+ MB: Consider for applications that frequently query large event ranges or work with many events
  • Performance considerations: Larger message sizes consume more memory. Balance your needs with available resources
  • Server configuration: Ensure the Chronicle Server is also configured to handle the message sizes you need

Null Values

Setting either property to null will use the gRPC default (4 MB), which is generally not recommended for Chronicle applications:

var options = new ChronicleOptions
{
    MaxReceiveMessageSize = null, // Uses gRPC default of 4 MB - not recommended
    MaxSendMessageSize = null     // Uses gRPC default of 4 MB - not recommended
};