Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the largest message Aeron can process?

What is size of the largest message real-logic's Aeron can process?

I realize Aeron shines for small messages, however I would like to have a single protocol throughout our stack and some of our messages easily reach a size of 100Mb.

The documentation is not clear on what settings affect the answer to this question. My worry is that the default buffer settings don't allow messages of this size. Or do the buffer settings have no impact on maximum application message size?

like image 365
Erik van Oosten Avatar asked Aug 27 '15 07:08

Erik van Oosten


1 Answers

We discussed this issue on a recent conference with Martin Thompson, main contributor of Aeron.

Not only it is not possible to exceed the size of the page, if you take a look at the Aeron presentation slides 52 to 54, these are main reasons not to push large files:

  • page faults are almost guaranteed, if message size is close to the page size, and it will make Aeron repeat the sequence with the next page, i.e. major slowdown
  • cache churn
  • VM pressure

Long story short, split your 100M message into smaller chunks, at most 1/4 of the page size minus header, if you use IPC; or the size of MTU minus header (maximum transfer unit), if you go via UDP. It will improve throughput, remove pipe clogging and fix other issues. The logic behind MTU is, occasionally UDP packets get lost and everything is re-sent by Aeron starting with lost packet. So, you want to have your chunks fit a single packet for performance.

For maximum performance, in your application-level protocol, I would create a first packet having file metadata and length, the receiving side then creates memory-mapped file on HDD of given length and fills it up with incoming chunks, where each chunk includes offset and file ID (in case you want to push multiple files simultaneously). This way you copy from Aeron buffer to mmap and completely avoid garbage collection. I expect the performance of such file transfer to be faster than most other options.

To answer the original question: With default settings, maximum message size is 16MB minus 32 bytes header. To change it, on your media driver you can try changing aeron.term.buffer.length and aeron.term.buffer.max.length system properties (see Aeron Configuration Options). Here, term buffer corresponds to a "page" in other parts of documentation and in fact, works similarly to OS memory pages in some respects. While term.buffer.max.length configures number of buffers/pages in rotation.

like image 127
Alex Pakka Avatar answered Nov 07 '22 11:11

Alex Pakka