I went through this article, which explains various methods for checking your RAM usage. However, I can't reconcile the different methods and don't know which one is correct.
When I first login, I'm greeted with a screen like this:
System information as of Sun Apr 28 21:46:58 UTC 2013
System load: 0.0 Processes: 76
Usage of /: 15.6% of 7.87GB Users logged in: 1
Memory usage: 41% IP address for eth0:
Swap usage: 0%
This suggests to me that I am using 41% of my RAM, which seems quite high since the server isn't doing much. Or does that number refer to something besides RAM?
Next I try the free -m
method:
ubuntu@ip-:~$ free -m
total used free shared buffers cached
Mem: 590 513 76 0 67 315
-/+ buffers/cache: 130 459
Swap: 0 0 0
According to the explanatory graphic in the article, this implies I have 130MB of used RAM and 459MB of free RAM, which suggests I'm using about 22% of my RAM.
Next I run top
:
top - 22:14:48 up 195 days, 21:30, 2 users, load average: 0.00, 0.01, 0.05
Tasks: 77 total, 1 running, 76 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.3%us, 0.3%sy, 0.0%ni, 97.7%id, 0.7%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 604376k total, 525692k used, 78684k free, 69124k buffers
Swap: 0k total, 0k used, 0k free, 322740k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 24332 1864 976 S 0.0 0.3 0:08.75 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
This is the most confusing, as the summary shows me using 525MG of 604M total, and yet when is use the "m" interactive command to sort by top memory the top process is only using 0.3% of the memory???
Finally, the ps
command seems to show very little memory usage as well:
root@ip-:/home/ubuntu# ps -o command,rss
COMMAND RSS
ps -o command,rss 788
sudo su root 1764
su root 1404
bash 2132
I would love for someone to correct whatever misunderstandings I have that are creating these apparent conflicts.
Thanks!
EDIT for Rahul
Ouput of cat /proc/meminfo
:
MemTotal: 604376 kB
MemFree: 157564 kB
Buffers: 49640 kB
Cached: 231376 kB
SwapCached: 0 kB
Active: 290040 kB
Inactive: 97772 kB
Active(anon): 107672 kB
Inactive(anon): 4844 kB
Active(file): 182368 kB
Inactive(file): 92928 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 52 kB
Writeback: 0 kB
AnonPages: 106836 kB
Mapped: 22920 kB
Shmem: 5712 kB
Slab: 42032 kB
SReclaimable: 34016 kB
SUnreclaim: 8016 kB
KernelStack: 688 kB
PageTables: 3584 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 302188 kB
Committed_AS: 242768 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 7152 kB
VmallocChunk: 34359729008 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 637952 kB
DirectMap2M: 0 kB
Best Answer
You just need to understand Memory Concept
As per your Output Of /proc/meminfo , You just need to Notice below things :
Buffers :- A buffer is something that has yet to be "written" to disk. It represents how much RAM is dedicated to cache disk block. "Cached" is similar to "Buffers", only this time it caches pages from file reading
Cached :- A cache is something that has been "read" from the disk and stored for later use. Generally, you can consider cache area as another "free" RAM since it will be shrunk gradually if the application demands more memory.
It is enough to understand that both "buffers" and "Cached" represent the size of system cache. They dynamically grow or shrink as requested by internal Linux kernel mechanism.
at Webhosting they do cache clear using below cmd: (mostly configured in cron):
Quote Link
EDIT for one more requirement i.e per user memory usage
Please check with above script and let me know, if it showing properly or not.