user310291
user310291

Reputation: 38228

Parallel between LMax Disruptor and Rx Framework concept?

As I read here http://mechanitis.blogspot.fr/2011/06/dissecting-disruptor-how-do-i-read-from.html

"for every individual item, the Consumer simply says "Let me know when you've got more than this number", and is told in return how many more entries it can grab."

Doesn't this relates to Rx Framework concept as exposed by Erik Meijer http://www.youtube.com/watch?v=8Mttjyf-8P4 ?

If yes could Rx Framework be helpfull to implement similar piece of software ?

Upvotes: 2

Views: 2339

Answers (2)

Benjol
Benjol

Reputation: 66607

Nice question, I've been wondering about this myself, for one of my current projects.

I don't feel greatly qualified to give a definitive answer, however:

They are designed to scratch different itches.

Disruptor is clearly designed for performance first, as close to the metal as possible. It doesn't do anything fancy apart from what it does.

Rx is higher level, it is 'Linq to events', it allows you to do nice things with 'events' that you couldn't with normal framework events (you can't filter a standard event and then continue propagating it as an event).

Semantic differences

As the originator of Disruptor.Net pointed out here:

The interface matches but I think the semantic behind RX does not:

  • an exception (OnError) terminates the stream, this in not the case with the disruptor
  • you can not subscribe to the disruptor while it's hot: observers would have to be setup before "starting" the disruptor, this does not work very well with operators like retry for instance which will re- subscribe in case of error
  • lots of operators do not make sense with the disruptor or would just not work

Having said that, he was (at least at one time) thinking about integration between Disruptor.Net, TPL Dataflow and Rx.

Here is another page where someone asks the same question, the page concludes with:

Disruptor is in fact more like TPL DataFlow in my opinion.

Upvotes: 4

Peter Lawrey
Peter Lawrey

Reputation: 533780

Without know the Rx framework, you could be right. However Disruptor.Net is designed to be a port of the Java version so it will be as similar as possible. Given the original doesn't use Rx, it would add lots of rework and possibly performance issues to use a different library.

Upvotes: 1

Related Questions