Skip to content

How do I reduce resource utilization by Aeron?

Problem

You've setup Aeron for running on a machine with a large amount of resources, but now want to run it on a developer machine.

Solution

Consider:

  • changing to less intensive idle strategies on your agents and in Aeron;
  • set the Aeron Media Driver threading mode to SHARED with a shared Idle Strategy.

Discussion

Aeron's Media Driver is constructed out of three agents - the Sender, Receiver and Driver Conductor. You can reduce the resources required by scheduling the Sender, Receiver and Driver Conductor on a single thread. To do this, set the threading mode to ThreadingMode.SHARED, for example:

final MediaDriver.Context mediaDriverCtx = new MediaDriver.Context()
    .sharedIdleStrategy(new SleepingMillisIdleStrategy(1))
    .threadingMode(ThreadingMode.SHARED);

This will combine Sender, Receiver and Driver Conductor onto a single thread, with a 1ms sleep in the duty cycle.

Additionally, set the Aeron idle strategy to a calmer variant in the Aeron context:

final Aeron.Context aeronCtx = new Aeron.Context()
    .idleStrategy(new SleepingMillisIdleStrategy(1))

This will set the Aeron object to use a 1ms sleep in its duty cycle.

See Also

Back to top