7/24/2023 0 Comments Jvm startup time![]() ![]() Since this could be caused by different default garbage collection algorithms I forced them both to G1GC. Java 11 is slightly slower than Java 8 (in case of OpenJDK).Of the frameworks, Vert.x, Helidon and Quarkus are the fastest.Oracle JDK 8u221 (8u222 was not available yet at the time of writing) and OpenJDK 8u222 show almost no difference. Of the JVMs, OpenJ9 is the fastest to start for every framework.The results of the JIT compiled code can be seen in the image above. The script used to process the measures can be found here. I needed to clean it ‘manually’ in my script after a run. The Microprofile fat JAR generated a large temp directory on each run which was not cleaned up after exiting. I created the following script to execute my test and collect the data. The script to execute the test and collect data Java8222cmd="/jvms/java-8-openjdk-amd64/bin/java -Xmx1024m -Xms1024m -XX:+UseG1GC -XX:+UseStringDeduplication -jar" Based on this I could execute the following to get the wanted behavior. I found the magic on how to do this here. I wanted to measure the time between the java command to run the JAR file and the first occurance of the above lines. In order to determine the startup time, I looked at the text line in the logging where the framework indicated it was ready. The framework implementations which I’ve used can be found here. SetupĪt the end of this blog post you can find a list of framework versions which have been used for my tests. If you want to know for sure if these differences are similar for you, conduct your own tests which are representative for your situation on your hardware and see for yourself. Use these measures as an inspiration to get a general idea about what differences between startup time might be. This is of course not the same as a full blown application running in production on specialized hardware. These measures have been conducted on specific hardware (my laptop) using specific test scripts on specific though minimal implementations (but comparable). ![]() I’ve looked at both JIT and AOT (wherever this was possible) and ran the code on different JVMs. In this blog post I’ll provide some measures which I did on start-up times of minimal implementations of several frameworks and an implementation with only Java SE. You will not achieve start-up times near AOT start-up times but by choosing the right framework and JVM, it can still be acceptable. If you need specific libraries which cannot be natively compiled (not even when using the Tracing Agent), using Java the old-fashioned JIT way is also an option. Which framework produces the native executable which is fastest to start? AOT code, although it is fast to startup, still shows differences per framework. Spring will probably follow with version 5.3 Q2 2020. ![]() Several frameworks already support this out of the box such as Helidon SE, Quarkus and Micronaut. When you want to reduce startup time, an obvious thing to look at is ahead of time (AOT) compilation such as provided by an early adopter plugin of GraalVM. When running your code using a ‘serverless’ framework such as for example Knative or FnProject, scaling and getting the first instance ready is faster. It can for example reduce the amount of time a rolling upgrade of instances takes and reduce build time thus shortening development cycles. When developing microservices, a fast startup time is useful. ![]()
0 Comments
Leave a Reply. |