Compressing headers

85 views Asked by At

We're using NServiceBus 4.6 with SQL Server transport (2012). The SQL Server database is set up for high availability using Availability Groups.

Our DBAs are complaining about the amount of "churn"a we have happening in the transport database, and especially the load that this is placing on our WAN.

We are currently using XML Serialization, so I started looking at the other serialization options that are available to us (would probably favour JSON so that it's still readable). However, in starting to look into this, I've realised that our message bodies are typically between 600 and 1000 bytes, whereas our message headers are regularly in the range of 1200 - 1800 bytes1. So, even if I achieve a great saving in terms of body sizes, it's not going to produce the large scale improvements that I'm looking for.

The Question

Given, as I understand it, that the headers don't have to be readable when the messages are stored in the SQL Server database, is there any way that I can compress them?

Or other strategies to reduce the amount of data that we're adding and deleting from this database? (Whilst staying on NSB 4.6 for now)


1We are adding a few custom headers ourselves for metadata that really doesn't belong in the message classes.

aSince every message at least goes into a queue table, then is removed from that table and is placed in the audit table, before we later remove older audit entries, and we've got a lot of messages, we're putting a lot in the SQL Server transaction log.

1

There are 1 answers

0
Phil Sandler On

You can compress and decompress the messages content via a Mutator. The mutator example actually is based on compressing a message, so should be an easy solution for that part:

http://docs.particular.net/samples/messagemutators/#code-walk-through-transportmessagecompressionmutator

You can probably add some code that will do the same with the headers, compressing your custom attributes before writing them and decompressing them before reading them.