How aeron-io/aeron works
Project Type and Purpose
• Aeron is a high-performance message transport framework supporting UDP unicast, UDP multicast, and IPC.
• It provides multi-language client libraries (Java, C, C++), a Media Driver that handles network and IPC I/O, an Archive module for durable recording/replay, and a Cluster module for Raft-based replicated state machines.
High-Level Modules (Top-Level Directories)
• aeron-client: language bindings and client-side Conductor logic
• aeron-driver: Media Driver implementation (network, IPC, threading, flow control)
• aeron-archive: persistent storage of streams (recording, replay)
• aeron-cluster: fault-tolerant cluster services using Raft consensus
• aeron-agent, aeron-annotations, aeron-test-support: support, tooling, logging agents, codegen, testing
Key Components
a. Client Application
• Language-specific API (Java/C/C++)
• ClientConductor (manages publications/subscriptions, ring buffers to Media Driver)
b. Media Driver
• IPC layer (shared memory ring buffers between client and driver)
• Network transport (UDP send/receive endpoints, flow/congestion control)
• Threading model (sender thread, receiver thread, conductor thread)
c. Archive Module
• ArchiveConductor (listens on control streams from clients)
• RecordingWriter (writes messages to file store)
• ReplaySession (reads recordings and publishes to clients)
d. Cluster Module
• ConsensusModule (leader election, log replication)
• ClusteredMediaDriver & ClusterBackup (integrate Media Driver with cluster state)
e. Storage and External Services
• File system for recordings (catalog, segment files)
• Optional monitoring or MBean endpoints
Relationships and Data Flows
• Media Driver → Sender Thread → UDP Socket → Remote Media Driver Receiver Thread → IPC Ring Buffer → Remote ClientConductor → Client API → Remote Client Application
• Archive: ClientConductor publishes control messages to Archive channels → ArchiveConductor reads those streams via Media Driver → RecordingWriter writes to disk
• Replay: ArchiveConductor reads from disk → ReplaySession publishes via Media Driver → ClientConductor receives via IPC → Client application
• Cluster: Clients submit messages to Cluster ingress via Media Driver; ConsensusModule replicates logs; egress messages flow back via Media Driver
Architectural Patterns and Principles
• Modular multi-language client–driver separation via IPC ring buffers
• Thread-per-role in Media Driver (conductor, sender, receiver) with lock-free queues
• Back-pressure and flow control loops in both IPC and network layers
• Extension points: custom CongestionControl, Authenticators, external NameResolver
• Archive and Cluster built on top of core transport, reusing Media Driver I/O