Vert.x - an asynchronous, event-driven framework created under the influence of node.js. Part 1

Hello!
It’s very trendy to use node.js. at the moment. However, not everyone likes him. In this review, I would like to talk a bit about the competitor that was written under the influence of
node.js. Vert.x is an asynchronous, event-driven framework whose goals intersect with the popular node.js. High performance, simple asynchrony and configuration are all on vert.x.
The first version of the framework was released in 2012, while node.js was released in 2009. However, VMware is already supported and can run on CloudFoundry.
Main characteristics of the product under the cut:

  • Multi-lingual. You can use JavaScript, Ruby, Groovy, Java, Python. Almost ready to support Scala and Closure
  • opensource. ASL 2.0 license
  • true concurrency and high performance
  • written in java, and uses all the delights of the JVM, scaling easily between cores, without having to worry about interprocess communication
  • Uses the 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 extremely simple.
  • Modular system with public repository
  • Distributed message bus that spans both server and client.
  • Embedded version available
  • According to various tests, perhaps the most productive framework in its class
  • Requires JDK 1.7
  • WebSockets, SockJS support

Interesting? Example 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 do:
vertx run Server.groovy -instances 32

As you can see, everything is extremely simple and clear.

After looking at the code examples and reading 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 more detailed testing materials ready. I will tell about him in the third part.
Unfortunately, these tests do not contain scala tests. As you know, scala in many cases is faster than java.
Perhaps for a Friday post, this is enough. In the next part I will talk about the basic principles and patterns used in vert.x.
Project website . The link is excellent documentation.

Also popular now: