Memory Usage check

Thread Tools Search this Thread
Operating Systems Solaris Memory Usage check
# 1  
Old 05-26-2014
Memory Usage check

Hello Friends,

I need to check memory usage & availability before I could run a program if there is enough memory is left or not, so how could i achieve this? Which command output i should rely on? I have diplayed outputs of SAR, VMstat and PRstat commands below, But how could i check memory usage according to total mem?

Output of SAR command for Free & Swap Mem.
-bash-3.00$ sar -r 4 5 

SunOS dx352 5.10 Generic_147441-10 i86pc    05/26/2014

16:10:56 freemem freeswap
16:11:00 6541752 61892086
16:11:04 6541762 61892824
16:11:08 6541676 61892808
16:11:12 6541589 61892808
16:11:16 6541410 61892808

Average  6541638 61892667

For example i have tried this directingSAR output to a file, however i can't compare it to total memory. How could i proceed? should i use "prtconf | grep -i mem" output to compare the value below?

cat 123.txt | nawk '/Average/{print $2}'

Output of VMSTAT for Memoru Usage Status of Virtual Machine
-bash-3.00$ vmstat 4 5
 kthr      memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr s0 s1 s2 --   in   sy   cs us sy id
 0 0 0 37855508 28701468 31 49 49 0 0 0  0 -0  4 -0  0 2247 2054 1087  0  1 98
 0 0 0 30946784 26165180 3 14 0 0  0  0  0  0  6  0  0 2798 2554 1497  1  0 99
 0 0 0 30946632 26164856 0 4 0  0  0  0  0  0  3  0  0 2927 3488 1825  1  2 97
 0 0 0 30946632 26164308 0 2 0  0  0  0  0  0 12  0  0 5979 8694 4221  2  2 96
 0 0 0 30946632 26164040 0 0 0  0  0  0  0  0  4  0  0 3630 4079 2333  1  1 98

Output of PRSTAT command which give process status based on users.
-bash-3.00$ prstat -u sscm -a -s cpu 0 1 | sed -e '/^$/d;/sleep/d;/Total/d'
 26306 sscm     3492K 2668K cpu7    59    0   0:00:00 0.0% prstat/1
 NPROC USERNAME  SWAP   RSS MEMORY      TIME  CPU                             
    13 sscm       25G 8581M    17%  69:43:21 1.3%

Last edited by EAGL€; 05-26-2014 at 09:25 AM..
# 2  
Old 05-26-2014
In the output of vmstat the free memory is in KB, the sar output is in pages.
bash-3.2$ sar -r 1 1

SunOS <name> 5.10 Generic_147440-09 sun4v    05/26/2014

14:23:00 freemem freeswap
14:23:01 10776773 203955648
bash-3.2$ pagesize
bash-3.2$ echo '10776773*8/1024' | bc
bash-3.2$ vmstat 1 1
 kthr      memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr lf s0 s4 s5   in   sy   cs us sy id
 0 0 0 101746080 85650520 267 1364 0 0 0 0 0 0 -0 -0 7 5002 17103 5156 0  0 99

The above shows 81/82GB of free ram.
You're running Solaris x86, so you have a pagesize of 4K:

$ echo '6541638*4/1024' | bc
$ echo 26164040/1024 | bc

EDIT: Corrected, see jlliagre's post below. The above output shows 24GB of free RAM.

Use /usr/sbin/prtconf|fgrep Memory to check the total installed RAM.

Last edited by radoulov; 05-26-2014 at 06:59 PM..
This User Gave Thanks to radoulov For This Post:
# 3  
Old 05-26-2014
You might also want to check echo "::memstat" | mdb -k.

ZFS tends to use free memory on the system (if not limited), but it will free it as soon as some process requires it.
# 4  
Old 05-26-2014
Originally Posted by Peasant
You might also want to check echo "::memstat" | mdb -k.

ZFS tends to use free memory on the system (if not limited), but it will free it as soon as some process requires it.

I did not know this command before but it really looks good to me.

I could run it as root user and it gave me an output like the following, however i may not be allowed to use root user permission to run such commands in production. What is the difference between free list and cache list? shall i consider the %Tot column for "Free" page sum?

-bash-3.00# echo "::memstat" | mdb -k
Page Summary                Pages                MB  %Tot
------------     ----------------  ----------------  ----
Kernel                     526621              2057    4%
Anon                       972918              3800    8%
Exec and libs              159977               624    1%
Page cache                3136595             12252   25%
Free (cachelist)          3495645             13654   28%
Free (freelist)           4286828             16745   34%

Total                    12578584             49135
Physical                 12250366             47852

# 5  
Old 05-26-2014
You have plenty of RAM available (62%), the freelist is unused RAM and contains nothing of interest while the cachelist, despite also being unused RAM contains data from previously accessed files. If these files are read again, the data will be picked from that memory saving I/Os.
# 6  
Old 05-26-2014
Well, I suppose the output of sar/vmstat and mdb are not sampled at the same time (or they are from different systems).
I'd expect the freelist (mdb) and free (vmstat) to be almost equal ...,
or I'm missing something?
# 7  
Old 05-26-2014
Out of ~49 GB, there is 26 GB or free RAM in the first posting (sar/vmstat) and 30 GB in the second one (::memstat), not that much a difference.
This User Gave Thanks to jlliagre For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How can I check actual memory usage each Process?

I can't check actual memory usage in the Redhat 5.5... The used memory is 14214 Mb of Total 15919 by Free -m command. I sum the RSS value on PS aux command result and the value is 5428.66Mb. Yes It's quite different actual usage memory and RSS value. So I added Shared memory value... (5 Replies)
Discussion started by: tom8254
5 Replies

2. UNIX for Dummies Questions & Answers

Memory usage per user,percent usage,sytem time in ksh

Let's say i have 20 users logged on Server. How can I know how much memory percent used each of them is using with system time in each user? (2 Replies)
Discussion started by: roy1912
2 Replies

3. AIX

Script to check the memory usage in AIX

Hello Everyone, I'm looking for a efficient script that monitors the memory usage on AIX and send email alerts when it reaches certain point. Q) need to get alerts, when the memory usage exceed 90% on AIX? or Q) Need to get alerts when available free Memory is 1G or 10% etc Any idea... (3 Replies)
Discussion started by: System Admin 77
3 Replies

4. Linux

how to check memory usage ?

hello, I have purchased VPS from one webhosting company. VPS comes with Virtuozzo power panel. It has 512MB gurranted RAM and dynamic RAM 2048 MB. I have hosted single domain with 50MB database and wordpress installation. But I am getting resource alerts. It goes sometime in yellow... (8 Replies)
Discussion started by: mrugesh78
8 Replies

5. UNIX for Dummies Questions & Answers

Command to display the space usage (memory usage) of a specific directory.

Hi all, Can you please tell me the command, with which one can know the amount of space a specific directory has used. df -k . ---> Displays, the amount of space allocated, and used for a directory. du -k <dir name> - gives me the memory used of all the files inside <dir> But i... (2 Replies)
Discussion started by: abhisheksunkari
2 Replies

6. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

7. Solaris

current CPU usage, memory usage, disk I/O oid(snmp)

Hi, I want to monitor the current cpu usage, monitor usage , disk I/o and network utlization for solaris using SNMP. I want the oids for above tasks. can you please tell me that Thank you (2 Replies)
Discussion started by: S_venkatesh
2 Replies

8. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

9. Programming

how to use ioctl to check out memory usage

Hi all, I tried to output memory usage information while the process is executing at a particular time. I found out some people suggesting calling the ioctl. I followed it and wrote a test example: #include <unistd.h> #include <stdlib.h> #include <iostream.h> #include <fcntl.h> #include... (2 Replies)
Discussion started by: lanchen
2 Replies

10. Programming

Monitor CPU usage and Memory Usage

how can i monitor usages of CPU, Memory, Hard disk etc. under SUN Solaries through a c program or java program i want to store that data into database so i can show it graphically thanks in advance (2 Replies)
Discussion started by: Gajanad Bihani
2 Replies
Login or Register to Ask a Question

Featured Tech Videos