Releases: disruptor-net/Disruptor-net
7.0.0-rc1
Major changes
- Add IPC-based disruptor (#79)
The IpcDisruptor is built on a value-type-based ring buffer stored in a shared memory-mapped file. This design allows the IpcDisruptor to support remote publication, i.e.: event publication from other processes on the same machine.
- Refactor Disruptor
StartandHalt- Make
Start/Haltreturn a task that represents the startup/halt of the disruptor.
- Make
Before,
Start/Haltwould return immediately without waiting for the event handlers startup/shutdown.
If the application main thread exited after invoking Halt, then the application would stop without running
the event handlerOnShutdown, which could be quite problematic ifOnShutdownneeded to perform critical
cleanup code.
- Make Disruptor and event processors disposable
- Refactor wait strategies and sequence barriers (BREAKING CHANGE)
- Wait strategies now create dedicated waiters for each event processor
- Sequence barriers are now simpler and
ISequenceBarrierOptionsis removed - Sequence barriers no longer wait for published sequences by default
- Disruptors now create dedicated sequence barriers for each event processor
- Use a dedicated type to identify sequencer waiter owners
The wait strategy API is now based on both IWaitStrategy and ISequenceWaiter.
If you need to migrate an existing wait strategy, you can follow the V7 migration sample.
- Refactor event processors (BREAKING CHANGE)
- Make
Start/Haltreturn a task that represents the startup/shutdown of the processors - Add a dedicated type to factorize processors state management
- Move processors cancellation tokens out of the sequence barriers
- Remove
IEventProcessor.WaitUntilStartedwhich can be replaced byStart().Wait() - Remove
WorkProcessor.HaltLater - Remove
WorkerPool.DrainAndHalt - Add
WorkerPool.HasBacklog - Remove
TaskCreationOptionsfromIEventProcessor.Start
- Make
Minor changes
- Add net8.0 target
- Use a value type for gating sequence cache sequence in
MultiProducerSequencer(PERF) - Adjust
SingleProducerSequencerlayout (PERF) - Split
AsyncWaitStrategyandTimeoutAsyncWaitStrategy - Remove allocations from
AsyncWaitStrategy(PERF) - Remove allocations from
TimeoutAsyncWaitStrategy(PERF) - Add base interface for event handlers: IEventHandler
6.0.1
6.0.0
- Add
MaxBatchSizeto all event handler interfaces (IEventHandler,IBatchEventHandler,IValueEventHandler,IAsyncBatchEventHandler) - Refactor event processor factories (breaking change)
The factory method now takes a
SequenceBarrierinstead of aISequence[]. The factory implementations always had to create a sequence barrier anyway so the new API should be simpler is to use. Also, the factory types are now delegates instead of interfaces, so they can be created using lambdas, which was probably the design goal of the Java API.
- Remove
ISequence(breaking change)
The codebase was no longer creating any implementation other than
Sequence. Thus,ISequencewas an unnecessary abstraction which was not even useful for encapsulation because it was mutable.
- Remove the obsolete method
RingBuffer.ResetTo(breaking change) - Remove
LiteTimeoutBlockingWaitStrategy(breaking change) - Pass
DependentSequenceGroupin sequence barrier constructor (breaking change) - Add tag to
DependentSequenceGroup
The goal of the tag is to allow wait strategies to identify specific sequence groups to apply different wait logic.
- Add
HybridSpinWaitStrategy
It is a non-blocking strategy that uses either
AggressiveSpinWaitorSpinWaitdepending on the targetDependentSequenceGroup. Although this wait strategy is useful and functional, it was mainly added as an example of a wait strategy that applies different wait logic depending on the sequence groups tags.
5.0.0
The V5 is clearly a major version, with the addition of two new event handler interfaces, the support of Task based event consumers, and the refactoring of the wait strategy API. A few changes were ported from the Java version, the more important being the removal of event handling extension interfaces. However, many changes are .NET specific and some of them tend move the API away from the Java version in order to turn it into idiomatic .NET.
For the detailed changelog, see:
5.0.0-rc2
The RC2 is the last release of 5.0.0 that includes new features.
See RC1 changes.
Major
- Add
AsyncEventStream
AsyncEventStream is a new async poll-based API:
var stream = ringBuffer.NewAsyncEventStream(); await foreach (var batch in stream.ConfigureAwait(false)) { foreach (var evt in batch) { // process event } }
- Remove unused members from
ISequence(breaking change) - Use DependentSequenceGroup in
IWaitStrategy(breaking change)
The wait strategy API was refactored to use
DependentSequenceGroupinstead of the sequence coupleSequence cursor, ISequence dependentSequence. This change makes the API more explicit, avoid exposing mutable sequences to wait strategies and slightly improves performance.
- Replace
Disruptor.GetBarrierForbyDisruptor.GetDependentSequencesFor
Sequence barriers are stateful components which are dangerous to expose, but they were the only option to identify the source processor in a wait strategy and track the dependent sequences of a given processor. Exposing the dependent sequences instead of the barrier seems to
address both issues.
- Remove obsolete
Disruptor.HandleExceptionsWith(breaking change) - Remove sequence barrier interfaces (breaking change)
Minor
- Make all wait strategies sealed
- Handle explicit OnBatchStart implementations by @ltrzesniewski (#62).
- A few performance improvements (including #61 by @buybackoff).
5.0.0-rc1
Major
- Drop
net452andnetstandard2.0target frameworks (breaking change) - Remove
ILifecycleAware(breaking change) Move methods to event handler interfaces with default implementations - Remove
ITimeoutHandler(breaking change) Move OnTimeout to event handler interfaces with default implementation - Remove
IBatchStartAware(breaking change) Move OnBatchStart to event handler interfaces with default implementation - Refactor
IWaitStrategy(breaking change)
IWaitStrategy now uses the standard .NET cancellation type instead of ISequenceBarrier.
IWaitStrategy also returns aSequenceWaitResultwhich makes the fact that wait strategies can timeout more explicit..SequenceWaitResult WaitFor(long sequence, Sequence cursor, ISequence dependentSequence, CancellationToken cancellationToken);If you implemented custom wait strategies, you can simply replace
barrier.CheckAlert()withcancellationToken.ThrowIfCancellationRequested().
- New event handler:
IBatchEventHandler<T>
IBatchEventHandler is a new event handler which has a batch oriented API:
public interface IBatchEventHandler<T> { void OnBatch(EventBatch<T> batch, long sequence); }This handler has better performance than the default
IEventHandler<T>for processing batches of multiple events.
It is also much more convenient for explicit batch management.
- New event handler:
IAsyncBatchEventHandler<T>
IAsyncBatchEventHandler is a new event handler which has a async oriented API:
public interface IAsyncBatchEventHandler<T> { ValueTask OnBatch(EventBatch<T> batch, long sequence); }This event handler is quite unique because:
- The processing of this handler can generate heap allocations.
- The processing of this handler runs on thread-pool threads (other handlers runs on dedicated threads).
It is intended to be used in applications that can accept a reasonable amount of heap allocations and that use async APIs to process events.
Minor
-
Enable null reference analysis
-
Support batch handlers in EventPoller
-
Add dedicated exception handling method for batches (breaking change)
-
Add dedicated exception handling method for timeouts (breaking change)
-
Replace
RunbyStartinIEventProcessor(breaking change) -
Remove
IExecutor(breaking change)
IExecutor was a port of
java.util.concurrent.Executorwhich was used to start event processor tasks.
Event processor tasks are now started directly using a TaskScheduler.
If you used the Disruptor constructor that was IExecutor-based, you can simply use the TaskScheduler-based constructor instead.
If you implemented a custom IExecutor, you can implement a custom TaskScheduler instead.
- Use a pointer in
MultiProducerSequencer(performance)
MultiProducerSequencer now uses a POH (pinned object heap) allocated array to remove array bound checks (net5.0+ only).
- Replace
INonBlockingWaitStrategybyIWaitStrategy.IsBlockingStrategy(breaking change) - Replace CAS loop by
Interlocked.AddinMultiProducerSequencer(performance) - Add a property to check if disruptor has been started
- Replace
IsPublishedwithIsAvailableon RingBuffer (breaking change) - Move event processors to Processing namespace (breaking change)
- Make
ConsumerRepositoryrelated types internal (breaking change) - Remove
TimeoutException(breaking change) - Remove
AlertException(breaking change) - Remove
NoOpEventProcessor(breaking change) - Rename default event processor (breaking change) Make event processor names matching event handler names
In addition, this version includes a few micro-optimization from @buybackoff.