Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect computation for the memory #68

Open
trajano opened this issue Oct 9, 2022 · 0 comments · Fixed by RISE-GmbH/container-jmeter#1 · May be fixed by #69
Open

Incorrect computation for the memory #68

trajano opened this issue Oct 9, 2022 · 0 comments · Fixed by RISE-GmbH/container-jmeter#1 · May be fixed by #69

Comments

@trajano
Copy link

trajano commented Oct 9, 2022

The computation for memory usage is incorrect in

freeMem=`awk '/MemAvailable/ { print int($2/1024) }' /proc/meminfo`

as that will give the system's memory rather than the container's limit memory.

In fact with newer JDKs there's no need to set it explicitly, instead you can let it compute it automatically. But don't that's also not good as it defaults to 25% of RAM that is allocated by default.

Instead specify the percentage usually 80% is good. -XX:MaxRAMPercentage=80

Here's how I used it https://github.com/trajano/spring-cloud-demo/blob/12deda06f3fb9c4101b4d4cf3c623a3001bd10d8/Dockerfile#L45

However, this would need to have an upgrade of the JDK as JDK8 does not support the parameter.

A workaround to this would be to use /sys/fs/cgroup/memory/memory.limit_in_bytes

You can verify this by

docker run --memory=1g  --entrypoint /bin/cat -it justb4/jmeter /sys/fs/cgroup/memory/memory.limit_in_bytes
trajano added a commit to trajano/docker-jmeter that referenced this issue Oct 9, 2022
@trajano trajano linked a pull request Oct 9, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant