Aeron Selector

Overview

Aeron Selector is a mechanism for an application thread to efficiently await data on a set of subscriptions rather than needing to continually poll for data. This means the application thread can sleep and doesn’t need to busy spin which consumes CPU cycles. The use case for Aeron Selector is an application consuming a number of streams of data where the latency cost of waking sleeping threads to process new data is an acceptable trade-off in return for reduced CPU usage of sleeping threads that would otherwise be busy spinning.

Architecture

Aeron Selector has two parts:

  1. Aeron Selector daemon (aeronsd).

  2. Aeron Selector client.

An application using a Selector client will also need a regular Aeron client, the latter is still used for managing subscriptions and publications, sending and receiving data, etc., while the former is only used for waiting on data.

The following clients are available:

  1. C client - requires Aeron C client.

  2. C client - requires Aeron C wrapper client.

  3. Java client - requires Aeron Java client.

    The jar can be obtained from the premium repository using:

    <groupId>io.aeron.premium.selector</groupId>
    <artifactId>aeron-selector</artifactId>

For details how to use the clients, please consult the JavaDoc or comments in the corresponding source files.

There’s only one version of the daemon, it’s a native application written in C.

Note: Currently daemon is only available on Linux as it relies on the epoll API.

Running aeronsd

First, make sure you have a Media Driver 1.43.0+ running. Then simply run the aeronsd binary.

When aeronsd starts it will print a message to stdout, it will also create some counters available in AeronStat, e.g.:

 37 :                    0 - aeronsd clients: clientId=1 version=0.0.1-SNAPSHOT commit=6b7860b8f3 pid=42912 address=127.0.0.1:45135
 38 :                    0 - aeronsd subscriptions: clientId=1
 39 :            2,029,239 - aeronsd max cycle time in ns: clientId=1
 40 :                    0 - aeronsd cycle time threshold exceeded count: clientId=1 threshold=1000000000ns

To see available configuration options run aeronsd -h.