I want to calculate the total amount of memory used by the system,
Someone please confirm if the below formula is correct.
Is this correct? and if so
Am I running out of memory?
what is the limit in % that I should maintain for a better performance?
A used% value for memory is not very meaningful. It may not give you a good measure of whether you are "running out of memory".
In any case, your formula should be dividing by total, rather than by memUsed. That doesn't change the result much in your case, but under other conditions it might be a big difference.
Since you have enough of swap space, your system isn't "running out of memory" in a literal sense. Almost all of your 5135588 KiB of free swap space plus a significant part of your 1444676 KiB of cache would need to be used by "anonymous" memory before you would literally run out of memory. That is likely more than double your current use level of anonymous memory.
Your high use of swap space might indicate a lot of active anonymous pages have been pushed out to swap, meaning lack of memory is making your system much slower. But it equally well might mean you have a bunch of idle services running that own a lot of anonymous memory that they aren't trying to use, so that has properly been swapped out.
Your high level of memory use by processes as compared to cache might mean that code pages (and other file mappings) aged out of each process address space are quickly dropped from the cache for lack of space, so they must be frequently read back from the original files (.so files etc.) as they are faulted back into process address spaces (again meaning lack of memory is making the system slow). But it equally well might mean the use of file mappings by your processes is either small (most memory use anonymous) or stable, such that few pages age out of the process address space and the cache size is plenty for the use of cache.
hard to tell... I never use the free command as it doesn't tell the whole picture. For example how much slab is used? How much memory is mapped? maybe those numbers are included in others, but I'll let others help. The ONE thing that should be ignored is 'cache' as that is memory for caching files. The more files you open and read the more cache is used. However if the system needs the memory for something else, it just gets rid of older pages.
on my system:
[root@o185i193 plot]# free -o
total used free shared buffers cached
Mem: 4059252 2368812 1690440 0 194424 1909904
Swap: 1052216 0 1052216
[root@o185i193 plot]# collectl -sm --verbose -c1
# MEMORY STATISTICS
# Total Used Free Buff Cached Slab Mapped Commit Inact Total Used Free In Out Fault MajFt In Out
3964M 2329M 1634M 194424K 1865M 114852K 162112K 421420K 1225M 1027M 0 1027M 0 0 19604 0 0 120
so you can see there is a lot more going on that free is telling you. In fact, if you look at /proc/meminfo you'll see even more.
The “total” memory is the amount available after loading the kernel. Any memory being used for processes or disk buffering is listed as “used.” Memory that is currently unused is listed in the “free” column. Note that the total memory is equal to the sum of the “used” and “free” columns.
The memory indicated as “shared” is an indication of how much memory is common to more than one process. A program such as the shell typically has more than one instance running. The executable code is read-only and can be shared by all processes running the shell.
The “buffers” entry indicates how much of the memory in use is currently being used for disk buffering.
The “free” command also shows very clearly whether the swap space is enabled, and how much swapping is going on.
Source : http://www.linuxjournal.com/article/2770
|All times are GMT -5. The time now is 07:05 AM.|