For developers looking to break free from their application servers, Vert.x provides an exciting new paradigm as the Vert.x development team explains in this Q&A.
What unique features and benefits does Vert.x provide for traditional server-side developers?
Vert.x has a number of unique features compared to traditional development based on application servers that represent a total shift in development paradigm. A developer using Vert.x will tell you that this un-opinionated aspect is one of its strongest points since you are not constrained by any strict structure. You can develop what you think will better solve the problem you're facing.
Other developers, however would refer to its high availability and scalability out of the box as a unique feature since from the development perspective they do not need to change their code to scale from one to many machines.
However this is not it, the reactive aspect will save hours of debugging sessions since with Vert.x you are guaranteed to run only on one thread and the typical thread safety/debugging issues are a thing of the past, or should we say, application servers.
How does Vert.x compare to other technologies like Node.js?
Both Node.JS and Vert.x have about the same performance curve. Vert.x uses a Java Virtual Machine, which executes code slightly faster than JS, but with higher memory consumption. Both Nodes.JS and Vert.x are implementing a reactor pattern based on an event loop. On this aspect, Vert.x handles several event loops so the application can use optimally all CPU’s core in a single process.
Dynamically typed languages offers ability to iterate and prototype quickly, while Vert.x differentiated from Node.JS by also offering static typed languages (Java, Ceylon, etc). Static typing offers unparalleled refactoring abilities and that you have only in Vert.x.
Most will probably find Node.JS to be easier to start with since being Vert.x a rather young project its ecosystem is not comparable to Node.JS one. Performance wise, from benchmarks it looks like Node.JS frameworks lack behind severely.
But this is not all, Vert.x brings more than just a event-driven model to the JVM; out of the box developers get cluster support, high availability and scalability over all CPU cores and network nodes in your deployment.
What benefits does Vert.x provide over a traditional application server?
If we can describe Vert.x in 5 words they would be:
When you look at these words and try to compare against an application server you notice that you cannot do that.
Vert.x is a framework so it means that your application does not need an application server, in fact it only requires an installed Java Runtime Environment on the host machine. This simplifies a lot the OPS-side of the work. It is un-opinionated in the sense that the developer is king, she can decide which other component, library or piece of code to use. Vert.x does not mandate any specific structure or build tools. For example as a developer you are not bound to use a specific build tool, in fact you can use Apache Maven, Gradle, Apache Ant or even NPM or your custom scripts.
Now what really makes Vert.x different from an application server are the remaining items: Reactive, Polyglot and Distributed.
Regarding the reactive aspect, in an application server, the supports for is provided in the form of multi-threading. Each user-request is mapped to a thread, which takes care of responding to the user-request. The application developer writes his application as if only one user was using it. However there are disadvantages to this model:
There is a computing overhead in constantly switching threads.
There is a linear relationship between the number of threads and the memory used, because at minimum each thread gets a stack allocated to him. A stack uses memory.
Thread safety is always a pain point and hard to implement.
Vert.x takes a different road when building modern applications, one that accommodates more user-requests and longer-running user-requests by providing better CPU and memory usage. Vert.x addresses these requirements with asynchronous event-driven non-blocking I/O: it uses a single thread that handles all user-requests, but outsources all I/O operations so they do not block the thread.
With this model Vert.x can handle thousands of concurrent user-requests easily with very little memory.
And this brings us to the last point that Vert.x is by nature distributed. All services communicate over an event bus, this gives the developers horizontal scaling out of the box. Since Vert.x can support many languages the messages on the event bus are usually in JSON format and this is the key that allows all this flexibility. It’s also a key feature to implement micro-services based applications.
What are the best resources for developers looking to learn more about Vert.x?
Vert.x is quite new project so you will not find many published books about it. There are some, however the project is evolving quite fast and probably developers would find the project website http://vertx.io a good source of information as well the GitHub example repository https://github.com/vert-x3/vertx-examples.
If you're looking more into presentations and videos then on the project website there are a list of presentations done not only by the core team but also by community members. This should show that there is lots of interest.
Finally, there is a blog (http://vertx.io/blog) where technical articles are posted regularly. We can mention the “Introduction to Vert.x” blog post series (http://vertx.io/blog/my-first-vert-x-3-application/) that provides a step by step introduction to Vert.x and its ecosystem.