Operating System - Linux
1751709 Members
4142 Online
108781 Solutions
New Discussion юеВ

Re: Percentage of total memory utilization is shown above 100%.

 
SOLVED
Go to solution
senthil_kumar_1
Super Advisor

Percentage of total memory utilization is shown above 100%.

Hi All,

In some of linux servers, The percentage of total mem utilization is above 100.

pmem is showing percentage value of rss.
rss is the size of physical memory that a process is using.

Ex:

server 1:

[root@emdlagas1109 ~]# ps -eo user,pid,pmem,comm | awk '{x += $3} END {print x}'
34.2


server 2:

-bash-3.00# ps -eo user,pid,pmem,size,comm | awk '{x += $3} END {print x}'
181.9

in second one it showing as 181.9%, how it is possible.


Pls explain me the purpose of pmem.
13 REPLIES 13
James R. Ferguson
Acclaimed Contributor
Solution

Re: Percentage of total memory utilization is shown above 100%.

Hi Senthil:

The problem lies in accounting for shared code and data. That is, if two processes use a shared library and/or use common shared memory segments for interprocess communication, the simple sum of the memory requirements for the two processes will be larger than their real contribution.

If this is something more than an academic question, what are you trying to solve?

Regards!

...JRF...
senthil_kumar_1
Super Advisor

Re: Percentage of total memory utilization is shown above 100%.

Hi James,

How can i find the exact percentage of total memory in Linux servers.


James R. Ferguson
Acclaimed Contributor

Re: Percentage of total memory utilization is shown above 100%.

Hi (again):

> How can i find the exact percentage of total memory in Linux servers.

First, why would you care?

Second, without a tool and a rule to measure and apportion memory used by more than one process to only one process (as I first wrote) you have no chance to define "exact percentage".

Third, what would you do if you did have an exact measurement?

Regards!

...JRF...





emha_1
Valued Contributor

Re: Percentage of total memory utilization is shown above 100%.

hi senthil,

question is as well, what in your meaning is percentage of memory usage...

all the memory not used by user processes is automaticaly acquired by kernel for buffers and caches, so the usage is still reaching almost 100%


emha.
senthil_kumar_1
Super Advisor

Re: Percentage of total memory utilization is shown above 100%.

Hi James,

We have to tell the percentage of total memory utilization to out project manager at regular intervals.

so that i am asking "how to find the percentage of total memory utilization".
Steven E. Protter
Exalted Contributor

Re: Percentage of total memory utilization is shown above 100%.

Shalom,

Change the basis of the analysis.

Memory in this context is being shown as physical memory.

Of course you can utilize more than 100% of it because you save swap.

Memory in the HP-UX world is defined as physical memory plus swap.

You need to get the swap size some how and calculate memory use based on real memory capacity which is swap plus physical ram.

Or you can decide that you are utilizing more than 100% of RAM. That is quite possible.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
James R. Ferguson
Acclaimed Contributor

Re: Percentage of total memory utilization is shown above 100%.

Hi (again) Senthil:

> so that i am asking "how to find the percentage of total memory utilization".

You could use 'free()' and compute the ratio of the total memory to the used memory:

# free|awk '/^Mem/ {printf "%4.1f\n",$3/$2*100}'

For example, I had:

# free
total used free shared buffers cached
Mem: 513692 484308 29384 0 33052 308588
-/+ buffers/cache: 142668 371024
Swap: 765944 0 765944

...so:

# free|awk '/^Mem/ {printf "%4.1f\n",$3/$2*100}'

94.4

Regards!

...JRF...

Steven E. Protter
Exalted Contributor

Re: Percentage of total memory utilization is shown above 100%.

Shalom,

I have tested both of JRF's commands on CentOS 5.2

Works great.

One problem with the concept.

By default RHEL assigns most spare memory to the buffer cache.

You will find on systems that are not busy memory utilization is nearly always between 90% and 99%.

Is the buffer pool really used memory?

I say no, because the instant a process wants memory, its pulled out of the pool.

You will probably using JRF's excellent code see a flat line on memory use.

Mem: 329728 324512 5216 0 3624 163188
-/+ buffers/cache: 157700 172028
Swap: 1048568 216 1048352

This is output of free from my system. Buffer cache in Linux is like the buffer pool in HP-UX. Except there is virtually no cost in moving memory in and out of it.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
emha_1
Valued Contributor

Re: Percentage of total memory utilization is shown above 100%.

hi,

slight modification of James' formula to get usage just of user processes

free|awk '/^Mem/ {printf "%4.1f\n",($2-$4-$6-$7)/$2*100}'


emha.