-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Slow start of CLI, missing the supersonic effect #18097
Comments
Could be related to #16355 |
@rsvoboda I figured out what is causing this strange behaviour on macOS systems when using Java CLI or starting Java apps in general. The problem is that for some unknown reason, the following call on the JVM is taking seconds to execute: java.net.InetAddress.getLocalHost() It could be solved by adding the hostname that the application will return on your etc hosts file, pointing to 127.0.0.1 like:
To see your actual hostname, run: I don't know in what JDK versions this problem happens, but I tested on Java LTS versions (11 & 17). After change hosts file, you can just run Quarkus Fast-Jar and the startup time will be very fast as it should be: In my case it's now just taking 0.553 seconds!!! Before I change the etc/hosts file, the startup was taking about 5 seconds. If you're curious, you can run the Main class of inetTester.jar to see how much time the call takes to execute: public static void main(String[] args) throws UnknownHostException {
System.out.printf("Calling the hostname resolution method...%n");
final Instant start = Instant.now();
final String hostName = InetAddress.getLocalHost().getHostName();
final long end = Duration.between(start, Instant.now()).toMillis();
System.out.printf("Method called, hostname %s, elapsed time: %d (ms)%n", hostName, end);
} |
Hostname resolution trick is not helping in my case. In the description you can see that I have quick starts with other java programs. I will try to ping some people to see how quick |
Ah, so I guess I found the trouble, I'm using quarkus app through jbang as described in https://quarkus.io/get-started/ and https://quarkus.io/guides/cli-tooling#installing-the-cli When I directly invoke
cc @maxandersen |
Yes. Two runs of a jvm vs one will have this effect. I don't see the same big difference though. What java version are you using ? |
Two runs of a jvm - yup, I realized that when looking into the details, was using GraalVM CE 21.3.0 Java11. The main concern is that the JBang way of using So this way users get a slower experience with CLI than if they use for example SDKMAN! based CLI installation. |
correct its slightly slower but it is also way simpler and more reliable to install. working on making jbang native which should help too and provide java based fallback so still reliable to install. But its not in the cards at the moment. |
/cc @ebullient, @maxandersen |
Quite slow on WSL2 with Ubuntu 20
version 3.5.0 |
How is it installed ? |
@maxandersen JBang |
Ok. Try use direct sdk or scoop or choco. That removes one jvm start from that. Try measure that and see what diff that does for you. |
Bit better with sdk, about half:
|
Quarkus CLI has slow(-ish) start, I'm missing the supersonic effect.
I'm using MBP 2019 with JDK 11 and the cli startup feels slow, 2 seconds to get help.
Did also comparison with CLI for Spring Boot and Micronat to get help text and to get version.
Micronaut cli is slower than Quarkus cli, but Spring Boot cli is much faster, around 0.6s versus 1.7s. I think Quarkus cli should get under 1 second.
Version:
Help:
The text was updated successfully, but these errors were encountered: