End-to-End Payload Compression

Solace recommends that you do not use end-to-end payload compression to reduce payload sizes that are larger than the maximum message size supported by the Solace event broker.

The Solace .NET API can perform end-to-end payload compression to allow for:

  • Faster message throughput.

  • Reduced bandwidth usage.

  • Improved performance in your applications.

While end-to-end payload compression creates more work for the Solace .NET API, it enables faster aggregate rates of message publishing and message receiving. The Solace event broker offers transport message compression that compresses the entire message, see Streaming Compressed Connections. However, when you send and receive large messages, compressing the entire message creates a lot of work for the event broker, which can result in slower throughput. If your application needs to send and receive large messages, we recommend you use end-to-end payload compression to improve performance.

  1. Considerations When Compressing Message Payloads

  2. Compressing Message Payloads in the Solace .NET API

Considerations When Compressing Message Payloads

The following sections explain what you should be aware of when you compress message payloads with the Solace Messaging APIs.

Use only one form of message compression

We recommend you only use one form of compression, either Streaming Compressed Connections through the event broker or end-to-end payload compression through the APIs. Compressing the same message multiple times can waste resources and usually does not result in smaller message sizes.

Message size validation with compression

The APIs validate message size at different points in the publishing process depending on which Solace Messaging API you use:

  • After compression—These APIs check the message size after payload compression. This allows you to send large, highly compressible messages. The uncompressed message can be up to 500 MB, as long as the compressed size does not exceed the event broker maximum message size (30 MB in most cases).

  • Before compression—These APIs check the message size before payload compression. Uncompressed messages that exceed the event broker maximum message size (30 MB in most cases) are rejected even if payload compression would reduce them below the limit.

The following table shows when each API validates message size, and the minimum API version required if applicable:

API Validates After Compression Validates Before Compression
Solace JCSMP API

This API validates message size after compression starting from the version shown.
10.30+

Not applicable - this API validates at a different point in the publishing process.

Solace JMS API

This API validates message size after compression starting from the version shown.
10.30+

Not applicable - this API validates at a different point in the publishing process.

Solace Java API

Not applicable - this API validates at a different point in the publishing process.

This API validates message size before compression in all supported versions.

Solace C API

Not applicable - this API validates at a different point in the publishing process.

This API validates message size before compression in all supported versions.

Solace .NET API

Not applicable - this API validates at a different point in the publishing process.

This API validates message size before compression in all supported versions.

Solace JavaScript API

Not applicable - this API validates at a different point in the publishing process.

This API validates message size before compression in all supported versions.

Solace Go API

Not applicable - this API validates at a different point in the publishing process.

This API validates message size before compression in all supported versions.

Solace Python API

Not applicable - this API validates at a different point in the publishing process.

This API validates message size before compression in all supported versions.

Solace Java RTO API

Not applicable - this API validates at a different point in the publishing process.

This API validates message size before compression in all supported versions.

For the Solace Messaging APIs for JMS and JCSMP, if you use versions older than the ones listed in this table, messages are validated before payload compression.

For more information about event broker maximum message sizes, see Sending Messages Larger Than the Event Broker's Maximum Message Size.

Do not use end-to-end payload compression with small messages

End-to-end payload compression works best with messages that are a few megabytes in size. Solace does not recommend using message payload compression with small messages, because end-to-end payload compression can actually increase the size of small messages.

Upgrade your publisher and receiver applications

Receiver applications automatically decompress any compressed message payloads only if the API supports message payload compression and is updated to the minimum supported version. If your receiver application does not support message payload compression, this can cause potential errors or exceptions. Make sure you update your publisher and receiver applications to the minimum supported versions for payload compression. For version support information, see Feature Support of Solace Messaging APIs .

End-to-end payload compression limitations

End-to-end payload compression does not currently support Solace Cache.

End-to-end payload compression is not compatible with:

  • SolCache

  • Non-SMF protocols, such as AMQP, HTTP, Kafka, and MQTT

If your applications use any of the above, we recommend that you do not use end-to-end payload compression.

Compressing Message Payloads in the Solace .NET API

Your publisher application can compress the binary payload of a message before you publish it. To compress a message payload, you must set a property that tells the Solace .NET API that you want end-to-end payload compression enabled. The payload compression level property can be set to an integer from 0-9:

  • 0—Payload compression is disabled. This is the default setting.

  • 1 - 9—Payload compression is enabled. 1 is the lowest level of compression with the fastest data throughput, and 9 is the highest level of compression with the slowest data throughput.

Your payload compression level should be adjusted according to your network and performance requirements.

In the Solace .NET API, set PayloadCompressionLevel when you configure your session properties. For example:

SessionProperties sessionProps = new SessionProperties()
{
    // SessionProperties
    // ...
    PayloadCompressionLevel = 9 // Payload compression enabled with max compression
};

For more information, see the Solace Messaging API for .NET reference.