How to send messages over 8kb¶
You need to send messages greater than 8kb in size.
Term buffer length directly impacts the maximum message length. Setting a larger term buffer length will allow larger messages to be sent, up to 16MB.
The formula for determining the maximum message length from the term buffer length is:
min(16MB, Term Buffer Length / 8). You can increase the term buffer length by setting the default Term Buffer Lengths with the system property
aeron.ipc.term.buffer.length. These can also be set on the Media Driver context using
If you require individual sizing of each Aeron publication, you can override the default value by specifying a term-length within the Aeron channel description, for example:
- 128kb term length for an IPC channel:
aeron:ipc?term-length=128kto support messages up to 16kb
- 2MB term length for a UDP channel:
aeron:udp?endpoint=192.168.0.1:12345|term-length=2mto support messages up to 256kb
- the term length value must be a power of 2. If not, you will get an exception:
IllegalStateException : Term length not a power of 2
- tryClaim will not support anything beyond
maxPayloadLength(the default is 1376 bytes).
- term buffer length cannot exceed 1,073,741,824 bytes.
- You can use either fully defined values, like
65536or you can use
mto refer to kilobytes or megabytes respectively.
- Aeron will not reconstruct fragmented messages automatically. See How to read fragmented messages