Disruptor pattern with pull even handler

401 views
Skip to first unread message

Prabath Ariyarathna

unread,
Jan 22, 2015, 3:10:36 AM1/22/15
to lmax-di...@googlegroups.com
I'm going to improve performance of existing solution introducing disruptor pattern. Existing solution contains single producer and consumer with shared byte buffer. In this scenario producer push data to shared buffer and consumer pull data from the buffer but disruptor pattern doesn't support to the pull event handler. Disruptor events handlers are being triggered automatically by the disruptor framework. any suggestions?

Michael Barker

unread,
Jan 22, 2015, 6:49:23 PM1/22/15
to lmax-di...@googlegroups.com

On 22 January 2015 at 21:10, Prabath Ariyarathna <praba...@gmail.com> wrote:
I'm going to improve performance of existing solution introducing disruptor pattern. Existing solution contains single producer and consumer with shared byte buffer. In this scenario producer push data to shared buffer and consumer pull data from the buffer but disruptor pattern doesn't support to the pull event handler. Disruptor events handlers are being triggered automatically by the disruptor framework. any suggestions?

--
You received this message because you are subscribed to the Google Groups "Disruptor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lmax-disrupto...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Prabath Ariyarathna

unread,
Jan 22, 2015, 10:45:23 PM1/22/15
to lmax-di...@googlegroups.com
Hi Mike.

Seems it is fit with my requirement. 
Thanks for sharing but not clear what are the constructor parameter we need to use. 
If you have any sample, please share. 

Thanks,
Prabath.

Prabath Ariyarathna

unread,
Jan 22, 2015, 10:57:52 PM1/22/15
to lmax-di...@googlegroups.com
Hi Mike.

After went through the experimental EventPooler I can see tiny problem on that. Even though it providing polling facility, developer cannot directly access Event through their code because still it is pushing Event via the EventHandler. In my scenario, I need to access Events from my Code not via the EventHandlers. Please correct me if I'm wrong. 

Thanks.
Prabath.

Michael Barker

unread,
Feb 1, 2015, 3:11:00 PM2/1/15
to lmax-di...@googlegroups.com
Yes you do need to use an event handler.  We implement it this way to prevent data copying and allow the reuse of event objects.  Using an event handler callback means that the Disruptor knows when an event object is in use and when it can recycle the event for others to be used.  If you really need to the objects, then you can still use the EventPoller and copy the data out as required.  However, this is a bit ugly a does reduce the Disruptor's ability to run efficiently, e.g. smart batching is no longer possible.


Mike. 

Rui Li

unread,
May 21, 2016, 4:56:54 AM5/21/16
to Disruptor
Hey Mike,

I read the code via the link you provided. Got some questions:

1. I think calling EventPoller::poll doesn't block the consumer right? So the consumer is kind of busy-waiting for new data to be ready.
2. How can we inform the consumer that no more data will be written?

I'd really appreciate it if you can help with the questions. Thanks!

在 2015年2月2日星期一 UTC+8上午4:11:00,mikeb01写道:
Reply all
Reply to author
Forward
0 new messages