ConfigsJul 1, 2026·3 min read

LMAX Disruptor — High-Performance Inter-Thread Messaging for Java

A low-latency, lock-free ring buffer library for Java that achieves millions of operations per second, widely used in trading systems and high-throughput event processing.

Agent ready

Review-first install path

This asset needs a review step. The copied prompt tells the agent to dry-run, show the writes, then proceed only after confirmation.

Needs Confirmation · 66/100Policy: confirm
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
LMAX Disruptor Overview
Review-first command
npx -y tokrepo@latest install 42a6bda0-7527-11f1-9bc6-00163e2b0d79 --target codex

Dry-run first, confirm the writes, then run this command.

Introduction

The LMAX Disruptor is a ring-buffer-based messaging framework created by LMAX Exchange to power their financial trading platform. It replaces traditional queues with a mechanical-sympathy design that minimizes lock contention, false sharing, and garbage collection pressure.

What the Disruptor Does

  • Provides a lock-free ring buffer for passing events between producer and consumer threads
  • Achieves single-digit microsecond latencies for inter-thread communication
  • Supports multiple consumer patterns: pipeline, diamond, and broadcast topologies
  • Eliminates garbage collection pauses by pre-allocating event objects in the ring
  • Delivers predictable, low-jitter throughput under sustained high load

Architecture Overview

The Disruptor uses a fixed-size ring buffer backed by a pre-allocated array. Producers claim slots via an atomic sequence counter, write data, and publish. Consumers track their own sequence cursors and spin-wait or use a WaitStrategy for new events. The design avoids locks, minimizes cache-line contention through padding, and keeps allocation on the hot path to zero.

Self-Hosting & Configuration

  • Add the Maven dependency to your Java project (JDK 11+ for v4.x)
  • Choose a WaitStrategy: BusySpinWaitStrategy for lowest latency, SleepingWaitStrategy for lower CPU
  • Set the ring buffer size to a power of two for optimal index masking
  • Wire event handlers in the desired topology using handleEventsWith() and then()
  • No external services or configuration files are required

Key Features

  • Mechanical-sympathy design aligned with CPU cache architecture
  • Pre-allocated, GC-free event passing in the hot path
  • Pluggable wait strategies to trade latency for CPU usage
  • Supports batching: consumers process ranges of events efficiently
  • Battle-tested in production at LMAX Exchange handling millions of orders per second

Comparison with Similar Tools

  • java.util.concurrent queues — ArrayBlockingQueue and LinkedBlockingQueue use locks; the Disruptor is lock-free and faster
  • Chronicle Queue — persistent, memory-mapped queue for inter-process messaging; the Disruptor is in-process only but lower latency
  • Aeron — UDP-based messaging for inter-machine IPC; the Disruptor focuses on intra-JVM threading
  • Akka Actors — actor-based concurrency model; the Disruptor is a lower-level primitive for maximum throughput

FAQ

Q: When should I use the Disruptor over standard Java queues? A: When inter-thread latency and throughput are critical, such as trading engines, event sourcing, and log aggregation pipelines.

Q: Does it support multiple producers? A: Yes. Use ProducerType.MULTI when constructing the Disruptor for safe concurrent publishing.

Q: What happens when the ring buffer is full? A: The producer blocks (or spins) until a consumer advances, applying natural back-pressure.

Q: Is it used outside of finance? A: Yes. Log4j2 uses the Disruptor for its async loggers, and it appears in game servers, messaging systems, and data pipelines.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets