I have done some research with the disruptor patern and there's one thing I can't wrap my head arround.
There are the producers, which provide the entry's for the ring buffer. There is the ringbuffer, basically a fixed but endless array. There are the consumers (basically sperate threads), handling the entries from the ringbuffer.
I'm trying to relate how the disruptor patern can be used in a real case scenario of a stock market.
Usually you would have the orderbook containing all orders. How I see it, a producer would receive a new order from a broker. The producer places the order in the ringbuffer. After the order has been placed in the ringbuffer, a consumer fetches the order and cross-checks it with the orderbook.
Now here is the part where I'm having a bit of trouble understanding the advantage. If there would be multiple consumers, which is what you want for scalable system, how can there be multiple consumers handing orders?
The orderbook has to be locked when accessed by a consumer to ensure integrity. What I'm looking for is an answer to this question and a rough idea how a order matching engine could possibly benefit from this patern.
LMAX has their own order matching engine, so there has to be something I'm overlooking.
Thank you