Hi everyone.
Something crucial seems to have happened in Debian 9. I first noticed this, when I upgraded one LXC container from Debian 8 to Debian 9. After the upgrade, my Java services consumed around ~20GB memory right after startup (if they weren't started with -Xmx). After some research how Java computes this initial heap memory value, I found that Java seems to somehow reference the memory values of the host machine, not the container.
This whole behavior seems to not be affected by a specific Java or Proxmox version. I did some tests with the default Debian 8 and 9 and Ubuntu 18.04 LXC templates, on our production Proxmox server (64 GB RAM) and on a freshly installed Proxmox inside of a Virtual Box VM (16 GB RAM). The Java versions differ from OpenJDK 7, 8, 10. I even tried Oracle Java in my earlier attempts (not in the screenshots), with exactly the same result. Every container has 1024 MB RAM and 512 MB Swap.
The attached screenshots are the results of my tests. The screenshots visualize, that as soon as the container is Debian 9 based, the memory sizes Java calculates explode. In the containers I did something like:
Could this be a bug in the hardware abstraction?
My tests:
Something crucial seems to have happened in Debian 9. I first noticed this, when I upgraded one LXC container from Debian 8 to Debian 9. After the upgrade, my Java services consumed around ~20GB memory right after startup (if they weren't started with -Xmx). After some research how Java computes this initial heap memory value, I found that Java seems to somehow reference the memory values of the host machine, not the container.
This whole behavior seems to not be affected by a specific Java or Proxmox version. I did some tests with the default Debian 8 and 9 and Ubuntu 18.04 LXC templates, on our production Proxmox server (64 GB RAM) and on a freshly installed Proxmox inside of a Virtual Box VM (16 GB RAM). The Java versions differ from OpenJDK 7, 8, 10. I even tried Oracle Java in my earlier attempts (not in the screenshots), with exactly the same result. Every container has 1024 MB RAM and 512 MB Swap.
The attached screenshots are the results of my tests. The screenshots visualize, that as soon as the container is Debian 9 based, the memory sizes Java calculates explode. In the containers I did something like:
# install java somehow
apt update && apt install -y default-jre
#show the result
free -m && java -XX:+PrintFlagsFinal -version | grep -i heapsize | egrep 'Initial|Max'
apt update && apt install -y default-jre
#show the result
free -m && java -XX:+PrintFlagsFinal -version | grep -i heapsize | egrep 'Initial|Max'
Could this be a bug in the hardware abstraction?
My tests: