The messaging layer takes care of the direct peer to peer transfer of segment batches, and coordination barriers.
The Onyx messaging implementation is pluggable and alternative
implementations can be selected via the :onyx.messaging/impl
Peer Configuration option.
Owing to Aeron’s high throughput and low latency, Aeron is the default Onyx messaging implementation. There are a few relevant considerations when using the Aeron implementation.
The Aeron messaging implementation will use the port configured via
:onyx.messaging/peer-port
. This UDP port must be unfirewalled.
Aeron requires a media driver to be used on each node. Onyx provides
an embedded media driver for local testing, however use of the
embedded driver is not recommended in production. The embedded driver
can be configured via the :onyx.messaging.aeron/embedded-driver?
Peer Configuration option.
When using Aeron messaging in production, a media driver should be created in another java process. You can do this via the following code snippet, or by using the Aeron distribution.
(ns your-app.aeron-media-driver
(:require [clojure.core.async :refer [chan <!!]])
(:import [io.aeron Aeron$Context]
[io.aeron.driver MediaDriver MediaDriver$Context ThreadingMode]))
(defn -main [& args]
(let [ctx (doto (MediaDriver$Context.))
media-driver (MediaDriver/launch ctx)]
(println "Launched the Media Driver. Blocking forever...")
(<!! (chan))))
Aeron is independently configurable via Java properties (e.g.
JAVA_OPTS="-Daeron.mtu.length=16384"
). Configuration of these may
cause different performance characteristics, and certain options may
need to be configured in order to communicate large segments between
peers.
Documentation for these configuration options can be found in Aeron’s documentation.