Skip to content

I set Term Buffer to x, but I see much larger log buffer files. Why?

Problem

  • You see much larger than expected log buffer sizes
  • You've put your log buffers on /dev/shm and a RegistrationException was raised

Solution

Log buffers contain 3 term buffers, plus metadata. Thus, log buffer sizing is 3x term buffer sizing.

Discussion

When you set the Media Driver folder via the MediaDriver.Context, you're setting the root folder for the data files required for the Media Driver to operate. The Log Buffers are stored under directories in this folder.

final MediaDriver.Context mediaDriverCtx = new MediaDriver.Context()
    .aeronDirectoryName("/dev/shm/md");

Here's an example media driver folder containing two IPC publications:

Tree

The files are created at their full size by default, since this ensures no surprises at runtime and allows for best performance. If you want to stop this behavior, use the sparse=true channel parameter in a Publication, for example:

  • aeron:ipc?sparse=true Sparse IPC channel
  • aeron:udp?endpoint=192.168.0.1:12345|alias=def|sparse=true Sparse UDP channel (with endpoint and alias defined as well)

See Also