Sunday, January 25, 2015

ubuntu - Why is the memory consumption in htop not shown proportionally?



Based on this question the colours have the following meaning:




Green = Used memory 
Blue = Buffers
Yellow/Orange = Cache


HOw is



Now looking at my htop, I see only 878MB is taken, which includes a large chunk in the cache. But the total memory is 1.91 GB. So why is the bar so far in the right-hand side, where it should be really in the middle?




Ishtop indicating that my server still requires more memory than expected?
Even though only 50% is taken? I'm not sure how I should read this.



Even based on the help section, 878M/1.91G is really used/total.
enter image description here



So what gives that the bar is stretched all way to the right hand side?


Answer



Refer to the htop FAQ:





The MEM% number is low, but the bar looks almost full. What's going
on?



The number showed by the memory meter is the total memory used by
processes. The additional available memory is used by the Linux kernel
for buffering and disk cache, so in total almost the entire memory is
in use by the kernel.





The kernel will allocate unused memory for caching, in order to improve system performance. The idea is that "unused memory is wasted memory". If an application requests more memory, the kernel will release memory used for caching to that application.



You can read more here:




To make the most efficient use of real memory, Linux automatically uses all free RAM for buffer cache, but also automatically makes the cache smaller when programs need more memory.




In your screenshot, the green section of the bar represents the 878MB of memory used by applications, while the purple and yellow sections of the bar are used by buffers and cache, and are free for applications to claim.


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...