Skip to content

Create CDS Archive for JVM app class pre-loading#154

Open
MirandaStreeter wants to merge 5 commits into
OpenVoxProject:mainfrom
MirandaStreeter:appcds
Open

Create CDS Archive for JVM app class pre-loading#154
MirandaStreeter wants to merge 5 commits into
OpenVoxProject:mainfrom
MirandaStreeter:appcds

Conversation

@MirandaStreeter

@MirandaStreeter MirandaStreeter commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Short description

It's possible to memory-map the JVM application classes (ie jruby, clojure, puppetserver, etc) instead of unpacking them from the jar files on startup. The base classes are already shipped with whatever JRE you run. Doing this for the application itself shaves ~10% of startup time in my testing (at the cost of ~100MB space). This uses an extra stage during the containerfile build steps.

See: https://docs.oracle.com/en/java/javase/21/vm/class-data-sharing.html

The hard part, and what made this take so long to work out, was figuring out why the SIGTERM handler wasn't cleanly shutting down the JVM. It was nothing to do with dumb-init behavior, and nothing to do with the Alpine container's busybox version of pkill. No, we only need to target the child process, not the puppetserver wrapper that calls runuser. And as an added bonus the shutdown seems to be faster as well. :)

Part of #139

Checklist

I have:

Signed-off-by: Miranda Streeter <miranda@mirandastreeter.com>
@MirandaStreeter MirandaStreeter requested a review from a team as a code owner June 24, 2026 07:30
@rwaffen rwaffen added the enhancement New feature or request label Jun 24, 2026
@rwaffen

rwaffen commented Jun 24, 2026

Copy link
Copy Markdown
Member

LGTM,

The ENV and LABEL which are now in the cds container will be kept when doing FROM in the final container?

@MirandaStreeter

Copy link
Copy Markdown
Contributor Author

LGTM,

The ENV and LABEL which are now in the cds container will be kept when doing FROM in the final container?

Yes, they're kept, they live in the app stage which is the shared base for both the cds and final stages.

rwaffen
rwaffen previously approved these changes Jun 25, 2026

@rwaffen rwaffen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread Containerfile.alpine Outdated
Signed-off-by: Miranda Streeter <miranda@mirandastreeter.com>
@MirandaStreeter MirandaStreeter requested a review from rwaffen June 26, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants