Vert.x (vertx) introductory information

1.vert.x Profile

vert.x using eventloop callback mechanism similar Node.js, the advantage is Eventloop scene is almost single-threaded concurrency is the fastest solution, but it also needs the support of the surrounding ecology, such as DbClient / HttpClient those dealing with the need to support IO API asynchronous callback style, simply integrate the community or their own reality. Dependency Injection library could use Guice, the overall start-up time is probably about a quarter of the size of spring boot with the project, less than half the standard memory footprint.

Vert.x dependent on the underlying communication framework Netty, and encapsulates support Http protocol, and therefore can be very convenient Web development does not depend on any intermediate. Do not rely on middleware, programming will become very flexible, very strong customization, security will be improved to some degree layer.

2. Advantage

  • Vert.x first advantage is that this is a non-blocking asynchronous framework
  • Vertx supports a variety of programming languages
  • Do not rely on middleware: the bottom Vert.x dependent Netty, so the use of Vert.x build a Web project does not depend on middleware
  • Improve the ecological
    Vert.x and contrast Spring, there is a feeling of use MacOS and Windows comparison. Different Vert.x Spring and large family system, Vert.x provide database operations, common operating structure Redis, Web client operations, some operations such as NoSQL databases, very clean, very simple, but enough to use
  • Health services for the micro-
    Vert .x offers a variety of components to build micro-based applications and services. The interaction between the service can be very easily carried out by EventBus. And it provides HAZELCAST to implement distributed.

3.web Service Selection

For the realization of a simple web service, there are many options, classified into three simple

  • This is one of the most used, but also a lot of Java developers may first thought is to use Java middleware to achieve, just download a Tomcat, and then write a web project can provide external Web services. This way we do not need to fully consider the interaction of threads, no need to consider the network protocol, only need to focus on business logic, can be said to be a form of all-inclusive.
  • Socket or the NIO Java using native to achieve, but this approach is more complex, demanding programming skills, but also difficult to ensure the realization of their own performance and stability. In this way completely requires manual processing, rarely use this way to achieve HTTPServer, can say this is the most primitive form.
  • Interposed between the original form and the whole package, it is to use a third party to implement the frame, such as partial or Vertx underlying Netty. You can use the API frame package simply create a HttpServer, does not need to focus on the underlying communication protocol. This method is more flexible, in general, higher performance, and does not rely on middleware.

4. Start Tutorial

Write a Demo:

Series Tutorial:

A run up example:

Official kinds of sample code:

Published 418 original articles · won praise 745 · Views 1.26 million +

Guess you like

Origin blog.csdn.net/u013467442/article/details/98201401