Skip to content

Commit

Permalink
cgroup ref
Browse files Browse the repository at this point in the history
  • Loading branch information
s50600822 committed Feb 29, 2024
1 parent c599672 commit d4e4a46
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions vs/java/cgroup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Available Memory (Free): 242 MB
Maximum Memory (Allocated): 245 MB
Total System Memory: 7940 MB

# GOOD, since JDK 11
# GOOD, since JDK 11. Also mentioned in https://kubernetes.io/docs/concepts/architecture/cgroups/
./runWithDocker.sh
Available Processor Count: 2
Available Memory (Total): 247 MB
Expand All @@ -39,7 +39,7 @@ Total System Memory: 512 MB

### Try all JDK versions if curious
```bash
# BAD
# BAD
docker run --rm --cpus=2 --memory=512m --name jvm_cgroup_demo_openjdk8 -v .:/app openjdk:8 java -Xmx256m -Xms256m -jar /app/application.jar
docker run --rm --cpus=2 --memory=512m --name jvm_cgroup_demo_openjdk9 -v .:/app openjdk:9 java -Xmx256m -Xms256m -jar /app/application.jar
docker run --rm --cpus=2 --memory=512m --name jvm_cgroup_demo_openjdk10 -v .:/app openjdk:10 java -Xmx256m -Xms256m -jar /app/application.jar
Expand All @@ -51,21 +51,21 @@ docker run --rm --cpus=2 --memory=512m --name jvm_cgroup_demo_openjdk17 -v .:/ap
docker run --rm --cpus=2 --memory=512m --name jvm_cgroup_demo_openjdk21 -v .:/app openjdk:21 java -Xmx256m -Xms256m -jar /app/application.jar
```

while openjdk stop publishing jdk 8 images after
```bash
while openjdk stop publishing jdk 8 images after
```bash
docker run --rm --cpus=2 --memory=512m --name jvm_cgroup_demo_openjdk9 -v .:/app openjdk:8 java -version
openjdk version "1.8.0_342"
OpenJDK Runtime Environment (build 1.8.0_342-b07)
OpenJDK 64-Bit Server VM (build 25.342-b07, mixed mode)
```

Fixes continues to be ported into jdk8 later builds and distributor like Amazon continue to publish new imgs with fixes
Fixes continues to be ported into jdk8 later builds and distributor like Amazon continue to publish new imgs with fixes
```bash
# BAD still
docker run --rm --cpus=2 --memory=512m --name amazoncorretto8u352 -v .:/app amazoncorretto:8u352 java -Xmx256m -Xms256m -jar /app/application.jar
docker run --rm --cpus=2 --memory=512m --name amazoncorretto8u362 -v .:/app amazoncorretto:8u362 java -Xmx256m -Xms256m -jar /app/application.jar

# GOOD
# GOOD
docker run --rm --cpus=2 --memory=512m --name amazoncorretto8u372 -v .:/app amazoncorretto:8u372 java -Xmx256m -Xms256m -jar /app/application.jar
docker run --rm --cpus=2 --memory=512m --name amazoncorretto8u382 -v .:/app amazoncorretto:8u382 java -Xmx256m -Xms256m -jar /app/application.jar
docker run --rm --cpus=2 --memory=512m --name amazoncorretto8u402 -v .:/app amazoncorretto:8u402 java -Xmx256m -Xms256m -jar /app/application.jar
Expand Down Expand Up @@ -157,4 +157,13 @@ Total System Memory: 7941 MB


### See also
https://github.com/s50600822/Notes/wiki/Cgroup

https://github.com/s50600822/Notes/wiki/Cgroup

https://kubernetes.io/docs/concepts/architecture/cgroups/

https://github.com/containerd/cgroups

https://github.com/KimMachineGun/automemlimit

https://github.com/google/cadvisor

0 comments on commit d4e4a46

Please sign in to comment.