Microservices are gaining traction as an software architecture style that will better support continuous delivery, provide a model for rapid deployment and separation of concerns.
Vert.x 3 and Vert.x-Apex provide an interesting model for building a microservices. As one of the examples shows, a simple verticle can expose an HTTP service, so a REST service is available. The verticle binds its own tcp port.
When scaling up to multiple micro-services to support a full application you end up with a number of choices. Any thoughts on what style could eventually support continuous delivery, and minimizing downtime on upgrades?
On the deployment side rapid deployment of new services would be desirable, without bringing the whole application down.
Separate micro-services offer an interesting way of development, but offers some challenges in orchestration and deployment.
Any thoughts?
Eclipse Vert. x is a toolkit to build reactive microservices.
x website (vertx.io) says, “Eclipse Vert. x is a toolkit for building reactive applications on the JVM.” It is event-driven, single-threaded, and non-blocking, which means you can handle many concurrent apps with a small number of threads. (If you know how the Node. js event loop works, Vert.
Vert. x is a polyglot web framework that shares common functionalities among its supported languages Java, Kotlin, Scala, Ruby, and Javascript. Regardless of language, Vert. x operates on the Java Virtual Machine (JVM). Being modular and lightweight, it is geared toward microservices development.
Let's start with terminology.
verticle
is a Java class that usually extends AbstractVerticle
and implements a start(..) method. A verticle can expose one or more HTTP endpoints and expore one or more eventbus
endpoints.application
(previously called a 'module'). An application can contain one or more verticles. I usually keep it 1:1 to keep things small and simple.instance
. You can run multiple instances of an application to increase parallelization.container
. A container is a running process with one or more instances of an application.When building a microservices-style application with Vert.x, you typically want small independent logical units of work, call them services. Such a service should ideally run in its own process, be self-contained and indepedently upgradeable. Mapping it to the terminology above: build the service as a Vert.x application containing a single Verticle with the service logic.
Vert.x applications communicate with each other using the distributed eventbus, built with Hazelcast. This means that multiple JVM's running on the same server, or even on multiple servers, can communicate with each other over the Vert.x eventbus.
A web application built with Vert.x usually consists of one or more Vert.x applications exposing REST endpoints communicating over the eventbus with one or more Vert.x applications exposing (internal) eventbus endpoints.
To answer your question: option 3 is the most common in Vert.x setups, and stays the closest to a microservices architecture. You can choose between 2 options there: you either run 1 application with a REST endpoint that handles all HTTP calls and delegates request processing over the eventbus to other applications, or you give each service (or at least, each service providing functionality for end users) its own REST endpoint. The latter is a bit more complex to setup since there are multiple HTTP endpoints to connect to from the frontend, but it's more scalable and has less single points of failure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With