Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparison of Java reactive frameworks [closed]

I see many frameworks/libraries that claim that they can help build reactive applications in Java, such as: Akka, Vert.x, RxJava, Reactor, QBit, etc.

They seem to have different approaches, features, pros, cons, etc. I could not find detailled comparisons. There is documentation about each of these framerwork, but it is not enough for me to understand the differences.

What are the differences between the major Java reactive frameworks?

And what are the application requirements that can drive the choice of a Java reactive framework?

Thank you for your time.

like image 332
Florian Beaufumé Avatar asked Nov 12 '15 12:11

Florian Beaufumé


1 Answers

I'm working on RxJava and I did some evaluations on Akka-Streams and Reactor recently.

As far as I can tell with all the libraries, they converge to a single concept called Reactive-Streams so you can go back and forth between the implementations.

I believe RxJava is the most generic of all, has zero dependencies on other libraries and is not opinionated about concurrency. It is very popular on Android mainly due to support by other libraries/frameworks such as Retrofit. The 1.x branch doesn't implement Reactive-Streams but has wrappers for it whereas 2.x is natively Reactive-Streams compliant (currently available in preview). Many popular JVM-based programming languages have adaptors for it (Scala, Kotlin, Clojure, etc).

Reactor is Reactive-Streams compliant as it is more recent library. They have dependencies/support for a lot of other libraries. They chose a different set of tradeoffs when it comes to concurrency and queueing in the streams (i.e., LMAX Disruptor-style). There were a few back and forth between it and RxJava regarding operators and we've started talking about having a shared pool of operators.

Akka is highly dominated by Scala-like concepts; I had a small trouble getting it to work. The team behind it were involved in developing the Reactive-Streams specification and there is an Akka-Streams library that is advertised to support Reactive-Streams, however, accessing it is cumbersome because its fluent API is heavily intertwined with the Akka actor model.

If you are on the server/desktop/Android side, RxJava is generally a good choice (and I believe is documented better than the others) and is aimed at high-throughput asynchronous operations. If you are more on the latency side, Reactor might be a better choice. I don't know much about the usages of Akka-Streams but I saw one benchmark a year ago where a web-server built around Akka outperformed Tomcat and Netty+RxJava.

like image 159
akarnokd Avatar answered Sep 28 '22 01:09

akarnokd