我想用Java开发微服务。 Spring 5和Eclipse Vert.x中最好的选择是什么?或者我应该尝试其他什么?
答案 0 :(得分:1)
老实说,这取决于很多因素。 在拨打电话之前您需要考虑的一些因素是
你需要多长时间才能开始?您是仅仅是为了学习这些框架,还是在构建更大的项目?
Reactor框架现在是Spring 5的一部分,使用两个框架都可以实现异步非阻塞休息服务。两者都建立在Netty之上,就构建微服务而言,它将满足您的大部分需求。 Pivotal(Spring / SpringBoot背后的公司)已经创建了许多集成模块供您使用其他框架(用于其他目的),但是如果您使用的是Spring引导,那么它是如何感觉它是集成某些组件的最佳方式。这可以导致更大的部署规模包,但您可以获得不必集成这些组件的好处。 Vertx是真正的polygot,任何与JVM一起使用的语言都可以与Vertx本身一起顺利运行。
答案 1 :(得分:0)
Development time: Vertx is very lightweight but you need to add libraries and write the integration code, Spring has a lot of integration modules which increased the deployment size
Memory cost: Because of the above point Vertx take less memory whereas Spring takes more memory for each service instance
Maintenance cost - Vertx: Manual configuration is high, Spring provides a lot of Autoconfiguration
Complexity: My personal opinion is that creating reactive applications with Vert.x is much simpler and understandable than using Spring Framework 5.0.
Vert.x is polyglot. Applications can be written in several languages. It is even possible to use different languages in the same application. At this point, Java, Python, Groovy, Ruby, and JavaScript can be used and support for Scala and Clojure is on the way
Non-blocking, event-driven nature is extremely well-suited for modern web applications Where Vert.x makes it easy to write concurrent applications that scale effortlessly from a single low-end machine to a cluster with several high-end servers.