Disruptor Pattern
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.
Great find @npathai :+1:
@iluwatar Yup its an amazing pattern. I will keep adding newer ones. I like learning patterns and will contribute lot here. :)
Disruptor was recently mentioned in Spring blog here: https://spring.io/blog/2016/07/20/notes-on-reactive-programming-part-iii-a-simple-http-server-application
http://lmax-exchange.github.io/disruptor/
Hello everyone! I'm new to Java Design Patterns and excited to contribute. I'd love some guidance on how I can be of assistance here. Specifically, are there plans to incorporate a new module focusing on the 'Disruptor' pattern? I'm eager to learn and contribute to its implementation if that's in line with the project's objectives.
Sure, check here first https://github.com/iluwatar/java-design-patterns/wiki/01.-How-to-contribute
Study the existing design patterns. The new one is expected to follow the same technical structure.
Thank you for talking me to the requirements for contributions. Before proposing the Disruptor pattern implementation, I'll thoroughly research the existing design patterns to ensure they correspond with the technical structure.
This issue has been automatically marked as stale because it has not had recent activity. The issue will be unassigned if no further activity occurs. Thank you for your contributions.
Updated task description