Skip to content

How can I increase Aeron performance?

Problem

You want to increase Aeron performance.

Solution

Tune Aeron to better maximize utilization of the resources available.

Consider:

  • switching to dedicated Media Driver threads
  • setting aggressive Idle Strategies
  • pinning Aeron and application threads to dedicated cores.

Discussion

This is a topic best suited for a commerical support engagement since the application and how it uses Aeron, the volume and encoding/decoding of data, the hardware (CPUs, Network Cards, Switches), and operating environment (dedicated private network, cloud, JVM vendor and version, garbage collector, etc.) all impact the optimal settings and maximum achievable performance. The bare basic settings for the Java Media Driver are given below.

Aeron's Media Driver is constructed out of three agents - the Sender, Receiver and Driver Conductor. You can maximize the performance - if you have the necessary hardware threads available - by scheduling the Sender, Receiver and Driver Conductor on a dedicated threads. To do this, set the threading mode to ThreadingMode.DEDICATED, for example:

final MediaDriver.Context mediaDriverCtx = new MediaDriver.Context()
    .sharedIdleStrategy(new BackOffIdleStrategy(...))
    .threadingMode(ThreadingMode.DEDICATED);

This will keep Sender, Receiver and Driver Conductor on dedicated threads, with a BackoffIdleStrategy managed duty cycle. You can pin these threads to specific hardware cores to reduce jitter.

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

final Aeron.Context aeronCtx = new Aeron.Context()
    .idleStrategy(new BackOffIdleStrategy(...))

This will set the Aeron object to use a BackoffIdleStrategy. If you have the hardware available, you can select even more aggressive idle strategies. Again, you can pin any of your application threads to maximize performance.

Note that performance may be worse if the settings above are run on a under powered machine, or in a machine with cores shared by another host in a virtualized environment.

See Also