Skip to content

Commit 57e646c

Browse files
author
Yuriy Bezsonov
committed
refactor(apps): reorganize Java25 Dockerfile numbering and simplify pom.xml
1 parent ec28bf0 commit 57e646c

File tree

9 files changed

+114
-151
lines changed

9 files changed

+114
-151
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

apps/unicorn-store-spring-java25/pom.xml

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -150,20 +150,6 @@
150150
</dependency>
151151
</dependencies>
152152

153-
<pluginRepositories>
154-
<pluginRepository>
155-
<releases>
156-
<enabled>false</enabled>
157-
</releases>
158-
<snapshots>
159-
<enabled>true</enabled>
160-
</snapshots>
161-
<id>graalvm-native-build-tools-snapshots</id>
162-
<name>GraalVM native-build-tools Snapshots</name>
163-
<url>https://raw.githubusercontent.com/graalvm/native-build-tools/snapshots</url>
164-
</pluginRepository>
165-
</pluginRepositories>
166-
167153
<build>
168154
<plugins>
169155
<plugin>
@@ -224,52 +210,6 @@
224210
</plugins>
225211
</build>
226212
</profile>
227-
<profile>
228-
<id>soci</id>
229-
<build>
230-
<plugins>
231-
<plugin>
232-
<groupId>org.springframework.boot</groupId>
233-
<artifactId>spring-boot-maven-plugin</artifactId>
234-
<configuration>
235-
<layers>
236-
<enabled>true</enabled>
237-
</layers>
238-
</configuration>
239-
</plugin>
240-
</plugins>
241-
</build>
242-
</profile>
243-
<profile>
244-
<id>buildpacks</id>
245-
<build>
246-
<plugins>
247-
<plugin>
248-
<groupId>org.springframework.boot</groupId>
249-
<artifactId>spring-boot-maven-plugin</artifactId>
250-
<configuration>
251-
<image>
252-
<name>unicorn-store-spring:latest</name>
253-
<buildpacks>
254-
<buildpack>paketobuildpacks/amazon-corretto:9.3.2</buildpack>
255-
<buildpack>paketobuildpacks/java:20.2.0</buildpack>
256-
<buildpack>paketobuildpacks/syft:2.24.0</buildpack>
257-
<buildpack>paketobuildpacks/spring-boot:5.33.5</buildpack>
258-
<buildpack>paketobuildpacks/executable-jar:6.13.4</buildpack>
259-
</buildpacks>
260-
<env>
261-
<SPRING_DATASOURCE_URL>${env.SPRING_DATASOURCE_URL}</SPRING_DATASOURCE_URL>
262-
<SPRING_DATASOURCE_PASSWORD>${env.SPRING_DATASOURCE_PASSWORD}</SPRING_DATASOURCE_PASSWORD>
263-
<BP_JVM_VERSION>25</BP_JVM_VERSION>
264-
<BP_JVM_CDS_ENABLED>true</BP_JVM_CDS_ENABLED>
265-
<BP_SPRING_AOT_ENABLED>true</BP_SPRING_AOT_ENABLED>
266-
</env>
267-
</image>
268-
</configuration>
269-
</plugin>
270-
</plugins>
271-
</build>
272-
</profile>
273213
<profile>
274214
<id>jvm</id>
275215
<activation>

infra/scripts/deploy/test-optimizations.md

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ Build and test all Java container optimization methods for the Unicorn Store Spr
1010
## Usage
1111

1212
```bash
13-
./test-optimizations.sh # Build all images locally
14-
./test-optimizations.sh --deploy # Build, push to ECR, deploy to EKS, measure startup
15-
./test-optimizations.sh --only cds # Build single method
13+
# Full benchmark: clean Docker, build all, deploy to EKS, measure startup, revert to :latest
14+
./test-optimizations.sh --pre-clean --deploy --revert
15+
16+
# Build all images locally (no deploy)
17+
./test-optimizations.sh
18+
19+
# Build single method locally
20+
./test-optimizations.sh --only cds
21+
22+
# Build, push, and deploy single method
1623
./test-optimizations.sh --only cds --deploy
17-
./test-optimizations.sh --deploy --revert # Revert to :latest on exit
1824
```
1925

2026
## Options
@@ -25,30 +31,30 @@ Build and test all Java container optimization methods for the Unicorn Store Spr
2531
| `--deploy` | Push to ECR, deploy to EKS, measure startup times |
2632
| `--only <method>` | Build only specified method (partial match: `cds`, `native`, etc.) |
2733
| `--revert` | Revert deployment to `:latest` on exit (use with `--deploy`) |
34+
| `--pre-clean` | Full Docker prune before building (removes all images, containers, volumes, build cache) |
2835

2936
## Methods
3037

3138
| Tag | Method | Build | Needs DB | Code Change | Notes |
3239
|-----|--------|-------|----------|-------------|-------|
33-
| 01-baseline-1cpu | Baseline with 1 CPU | No | No | No | Deploy-only, ~10-12s |
34-
| 01-baseline-2cpu | Baseline with 2 CPUs | No | No | No | Deploy-only, ~6s |
35-
| 01-pod-resize | In-place pod resize | No | No | No | Deploy-only, CPU boost controller |
36-
| 02-multi-stage | Optimized Dockerfile | Yes | No | No | Baseline build |
37-
| 03-jib | Google Jib Maven plugin | Yes | No | No | No Dockerfile |
38-
| 04-custom-jre | Custom JRE with jlink | Yes | No | No | Smaller image |
39-
| 05-soci | Seekable OCI (lazy loading) | Yes | No | No | SOCI index after push |
40-
| 06-cds | Class Data Sharing | Yes | Yes | No | Paketo Buildpacks |
41-
| 07-aot | Ahead-of-Time compilation | Yes | Yes | No | Java 25+ AOT cache |
42-
| 08-native | GraalVM Native Image | Yes | No | No | Long build time |
43-
| 09-crac | Coordinated Restore at Checkpoint | Yes | Yes | Yes | UnicornPublisher swap |
40+
| 01-multi-stage | Baseline with 1 CPU | Yes | No | No | Baseline build + deploy |
41+
| 01-multi-stage-2cpu | Baseline with 2 CPUs | No | No | No | Deploy variant, same image |
42+
| 01-multi-stage-pod-resize | In-place pod resize | No | No | No | Deploy variant, CPU boost controller |
43+
| 02-jib | Google Jib Maven plugin | Yes | No | No | No Dockerfile |
44+
| 03-custom-jre | Custom JRE with jlink | Yes | No | No | Smaller image |
45+
| 04-soci | Seekable OCI (lazy loading) | Yes | No | No | SOCI index after push |
46+
| 05-cds | Class Data Sharing | Yes | Yes | No | Paketo Buildpacks |
47+
| 06-aot | Ahead-of-Time compilation | Yes | Yes | No | Java 25+ AOT cache |
48+
| 07-native | GraalVM Native Image | Yes | No | No | Long build time |
49+
| 08-crac | Coordinated Restore at Checkpoint | Yes | Yes | Yes | UnicornPublisher swap |
4450

4551
## Flow
4652

4753
### Build-only mode (default)
4854

4955
```
5056
For each method:
51-
1. Skip if deploy-only (01-baseline-*, 01-pod-resize)
57+
1. Skip build if deploy variant (01-multi-stage-2cpu, 01-multi-stage-pod-resize)
5258
2. Pre-build hooks (CRaC: swap UnicornPublisher.crac)
5359
3. Start PostgreSQL if needed (CDS, AOT, CRaC) - AWS RDS or local Docker
5460
4. Build image (docker build, mvn jib:dockerBuild, or pack build)
@@ -66,15 +72,15 @@ For each method:
6672
│ Start watcher ──────────────────► Initialize results file │
6773
│ │
6874
│ For each method: │
69-
│ Build image (skip for 01-*)
70-
│ Push to ECR (skip for 01-*)
75+
│ Build image (skip for variants)
76+
│ Push to ECR (skip for variants)
7177
│ Write to queue ───────────────► Read queue │
7278
│ Continue immediately │
73-
│ Handle deploy-only methods:
74-
│ 01-baseline-1cpu: set 1 CPU│
75-
│ 01-baseline-2cpu: set 2 CPU│
76-
│ 01-pod-resize: install
77-
│ CPU boost controller
79+
│ Handle deploy variants:
80+
│ 01-multi-stage: set 1 CPU
81+
│ 01-multi-stage-2cpu: 2 CPU
82+
│ 01-multi-stage-pod-resize: │
83+
install CPU boost ctrl
7884
│ Or: kubectl set image :tag │
7985
│ Wait for rollout │
8086
│ Record startup time │
@@ -103,25 +109,27 @@ All output goes to `/tmp/test-optimizations/` (or `${SCRIPT_DIR}/.test-optimizat
103109

104110
### Build-only stdout
105111
```
106-
Method | Build | Size Local | Time
107-
---------------|-------|------------|------
108-
01-baseline-1cpu | ✅ | N/A | 0s
109-
02-multi-stage | ✅ | 598MB | 45s
110-
06-cds | ✅ | 1.23GB | 2m23s
111-
08-native | ❌ | N/A | 5m30s
112+
Method | Build | Size Local | Time
113+
--------------------------|-------|------------|------
114+
01-multi-stage | ✅ | 598MB | 45s
115+
01-multi-stage-2cpu | ✅ | N/A | 0s
116+
01-multi-stage-pod-resize | ✅ | N/A | 0s
117+
02-jib | ✅ | 590MB | 30s
118+
05-cds | ✅ | 1.23GB | 2m23s
119+
07-native | ❌ | N/A | 5m30s
112120
```
113121

114122
### Deploy mode results file
115123
```
116-
Method | Size Local | Size ECR | Build Time | Startup Time
117-
-----------------|------------|----------|------------|-------------
118-
01-baseline-1cpu | N/A | N/A | 0s | 10.234 seconds
119-
01-baseline-2cpu | N/A | N/A | 0s | 6.123 seconds
120-
01-pod-resize | N/A | N/A | 0s | 5.987 seconds
121-
02-multi-stage | 598MB | 580MB | 45s | 10.234 seconds
122-
06-cds | 1.23GB | 578MB | 2m23s | 3.916 seconds
123-
07-aot | 1.34GB | 428MB | 56s | 4.0 seconds
124-
09-crac | 1.1GB | 1.0GB | 3m20s | 0.087 seconds
124+
Method | Size Local | Size ECR | Build Time | Startup Time
125+
--------------------------|------------|----------|------------|-------------
126+
01-multi-stage | 598MB | 580MB | 45s | 10.234 seconds
127+
01-multi-stage-2cpu | N/A | N/A | 0s | 6.123 seconds
128+
01-multi-stage-pod-resize | N/A | N/A | 0s | 5.987 seconds
129+
02-jib | 590MB | 570MB | 30s | 10.100 seconds
130+
05-cds | 1.23GB | 578MB | 2m23s | 3.916 seconds
131+
06-aot | 1.34GB | 428MB | 56s | 4.0 seconds
132+
08-crac | 1.1GB | 1.0GB | 3m20s | 0.087 seconds
125133
```
126134

127135
## Database Configuration
@@ -137,13 +145,13 @@ The script automatically detects database configuration:
137145

138146
## Special Build Methods
139147

140-
### CDS (06-cds)
148+
### CDS (05-cds)
141149
Uses Paketo Buildpacks instead of Dockerfile:
142150
- Installs `pack` CLI if not available
143151
- `BP_JVM_CDS_ENABLED=true` - creates CDS archive during build
144152
- `BPL_JVM_CDS_ENABLED=true` - uses CDS archive at runtime
145153

146-
### Pod Resize (01-pod-resize)
154+
### Pod Resize (01-multi-stage-pod-resize)
147155
Installs Kube Startup CPU Boost controller:
148156
- Creates `StartupCPUBoost` resource with 100% CPU increase
149157
- Automatically removes boost when pod becomes ready
@@ -159,7 +167,7 @@ Database credentials are fetched automatically from AWS or use local Docker fall
159167

160168
## Notes
161169

162-
- Deploy-only methods (01-*) don't build images, they modify deployment config
170+
- Deploy variants (01-multi-stage-2cpu, 01-multi-stage-pod-resize) use the same 01-multi-stage image
163171
- CDS uses Paketo Buildpacks (not Dockerfile) for proper CDS archive creation
164172
- Native image may fail on ARM (macOS) - works on x86-64 Linux
165173
- CRaC requires x86-64 for `-XX:CPUFeatures=generic`

0 commit comments

Comments
 (0)