Call vertx.createHttpServer() outside the verticle
up vote
0
down vote
favorite
If I call vertx.createHttpServer()
outside the verticle class, only one I/O thread can be utilized when receives multiple requests at the same time:
VertxOptions options = new VertxOptions();
options.setEventLoopPoolSize(4);
Vertx vertx = Vertx.vertx(options);
HttpServer server = vertx.createHttpServer();
server.requestHandler(req -> {
System.out.println(Thread.currentThread() + ": " + req);
req.response().end("hellon");
});
server.listen(8080);
output:
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@716def00
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@4d61f8ea
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@20e9544b
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@245530df
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@3adedeba
Is there a way to utilize multiple cores of CPU without deploying verticles?
vert.x
add a comment |
up vote
0
down vote
favorite
If I call vertx.createHttpServer()
outside the verticle class, only one I/O thread can be utilized when receives multiple requests at the same time:
VertxOptions options = new VertxOptions();
options.setEventLoopPoolSize(4);
Vertx vertx = Vertx.vertx(options);
HttpServer server = vertx.createHttpServer();
server.requestHandler(req -> {
System.out.println(Thread.currentThread() + ": " + req);
req.response().end("hellon");
});
server.listen(8080);
output:
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@716def00
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@4d61f8ea
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@20e9544b
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@245530df
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@3adedeba
Is there a way to utilize multiple cores of CPU without deploying verticles?
vert.x
Have you tried creating the server again with the same options?
– tsegismont
Nov 17 at 8:46
Why don't you want to create verticles?
– Mis94
Nov 18 at 23:21
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
If I call vertx.createHttpServer()
outside the verticle class, only one I/O thread can be utilized when receives multiple requests at the same time:
VertxOptions options = new VertxOptions();
options.setEventLoopPoolSize(4);
Vertx vertx = Vertx.vertx(options);
HttpServer server = vertx.createHttpServer();
server.requestHandler(req -> {
System.out.println(Thread.currentThread() + ": " + req);
req.response().end("hellon");
});
server.listen(8080);
output:
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@716def00
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@4d61f8ea
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@20e9544b
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@245530df
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@3adedeba
Is there a way to utilize multiple cores of CPU without deploying verticles?
vert.x
If I call vertx.createHttpServer()
outside the verticle class, only one I/O thread can be utilized when receives multiple requests at the same time:
VertxOptions options = new VertxOptions();
options.setEventLoopPoolSize(4);
Vertx vertx = Vertx.vertx(options);
HttpServer server = vertx.createHttpServer();
server.requestHandler(req -> {
System.out.println(Thread.currentThread() + ": " + req);
req.response().end("hellon");
});
server.listen(8080);
output:
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@716def00
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@4d61f8ea
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@20e9544b
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@245530df
Thread[vert.x-eventloop-thread-1,5,main]: io.vertx.core.http.impl.HttpServerRequestImpl@3adedeba
Is there a way to utilize multiple cores of CPU without deploying verticles?
vert.x
vert.x
asked Nov 9 at 14:57
Neo
83411641
83411641
Have you tried creating the server again with the same options?
– tsegismont
Nov 17 at 8:46
Why don't you want to create verticles?
– Mis94
Nov 18 at 23:21
add a comment |
Have you tried creating the server again with the same options?
– tsegismont
Nov 17 at 8:46
Why don't you want to create verticles?
– Mis94
Nov 18 at 23:21
Have you tried creating the server again with the same options?
– tsegismont
Nov 17 at 8:46
Have you tried creating the server again with the same options?
– tsegismont
Nov 17 at 8:46
Why don't you want to create verticles?
– Mis94
Nov 18 at 23:21
Why don't you want to create verticles?
– Mis94
Nov 18 at 23:21
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228138%2fcall-vertx-createhttpserver-outside-the-verticle%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried creating the server again with the same options?
– tsegismont
Nov 17 at 8:46
Why don't you want to create verticles?
– Mis94
Nov 18 at 23:21