-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JDK 23 new console is causing a serious regression in startup #44471
Comments
@dmlloyd also proposed:
which also makes sense |
I've opened https://issues.redhat.com/browse/LOGMGR-354 with this idea. |
🙏 |
It turns out that using Here is an allocation framegraph for JDK 23: |
Is this with dev mode or plain startup? I have a vague recollection @Karm opened an issue to determine if the new console could allow us to get rid of Jansi and friends. |
All the flamegraphs are from prod mode startup |
Would you be able/willing to try jboss-logging/jboss-logmanager#491 to see if it fixes the issue? |
Sure, let me give it a shot |
The fix doesn't make a difference on its own unfortunately. From what I can tell, In addition to your change to the LogManager, I had to apply the following patch to Quarkus: diff --git a/bom/application/pom.xml b/bom/application/pom.xml
index e9ab40adbf5..a912e55218e 100644
--- a/bom/application/pom.xml
+++ b/bom/application/pom.xml
@@ -157,7 +157,7 @@
<dekorate.version>4.1.4</dekorate.version> <!-- Please check with Java Operator SDK team before updating -->
<maven-invoker.version>3.2.0</maven-invoker.version>
<awaitility.version>4.2.2</awaitility.version>
- <jboss-logmanager.version>3.0.6.Final</jboss-logmanager.version>
+ <jboss-logmanager.version>3.1.0.Final-SNAPSHOT</jboss-logmanager.version>
<flyway.version>10.21.0</flyway.version>
<yasson.version>3.0.4</yasson.version>
<!-- liquibase-mongodb is not released everytime with liquibase anymore, but the two versions need to be compatible -->
diff --git a/core/devmode-spi/pom.xml b/core/devmode-spi/pom.xml
index 377814ec671..52e75de8980 100644
--- a/core/devmode-spi/pom.xml
+++ b/core/devmode-spi/pom.xml
@@ -15,6 +15,10 @@
<description>SPI classes for Quarkus Development mode.</description>
<dependencies>
+ <dependency>
+ <groupId>org.jboss.logmanager</groupId>
+ <artifactId>jboss-logmanager</artifactId>
+ </dependency>
</dependencies>
</project>
diff --git a/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java b/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java
index a659d432428..98b493d81e9 100644
--- a/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java
+++ b/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java
@@ -11,6 +11,7 @@
import java.util.concurrent.LinkedBlockingDeque;
import java.util.function.BiPredicate;
import java.util.function.Consumer;
+import java.util.logging.ConsoleHandler;
public abstract class QuarkusConsole {
@@ -108,6 +109,9 @@ public static boolean hasColorSupport() {
if (Boolean.getBoolean(FORCE_COLOR_SUPPORT)) {
return true; //assume the IDE run window has color support
}
+ // force some initialization
+ //noinspection ResultOfMethodCallIgnored
+ org.jboss.logmanager.handlers.ConsoleHandler.hasConsole();
if (IS_WINDOWS) {
// On Windows without a known good emulator
// TODO: optimally we would check if Win32 getConsoleMode has After using your PR for the log manager and the patch above, the JLine console completely went away |
That said, the PR itself is totally valid, we just need to do more in Quarkus to make the problem dissapear |
Since dev mode pertains specifically to the console, maybe we should just set the property there (edit: somewhere very early) as well. That would avoid the dependency (there's nothing special about the logmanager fix that merits the dependency, it's just setting the property). |
The class I changed is actually part of the prod jar (which is what I've been testing). But yeah, we can certainly just apply the property in the same manner somewhere early |
diff --git a/bom/application/pom.xml b/bom/application/pom.xml
index e9ab40adbf5..a912e55218e 100644
--- a/bom/application/pom.xml
+++ b/bom/application/pom.xml
@@ -157,7 +157,7 @@
<dekorate.version>4.1.4</dekorate.version> <!-- Please check with Java Operator SDK team before updating -->
<maven-invoker.version>3.2.0</maven-invoker.version>
<awaitility.version>4.2.2</awaitility.version>
- <jboss-logmanager.version>3.0.6.Final</jboss-logmanager.version>
+ <jboss-logmanager.version>3.1.0.Final-SNAPSHOT</jboss-logmanager.version>
<flyway.version>10.21.0</flyway.version>
<yasson.version>3.0.4</yasson.version>
<!-- liquibase-mongodb is not released everytime with liquibase anymore, but the two versions need to be compatible -->
diff --git a/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java b/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java
index a659d432428..8f1a0072288 100644
--- a/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java
+++ b/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java
@@ -104,7 +104,16 @@ public synchronized static void uninstallRedirects() {
redirectsInstalled = false;
}
+ private static void checkAndSetJdkConsole() {
+ // the JLine console in JDK 23+ causes significant startup slowdown, so we avoid it unless the user opted into it
+ String res = System.getProperty("jdk.console");
+ if (res == null) {
+ System.setProperty("jdk.console", "java.base");
+ }
+ }
+
public static boolean hasColorSupport() {
+ checkAndSetJdkConsole();
if (Boolean.getBoolean(FORCE_COLOR_SUPPORT)) {
return true; //assume the IDE run window has color support
} works as well |
Simpler is better! I like it. |
💪🏽 |
Thanks @Karm ! |
@dmlloyd has a new version with your changes been released? |
No, not yet, as far as I'm aware. @jamezp WDYT about a release? |
I'm on PTO today through Monday, but I can do a release on Tuesday. |
Thanks folks! |
I opened #44796 |
Default to old console if user has not set it
This is done because the new JLine console which is the default from JDK 23 (maybe even 22?) causes a large regression in startup time due to it loading a very large number of classes. If users really want to use the new console, they have to start the application with `-Djdk.console=jdk.internal.le` Fixes: quarkusio#44471 Fixes: quarkusio#44653 (cherry picked from commit 88a0dce)
@geoand Thanks for the heads-up. I take it's a regression caused by https://bugs.openjdk.org/browse/JDK-8308591? If so the CSR has this piece of information:
If we have a good and reliable benchmark showing the regression then I'll report this upstream. But probably next year as I don't have the cycles to do it this week. I suppose the claim would be a ~16% regression for this particular quarkus app (is this the dev-console or something else)? That sounds serious enough to warrant a report. |
Thanks @jerboaa ! The example I mentioned above is a very simple REST application. The regression we are seeing is in production mode, so there is no dev console. |
This is done because the new JLine console which is the default from JDK 23 (maybe even 22?) causes a large regression in startup time due to it loading a very large number of classes. If users really want to use the new console, they have to start the application with `-Djdk.console=jdk.internal.le` Fixes: quarkusio#44471 Fixes: quarkusio#44653 (cherry picked from commit 88a0dce)
Description
When using the
rest-json
quickstart, on my machine I see the following numbers for startup:The regressions from 23 to 24 can be reversed by setting
-Djdk.console=java.base
.We should do that as the first thing in our generated main (unless the user has already set such a property).
P.S. @dmlloyd spotted the JLine issue by looking at the allocation flamegraphs I produced:
21:
24:
Implementation ideas
No response
The text was updated successfully, but these errors were encountered: