diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java index 1b83d98176840..90a89c45442c2 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java @@ -274,8 +274,7 @@ public static void startServerAfterFailedStart() { doServerStart(vertx, buildConfig, config, LaunchMode.DEVELOPMENT, new Supplier() { @Override public Integer get() { - return ProcessorInfo.availableProcessors() - * 2; //this is dev mode, so the number of IO threads not always being 100% correct does not really matter in this case + return ProcessorInfo.availableProcessors(); //this is dev mode, so the number of IO threads not always being 100% correct does not really matter in this case } }, null, false); } catch (Exception e) { diff --git a/extensions/vertx/deployment/src/test/java/io/quarkus/vertx/deployment/MessageConsumerContextTest.java b/extensions/vertx/deployment/src/test/java/io/quarkus/vertx/deployment/MessageConsumerContextTest.java index 54e945fc186f6..cc80a52a62335 100644 --- a/extensions/vertx/deployment/src/test/java/io/quarkus/vertx/deployment/MessageConsumerContextTest.java +++ b/extensions/vertx/deployment/src/test/java/io/quarkus/vertx/deployment/MessageConsumerContextTest.java @@ -84,11 +84,7 @@ public void testRequestReply() throws InterruptedException { }) .await().atMost(Duration.ofSeconds(3)); - if (Runtime.getRuntime().availableProcessors() > 1) { - assertEquals(3, MessageConsumers.MESSAGES.size()); - } else { - assertTrue(MessageConsumers.MESSAGES.size() >= 2); - } + assertTrue(MessageConsumers.MESSAGES.size() >= 2); } @ApplicationScoped diff --git a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java index 4a4161d600573..1d4ff48c2413d 100644 --- a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java +++ b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java @@ -381,7 +381,10 @@ private static int calculateDefaultIOThreads() { //it's hard to say what this number should be, but it is also obvious //that for constrained environments we don't want a lot of event loops //lets start with 10mb and adjust as needed - int recommended = ProcessorInfo.availableProcessors() * 2; + //We used to recommend a default of twice the number of cores, + //but more recent developments seem to suggest matching the number of cores 1:1 + //being a more reasonable default. It also saves memory. + int recommended = ProcessorInfo.availableProcessors(); long mem = Runtime.getRuntime().maxMemory(); long memInMb = mem / (1024 * 1024); long maxAllowed = memInMb / 10; diff --git a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/config/VertxConfiguration.java b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/config/VertxConfiguration.java index 464b453c6d471..375dbcf200228 100644 --- a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/config/VertxConfiguration.java +++ b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/config/VertxConfiguration.java @@ -23,7 +23,7 @@ public class VertxConfiguration { public boolean classpathResolving; /** - * The number of event loops. 2 x the number of core by default. + * The number of event loops. By default, it matches the number of CPUs detected on the system. */ @ConfigItem public OptionalInt eventLoopsPoolSize;