{"id":60,"date":"2023-02-05T18:41:58","date_gmt":"2023-02-05T18:41:58","guid":{"rendered":"http:\/\/mityjohn.com\/?p=60"},"modified":"2023-12-20T22:33:01","modified_gmt":"2023-12-20T22:33:01","slug":"modern-java-development-the-fast-and-the-furious","status":"publish","type":"post","link":"https:\/\/mityjohn.com\/?p=60","title":{"rendered":"Modern Java Development &#8211; The Fast And The Furious"},"content":{"rendered":"\n<p class=\"has-large-font-size\"><strong>A small throwback in history\u2026<\/strong><\/p>\n\n\n\n<p>Remember the days when Java was created at Sun Microsystems? More specifically, when James Gosling led a team of researchers in an attempt to create a new language that would allow electronic consumer devices to communicate with each other. Efforts on the language began in 1991 and the first release occurred in 1995.<\/p>\n\n\n\n<p>The difference between the way Java and other programming languages were working was at least revolutionary. Code in other languages was first translated by a compiler into instructions for a specific type of computer, while the Java compiler instead converted code into something called Bytecode, which is then interpreted by software called the Java Runtime Environment (JRE) (or the Java virtual machine).<\/p>\n\n\n\n<p>For some decades, Java was the undisputed number one programming language. We define it as an interpreted, moderately complex, multi-threaded, garbage-collected and powerful programming platform. Moreover, the JVM is battle-tested, powerful, mature and one of the best Process Virtual Machines in the industry. At the time, Java was perfect for large, monolithic enterprise applications.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide4-1024x576.png\" alt=\"\" class=\"wp-image-63\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide4-1024x576.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide4-300x169.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide4-768x432.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide4.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Even today it is still one of the most popular programming languages today due to many reasons :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>It has outstanding IDE\u2019s supporting the development<\/li>\n\n\n\n<li>There is a very big community and support of major players<\/li>\n\n\n\n<li>The language was and is a mature, secure, stable and robust ecosystem<\/li>\n\n\n\n<li>It is a JVM based-language &amp; deratives (Java, Kotlin, Groovy, and Scala)<\/li>\n\n\n\n<li>It ensures platform independency<\/li>\n<\/ul>\n\n\n\n<p>On the other hand we encounter different challenges to the traditional Java ecosystem:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><em>Reflection<\/em>: Reflection is used to get, examine or modify the behavior of methods, classes, and interfaces at runtime. It\u2019s used by many Java frameworks like <strong>Spring<\/strong> to load and instantiate Beans in a dynamic way.<\/li>\n\n\n\n<li><em>Reflective Data Cache<\/em>: Because Reflection is slow frameworks like Spring uses a cache to store objects and beans.<\/li>\n\n\n\n<li><em>Big package size<\/em><\/li>\n\n\n\n<li><em>Slow Dynamic Classloading<\/em><\/li>\n\n\n\n<li><em>ClassPath scanning<\/em><\/li>\n\n\n\n<li><em>Runtime Proxies<\/em><\/li>\n\n\n\n<li><em>Runtime Byte-code generation<\/em>: The interpretation process that converts Java bytecode to machine code happens in the runtime. Because interpretation is slow, Java uses the JIT compiler, trying to improve the performance.<\/li>\n\n\n\n<li>Java 8 memory limits in <em>Containers<\/em> [solved later]<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-1024x576.png\" alt=\"\" class=\"wp-image-64\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-1024x576.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-300x169.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-768x432.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-1536x864.png 1536w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image.png 2000w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Unfortunately, with the rise of Microservices and Serverless, Java had become disadvantageous as the JVM seems too large (high memory footprint) and slow (slow start-up time).And, as we can observe in modern container-based development, the container comes with limited resources. Considering all these points, we are reaching fresh challenges in terms of new <strong>Software Architectures<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Challenges to use Java in Microservices\/ Serverless scenarios<\/li>\n\n\n\n<li>Famous tools and frameworks: they are not optimized for low memory and <em>Cold Start<\/em><\/li>\n<\/ul>\n\n\n\n<p>As a result of this, people started to use other, small and faster languages, like Node.js, Rust or Golang in Cloud-Native development.<\/p>\n\n\n\n<p>The question therefore is why we need <em><strong>java<\/strong><\/em> but as we all know&#8230;<\/p>\n\n\n\n<p class=\"has-text-align-center\">&#8220;<strong><em>Java Developers never RIP,<br>They just get Garbage Collected<\/em><\/strong>&#8220;<\/p>\n\n\n\n<p>&#8230; we can easily move to other languages like <em>GO &amp; Rust <\/em>that give us a bitter performance.<\/p>\n\n\n\n<p>But actually,  we cannot provide a straight answer because of Java&#8217;s world wide popularity:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After 25+ years <em>Java<\/em> is still a very popular language, more in particular for large organizations.<\/li>\n\n\n\n<li>Throughout the years Java introduced new updates and solutions to adapt to many industry trends like:\n<ul class=\"wp-block-list\">\n<li>Reactive programming<\/li>\n\n\n\n<li>Cloud: Spring Cloud that quickly builds some of the common patterns in distributed systems (Routing, Service Discovery, circuit breakers, and more)<\/li>\n\n\n\n<li>New features that have been added to the language since Java 8 till now<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>Finally, the Java Community started to offer a modern version of Java with&nbsp;<strong>GraalVM<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"722\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-2-1024x722.png\" alt=\"\" class=\"wp-image-68\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-2-1024x722.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-2-300x212.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-2-768x542.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-2-1536x1083.png 1536w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-2.png 1595w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>No, not that old bike, we needed something fast and furious. Rather something like this&#8230; GraalVM.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide9-1024x576.png\" alt=\"\" class=\"wp-image-69\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide9-1024x576.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide9-300x169.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide9-768x432.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide9.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>GraalVM is JDK distribution that offers AOT compilation and polyglot programming. Moreover, it compiles directly to Native Code and is perfectly suitable for Cloud Native Development (because of its low memory footprint and fast start-up time).<\/p>\n\n\n\n<p>Thanks to the GraalVM innovation, new frameworks could arise like Quarkus, Micronaut &amp; Spring Native for cloud development. Before diving into these frameworks, we\u2019ll start by taking a closer look to GraalVM.<\/p>\n\n\n\n<p>We do can tell, Java is here to stay and will not disappear soon at least!<\/p>\n\n\n\n<p class=\"has-large-font-size\">A new era of speed arises<\/p>\n\n\n\n<p><strong>The rise of Java Microframeworks<\/strong><\/p>\n\n\n\n<p>First, we are taking a small sidestep to look at Microframeworks. In the past, we used to build large monolithic architectures, but these had their pitfalls. Since they combined multiple functional modules, whenever one module failed, everything failed. So, we began breaking them down into separate modules, \u2018microservices\u2019, which minimised their dependencies and reduced the impact of one of the services failing. These microservices were meant to work separately from each other, deployed on separate servers, running in their own specific environment.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide12-1024x576.png\" alt=\"\" class=\"wp-image-72\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide12-1024x576.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide12-300x169.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide12-768x432.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide12.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>With the rise of cloud computing, these services became serverless (function-as-a-service), eliminating the complexity of building and maintaining the infrastructure that normally accompanied the development and launch of new applications.<\/p>\n\n\n\n<p>Accordingly, by virtualising the environments on which our services ran, we made them sustainable and flexible, we automated delivery and made the services highly scalable. Especially in a cloud environment, we can easily scale those services&#8230;. but in the end, our resources are still finite!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"862\" height=\"630\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-4.png\" alt=\"\" class=\"wp-image-73\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-4.png 862w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-4-300x219.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-4-768x561.png 768w\" sizes=\"auto, (max-width: 862px) 100vw, 862px\" \/><\/figure>\n\n\n\n<p>So, we had to rethink it: how can or should we use less resources?<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"506\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-5.png\" alt=\"\" class=\"wp-image-74\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-5.png 900w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-5-300x169.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-5-768x432.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<p>Therefore we first need to take a closer look to microframeworks. To start with, the name refers to minimalistic web application frameworks. These frameworks are composed:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>without authentication and authorzation<\/li>\n\n\n\n<li>without database abstraction via object-relational mapping<\/li>\n\n\n\n<li>without input validation an input sanitation<\/li>\n<\/ul>\n\n\n\n<p>Some examples of microframeworks are Javalin, Micronaut, Helidon, Quarlus, &#8230;<\/p>\n\n\n\n<p>But fewer modules, functions and dependencies aren\u2019t sufficient &#8230; If we take a closer look at the number of lines of code related to start-up time and memory usage, we can also immediately notice the impact when using reflection.The result? Well, there goes our speed. Just line up and wait in the queue, please.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"513\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-8-1024x513.png\" alt=\"\" class=\"wp-image-77\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-8-1024x513.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-8-300x150.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-8-768x385.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-8.png 1104w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>he result? Well, there goes our speed. Just line up and wait in the queue, please.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"819\" height=\"1024\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-6-819x1024.png\" alt=\"\" class=\"wp-image-75\" style=\"width:420px;height:525px\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-6-819x1024.png 819w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-6-240x300.png 240w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-6-768x960.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-6.png 900w\" sizes=\"auto, (max-width: 819px) 100vw, 819px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>&#8230;. given all this, is it still posisble to have the same productivity but without reflection?<\/p>\n\n\n\n<p> Of course there is, and we can do this with <strong>AOT <\/strong>compilation.<\/p>\n\n\n\n<p class=\"has-bg-color has-accent-background-color has-text-color has-background\"><em><strong>Ahead of Time (AOT) Compilation<\/strong><\/em><br><em>\u201cCompiling high level programminglanguage or intermediaterepresentationsuch as java byte code into native machine codesothattheresultingbinary filecanexecutenatively.\u201d<\/em><\/p>\n\n\n\n<p><strong>AOT <\/strong>will result in:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>short startup time<\/li>\n\n\n\n<li>dependency injection at compile time<\/li>\n\n\n\n<li>can be run with as little as 15m Max  Heap <\/li>\n<\/ul>\n\n\n\n<p>After getting a first glimpse of AOT, we are ready to board our supersonic car we call GraalVM.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">GraalVM<\/p>\n\n\n\n<p>The \u201cGraalVM\u201d project started out as a research project inside <strong>Oracle Labs<\/strong>, attempting to reduce Java memory and CPU consumption in addition to improving the performance of the Applications. The project is <strong>written in Java<\/strong> and the main focus of the project was to improve the JIT compiler in Java and introduce Ahead-of-Time (AOT) compilation which is called<strong> Native-image.<\/strong><\/p>\n\n\n\n<p>GraalVM is a tool designed for developers to write and execute Java code. Specifically, GraalVM is a Java Virtual Machine (JVM) and Java Development Kit (JDK) created by Oracle. It is a powerful runtime that improves application performance and efficiency.<\/p>\n\n\n\n<p class=\"has-bg-color has-accent-background-color has-text-color has-background\"><strong>Why is it actually called GraalVM?<\/strong><\/p>\n\n\n\n<p class=\"has-dark-bg-color has-accent-background-color has-text-color has-background\"><em>The word \u201c<strong>Graal<\/strong>\u201d comes from old French for \u201c<strong><u>Grail<\/u><\/strong>\u201d. The \u201cGraal\u201d Oracle project started out as a research project inside Oracle Labs, attempting to make a Java compiler while being fast and easy to maintain.<\/em><br><em>The \u201c<strong>VM<\/strong>\u201d in \u201cGraalVM\u201d comes from the fact that it runs inside the JVM.&nbsp; &nbsp;<\/em> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/p>\n\n\n\n<p>We can define the main objectives of GraalVM as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Writing a <strong>compiler <\/strong>that is faster and easier to maintain<\/li>\n\n\n\n<li>Having a Low-footprint and a fast start-up Java for Cloud and Serverless<\/li>\n\n\n\n<li>Improving the <strong>performance <\/strong>of languages that run on the JVM (and so reducing application startup times)<\/li>\n\n\n\n<li>Integrating <strong>multi-language<\/strong> <strong>support <\/strong>into the Java ecosystem, as well as providing a set of programming tools to do so<\/li>\n<\/ul>\n\n\n\n<p>To achieve these goals, GraalVM adds an optimising compiler to the JDK, which provides performance optimisations for individual languages and interoperability for polyglot applications. Besides supporting Java code, GraalVM also supports additional programming languages including Scala, Kotlin, Groovy, Clojure, R, Python, JavaScript, Ruby. In essence, GraalVM allows developers to run code efficiently in multiple languages and libraries while in a single application.<\/p>\n\n\n\n<p>In addition, GraalVM provides a framework for creating language-agnostic tools like debuggers, profilers, or other instrumentations. Accordingly, it will provide a standardised way to express and execute programme code. This will enable cross-language research, as well as the development of tools that once developed can then be applied to any language.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"Components-of-GraalVM\">Components of GraalVM&nbsp;&nbsp;<\/h4>\n\n\n\n<p>Among others, we distinguish three main components that make up the core of GraalVM:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Just-in-time compiler <\/strong>a high performance optimizing just-in-time compiler which is written in modular, maintainable, and extendable fashion in Java itself, to replace the old <strong>C++ written(C1\/C2) <\/strong>HotSpot Java Virtual Machine.<\/li>\n\n\n\n<li><strong>Ahead-of-time compiler<\/strong> to build native executables<\/li>\n\n\n\n<li><strong>multiple languages support<\/strong>: the ability to implement language interpreters. This allows GraalVM to be expanded to add additional languages to the Java ecosystem. It also supports tools such as a language-agnostic debugger, profiler and heap viewer.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"520\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-10-1024x520.png\" alt=\"\" class=\"wp-image-79\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-10-1024x520.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-10-300x152.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-10-768x390.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-10-1536x780.png 1536w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-10.png 1788w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"How-does-GraalVM-work?\">How does GraalVM work?<\/h4>\n\n\n\n<p>The GraalVM just-in-time compiler is used to accelerate the performance of any Java and JVM-based application without the need for code changes. GraalVM can also use its ahead-of-time native image compiler to translate Java and JVM applications into native platform executables. The Enterprise version compiler includes 62 compiler optimisation algorithms, also called phases. Of these algorithms, some include techniques for vectorising complex programmes, code specialisation and large-scale escape analysis. Compiler phases are optimised by using techniques such as aggressive and polymorphic inlining.<\/p>\n\n\n\n<p class=\"has-bg-color has-accent-background-color has-text-color has-background\"><em>In object-oriented programming, polymorphism (from the Greek meaning &#8220;having multiple forms&#8221;) is the characteristic of being able to assign a different meaning or usage to something in different contexts &#8211; specifically, to allow an entity such as a variable, a function, or an object to have more than one form.<\/em><\/p>\n\n\n\n<p>Object allocations are also improved through optimizations made in memory-allocation. For example, GraalVM will use partial escape analysis and scalar replacement for such tasks. In general, GraalVM can achieve better performance with less memory.<\/p>\n\n\n\n<p>Potential attack surfaces are also minimized when the ahead-of-time compiler compiles Java code into a native executable. This is because only the code required to execute the application is included. To do this, GrallVM will analyze the application code, its dependencies, dependent JDK libraries and VM components.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"362\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-11-1024x362.png\" alt=\"\" class=\"wp-image-80\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-11-1024x362.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-11-300x106.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-11-768x271.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-11.png 1143w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>When we compile our Java programme (e.g., using the Java command), we\u2019ll end up with our source code compiled into the binary representation of our code \u2013 a JVM bytecode (1). This bytecode is simpler and more compact than our source code, but conventional processors in our computers cannot execute it.<\/p>\n\n\n\n<p>To be able to run a Java programme, the JVM interprets the bytecode (2). Since interpreters are usually a lot slower than native code executing on a real processor, the JVM can run another compiler which will now compile our bytecode into the machine code that can be run by the processor. This so-called just-in-time compiler is much more sophisticated than the javac compiler, and it runs complex optimisations to generate high-quality machine code.<\/p>\n\n\n\n<p>GraalVM can compile the code Just-In-Time (JIT) or Ahead of Time (AOT) directly to native image (3).<\/p>\n\n\n\n<p>There is a general myth that AOT is faster, which is very true in the first few runs, but there is a possibility that the JIT might outperform the AOTs, as JIT is constantly optimising (Graal VM) based on the feedback it gets from profiling. JIT normally has a larger footprint than AOT.<\/p>\n\n\n\n<p>For Serverless \u2014 it makes more sense to go towards AOT, while for long running container based\/VM based deployments, JIT might make more sense.<\/p>\n\n\n\n<p>In theory,&nbsp;<strong>a Just-in-Time (JIT) compiler has an advantage over Ahead-of-Time (AOT) if it has enough time and computational resources available<\/strong>. A JIT compiler can be faster because the machine code is being generated on the exact machine that it will also execute on.<\/p>\n\n\n\n<p>The Graal compiler also works as an ahead-of-time (AOT) compiler, producing native executables. Given Java&#8217;s dynamic nature, how does that work exactly?<\/p>\n\n\n\n<p>Unlike JIT mode, where compilation and execution happen at the same time, in AOT mode the compiler performs&nbsp;<strong>all&nbsp;<\/strong>compilations during build time, before the execution. The main idea here is to&nbsp;<strong>move all the &#8220;heavy lifting&#8221; \u2014 expensive computations \u2014 to build time<\/strong>, so it can be done once, and then at runtime generated executables start fast and are ready from the get-go because everything is pre-computed and pre-compiled.<\/p>\n\n\n\n<p>The GraalVM &#8216;native-image&#8217; utility takes Java bytecode as input and outputs a native executable. To do so, the utility performs a static analysis of the bytecode under a closed world assumption. During the analysis, the utility looks for all the code that your application actually uses and eliminates everything that is unnecessary.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"418\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-12-1024x418.png\" alt=\"\" class=\"wp-image-82\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-12-1024x418.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-12-300x122.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-12-768x313.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-12-1536x627.png 1536w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-12.png 1821w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>These three key concepts help you better understand the Native Image generation process:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Points-to analysis<\/strong>. GraalVM Native Image determines which Java classes, methods, and fields are reachable at runtime, and only those will be included in the native executable. The points-to analysis starts with all entry points, usually the main method of the application. The analysis iteratively processes all transitively reachable code paths until a fixed point is reached and the analysis ends. This applies not only to the application code but also to the libraries and JDK classes \u2014 everything that is needed for packaging an application into a self-contained binary.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Initializations at build time<\/strong>. GraalVM Native Image defaults to class initialization at runtime to ensure correct behavior. But if Native Image can prove that certain classes are safe to initialize, it will initialize them at build time instead. This makes runtime initialization and checks unnecessary and improves performance.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Heap snapshotting<\/strong>. Heap snapshotting in Native Image is a very interesting concept and deserves its own article. During the image build process, Java objects allocated by static initializers, and all the objects that are reachable, are written onto the image heap. This means that your application starts much faster with a pre-populated heap.<\/li>\n<\/ul>\n\n\n\n<p>Still, there are some limitations on using the Native Image as e.g.:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Dynamic Class Loading<\/strong>: Deploying jars, wars, etc. at runtime impossible.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Reflection<\/strong>: Requires registration via native-image CLI\/API.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Dynamic Proxy<\/strong>:  No agents: JMX, JRebel, Byteman, profilers, tracers, etc.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-align-left has-bg-color has-accent-background-color has-text-color has-background\"><strong>GraalVM<\/strong><br><strong>The word \u201cGraal\u201d comes from old French (or Dutch?)&nbsp; for \u201cGrail\u201d <\/strong>&nbsp;<br><em>The \u201c<\/em><strong><em>Graal<\/em><\/strong><em>\u201d Oracle project started out as a research project inside <\/em><strong><em>Oracle Labs<\/em><\/strong><em>, attempting to make a Java <\/em><strong><em>compiler<\/em><\/strong><em> while being <\/em><strong><em>fast and easy <\/em><\/strong><em>to maintain.<\/em><br><em>The \u201c<\/em><strong><em>VM<\/em><\/strong><em>\u201d in \u201cGraalVM\u201d comes from the fact that it <\/em><strong><em>runs inside the JVM<\/em><\/strong><em>.<\/em><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Microprofile<\/p>\n\n\n\n<p>Microprofile is a community-driven <strong>specification<\/strong> which is is designed to provide a <strong>baseline platform definition<\/strong>. Firstly to optimizes the <strong>Enterprise<\/strong> Java <em>for microservices architecture<\/em> and secondly to deliver application <strong>portability<\/strong> across multiple MicroProfile runtimes.<\/p>\n\n\n\n<p>The founding vendors of MicroProfile offered their own microservices frameworks: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open Liberty (<em>IBM<\/em>), <\/li>\n\n\n\n<li>WildFly Swarm (<em>Red Hat<\/em>) &nbsp;=&gt; Thorntail&nbsp; =&gt; <strong>Quarkus<\/strong>, <\/li>\n\n\n\n<li>TomEE (<em>Tomitribe<\/em>), <\/li>\n\n\n\n<li>Payara Micro (<em>Payara<\/em>)<\/li>\n<\/ul>\n\n\n\n<p class=\"has-medium-font-size\">Quarkus<\/p>\n\n\n\n<p><strong>Quarkus <\/strong>is a <strong>MicroProfile implementation<\/strong> that focuses on efficiently running Java applications in containers in general and Kubernetes in particular.<\/p>\n\n\n\n<p>It is a <strong>framework developed by RedHat for creating Java applications<\/strong>. Quarkus was developed with the goal of running Java programs in containers. In particular, it focuses on supporting orchestration software Kubernetes.<br>Another focus of Quarkus development is on the use of established Java libraries and standards.<\/p>\n\n\n\n<p>\u201cHotSpot\u201d, from the OpenJDK project, is used as a Java Virtual Machine (JVM) to be the execution layer for Java code. In addition, the \u201cGraalVM\u201d development, which builds on HotSpot, can also be used. The latter allows <strong>Java code to be compiled into directly executable machine code<\/strong>. <\/p>\n\n\n\n<p>In order to understand the immediate benefit of using Quarkus, let\u2019s first look at how Java applications run with and without Quarkus.<\/p>\n\n\n\n<p><strong>So how does a regular framework work?<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"417\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-13-1024x417.png\" alt=\"\" class=\"wp-image-86\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-13-1024x417.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-13-300x122.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-13-768x313.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-13-1536x626.png 1536w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-13.png 2000w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>When the traditional Java cloud native frameworks start there are certain set of activities which are performed during the build time.<\/p>\n\n\n\n<p>Secondly, there\u2019s a certain set of activities which are performed during the runtime. Now these activities which are performed by the traditional framework during the build time or the compile time, is primarily the application packaging part, which is usually done using build tools like maven, gradle etc.<\/p>\n\n\n\n<p>The remaining set of activities like loading of the configuration file, scanning the class path to find the annotated classes and read annotations, reading the XML descriptors, starting the thread pool and so on and done during the runtime when the application starts. So this means that since most of the activities are performed during the runtime instead of compile time, hence the application startup time is more when you run your applications using traditional java cloud native frameworks.<\/p>\n\n\n\n<p><br>When the traditional Java cloud native frameworks start there are certain set of activities which are performed during the build time.Secondly, there\u2019s a certain set of activities which are performed during the runtime. Now these activities which are performed by the traditional framework during the build time or the compile time, is primarily the application packaging part, which is usually done using build tools like maven, gradle etc. The remaining set of activities like loading of the configuration file, scanning the class path to find the annotated classes and read annotations, reading the XML descriptors, starting the thread pool and so on and done during the runtime when the application starts. So this means that since most of the activities are performed during the runtime instead of compile time, hence the application startup time is more when you run your applications using traditional java cloud native frameworks.As with other programming languages, a Java programme begins with source code that can be read by a human. In order to execute the instructions of the source text on a computer, corresponding instructions are generated in the format of the specific processor.<\/p>\n\n\n\n<p>With Java, there is another intermediate step: The source text is first translated into an intermediate format, the so-called bytecode, as is the case with the Python language. The bytecode is then executed in the \u201cJava virtual machine\u201d (JVM). In order to run a Java programme on a device, a JVM must be installed on it.<\/p>\n\n\n\n<p>The bytecode is traditionally interpreted for execution in the JVM. The bytecode instructions are translated piece by piece into machine code instructions and executed. The process of \u201cjust-in-time compilation\u201d (JIT) is more effective. With that process, the bytecode is also converted into machine code, but further optimizations also come into play.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide39-1024x576.png\" alt=\"\" class=\"wp-image-87\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide39-1024x576.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide39-300x169.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide39-768x432.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/Slide39.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Let&#8217;s do it the Quarkus way<\/strong><\/p>\n\n\n\n<p>The new way or the Quarkus way to optimise the application start-up time is that Quarkus performs most of the activities during the build time instead of runtime.<\/p>\n\n\n\n<p>Loading of the configuration files, class path scanning, read and set the properties etc. are performed during the build time. This means that the metadata is only processed once during the build time.<\/p>\n\n\n\n<p>So when your application starts, since all the metadata is already loaded and set during build time, it minimises the need of dynamic scanning and loading of classes during the runtime. Naturally this results in a significant improvement in the startup times of the applications. So this is the way Quarkus works behind the scenes and the reason for its <strong>supersonic, subatomic nature<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"365\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-14-1024x365.png\" alt=\"\" class=\"wp-image-89\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-14-1024x365.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-14-300x107.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-14-768x273.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-14-1536x547.png 1536w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-14.png 2000w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In contrast to the native execution of Java applications, Quarkus offers several advantages. Let\u2019s differentiate between <strong>the<\/strong><strong> <\/strong><strong>two<\/strong><strong> modes <\/strong><strong>supported<\/strong><strong> <\/strong><strong>by<\/strong><strong> <\/strong><strong>Quarkus<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Optimization of the bytecode<\/strong> and execution in the JVM<\/li>\n\n\n\n<li><strong>Running as native code<\/strong> after compilation<\/li>\n<\/ol>\n\n\n\n<p>Java code written with Quarkus can be executed normally in the JVM. However, there are considerable advantages in terms of memory consumption and start time of a running application. To achieve this, Quarkus uses a few tricks. <\/p>\n\n\n\n<p>In particular, a number of <strong>time-consuming steps are moved from the execution to the build process<\/strong>. <\/p>\n\n\n\n<p>This includes the steps that otherwise occur every time a Java application is executed:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Loading and parsing configurations<\/li>\n\n\n\n<li>Scanning the Java class path and resolving annotations<\/li>\n\n\n\n<li>Creating entity models for databases or the like where applicable<\/li>\n<\/ul>\n\n\n\n<p>With Quarkus, these steps are carried out once and the results are cached for quick retrieval. Further performance optimization comes in the form of <strong>Quarkus<\/strong><strong> reducing the amount of dynamic information available at runtime<\/strong>. This is replaced by corresponding static constructs. This is particularly useful with regard to use in containers. A containerized application is usually not changed anyway and always runs in the same environment.<\/p>\n\n\n\n<p>The second mode supported by Quarkus for running Java applications is even more interesting. With \u201cahead-of-time compilation\u201d (AOT), <strong>directly executable machine code is generated from the Java source text instead of bytecode<\/strong>, meaning there is no longer any need for a JVM on the target hardware. The program only runs on specific processor architecture and has to be recompiled for other platforms. However, this restriction is usually irrelevant for use in containers. The savings in memory consumption and application startup time achieved with AOT compilation are nothing short of breathtaking.<\/p>\n\n\n\n<p><strong>Pros and cons of Quarkus?<\/strong><\/p>\n\n\n\n<p><strong>Pros:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li> User friendliness (JEE &amp; Spring devs), solid framework,:\n<ul class=\"wp-block-list\">\n<li><strong>\u201cbest of breed\u201d <\/strong>framework standards, e.g. Eclipse MicroProfile, Spring Dependency Injection, Hibernate ORM <\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Performance: \n<ul class=\"wp-block-list\">\n<li>fast application start-up time, <\/li>\n\n\n\n<li>low memory consumption, <\/li>\n\n\n\n<li>almost immediate scaling of services, <\/li>\n\n\n\n<li>lower space requirements for native images<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p><strong>Cons:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Reducing the dynamic information generated during runtime can lead to problems in some scenarios. <\/li>\n\n\n\n<li>The severely limited possibilities for introspection may make it <strong>difficult to debug<\/strong> an application.<\/li>\n\n\n\n<li>The highly-optimized build process for native images <strong>takes a long time<\/strong>\u2026 <\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"479\" height=\"417\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-15.png\" alt=\"\" class=\"wp-image-91\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-15.png 479w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-15-300x261.png 300w\" sizes=\"auto, (max-width: 479px) 100vw, 479px\" \/><\/figure>\n\n\n\n<p> <\/p>\n\n\n\n<p class=\"has-medium-font-size\">Micronaut<\/p>\n\n\n\n<p>Micronaut is a modern Java framework that can be used to build microservices and serverless applications tailored for JDK and GraalVM. It is developed by the creators of the Grails framework and sponsored by Object Computing, Inc. Micronaut development started on early 2018, the 1.0.0 version was released on October 2018.<\/p>\n\n\n\n<p>Micronaut is an open source JVM-based software framework for building lightweight, modular applications and microservices. It is known for its ability to help developers create applications and microservices with small memory footprints and short start-up times (logically, same specs as Quarkus). <\/p>\n\n\n\n<p>It\u2019s created to address some of the weaknesses of Spring\/Spring Boot. Developed by OCI, the same company that created Grails, Micronaut is a framework designed to make creating microservices quick and easy. While Micronaut contains some features that are similar to existing frameworks like Spring, it also has some new features that set it apart. And with support for Java, Groovy, and Kotlin, it offers a variety of ways to create applications.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"Main-Features\">Main Features<\/h4>\n\n\n\n<p>One of the most exciting features of Micronaut is its compile time dependency injection mechanism. Most frameworks use reflection and proxies to perform dependency injection at runtime. <strong>Micronaut, however, builds its dependency injection data at compile time.<\/strong> The result is faster application startup and smaller memory footprints.<\/p>\n\n\n\n<p><strong>Another feature is its first class support for reactive programming, for both clients and servers.<\/strong> The choice of a specific reactive implementation is left to the developer as both RxJava and Project Reactor are supported.<\/p>\n\n\n\n<p>Micronaut also has several features that make it an excellent framework for developing cloud-native applications. It supports multiple service discovery tools such as Eureka and Consul, and also works with different distributed tracing systems such as Zipkin and Jaeger.<\/p>\n\n\n\n<p>Micronaut provides natively support to many cloud features:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Distributed Configuration with:\n<ul class=\"wp-block-list\">\n<li>HashiCorp Consul<\/li>\n\n\n\n<li>HashiCorp Vault<\/li>\n\n\n\n<li>Spring Cloud Config<\/li>\n\n\n\n<li>AWS Parameter Store<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Service Discovery with:\n<ul class=\"wp-block-list\">\n<li>Consul<\/li>\n\n\n\n<li>Eureka<\/li>\n\n\n\n<li>Kubernetes<\/li>\n\n\n\n<li>AWS Route 53<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Serverless Functions: many features are provided to make it easier to write functions, run and deploy them to Function as a Service (FaaS) providers such as AWS Lambda or dedicated containers such as OpenFaaS.<\/li>\n<\/ul>\n\n\n\n<p>Micronaut projects can also be generated with an online generator: Micronaut Launch.<\/p>\n\n\n\n<p>The framework was created from the ground up to support work with microservices and serverless functions. The creators advertise it as a natively cloud-native stack, meaning various aspects of cloud deployment (service discovery, distributed tracing, fast start-up, and small memory footprint) have been considered while designing the framework. Although it is cloud-focused, we can create command-line applications as well.<\/p>\n\n\n\n<p>Because of the ahead-of-time compilation and resolving DI during the build phase, the memory usage and start-up times are low. Such features are crucial when working with serverless functions (cf. microframeworks).<\/p>\n\n\n\n<p><strong>So, when should you use it?<\/strong><\/p>\n\n\n\n<p>Let\u2019s say, you need native images but you cannot handle living on the bleeding edge or having frequent updates or you may need something special, Micronaut might be your solution.It\u2019s can be used for Spring MVC\/Spring Boot, which is the most dominant Server-Side framework in Java. It also uses the conventional OpenJDK, but this will slowly lose its charm in Cloud-Native Java Development.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-17-1024x576.png\" alt=\"\" class=\"wp-image-93\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-17-1024x576.png 1024w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-17-300x169.png 300w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-17-768x432.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-17-1536x864.png 1536w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-17.png 2000w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Spring Native<\/h2>\n\n\n\n<p>Spring is a very popular framework as it helps to build Java web applications easily and quickly (compared to the old Java frameworks). It uses the conventional OpenJDK and introduces many features and integrations with other technologies like Spring Boot, Spring Cloud, Spring Data, Spring AWS and Project Reactor.<\/p>\n\n\n\n<p>The biggest competition today is about building more efficient Java applications for the Cloud ecosystem and therefore logically the Spring community wants to be a part of this competition. That\u2019s why Spring declared a new solution called Spring Native which will use GraalVM for Cloud-Native development.<\/p>\n\n\n\n<p>The main difference between Spring and Spring Native images:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>No class lazy loading as everything shipped in the executables will be loaded in memory on start-up;<\/li>\n\n\n\n<li>Classpath scanning is fixed at build time;<\/li>\n\n\n\n<li>Static analysis of your application from the main entry point, is performed at build time;<\/li>\n\n\n\n<li>Removing the unused parts of the codebase at build time;<\/li>\n\n\n\n<li>Configuration is required for reflection, resources, and dynamic proxies.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-medium-font-size\">It&#8217;s time for a line-up <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"952\" height=\"1024\" src=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-16-952x1024.png\" alt=\"\" class=\"wp-image-92\" srcset=\"https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-16-952x1024.png 952w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-16-279x300.png 279w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-16-768x826.png 768w, https:\/\/mityjohn.com\/wp-content\/uploads\/2022\/12\/image-16.png 1046w\" sizes=\"auto, (max-width: 952px) 100vw, 952px\" \/><\/figure>\n\n\n\n<p><strong>Quarkus<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>It is suitable for a wide range of different application scenarios.<\/li>\n\n\n\n<li>Other frameworks are more specific to some extent.<\/li>\n\n\n\n<li>It features a large new community.<\/li>\n\n\n\n<li>It has fast bug fixes and feature updates.<\/li>\n<\/ul>\n\n\n\n<p><strong>Micronaut<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>With the Micronaut framework, microservices and serverless applications can be programmed in Java.<\/li>\n\n\n\n<li>As with Quarkus, GraalVM is used here.<\/li>\n\n\n\n<li>It is less performant then Quarkus.<\/li>\n\n\n\n<li>It is supported by OCI (company which developed Grails)<\/li>\n<\/ul>\n\n\n\n<p><strong>Spring Native<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Spring is probably the most popular Java framework for web applications, having also a broad long-term existing open source community.<\/li>\n\n\n\n<li>Spring Native is based on GraalVM and, in addition to the creation of microservices, it supports reactive programming and live reload. In a performance comparison, Quarkus beats Spring Native.<\/li>\n\n\n\n<li>An existing Spring project can be migrated to Quarkus relatively easily.<\/li>\n\n\n\n<li>On the other hand, Quarkus comes with a more steap learning curve.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-bg-color has-accent-background-color has-text-color has-background\">Whichever framework you choose, it is evident that Java is ready for a new era of speed and innovation. Now it is time for you to jump on board!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A small throwback in history\u2026 Remember the days when Java was created at Sun Microsystems? More specifically, when James Gosling led a team of researchers in an attempt to create a new language that would allow electronic consumer devices to communicate with each other. Efforts on the language began in 1991 and the first release [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":150,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[8,11,10,12],"class_list":["post-60","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","tag-development","tag-java","tag-programming","tag-quarkus"],"_links":{"self":[{"href":"https:\/\/mityjohn.com\/index.php?rest_route=\/wp\/v2\/posts\/60","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mityjohn.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mityjohn.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mityjohn.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mityjohn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=60"}],"version-history":[{"count":17,"href":"https:\/\/mityjohn.com\/index.php?rest_route=\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":177,"href":"https:\/\/mityjohn.com\/index.php?rest_route=\/wp\/v2\/posts\/60\/revisions\/177"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mityjohn.com\/index.php?rest_route=\/wp\/v2\/media\/150"}],"wp:attachment":[{"href":"https:\/\/mityjohn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mityjohn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mityjohn.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}