the question may look like a troll, but actually it is about how vert.x controls concurrency, since the vertex itself works in a dedicated thread.
Look at this simple vert.x http server written in Java:
import org.vertx.java.core.Handler; import org.vertx.java.core.http.HttpServerRequest; import org.vertx.java.platform.Verticle; public class Server extends Verticle { public void start() { vertx.createHttpServer().requestHandler(new Handler<HttpServerRequest>() { public void handle(HttpServerRequest req) { req.response().end("Hello"); } }).listen(8080); } }
As far as I understand the docs, this whole file is the top. Thus, the start method is called vertically in the selected thread, so good. But where is the Handler request called? If it is called in this thread, I donβt see where it is better than node.js.
I am very familiar with Netty, which is based on the vert.x-based / concurrency network. Each incoming connection is mapped to a dedicated stream, which scales very well. So ... does that mean incoming connections are also peaks? But how then can a Verticle Server instance interact with these clients? Actually, I would say that this concept is limited to node.js.
Please help me understand the principles correctly!
Regards, Chris
source share