Skip to content

Commit 358bb87

Browse files
committed
docs: update JRE examples to Java 21, expand memory calculator config
- Use Java 21 in version examples and profile.d output - Prefer JBP_CONFIG_<JRE>_JRE for memory calculator config (covers stack_threads, class_count, headroom) - Note MEMORY_CALCULATOR_* env vars take precedence but don't cover class_count - Add stack_threads/class_count/headroom descriptions
1 parent 88bcf93 commit 358bb87

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

docs/IMPLEMENTING_JRES.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ These are available in `src/java/jres/` and called by `BaseJRE` internally. You
251251

252252
### Version resolution priority
253253

254-
1. `BP_JAVA_VERSION` (e.g. `17`, `17.*`, `17.0.13`)
254+
1. `BP_JAVA_VERSION` (e.g. `21`, `21.*`, `21.0.5`)
255255
2. `JBP_CONFIG_<JREKEY>_JRE` with `version:` field
256256
3. Manifest `default_versions` entry for this JRE key
257257

@@ -260,8 +260,8 @@ These are available in `src/java/jres/` and called by `BaseJRE` internally. You
260260
`WriteJavaHomeProfileD` produces `$DEPS_DIR/<idx>/.profile.d/java.sh`:
261261

262262
```bash
263-
export JAVA_HOME=$DEPS_DIR/0/jre/jdk-17.0.13
264-
export JRE_HOME=$DEPS_DIR/0/jre/jdk-17.0.13
263+
export JAVA_HOME=$DEPS_DIR/0/jre/jdk-21.0.5
264+
export JRE_HOME=$DEPS_DIR/0/jre/jdk-21.0.5
265265
export PATH=$JAVA_HOME/bin:$PATH
266266
```
267267

@@ -277,11 +277,23 @@ Downloads `java-buildpack-memory-calculator` binary. At application start it com
277277
-Xmx512M -Xms512M -XX:MaxMetaspaceSize=128M -Xss1M -XX:ReservedCodeCacheSize=32M
278278
```
279279

280-
User customization via env:
280+
User customization — prefer `JBP_CONFIG_<JRE>_JRE` for structured config (covers all three knobs):
281+
282+
```bash
283+
cf set-env myapp JBP_CONFIG_OPEN_JDK_JRE \
284+
'{memory_calculator: {stack_threads: 300, class_count: 500, headroom: 10}}'
285+
```
286+
287+
`stack_threads` — number of user threads (default: 200); affects `-Xss` heap budget.
288+
`class_count` — estimated loaded classes (default: auto-detected); affects `-XX:MaxMetaspaceSize`.
289+
`headroom` — percent of total memory to leave unallocated (default: 0).
290+
291+
`MEMORY_CALCULATOR_*` env vars are a simpler alternative, but only cover two of the three knobs. They take precedence over `JBP_CONFIG_*` when both are set:
281292

282293
```bash
283294
cf set-env myapp MEMORY_CALCULATOR_STACK_THREADS 300
284-
cf set-env myapp MEMORY_CALCULATOR_HEADROOM 10 # % headroom to leave
295+
cf set-env myapp MEMORY_CALCULATOR_HEADROOM 10
296+
# class_count not available as a MEMORY_CALCULATOR_* env var — use JBP_CONFIG_* for that
285297
```
286298

287299
### JVMKill Agent

0 commit comments

Comments
 (0)