{"id":76573,"date":"2020-04-03T13:42:25","date_gmt":"2020-04-03T11:42:25","guid":{"rendered":"https:\/\/prohoster.info\/blog\/administrirovanie\/nativnaya-kompilyacziya-v-quarkus-pochemu-eto-vazhno"},"modified":"2020-04-03T13:42:25","modified_gmt":"2020-04-03T11:42:25","slug":"nativnaya-kompilyacziya-v-quarkus-pochemu-eto-vazhno","status":"publish","type":"post","link":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/nativnaya-kompilyacziya-v-quarkus-pochemu-eto-vazhno","title":{"rendered":"Native compilation in Quarkus - why it matters","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Hello everyone! This is the second post in our series on Quarkus \u2013 today we'll talk about native compilation.<\/p>\n<p><img decoding=\"async\" alt=\"Native compilation in Quarkus - why it matters\" src=\"\/wp-content\/uploads\/2020\/04\/3690313f6718405b06f0a6b5360767e3.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/developers.redhat.com\/blog\/2019\/03\/20\/quarkus-0-12-0-released\/\">Quarkus<\/a><\/noindex> \u2013 a Java stack tailored for <noindex><a rel=\"nofollow\" href=\"https:\/\/developers.redhat.com\/topics\/kubernetes\/\">Kubernetes<\/a><\/noindex>. While there's still a lot to be done here, we've thoroughly worked on various aspects, including JVM optimization and a number of frameworks. One of the features of Quarkus that has garnered significant interest from developers is its comprehensive seamless approach to turning Java code into executable files for specific operating systems (known as 'native compilation'), similar to C and C++, where such compilation typically occurs at the end of a cycle consisting of building, testing, and deployment.<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\nAnd while native compilation, as we'll show below, is important, it should be noted that Quarkus actually runs very well on a standard OpenJDK Hotspot JVM thanks to the performance improvements we've implemented across the stack. Therefore, native compilation should be regarded as an additional bonus that can be used at will or when necessary. In terms of native images, Quarkus significantly relies on OpenJDK. The developer-friendly dev mode is warmly welcomed, providing nearly instantaneous testing of changes due to the advanced dynamic code execution capabilities implemented in Hotspot. Additionally, when creating native images, GraalVM utilizes the OpenJDK class library and HotSpot capabilities.<\/p>\n<p>So why is native compilation needed if everything is already well optimized? This is the question we aim to answer below.<\/p>\n<p>Let's start with the obvious: Red Hat has extensive experience in optimizing JVMs, stacks, and frameworks throughout the development of the <noindex><a rel=\"nofollow\" href=\"http:\/\/www.jboss.org\/\">JBoss<\/a><\/noindex>, including:<\/p>\n<ul>\n<li>The first application server for cloud use on the <noindex><a rel=\"nofollow\" href=\"https:\/\/www.redhat.com\/en\/blog\/openshift-is-the-first-paas-to-support-java-ee-6-full-profile-in-the-cloud\">Red Hat OpenShift<\/a><\/noindex>.<\/li>\n<li>The first application server for desktop use <noindex><a rel=\"nofollow\" href=\"https:\/\/developers.redhat.com\/index.php\/videos\/youtube\/9c-g7UxT0nk\/\">Plug PC<\/a><\/noindex>.<\/li>\n<li>The first application server for <noindex><a rel=\"nofollow\" href=\"http:\/\/blog.arungupta.me\/wildfly-on-raspberry-pi-techtip-24\/\">Raspberry Pi<\/a><\/noindex>.<\/li>\n<li>A number of projects operating on devices <noindex><a rel=\"nofollow\" href=\"http:\/\/www.jboss.org\/iot\/android\/\">Android<\/a><\/noindex>.<\/li>\n<\/ul>\n<p>\nWe have been addressing the challenges of running Java applications in the cloud and on resource-constrained devices (read, IoT) for many years and have learned to extract the maximum performance and memory optimization from the JVM. Like many others, we have long been working with native compilation of Java applications through <noindex><a rel=\"nofollow\" href=\"https:\/\/gcc.gnu.org\/wiki\/GCJ\">GCJ<\/a><\/noindex>, <noindex><a rel=\"nofollow\" href=\"https:\/\/readytalk.github.io\/avian\/\">Avian<\/a><\/noindex>, <noindex><a rel=\"nofollow\" href=\"https:\/\/www.excelsiorjet.com\/\">Excelsior JET<\/a><\/noindex> and even <noindex><a rel=\"nofollow\" href=\"https:\/\/source.android.com\/devices\/tech\/dalvik\">Dalvik<\/a><\/noindex> We are well aware of the advantages and disadvantages of this approach (for instance, the dilemma of choosing between the versatility of 'build once \u2013 run anywhere' and the fact that compiled applications have smaller sizes and start faster).<\/p>\n<p>Why is it so important to consider these pros and cons? Because in some situations, their balance becomes decisive:<\/p>\n<ul>\n<li>For example, in serverless\/event-driven environments, where <noindex><a rel=\"nofollow\" href=\"https:\/\/mikhail.io\/2018\/08\/serverless-cold-start-war\/\">services must operate<\/a><\/noindex> in (hard or soft) real-time to respond to events effectively. Unlike long-lived persistent services, here the duration of a cold start critically increases the response time to requests. Starting the JVM still takes a significant amount of time, and although in some cases it can be shortened purely through hardware methods, the difference between one second and five milliseconds can be a matter of life and death. Indeed, one can experiment with creating a hot backup of Java machines (as we did during <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/projectodd\/kwsk\">the porting of OpenWhisk to Knative<\/a><\/noindex>), but this alone does not guarantee a sufficient number of JVMs to handle requests as the load scales. And from an economic perspective, this is certainly not the most optimal choice.<\/li>\n<li>Moreover, there is another frequently surfacing aspect: multi-tenancy. Despite the fact that JVM capabilities have come close to those of operating systems, they still cannot perform a function that we have become so accustomed to in Linux\u2014isolating processes. Therefore, a failure in one thread can take down the entire Java machine. Many try to circumvent this drawback by allocating a separate JVM for each user's applications to minimize the impact of failures. This makes sense, but it does not scale well.<\/li>\n<li>Additionally, for cloud-oriented applications, a metric such as service density on the host is vital. Transitioning to the methodology <noindex><a rel=\"nofollow\" href=\"https:\/\/12factor.net\/\">12 factors of application<\/a><\/noindex>, microservices and Kubernetes increase the number of Java instances per application. Thus, on one hand, this provides elasticity and reliability, but at the same time, the basic memory consumption per service also rises, with some of these costs not always being strictly necessary. Statically compiled executables gain an advantage here through various optimization techniques, such as low-level dead-code elimination, where only those parts of the frameworks (including the JDK itself) that the service actually uses are included in the final image. Therefore, native compilation with Quarkus helps to place service instances more densely on the host without compromising security.<\/li>\n<\/ul>\n<p>\nThe arguments presented above are already sufficient to understand the justification for native compilation from the perspective of the Quarkus project participants. However, there is another, non-technical but equally important reason: in recent years, many programmers and development companies have moved away from Java in favor of newer programming languages, considering that Java, along with its JVMs, stacks, and frameworks, has become too memory-hungry, too slow, etc.<\/p>\n<p>However, the habit of using the same tool for solving any task \u2013 <noindex><a rel=\"nofollow\" href=\"https:\/\/www.reddit.com\/r\/java\/comments\/8xv3ha\/does_anybody_use_spring_boot_with_aws_lambda_do\/\">is not always correct<\/a><\/noindex>. Sometimes it\u2019s better to take a step back and look for something different. And if Quarkus makes people pause and think, that\u2019s good for the entire Java ecosystem. Quarkus embodies an innovative perspective on how to create more efficient applications, making Java more relevant to new application architectures, such as serverless. Additionally, thanks to its extensibility, Quarkus, as we hope, will develop its own ecosystem of Java extensions, significantly increasing the number of frameworks that will support native compilation out of the box.<br \/>\n<br \/>Source: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/redhatrussia\/blog\/495212\/\">habr.com<\/a> <\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u0421 \u0432\u0430\u043c\u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0441\u0442 \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0440\u0438\u0438 \u043f\u043e Quarkus \u2013 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. Quarkus \u2013 \u044d\u0442\u043e Java-\u0441\u0442\u0435\u043a, \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434 Kubernetes. \u0418 \u0445\u043e\u0442\u044f \u0437\u0434\u0435\u0441\u044c, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043d\u043e\u0433\u043e\u0435 \u0435\u0449\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043c\u044b \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0440\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043c\u0430\u0441\u0441\u0443 \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e JVM \u0438 \u0446\u0435\u043b\u043e\u0433\u043e \u0440\u044f\u0434\u0430 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432. \u041e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 Quarkus, \u0432\u044b\u0437\u0432\u0430\u0432\u0448\u0435\u0439 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0441\u0442\u0430\u043b [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":76574,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-76573","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/nativnaya-kompilyacziya-v-quarkus-pochemu-eto-vazhno\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0432 Quarkus \u2013 \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0432\u0430\u0436\u043d\u043e | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/nativnaya-kompilyacziya-v-quarkus-pochemu-eto-vazhno\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-04-03T11:42:25+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-04-03T11:42:25+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Native Compilation in Quarkus \u2013 Why It Matters | ProHoster","description":"Hello everyone!","canonical_url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/nativnaya-kompilyacziya-v-quarkus-pochemu-eto-vazhno","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0432 Quarkus \u2013 \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0432\u0430\u0436\u043d\u043e | ProHoster","og:description":"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!","og:url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/nativnaya-kompilyacziya-v-quarkus-pochemu-eto-vazhno","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-04-03T11:42:25+00:00","article:modified_time":"2020-04-03T11:42:25+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"76573","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 17:34:49","updated":"2022-09-28 02:06:54","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/76573","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/comments?post=76573"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/76573\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media\/76574"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media?parent=76573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/categories?post=76573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/tags?post=76573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}