Message sizing
The sizing of messages that are sent to clients is very important to the overall performance and this must be carefully considered within the design of your solution.
Every topic message has a fixed header of 6 bytes. It then has the topic path terminated by one byte, plus any user header information that is also included with the message.
It is important to work out the size of the message so that the connector buffers can be set correctly, otherwise Diffusion™ is unable to put the messages on the wire quickly enough.
Byte pinching
With any messaging system, the smaller the messages, the lower the latency and the faster the system performs. There is a consultancy exercise that DiffusionData performs as a service to analyze the messages and reduce them as much as possible. The following list includes a few of the best practices to use:
- Only send data that is required by the client.
- Look at the data format and strip any fat off the message.
- Is the information being sent a true delta?
- Client side data models
Message encoding
If you are sending large messages, it is worth compressing the messages. This happens only once on the server, and then the clients have the technology to decompress them, this also includes JavaScript® clients. If other encoding is used, it is worth bearing in mind the CPU overhead required.