Comparison of Java reactive frameworks [closed]

限于喜欢 提交于 2019-12-03 03:37:57

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/33671578/comparison-of-java-reactive-frameworks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!