feat: migrate all JVM services to JDK 21 runtime#1240
Draft
ChakshuGautam wants to merge 2 commits intoegovernments:masterfrom
Draft
feat: migrate all JVM services to JDK 21 runtime#1240ChakshuGautam wants to merge 2 commits intoegovernments:masterfrom
ChakshuGautam wants to merge 2 commits intoegovernments:masterfrom
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add build/maven-jdk21/ as a new Dockerfile variant alongside the existing build/maven/ (JDK 17). Services on Spring Boot 3.x are switched to the new Dockerfile; legacy services (Spring Boot 1.5/2.x) remain on JDK 17 unchanged. Why: - JDK 17 has a cgroup v2 CPU detection bug (JDK-8281181) on kernel 6.8+ — the JVM sees all host CPUs instead of the container's CPU limit, spawning 50-60 threads instead of ~15. - JDK 21 fixes this and auto-sizes heap/GC/threads from cgroup limits, eliminating the need for manual JVM tuning flags. - JDK 21 runs Java 17 bytecode natively (no recompilation needed). New files: - build/maven-jdk21/Dockerfile: eclipse-temurin:21-jre-alpine runtime with CDS (Class Data Sharing) pre-dump for faster startup - build/maven-jdk21/start.sh: no default -Xms/-Xmx, CDS loading Updated: build-config.yml - 26 Spring Boot 3.x services → build/maven-jdk21/Dockerfile - 32 legacy/other services → unchanged (build/maven/Dockerfile) - 1 service (egov-user) → unchanged (build/maven-java8/Dockerfile) Validated on docker-compose local-setup (jar-swap approach): - 12 services rebased, all healthy - k6 load test: 100% success (104 transactions, 0 failures) - Memory: ~24% RSS reduction, ~42% thread count reduction Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6c59377 to
5c861ca
Compare
egov-user is on Spring Boot 1.5 / JDK 8 and cannot be easily migrated to Spring Boot 3.2. This new build variant compiles with JDK 8 but runs on JDK 21, getting cgroup v2 fixes and memory improvements without a framework migration. The hybrid approach: - Build stage: same JDK 8 Maven image (amazoncorretto-8) - Patch stage: injects JAXB API + runtime jars (removed from JDK 11+) - Runtime stage: eclipse-temurin:21-jre-alpine with CDS + --add-opens Measured results (8 vCPU / 16 GB VM): - Memory at idle: 461 MiB → 184 MiB (60% reduction) - Memory under 300 VU load: OOM-killed → 286 MiB (56% of limit) - Threads: 50+ → 34 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds JDK 21 runtime base images for all JVM services in Digit-Core. JDK 21 fixes the cgroup v2 CPU detection bug (JDK-8281181) on kernel 6.8+, which causes JDK 17 to see all host CPUs instead of container limits, spawning 50+ threads and wasting memory.
Changes
1.
build/maven-jdk21/— JDK 21 base for Spring Boot 3.x services (26 services)eclipse-temurin:21-jre-alpine2.
build/maven-java8-jdk21/— JDK 21 base for egov-user (Spring Boot 1.5)--add-opensflags for JDK module access (Spring Boot 1.5 uses internal APIs)3.
build-config.yml— Updated service→Dockerfile mappingsbuild/maven-jdk21/Dockerfilebuild/maven-java8-jdk21/Dockerfilebuild/maven/Dockerfile(JDK 17)Results (measured on 8 vCPU / 16 GB VM)
What's NOT changed
build/maven/Dockerfilebuild/maven-java8/Dockerfileleft untouched for other JDK 8 servicesTest plan
🤖 Generated with Claude Code