1846551 Members
1716 Online
110256 Solutions
New Discussion

Re: memory usage

 
SOLVED
Go to solution
Heiner E. Lennackers
Respected Contributor

memory usage

Hi,

i have several N4000 server used for calculation large jobs from abaqus, ls-dyna and some other tools.
To start a additional job, a user has to see if there is enough memory available. Are there any tools to see, how much memory a process is using exactly and how much memory is free, except glancePlus?

Heiner
if this makes any sense to you, you have a BIG problem
15 REPLIES 15
harry d brown jr
Honored Contributor

Re: memory usage

"using exactly" - the answer is no.

live free or die
harry
Live Free or Die
G. Vrijhoeven
Honored Contributor

Re: memory usage

Hi,

It is no tool like glance, but top will provide some information.

Hope this will help,

Gideon
Steven Gillard_2
Honored Contributor

Re: memory usage

The ps command can be used to find out (approximately) how much memory a process is using. For example the following command will display the memory usage of all processes:

$ UNIX95= ps -eo 'vsz args'

To find out how much free memory is on the system, you can use the vmstat command. It will give you the result in 4k pages so you'll need to multiply by 4 to get the result in kbytes.

Regards,
Steve
Heiner E. Lennackers
Respected Contributor

Re: memory usage

Hi,

thats the problem: top or this UNIX95 ps command are given me some informations, but this does help me in this case. example:
N-Class Server, 4 GB memory, top and ps say there is a job using 721708KB of memory, and all processes together taking 770932KB. But swapinfo says there is only 680MB of mem free, and a additional process terminates after allocation 620MB with messages "can't allocate memory".

Any suggestions?

Heiner
if this makes any sense to you, you have a BIG problem
harry d brown jr
Honored Contributor

Re: memory usage

The key words here are "using exactly", which top, vmstat, sar, ps, or whatever, other than glance, will not give you that detailed information, but if you want "CLOSE ENOUGH", try ps or lsof:

lsof -V -p 1573|grep mem|tr -s " " " "|awk 'BEGIN {FS=" ";ans=ans+$7;} END {print ans;}'

Note the "tr" command's first set of quotes has TWO spaces and the second set of qoutes has ONE space.

live free or die
harry
Live Free or Die
Ruediger Noack
Valued Contributor

Re: memory usage

Heiner,

you can't see with swapinfo your free memory but your free memory SWAP! Look at the column AVAIL. I guess it shows you 75% of your physical memory. It is HP-UX default.

Ruediger
Heiner E. Lennackers
Respected Contributor

Re: memory usage

Hi,

ok i do not need it exactly, but i wonder why the a second process can't allocate the rest and not just 620MB, when the first process uses 800MB in total and i have 4 GB. I found that the buffer cache seems to use 2 GB and does not shrink (what i would expext from a dynamic buffer cache. i think i have to reconfigure the kernel). But even then this process should be abale to allocate around 1GB.


Heiner
if this makes any sense to you, you have a BIG problem
Bill Hassell
Honored Contributor

Re: memory usage

There are several meanings to error messages stating 'out of memory' or similar. You have to address each possibility. I am assuming in all cases that the program is a only a 32bit executable.

First, what is maxdsiz set to in the kernel? This is the maximum data area that can be obtained with a malloc (and related) system call. maxdsiz is a fence to prevent programs from running away and using all swapspace and RAM. NOTE: virtual memory is defined as swap space and RAM taken as a whole using the swapmem_on parameter to define the boundaries.

You can set maxdsiz to the largest possible value that a 32bit program can have: 940 megs. By recompiling the program with different options, you can extend this limit to 1,750 megs and the program could ask for this much RAM.

However, when a program asks for RAM that is beyond the fence (regardless of actual RAM available), it will get an out of memory error.

Once the program is free to ask for large chinks of RAM, the next area to be concerned about is swap space. Actual RAM is not important except for performance (see below) but physical swap space that is reserved and actualy used is important. To run two programs that need 900 megs of RAM, you'll need a minimum of 900 megs of swap space, more if you only have 500 megs total in the system. Once you are out of swap space, you'll get the same out of memory error.

So you can easily run two 900 meg programs in only 500 megs of RAM...well, easily is different than fast. If both programs want to run at the same time and do not wait for terminal (interactive) I/O, then they will run at 1/20th to 1/100th normal speed. The reason is called swap thrashing. Say that each program can run by itself in 1 hour. But you try to run both at the same time and 100% of one program's data area plus some 400 megs of the other program will be written to swap. Afyter a while, the program in RAM will be deactivated so the second program can run and about 1300 megs if data will be exchange in the swap area. This will go on for hours and hours.

So check maxdsiz and total swapspace (swapinfo -tm). You may need a lot more RAM to run with reasonable pereformance.


Bill Hassell, sysadmin
harry d brown jr
Honored Contributor

Re: memory usage

Heiner,

I agree with Bill. Also, dynamic buffer cache has NOTHING to do with process's memory, it is for FILE IO caching. If you have the dbc_min_pct set HIGH then you are limiting the amount of memory for process's to use. Typically I have dbc_min_pct set to 5% and dbc_max_pct set to 10% - depending upon the FILE IO on the system, but if I have huge amounts of memory, I might reduce them to 2% and 5%.

Can you post your kernel parameters?

live free or die
harry
Live Free or Die
Heiner E. Lennackers
Respected Contributor

Re: memory usage

Hi Bill,

all binaries i use are 64bit binaries (pa2.0). maxdsiz and maxdsiz_64bit are set to values which wont cause this problem. I have 4GB of RAM, so i think it would be enough for these 2 processes. But i have to check the swap space. It seems that there is only 1GB of swap, but swapinfo says:
# swapinfo -tm
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 1024 0 1024 0% 0 - 1 /dev/vg00/lvol2
reserve - 807 -807
memory 3160 2496 664 79%
total 4184 3303 881 79% -

It doesn't even use the swap on disk, but it seems to you a lot of swap in memory.
How can i configure this?

Heiner
if this makes any sense to you, you have a BIG problem
Heiner E. Lennackers
Respected Contributor

Re: memory usage

Hi Harry,

here is my /stand/system file. All values not include are default, eg. dbc_min_pct=5, dbc_max_pct=50 ...

Heiner
if this makes any sense to you, you have a BIG problem
MANOJ SRIVASTAVA
Honored Contributor

Re: memory usage

Hi Hieniers


I ahve attached a simple script I got from the forums which give the o/p at any time in the following format :

Memory Stat total used avail %used
physical 4096.0 3234.0 862.0 79%
active virtual 1128.8 876.9 251.9 78%
active real 1169.8 732.3 437.5 63%
memory swap 3141.0 1016.0 2125.0 32%
device swap 8048.0 2133.9 5914.1 27%

Please compile using cc file name and you are good to go , this will give the sanpshot at that moment.

Manoj Srivastava
Ruediger Noack
Valued Contributor
Solution

Re: memory usage

Heiner,

look at your swapinfo output. There are only 881 MB free swap space. Starting a new process the OS has to reserve all the process memory size also in the swap. You see the already reserved but currently not used swap space in row reserved.
I believe there is not enough swap space for starting your new large process.
First add more swap swape. For that no reboot is nessassary.
Then reduce dbc_min_pct and dbc_max_pct how mentioned but you have to reboot your box for that.
And for the best performance to avoid paging buy more memory.

Ruediger
Heiner E. Lennackers
Respected Contributor

Re: memory usage

Hi,

i have to recompile the kernel to add swap, because maxswapchunks is to low. i have to write a change request to do so and it will take a week or two to assign points.
I think a will change the following:
maxswapchunks : as high as needed (4 or 8 gb)
swapmem_on : 0 (to prevent swapping in memory)
dbc_max_pct : 10 (should be enough, the server is no file-server)

any additional ideas?

Heiner
if this makes any sense to you, you have a BIG problem
U.SivaKumar_2
Honored Contributor

Re: memory usage

hi,
try using this command in xwindows
#puma
this is a software program which can attach to the running process and analyses the system resource consumption of the process it has attached to, graphically.

regards,
U.SivaKumar
Innovations are made when conventions are broken