broun
broun

Reputation: 2593

memory utilization by a linux process

I have a lot of instances of a process running on my host, each seemingly consuming large amount of memory.

ps aux on the processes give me the following information

blah1   18634  0.0  0.4 131852 31188 pts/15   Ssl+ 00:27   0:00 myPgm
blah2   18859  0.0  0.3 131292 30656 pts/32   Sl+  01:17   0:00 myPgm
blah3   19813  0.0  0.4 131960 31220 pts/44   Ssl+ 01:17   0:00 myPgm
blah4   20228  0.1  0.3 131728 31036 pts/54   Ssl+ 01:41   0:00 myPgm
blah5   20238  0.0  0.3 131688 30932 pts/20   Sl+  Nov15   0:00 myPgm
blah6   21181  0.0  0.3 131304 30632 pts/25   Sl+  Nov15   0:00 myPgm
blah7   21278  0.0  0.3 131824 31096 pts/61   Ssl+ Nov15   0:00 myPgm
blah8   21821  0.0  0.3 131444 30808 pts/7    Sl+  00:54   0:00 myPgm

So VSZ is always around 130 MB and RSS around 30 MB. pmap for the processes have the following data: For 18634:

mapped: 131852K    writeable/private: 59692K    shared: 28K

For 21181:

mapped: 131304K    writeable/private: 59144K    shared: 28K

and similar values for other processes as well. The host has 7GB of physical memory. At times I have around 700 to 800 instances of the same process running on the host. I am trying to understand how much memory each process consumes in reality. If i take "writeable/private" as the actual memory usage in each process then 58MB for each process would lead to 45 GB (for 800 process) which is crazy. Can anyone explain if im doing it wrong and how should be calculation be done?

Also free -k gives

             total       used       free     shared    buffers     cached
Mem:       7782580    4802104    2980476          0     380192    1931708
-/+ buffers/cache:    2490204    5292376
Swap:      1048568         32    1048536

Looks like not much swap is being used, now where does the memory for each process come from? Thanks.

Upvotes: 0

Views: 330

Answers (1)

Jan Matejka
Jan Matejka

Reputation: 1968

You don't know what VSZ is. You think you know, but evidence suggests otherwise, therefore you need to find out what it is.

VZS is Virtual Memory Size and that's all memory required by the process, including shared memory. That's why you can't just sum(VSZ) and expect to get less than the physical amount of memory + swap.

The mapped memory in pmap probably corresponds to VSZ and writable/private, I guess, is memory that is shared by some processes, where each of them has write access to that memory (like allocated by their parent process or so).

To understand this, you need to understand how memory allocation and access works, which is difficult. http://emilics.com/blog/article/mconsumption.html this article seems to explain it in some detail (but I read that only in cursory way)

Upvotes: 1

Related Questions