Tuesday, August 23, 2016

xenserver - Over committing memory failing with out reaching half of actual RAM



I am running centos 6.4 with 2.6.32-358.6.2.el6.x86_64 which is actually running as a xen vm
with




ram 2 GB



On this i have set



cat /proc/sys/vm/overcommit_memory  
2


But when i try to start my java application its showing




java.io.IOException: Cannot run program "/bin/bash": java.io.IOException: error=12, Cannot allocate memory
Caused by: java.io.IOException: java.io.IOException: error=12, Cannot allocate memory


But actually this machine has 1.5 gb free memory.



when i set



echo 0 > /proc/sys/vm/overcommit_memory



Everything is working fine,



i thought over committing memory allow me to use more virtual ram(swap+real ram),but why its failing even with more free real ram.


Answer



From this guide:




2 — The kernel fails requests for memory that add up to all of swap plus the percent of physical RAM specified in /proc/sys/vm/overcommit_ratio. This setting is best for those who desire less risk of memory overcommitment.





If you have less than 2 GB of swap, then the kernel will deny the request if overcommit_ratio is set too low. Having it set to "1" allows overcommitting and is good for performance.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...