Hello!
At the moment, it’s very trendy to use node.js. However, not everyone likes it. In this review, I would like to tell a little about the competitor, which was written under the influence of node.js
Vert.x is an asynchronous, event-driven framework whose goals overlap with the popular node.js. High performance, simple asynchrony and configuration are all vert.x.
The first version of the framework was released in 2012, while node.js was released in 2009. However, it is already supported by VMware and can be run on CloudFoundry.
The main characteristics of the product under the cut:
- Multi-lingual. You can use JavaScript, Ruby, Groovy, Java, Python. Scala and Closure support is almost ready
- opensource. ASL 2.0 license
- true concurrency and high performance
- written in java, and uses all the delights of the JVM, scaling easily between the cores, without having to worry about interprocessor interaction
- Uses Hazelcast - In-Memory Data Grid system. Transparent to the user naturally
- Uses Netty
- Super simple concurrency model. No synchronized or volatile, or explicit locks
- No noodle xml configs. Everything is very simple
- Modular system with shared repository
- A distributed message bus that spans both the server and the client.
- Embedded version available
- According to various tests, perhaps the most productive framework in its class
- Requires JDK 1.7
- WebSockets, SockJS support
Interesting? An example of rest helloworld on scala:
class SampleResticle extends Resticle { override def handles = { GET("/hello") :> OK( _ => "world ") } }
or a simpler server example serving the webroot directory. Groovy example:
vertx.createHttpServer().requestHandler { req -> def file = req.uri == "/" ? "index.html" : req.uri req.response.sendFile "webroot/$file" }.listen(8080)
In order to run for example the last helovorld, you need to run:
vertx run Server.groovy -instances 32
As you can see everything is extremely simple and clear.
')
Having looked at code examples, and having read the principles, I naturally decided to check the authors' statement about super performance. I looked for comparisons with node.js.
The first graph shows the test results when
only 200 / OK responds are given.

The second test gives a 72-byte html page:

tests are taken
from here . These tests were conducted relatively long ago. I have materials for more detailed testing. I will tell about it in the third part.
Unfortunately, these tests do not contain scala tests. As is known, scala in many cases turns out to be faster than java.
Perhaps, for the Friday post, this is enough. In the next part I will talk about the basic principles and patterns used in vert.x.
Project site . The link is excellent documentation.