quarkus: startup time is 2 times slower than documented - quarkus

I used the getting-started-project from the quarkus quickstart and compiled it. I started it with ./mvnw compile quarkus:dev. However, it starts after about 1.495s. In the documentation it is reached in about 0.668s. So in my case it is about 2 times slower than documented in the quarkus website. Btw, I restarted it a few times to check if it will be faster without changing/compiling any file. However, it starts always about 1.495s. Why the big difference?
[INFO] ----------------------< org.acme:getting-started >----------------------
[INFO] Building getting-started 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # getting-started ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # getting-started ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- quarkus-maven-plugin:1.0.0.Final:dev (default-cli) # getting-started ---
Listening for transport dt_socket at address: 5005
2019-11-27 13:11:13,904 INFO [io.quarkus] (main) Quarkus 1.0.0.Final started in 1.495s. Listening on: http://0.0.0.0:8080
2019-11-27 13:11:13,923 INFO [io.quarkus] (main) Profile dev activated. Live Coding activated.
2019-11-27 13:11:13,924 INFO [io.quarkus] (main) Installed features: [cdi, resteasy]
My machine: JDK 12 / MacBook 2018 / RAM: 16GB
I already set my hosts file by https://thoeni.io/post/macos-sierra-java/.

Methodology for start times shown on the website is documented here: https://quarkus.io/guides/performance-measure#how-do-we-measure-startup-time. It is important to note that the advertised start time measurements are from starting the application to processing the first request. First request time is not represented in the Info log message.
There are a large number of factors that influence the absolute start times observed, including (but not limited to) platform O/S, CPU specification, Java version, GC implementation, power management, hostname resolution etc.
It is unlikely that you will observe the same absolute start times, it is also possible to observe better start times than have been measured on our lab environment.
What is important to note in the start times displayed on the home page of the website is the difference between startup times for different deployment scenarios; more importantly the relative speed up from other frameworks.

Related

Jenkins job produces a successful build without completing the pipeline [duplicate]

I configure my job as freestyle. And I need to run cases to a specified machine. MY project is maven project. I want to copy reports to master node after cases finish to run.
Jenkins ver. 1.483
I use pscp to copy files which works fine by hand in windows command prompt.
My command looks like:
mvn clean install -U
pscp -P 22 -i pgrsa.ppk -r %SLAVE_JENKINS_HOME%\workspace\%JOB_NAME%\target\surefire-reports ci#master:%JENKINS_HOME%/workspace/%JOB_NAME%
The pscp seems not work. When I use command like this:
echo EchoCommand is working.===
mvn clean install -U
echo EchoCommand is working again.===
EchoCommand is working again.===Not show at the output of the console while EchoCommand is working.=== has been shown. Why? Anyone knows that?
EDIT
C:\Tools\Jenkins\workspace\myproject-testng-sample-windows>echo EchoCommand is working.===
EchoCommand is working.===
C:\Tools\Jenkins\workspace\myproject-testng-sample-windows>mvn clean install -U
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.pak.automation:myproject-testng-sample:jar:1.0.0-SNPASHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-deploy-plugin is missing. # com.pak:pak-parent:2.0.0, C:\Users\pak\.m2\repository\com\pak\pak-parent\2.0.0\pak-parent-2.0.0.pom, line 484, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. # com.pak:pak-parent:2.0.0, C:\Users\pak\.m2\repository\com\pak\pak-parent\2.0.0\pak-parent-2.0.0.pom, line 472, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myproject-testng-sample 1.0.0-SNPASHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://mvn.pak.com/pakrepo/org/apache/maven/plugins/maven-source-plugin/maven-metadata.xml
Downloading: http://mvn.pak.com/pak-releases/org/apache/maven/plugins/maven-source-plugin/maven-metadata.xml
Downloading: http://mvn.pak.com/pak-snapshots/org/apache/maven/plugins/maven-source-plugin/maven-metadata.xml
Downloading: http://mvn.pak.com/third-party/org/apache/maven/plugins/maven-source-plugin/maven-metadata.xml
377/377 B
377/377 B 377/377 B
Downloaded: http://mvn.pak.com/third-party/org/apache/maven/plugins/maven-source-plugin/maven-metadata.xml (377 B at 1.5 KB/sec)
Downloaded: http://mvn.pak.com/pakrepo/org/apache/maven/plugins/maven-source-plugin/maven-metadata.xml (377 B at 1.4 KB/sec)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # myproject-testng-sample ---
[INFO] Deleting C:\Tools\Jenkins\workspace\myproject-testng-sample-windows\target
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) # myproject-testng-sample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Tools\Jenkins\workspace\myproject-testng-sample-windows\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) # myproject-testng-sample ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) # myproject-testng-sample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Tools\Jenkins\workspace\myproject-testng-sample-windows\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) # myproject-testng-sample ---
[INFO] Compiling 4 source files to C:\Tools\Jenkins\workspace\myproject-testng-sample-windows\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # myproject-testng-sample ---
[INFO] Surefire report directory: C:\Tools\Jenkins\workspace\myproject-testng-sample-windows\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator#4d20a47e
testMethod1
testMethod2
testMethodmyproject2
testmyprojectSample
testMethod1
testMethod2
testMethodmyproject2
testmyprojectSample
we wont run test with class name: com.pak.myproject.sample.NoInjectionTest
we wont run test with class name: com.pak.myproject.sample.NoInjectionTest
I am test method 2
parameter in test method is: firstname
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.895 sec
Results :
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # myproject-testng-sample ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: C:\Tools\Jenkins\workspace\myproject-testng-sample-windows\target\myproject-testng-sample-1.0.0-SNPASHOT.jar
[INFO]
[INFO] >>> maven-source-plugin:2.1.1:jar (attach-sources) # myproject-testng-sample >>>
[INFO]
[INFO] <<< maven-source-plugin:2.1.1:jar (attach-sources) # myproject-testng-sample <<<
[INFO]
[INFO] --- maven-source-plugin:2.1.1:jar (attach-sources) # myproject-testng-sample ---
[INFO] No sources in project. Archive not created.
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # myproject-testng-sample ---
[INFO] Installing C:\Tools\Jenkins\workspace\myproject-testng-sample-windows\target\myproject-testng-sample-1.0.0-SNPASHOT.jar to C:\Users\pak\.m2\repository\com\pak\automation\myproject-testng-sample\1.0.0-SNPASHOT\myproject-testng-sample-1.0.0-SNPASHOT.jar
[INFO] Installing C:\Tools\Jenkins\workspace\myproject-testng-sample-windows\pom.xml to C:\Users\pak\.m2\repository\com\pak\automation\myproject-testng-sample\1.0.0-SNPASHOT\myproject-testng-sample-1.0.0-SNPASHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.649 s
[INFO] Finished at: 2014-04-08T13:19:58+08:00
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------
Recording test results
TestNG Reports Processing: START
mvn is a batch file. So It is need to call mvn .... Not just mvn ....
See call-batch-file-from-cygwin-breaks-after-1st-command
This could be due to an environment problem. You could, however, save yourself a lot of time and work by doing things a little bit different:
Make your job a Maven Project, makes configuration easier (and offers you nice features like test reports for single modules etc.). This might also make your report copying unneccessary.
Depending on what you want to do with these reports afterwards, you could simple use the Jenkins archiving mechanism to copy them over to your master.
if you REALLY need to copy them by hand, use the Publish Over SSH Jenkinsn plugin
Are you using Execute Shell in your free-style project, i.e. you are running on a *nix based environment? If so, your problem is detailed in my answer here:
Jenkins Build Script exits after Google Test execution
Jenkins launches Execute Shell as a temporary shell script with command /bin/sh -xe tempshell.sh. Note the -e part. This tells sh to exit when any single command in the script returns with non-zero value.
Your mvn clean install -U is probably returning with a non-zero value. You can check that by running it on command line, immediately followed by echo $?
Solution: To circumvent that, add set +e to the top of your Execute Shell script.
The problem may be that you are not giving enter after the last command.
Today I came across the same problem in our project, last command in jenkins is not executed.
After some trail and error methods, came to understand that.

Is there a way to porsue with maven build after running wildfly:run goal?

I would like to complete Maven build lifecycle after wildfly:run goal's execution.
The fact is that wildfly:run goal starts a standalone application server and from that point the CLI shows Wildfly's Log messages only.
[INFO] --- wildfly-maven-plugin:2.1.0.Beta1-SNAPSHOT:run (default) # PrimeFaces1 ---
[WARNING] The POM for org.wildfly.plugins:wildfly-plugin-core:jar:2.1.0.Beta1-SNAPSHOT is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] JAVA_HOME : C:\Program Files\Java\jdk1.8.0_201\jre
[INFO] JBOSS_HOME: C:\Users\Consul19\eclipse-workspace\MultiRunTest\PrimeFaces1\target\wildfly-18.0.1.Final
[INFO] JAVA_OPTS : -Xms64m -Xmx512m -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Djboss.modules.system.pkgs=org.jboss.byteman
[INFO] Server is starting up. Press CTRL + C to stop the server.
[INFO] JBoss Threads version 2.3.3.Final
[INFO] JBoss Remoting version 5.0.12.Final
[INFO] XNIO version 3.7.2.Final
[INFO] XNIO NIO Implementation Version 3.7.2.Final
[INFO] ELY00001: WildFly Elytron version 1.9.1.Final
13:04:25,585 INFO [org.jboss.modules] (main) JBoss Modules version 1.9.1.Final
13:04:26,228 INFO [org.jboss.msc] (main) JBoss MSC version 1.4.11.Final
13:04:26,248 INFO [org.jboss.threads] (main) JBoss Threads version 2.3.3.Final
13:04:26,472 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 18.0.1.Final (WildFly Core 10.0.3.Final) starting
13:04:27,800 INFO [org.wildfly.security] (ServerService Thread Pool -- 28) ELY00001: WildFly Elytron version 1.10.4.Final
Actually I would like to run next goals but the server takes control of the CLI
Besides, in the pom.xml, I've tried to sobstitute wildfly:run with the wildfly:deploy goal, which deploy the artifact on the local JBOSS server(already started), And in this case the maven build goes on until the end.
[INFO] --- maven-war-plugin:2.2:war (default-war) # PrimeFaces1 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [PrimeFaces1] in [C:\Users\Consul19\eclipse-workspace\MultiRunTest\PrimeFaces1\target\PrimeFaces1-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\Consul19\eclipse-workspace\MultiRunTest\PrimeFaces1\src\main\webapp]
[INFO] Webapp assembled in [128 msecs]
[INFO] Building war: C:\Users\Consul19\eclipse-workspace\MultiRunTest\PrimeFaces1\target\PrimeFaces1-1.0-SNAPSHOT.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] <<< wildfly-maven-plugin:2.1.0.Beta1-SNAPSHOT:deploy (default-cli) < package # PrimeFaces1 <<<
[INFO]
[INFO]
[INFO] --- wildfly-maven-plugin:2.1.0.Beta1-SNAPSHOT:deploy (default-cli) # PrimeFaces1 ---
[INFO] JBoss Threads version 2.3.3.Final
[INFO] JBoss Remoting version 5.0.12.Final
[INFO] XNIO version 3.7.2.Final
[INFO] XNIO NIO Implementation Version 3.7.2.Final
[INFO] ELY00001: WildFly Elytron version 1.9.1.Final
[INFO]
[INFO] --------------------< com.mkyong.core:PrimeFaces2 >---------------------
[INFO] Building PrimeFaces2 1.0-SNAPSHOT [3/3]
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] >>> wildfly-maven-plugin:2.1.0.Beta1-SNAPSHOT:deploy (default-cli) > package # PrimeFaces2 >>>
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) # PrimeFaces2 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Consul19\eclipse-workspace\MultiRunTest\PrimeFaces2\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # PrimeFaces2 ---
[INFO] Nothing to compile - all classes are up to date
As you can see in this case the deploy goal doesn't "lock" the CLI but the build process still continues until the end
This behaviour is expected for the wildfly:run command, you're supposed to interrupt the server from the outside once you're done testing. Quoting the goal's documentation,
This goal will block until cancelled or a shutdown is invoked from a management client.
If that doesn't suit you, you can instead use wildlfy:start followed by wildfly:deploy.

quarkus resteasy-jackson empty json result for native

Testing quarkus app, with my rest endpoint /init
Installed features: [cdi, resteasy, resteasy-jackson]
I found that when run app as java (not native), then check
http://localhost:8080/init
{
"user": {
"username": "u name",
"firstName": "f name",
"lastName": "l name",
"email": null
},
"logoutUrl": "url!!!!"
}
and as native,
And running native-ly like this:
package -Dnative -f pom.xml
Then run ./my-service-1.0-SNAPSHOT-runner:
it gets empty result:
http://localhost:8080/init
{}
The Jackson configure like this:
#Singleton
public class RegisterCustomModuleCustomizer implements ObjectMapperCustomizer {
public void customize(final ObjectMapper objectMapper) {
objectMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
}
}
No exception.
InitData defined like this, as normal bean class:
public class InitData {
private .. some fields
What could be missing? In't it supposed to works same for native/java?
UPDATE:
when run as java, compile quarkus:dev -f pom.xml:
[INFO] Scanning for projects... [INFO] [INFO] ------------<
my.compnay:my-service >------------ [INFO] Building my-service
1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] ---
maven-resources-plugin:2.6:resources (default-resources) # my-service
--- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] ---
maven-compiler-plugin:3.8.1:compile (default-compile) # my-service ---
[INFO] Changes detected - recompiling the module! [INFO] Compiling 41
source files to
/home/me/projects/my-project/v2/my-service-quarkus/target/classes
[INFO] [INFO] --- quarkus-maven-plugin:1.0.0.CR1:dev (default-cli) #
my-service --- Listening for transport dt_socket at address: 5005
2019-11-12 14:17:43,027 INFO [io.qua.dep.QuarkusAugmentor] (main)
Beginning quarkus augmentation 2019-11-12 14:17:43,599 INFO
[io.qua.arc.pro.BeanProcessor] (build-1) Found unrecommended usage of
private members (use package-private instead) in application beans:
- #Inject field my.compnay.application.InitResource#initFacadeService 2019-11-12 14:17:43,658 INFO [io.qua.dep.QuarkusAugmentor] (main)
Quarkus augmentation completed in 631ms 2019-11-12 14:17:44,104 INFO
[io.quarkus] (main) Quarkus 1.0.0.CR1 started in 1.260s. Listening on:
http://0.0.0.0:8080 2019-11-12 14:17:44,105 INFO [io.quarkus] (main)
Profile dev activated. Live Coding activated. 2019-11-12 14:17:44,105
INFO [io.quarkus] (main) Installed features: [cdi, resteasy,
resteasy-jackson]
Then hit: http://localhost:8080/init
2019-11-12 14:19:52,423 INFO [com.dis.pla.app.ser.fil.LoggingFilter]
(vert.x-worker-thread-1) Request GET /init from IP
0:0:0:0:0:0:0:1:48810 2019-11-12 14:19:52,425 INFO
[com.dis.pla.app.InitResource] (vert.x-worker-thread-1) Init with user
f name my.compnay.api.UserData#37ac6925
--
#RegisterForReflection (from here) is the annotation to use over the Data objects IF your Resource doe snot return that data object directly.
I.e. in my case:
#GET
public Response getInit(
thus it would not work innately until you put:
#RegisterForReflection
class InitData { ...
But still.
I think I should be a bug. It should all behave same way. Native or not.
I also thought it was a bug, but they explain it better here (quarkus.io):
When building a native executable, GraalVM operates with a closed world assumption. It analyzes the call tree and removes all the classes/methods/fields that are not used directly.
The elements used via reflection are not part of the call tree so they are dead code eliminated (if not called directly in other cases). To include these elements in your native executable, you need to register them for reflection explicitly.

Reduce log level in Sonar 2.1.x

I have a Maven 3.x build that uses Sonar 2.1.x for quality control. The maven-sonar plugin is used from inside Jenkins to run the Sonar checks.
During the Jenkins build, when Sonar kicks in, it logs A LOT of not so useful information at INFO level:
[INFO] [15:29:14.195] Java version: 1.6
[INFO] [15:29:20.853] Execute PMD 4.3 done: 6658 ms
[INFO] [15:29:20.853] Sensor PmdSensor done: 6658 ms
[INFO] [15:29:20.854] Sensor ProfileSensor...
[INFO] [15:29:21.186] Sensor ProfileSensor done: 332 ms
[INFO] [15:29:21.187] Sensor ProfileEventsSensor...
[INFO] [15:29:21.190] Sensor ProfileEventsSensor done: 3 ms
[INFO] [15:29:21.190] Sensor ProjectLinksSensor...
[INFO] [15:29:21.192] Sensor ProjectLinksSensor done: 2 ms
[INFO] [15:29:21.192] Sensor VersionEventsSensor...
[INFO] [15:29:21.198] Sensor VersionEventsSensor done: 6 ms
[INFO] [15:29:21.198] Sensor Maven dependencies...
[INFO] [15:29:21.261] Sensor Maven dependencies done: 63 ms
...
The log is quite big. I have been trying to find a way to set the log level to WARN with no luck. Any idea?
Thanks!
Unfortunately, there's no way to mute this INFO-level log.
As discussed here log level can be changed at the maven plugin level.
Run mvn with -Dorg.slf4j.simpleLogger.showLogName=true it will show the logger name with log like below
2022-11-09T05:47:18.8604059Z [INFO] org.sonarsource.scanner.maven.SonarQubeMojo - SCM writing changed lines (done) | time=83ms
2022-11-09T05:47:18.8604819Z [INFO] org.sonarsource.scanner.maven.SonarQubeMojo - Analysis report generated in 287ms, dir size=5.2 MB
2022-11-09T05:47:18.8605606Z [INFO] org.sonarsource.scanner.maven.SonarQubeMojo - Analysis report compressed in 1993ms, zip size=4.1 MB
2022-11-09T05:47:18.8606333Z [INFO] org.sonarsource.scanner.maven.SonarQubeMojo - Analysis report uploaded in 282ms
then on executing mvn with -Dorg.slf4j.simpleLogger.log.org.sonarsource.scanner.maven.SonarQubeMojo=error it will change the log level.

IntelliJ screws up maven project after crash, can't recover

So I'm working on my project here
https://github.com/dmg46664/migraine
and everything is fine, until my Toshiba fails to resume from sleep and so I have to hard reboot.
Once rebooted, intellij is now suddenly not happy with the project setup. It was perfectly happy before the reboot. This is not the first time stuff like this has happened. Usually, by clicking on maven->reimport/or deleting and reloading modules etc. (usually I'm not sure what fixes it), I eventually get the project into a useable state.
However, I can spend a fair amount of time trying to do this.
Here are screenshots after the screw up.
Everything seems pretty okay from the maven command line. (The html module is expected to fail).
[INFO]
[INFO] --- gwt-maven-plugin:2.5.0:compile (default) # migraine-html ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Migraine Metaproject .............................. SUCCESS [0.701s]
[INFO] Migraine Assets ................................... SUCCESS [0.910s]
[INFO] Migraine Core ..................................... SUCCESS [0.620s]
[INFO] Migraine HTML ..................................... FAILURE [1.390s]
[INFO] Migraine Java ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.966s
[INFO] Finished at: Sun Sep 08 12:01:13 CAT 2013
[INFO] Final Memory: 16M/222M
[INFO] ------------------------------------------------------------------------
So my question is looking for procedures/workarounds to recover from this.
In case editor highlights errors that are not the actual errors in the code and the project still builds, the first thing to try is File | Invalidate Caches | Invalidate and Restart.

Resources