<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Thomas Watson</title>
    <description>The latest articles on DEV Community by Thomas Watson (@tjwatson).</description>
    <link>https://dev.to/tjwatson</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1128466%2Fd1dc8c95-c8b4-423c-8ee4-2a879768c8af.jpeg</url>
      <title>DEV Community: Thomas Watson</title>
      <link>https://dev.to/tjwatson</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tjwatson"/>
    <language>en</language>
    <item>
      <title>How to package your cloud-native Java app for faster startup</title>
      <dc:creator>Thomas Watson</dc:creator>
      <pubDate>Wed, 20 Sep 2023 16:47:33 +0000</pubDate>
      <link>https://dev.to/openliberty/how-to-package-your-cloud-native-java-app-for-faster-startup-103p</link>
      <guid>https://dev.to/openliberty/how-to-package-your-cloud-native-java-app-for-faster-startup-103p</guid>
      <description>&lt;p&gt;Did you know you can repackage your cloud-native Java applications to start in milliseconds, without compromising throughput, memory, development-production parity, or Java language features? And with little to no refactoring of the application code? Here’s how…&lt;/p&gt;

&lt;h2&gt;
  
  
  The need for speed at startup
&lt;/h2&gt;

&lt;p&gt;In serverless environments, scale-to-zero can help reduce the overall cloud costs for deployed applications by shutting down unneeded application instances when no ongoing requests exist. When activity picks up for the application, new instances can start quickly, without introducing noticeable delays for the application end-user.&lt;/p&gt;

&lt;p&gt;Despite improvements to JDK technology that make it start in less than 1 second, like class data sharing and dynamic AOT compilation, it still cannot start fast enough to support scale-to-zero. However, the JDK is important for optimizing throughput and memory, ensuring development-production parity, and enabling a full range of Java language features. So how do we improve startup time while also benefiting from running on the full JDK?&lt;/p&gt;

&lt;p&gt;The InstantOn capability in the &lt;a href="https://openliberty.io/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_content=instanton" rel="noopener noreferrer"&gt;Open Liberty&lt;/a&gt; runtime uses the &lt;a href="https://developer.ibm.com/languages/java/semeru-runtimes/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_content=instanton" rel="noopener noreferrer"&gt;IBM Semeru Runtimes&lt;/a&gt; JDK and a Linux technology called &lt;a href="https://criu.org/Main_Page" rel="noopener noreferrer"&gt;Checkpoint/Restore in Userspace&lt;/a&gt; (CRIU) to take a checkpoint, or a point-in-time snapshot, of the application process. This checkpoint can then be restored very quickly to bring the application process back into the state it was in when the checkpoint was taken. The application can be restored multiple times because Open Liberty and Semeru JDK preserve the uniqueness of each restored process in containers.  Each restored application process runs without first having to go through the whole startup sequence, saving up to 90% of startup time (depending on your application). InstantOn requires very little modification of your Java application to make this improvement happen.&lt;/p&gt;

&lt;p&gt;The following diagram demonstrates how the checkpoint that is taken during the container image build can be used to rapidly start multiple instances of an application in production by restoring them to the checkpointed phase of the application process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F755hkx6ibohxyjsxwm52.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F755hkx6ibohxyjsxwm52.jpg" alt="Diagram showing that you can take a checkpoint during the container image build and then restore multiple instances of the application in production."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;InstantOn cannot be used outside of a container image build. An application container image provides a consistent environment, which is required to ensure a reliable restore of an Open Liberty application process. Since the InstantOn checkpoint is included in the last layer of the application container image, the resources in the underlying layers of the image do not change from the time the checkpoint is taken to the time the image is restored.&lt;/p&gt;

&lt;p&gt;The following tutorial walks you through containerizing your application using the Open Liberty Java runtime, InstantOn, IBM Semeru JDK, and Podman container tools running on Linux. For general information about containerizing applications with Open Liberty, see the &lt;a href="https://openliberty.io/guides/containerize-podman.html?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_content=instanton" rel="noopener noreferrer"&gt;Containerizing microservices with Podman&lt;/a&gt; guide.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites to checkpoint/restore a containerized application
&lt;/h2&gt;

&lt;p&gt;Currently, &lt;a href="https://openliberty.io/blog/2023/06/27/23.0.0.6.html?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_content=instanton" rel="noopener noreferrer"&gt;Open Liberty version 23.0.0.6&lt;/a&gt; or later supports running with InstantOn only on x86-64/amd64 architectures. All our testing was done on RHEL 9.0 and Ubuntu 22.04 but it might also be possible to run on other Linux distributions and versions if they have the following prerequisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  The kernel must support the Linux &lt;a href="https://man7.org/linux/man-pages/man7/capabilities.7.html" rel="noopener noreferrer"&gt;CAP_CHECKPOINT_RESTORE&lt;/a&gt; capability. This capability was introduced in kernel version 5.9.&lt;/li&gt;
&lt;li&gt;  The latest available version of Podman for the Linux distribution must be installed.&lt;/li&gt;
&lt;li&gt;  The Linux distribution must allow the execution of privileged container builds by using Podman or Docker.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more information about the runtime and host build system prerequisites, see the &lt;a href="https://openliberty.io/docs/latest/instanton.html?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_content=instanton#prereq" rel="noopener noreferrer"&gt;Open Liberty InstantOn documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create an application WAR file
&lt;/h2&gt;

&lt;p&gt;If you don’t have an application of your own handy, you can follow along with an example application from the &lt;a href="https://openliberty.io/guides/getting-started.html?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_content=instanton" rel="noopener noreferrer"&gt;Getting started with Open Liberty guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First, clone the &lt;a href="https://github.com/openliberty/guide-getting-started" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt; for the guide:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/openliberty/guide-getting-started.git
cd guide-getting-started
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, build the application, which is in the &lt;code&gt;finish/&lt;/code&gt; directory, and deploy it to Open Liberty:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd finish
mvn liberty:run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you see the following message, your Open Liberty instance is ready:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The defaultServer server is ready to run a smarter planet.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check out the service at the &lt;a href="http://localhost:9080/dev/system/properties" rel="noopener noreferrer"&gt;http://localhost:9080/dev/system/properties&lt;/a&gt; URL.&lt;/p&gt;

&lt;p&gt;Stop the running Open Liberty instance by pressing &lt;strong&gt;CTRL+C&lt;/strong&gt; in the command-line session where you started Open Liberty.&lt;/p&gt;

&lt;p&gt;Lastly, build the WAR for the application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mvn package
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command builds a &lt;code&gt;target/guide-getting-started.war&lt;/code&gt; archive. We can now include this WAR in a container image that uses the InstantOn feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing the startup time of your application
&lt;/h2&gt;

&lt;p&gt;For comparison of how long it takes your Open Liberty application container image to start both with and without InstantOn, we describe how to build the container image without InstantOn first. Then, we describe how to build with InstantOn and run the resulting containers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Containerizing the Open Liberty application without InstantOn
&lt;/h3&gt;

&lt;p&gt;Build the application container image without InstantOn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;podman build -t getting-started .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command creates the getting-started container image without any checkpoint image. &lt;/p&gt;

&lt;p&gt;Run this application container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;podman run --name getting-started --rm -p 9080:9080 getting-started
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the amount of time Open Liberty takes to report it is started and check out the service running in the container at the &lt;a href="http://localhost:9080/dev/system/properties" rel="noopener noreferrer"&gt;http://localhost:9080/dev/system/properties&lt;/a&gt; URL. After you finish checking out the application, stop the running container by pressing &lt;strong&gt;CTRL+C&lt;/strong&gt; in the command-line session where you ran the &lt;code&gt;podman run&lt;/code&gt; command.&lt;/p&gt;

&lt;h3&gt;
  
  
  Containerizing the Open Liberty application with InstantOn
&lt;/h3&gt;

&lt;p&gt;The Open Liberty container image contains the prerequisites for building an application container image with a checkpointed runtime process. Applications can use the Open Liberty image as a base to build their own application container images and from that, create their own application container image with a checkpointed process. &lt;/p&gt;

&lt;h4&gt;
  
  
  Build the application container image and checkpoint the application
&lt;/h4&gt;

&lt;p&gt;An InstantOn checkpoint is created by starting the Open Liberty runtime during the application container image build step. During this startup, the runtime processes the configuration, loads all the enabled features, and starts processing the configured application. Depending on the needs of your application, you can choose one of two specific phases during Open Liberty startup at which to checkpoint the process. You must configure the Dockerfile to specify your chosen phase (as we show later).&lt;/p&gt;

&lt;p&gt;The official &lt;a href="https://openliberty.io/docs/latest/container-images.html?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_content=instanton" rel="noopener noreferrer"&gt;Open Liberty images from the IBM Container Registry&lt;/a&gt; (ICR) include all the prerequisites that are needed for InstantOn to checkpoint an application process. For this example, the &lt;code&gt;getting-started&lt;/code&gt; application container image is using the &lt;code&gt;icr.io/appcafe/open-liberty:full-java11-openj9-ubi&lt;/code&gt; image from ICR as the parent image. Currently, InstantOn is supported only with the Java 11 and Java 17-based UBI images of Open Liberty.&lt;/p&gt;

&lt;p&gt;Update the application Dockerfile by adding a &lt;code&gt;RUN&lt;/code&gt; command for the &lt;code&gt;checkpoint.sh&lt;/code&gt; script to the end of the file, as shown in the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; icr.io/appcafe/open-liberty:full-java11-openj9-ubi&lt;/span&gt;
&lt;span class="k"&gt;ARG&lt;/span&gt;&lt;span class="s"&gt; VERSION=1.0&lt;/span&gt;
&lt;span class="k"&gt;ARG&lt;/span&gt;&lt;span class="s"&gt; REVISION=SNAPSHOT&lt;/span&gt;
&lt;span class="k"&gt;LABEL&lt;/span&gt;&lt;span class="s"&gt; \&lt;/span&gt;
  org.opencontainers.image.authors="Your Name" \
  org.opencontainers.image.vendor="IBM" \
  org.opencontainers.image.url="local" \
  org.opencontainers.image.source="https://github.com/OpenLiberty/guide-getting-started" \
  org.opencontainers.image.version="$VERSION" \
  org.opencontainers.image.revision="$REVISION" \
  vendor="Open Liberty" \
  name="system" \
  version="$VERSION-$REVISION" \
  summary="The system microservice from the Getting Started guide" \
  description="This image contains the system microservice running with the Open Liberty runtime."

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --chown=1001:0 src/main/liberty/config/ /config/&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --chown=1001:0 target/*.war /config/apps/&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;configure.sh
&lt;span class="k"&gt;RUN &lt;/span&gt;checkpoint.sh afterAppStart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This configuration adds the application process checkpoint as the last layer of the application container image. The &lt;code&gt;checkpoint.sh&lt;/code&gt; script allows you to specify either &lt;code&gt;afterAppStart&lt;/code&gt; or &lt;code&gt;beforeAppStart&lt;/code&gt; to indicate which phase of the startup performs the process checkpoint.&lt;/p&gt;

&lt;p&gt;Two options are available to determine whether the checkpoint occurs before or after the application itself starts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;beforeAppStart&lt;/code&gt;: The checkpoint happens after processing the configured application metadata. If the application has any components that get run as part of the application starting, the checkpoint is taken before executing any code from the application. This option is the earliest checkpoint phase that is offered by InstantOn.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;afterAppStart&lt;/code&gt;: This option is the latest phase where a checkpoint can happen, so it has the potential to provide the fastest startup time when restoring the application instance. The checkpoint happens after all configured applications are reported as started. This phase happens before opening any ports for listening to incoming requests for the applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;afterAppStart&lt;/code&gt; phase typically provides the quickest startup time for an application, but it also might cause some application code to run before the server process checkpoint happens. Since the &lt;code&gt;getting-started&lt;/code&gt; application used in this tutorial does not do anything in its startup logic that would cause problems in restoring, we can use the &lt;code&gt;afterAppStart&lt;/code&gt; phase for it.&lt;/p&gt;

&lt;p&gt;For InstantOn to take a checkpoint of and restore a process, the CRIU binary requires additional &lt;a href="https://openliberty.io/docs/latest/instanton.html?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_content=instanton#linux-capabilities" rel="noopener noreferrer"&gt;Linux capabilities&lt;/a&gt;. The Open Liberty container image includes the necessary capabilities already granted to the binary. However, the container must also have these capabilities granted when it is launched.&lt;/p&gt;

&lt;p&gt;With podman, you can use the &lt;code&gt;-–cap-add&lt;/code&gt; and &lt;code&gt;--security-opt&lt;/code&gt; options to grant the container build the necessary capabilities to take a checkpoint during the container build step. The user who launches the Podman container must have the authority to grant it the necessary Linux capabilities, so you must run the following command as root or &lt;code&gt;sudo&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;podman build \
   -t dev.local/getting-started-instanton \
   --cap-add=CHECKPOINT_RESTORE \
   --cap-add=SYS_PTRACE\
   --cap-add=SETPCAP \
   --security-opt seccomp=unconfined .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last instruction in the Dockerfile is to run the &lt;code&gt;checkpoint.sh&lt;/code&gt; script. When you execute the previous Podman build command, it launches Open Liberty to perform the checkpoint at the phase specified in the Dockerfile. After the container process data is persisted, Open Liberty stops and the container image build completes. The produced application container image contains the checkpoint process data as the last layer of the container image. The output looks something like the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Performing checkpoint --at=afterAppStart

Launching defaultServer (Open Liberty 23.0.0.6/wlp-1.0.78.cl230620230612-1100) on Eclipse OpenJ9 VM, version 11.0.19+7 (en_US)
[AUDIT   ] CWWKE0001I: The server defaultServer has been launched.
[AUDIT   ] CWWKG0093A: Processing configuration drop-ins resource: /opt/ol/wlp/usr/servers/defaultServer/configDropins/defaults/keystore.xml
[AUDIT   ] CWWKG0093A: Processing configuration drop-ins resource: /opt/ol/wlp/usr/servers/defaultServer/configDropins/defaults/open-default-port.xml
[AUDIT   ] CWWKZ0058I: Monitoring dropins for applications.
[AUDIT   ] CWWKZ0001I: Application guide-getting-started started in 1.886 seconds.
[AUDIT   ] CWWKC0451I: A server checkpoint "afterAppStart" was requested. When the checkpoint completes, the server stops.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Run the InstantOn application image
&lt;/h4&gt;

&lt;p&gt;Run the &lt;code&gt;getting-started-instanton&lt;/code&gt; container with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;podman run \
  --rm \
  --cap-add=CHECKPOINT_RESTORE \
  --cap-add=SETPCAP \
  --security-opt seccomp=unconfined \
  -p 9080:9080 \
  getting-started-instanton
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;--cap-add&lt;/code&gt; options grant the container the two Linux capabilities that CRIU requires to restore the application process. When Open Liberty restores the application process, it logs the following messages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[AUDIT   ] Launching defaultServer (Open Liberty 23.0.0.6/wlp-1.0.78.cl230620230612-1100) on Eclipse OpenJ9 VM, version 11.0.19+7 (en_US)
[AUDIT   ] CWWKZ0001I: Application guide-getting-started started in 0.233 seconds.
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://850ba43df239:9080/dev/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://850ba43df239:9080/metrics/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://850ba43df239:9080/health/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://850ba43df239:9080/ibm/api/
[AUDIT   ] CWWKC0452I: The Liberty server process resumed operation from a checkpoint in 0.283 seconds.
[AUDIT   ] CWWKF0012I: The server installed the following features: [cdi-4.0, distributedMap-1.0, jndi-1.0, json-1.0, jsonb-3.0, jsonp-2.1, monitor-1.0, mpConfig-3.0, mpHealth-4.0, mpMetrics-5.0, restfulWS-3.1, restfulWSClient-3.1, ssl-1.0, transportSecurity-1.0].
[AUDIT   ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 0.297 seconds.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If Open Liberty fails to restore the checkpoint process, it recovers by launching without the checkpoint image and logs the following message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CWWKE0957I: Restoring the checkpoint server process failed. Check the /logs/checkpoint/restore.log log to determine why the checkpoint process was not restored. Launching the server without using the checkpoint image.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check how long it took for Open Liberty to start and compare this to the time it took without InstantOn.&lt;/p&gt;

&lt;h3&gt;
  
  
  Performance results for Liberty InstantOn
&lt;/h3&gt;

&lt;p&gt;InstantOn improves startup time of Open Liberty applications significantly by restoring the process from the checkpointed state. The improvement in the time to first response (i.e. the time taken to serve the first request) is also impressive but obviously more of the application logic runs after the restore in that case. We measured both metrics for multiple applications running in containers and using the &lt;code&gt;afterAppStart&lt;/code&gt; checkpoint phase.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/HotswapProjects/pingperf-quarkus/" rel="noopener noreferrer"&gt;Pingperf&lt;/a&gt; is a very simple ping-type application involve a single REST endpoint.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/johnaohara/quarkusRestCrudDemo/" rel="noopener noreferrer"&gt;Rest crud&lt;/a&gt; is a bit more complicated, and involves JPA and a remote database.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/blueperf/acmeair-mainservice-java#acme-air-main-service---javaliberty/" rel="noopener noreferrer"&gt;AcmeAir Microservice Main&lt;/a&gt; uses the MicroProfile features.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffwn2tzce8fqrtz00xavw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffwn2tzce8fqrtz00xavw.png" alt="Graph shows that the Pingperf app's startup time was reduced by Liberty InstantOn from 1610 ms to 129 ms, the Rest Crud app's startup time was reduced from 2166 ms to 136 ms, and the AcmeAir Microservice Main app's startup time was reduced from 2799 ms to 180 ms."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Facur090a1j7f11s6scv7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Facur090a1j7f11s6scv7.png" alt="Graph shows that the Pingperf app's first response time was reduced by Liberty InstantOn from 1974 ms to 266 ms, the Rest Crud app's first response time was reduced from 2507 ms to 459 ms, and the AcmeAir Microservice Main app's first response time was reduced from 2917 ms to 331 ms."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These experiments show a healthy improvement in startup times for all 3 applications and the time to first response is also improved by up to 8.8x when compared with normal JVM mode without InstantOn&lt;sup id="fnref1"&gt;1&lt;/sup&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;This post describes how to configure your cloud-native application to start almost immediately by using the Open Liberty InstantOn feature to produce an application container image. The key value proposition of InstantOn is that you can repackage your cloud-native Java applications to start in milliseconds, without compromising on throughput, memory, development-production parity, or Java language features.&lt;br&gt;
This feature is now available in &lt;a href="https://openliberty.io/blog/2023/06/27/23.0.0.6.html?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_content=instanton" rel="noopener noreferrer"&gt;Open Liberty 23.0.0.6&lt;/a&gt; on the X86-64/AMD64 platforms running in the public cloud AWS EKS and Azure AKS environments.&lt;/p&gt;

&lt;p&gt;In the future, we are planning to broaden our platform coverage and expand to be able to run in more managed public and hybrid cloud environments. We also intend to explore supporting InstantOn with an even larger set of Open Liberty features. For more details about Open Liberty InstantOn, see the &lt;a href="https://openliberty.io/blog/2023/06/29/docs/latest/instanton.html?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_content=instanton" rel="noopener noreferrer"&gt;Faster startup for containerized applications with Open Liberty InstantOn&lt;/a&gt; documentation, which links to more elaborate discussion on known limitations and information on the Semeru JDK support for this feature. &lt;/p&gt;




&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;These experiments were run on a 24-core Linux X86-64 system, and &lt;code&gt;taskset -c&lt;/code&gt; was used to allocate 4 cores to the Open Liberty process running in containers in each case. Startup time is measured from the time the Open Liberty server startup is initiated to the time the server is ready to accept requests, as denoted by &lt;code&gt;The &amp;lt;server name&amp;gt; server is ready to run a smarter planet.&lt;/code&gt; message in the &lt;code&gt;messages.log&lt;/code&gt;. The time it takes to start the container itself is also included in the results shown. InstantOn versus normal startup times for these applications are shown here in milliseconds. Your results might vary based on your environment, hardware and software installed on your system, and other factors. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>java</category>
      <category>performance</category>
      <category>serverless</category>
      <category>cloudnative</category>
    </item>
  </channel>
</rss>
