iluwatar / iluwatar/java-design-patterns
Disruptor Pattern
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 94.7k
- Forks
- 27.4k
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 10
Description
Description:
The Disruptor is a high-performance inter-thread messaging library. It provides a way to achieve high throughput and low latency in message processing systems. The main elements of the Disruptor pattern include:
- Ring Buffer: A pre-allocated circular buffer that holds the data to be processed. The ring buffer is the core of the Disruptor, allowing for efficient memory allocation and access.
- Event Processors: Components that consume events from the ring buffer. They can be set up in different configurations such as single, multiple, or parallel consumers.
- Sequencers: Components that control the order of events being processed. They ensure that events are processed in the correct sequence and manage dependencies between different event processors.
- Producers: Components that publish events to the ring buffer. Producers write data to the ring buffer, which is then consumed by the event processors.
- Wait Strategies: Strategies that determine how consumers wait for events to be available in the ring buffer. Different strategies can be used to balance between CPU usage and latency.
References:
- Disruptor Pattern Wikipedia
- LMAX Disruptor: High Performance Inter-thread Messaging Library
- Martin Fowler on LMAX Architecture
Acceptance Criteria:
- Implement a ring buffer with configurable size to hold the events.
- Develop event processors that consume events from the ring buffer, supporting different processing configurations.
- Ensure proper sequencing of events using a sequencer component.
- Implement producers that can publish events to the ring buffer efficiently.
- Include at least one wait strategy for managing how consumers wait for events.
Please refer to the project contribution guidelines before submitting your pull request.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the linked project contribution guidelines and the Disruptor and LMAX references to understand the requested pattern. The work is complete when the acceptance criteria are met: configurable ring buffer, event processors, sequencing, efficient producers, and at least one wait strategy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100