Skip to content

Commit c1fc77b

Browse files
authored
Merge pull request #45 from clnative/patch-1
Headroom percentage vs. Headroom amount
2 parents f4e379c + 916a360 commit c1fc77b

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@ $ go get -v github.com/cloudfoundry/java-buildpack-memory-calculator
2121

2222
The following algorithm is used to generate the holistic JVM memory configuration:
2323

24-
1. Headroom is calculated as `total memory * (head room / 100)`
25-
1. If `-XX:MaxDirectMemorySize` is configured it is used for the amount of direct memory. If not configured `10M` (in the absence of any reasonable heuristic) is used.
26-
1. If `-XX:MaxMetaspaceSize` is configured it is used for the amount of metaspace. If not configured then the value is calculated as `(5800B * loaded class count) + 14000000b`.
27-
1. If `-XX:ReservedCodeCacheSize` is configured it is used for the amount of reserved code cache. If not configured `240M` (the JVM default) is used.
28-
1. If `-Xss` is configured it is used for the size of each thread stack. If not configured `1M` (the JVM default) is used.
29-
1. If `-Xmx` is configured it is used for the size of the heap. If not configured then the value is calculated as `total memory - (headroom + direct memory + metaspace + reserved code cache + (thread stack * thread count))`.
30-
31-
Broadly, this means that for a constant application (same number of classes), the non-heap overhead is a fixed value. Any changes to the total memory will be directly reflected in the size of the heap. Adjustments to the non-heap memory configuration (e.g. stack size, reserved code cache) _can_ result in larger heap sizes but can also have negative runtime side-effects that must be taken into account.
24+
1. `Headroom amount` is calculated as `total memory * (head room / 100)`.
25+
1. If `-XX:MaxDirectMemorySize` is configured it is used for the amount of direct memory. If not configured, `10M` (in the absence of any reasonable heuristic) is used.
26+
1. If `-XX:MaxMetaspaceSize` is configured it is used for the amount of metaspace. If not configured, then the value is calculated as `(5800B * loaded class count) + 14000000b`.
27+
1. If `-XX:ReservedCodeCacheSize` is configured it is used for the amount of reserved code cache. If not configured, `240M` (the JVM default) is used.
28+
1. If `-Xss` is configured it is used for the size of each thread stack. If not configured, `1M` (the JVM default) is used.
29+
1. If `-Xmx` is configured it is used for the size of the heap. If not configured, then the value is calculated as
30+
31+
```
32+
total memory - (headroom amount + direct memory + metaspace + reserved code cache + (thread stack * thread count))
33+
```
34+
35+
Broadly, this means that for a constant application (same number of classes), the non-heap overhead is a fixed value. Any changes to the total memory will be directly reflected in the size of the heap. Adjustments to the non-heap memory configuration (e.g. stack size, reserved code cache) _can_ result in larger heap sizes, but can also have negative runtime side-effects that must be taken into account.
3236

3337
### Compressed class space size
3438

0 commit comments

Comments
 (0)