Server RAM Usage checkup & support

Hi RAM of my system is 24 GB however when i checked the processes pids and counted the memory usage by pmap i found out that the total memory usage is 36 GB

It s obvious that my system might be using some of virtual memory or swap space . How can i check which memory it is using and how ..

Also what can be impact of this high RAM usage of the system ?

one impact i have noticed that it has become slow .

Thanks in Advace ...

Beware that you might have computed shared memory segments more than once by using pmap output.

To better understand your memory usage, you can post these commands output:

swap -s
echo ::memstat | mdb -k
vmstat 5 5
prstat -Z -s rss -c -n 4 1 1

swap -s
total: 28946352k bytes allocated + 3414784k reserved = 32361136k used, 3885104k available

vmstst 5 5

kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr m0 m1 m3 m4 in sy cs us sy id
10 0 0 5100944 886776 164 974 154 493 494 0 116 2 5 0 1 18113 196973 39266 69 16 15
13 0 0 3875264 1252720 229 587 690 428 412 0 0 0 0 0 0 21647 383666 38999 76 24 0
16 0 0 3865208 1246056 68 422 3 460 439 0 0 0 0 0 0 33147 377207 46801 75 25 0
20 0 0 3824328 1234288 289 1238 326 471 447 0 0 10 0 0 0 30461 383568 48936 75 25 0
15 0 0 3849016 1230616 206 809 231 327 305 0 0 7 0 0 5 18192 363225 31013 78 22 0

prstat -Z -s rss -c -n 4 1 1

PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
22375 a 1402M 1291M sleep 59 0 3:28:06 0.9% java/120
6600 a 1632M 1197M sleep 59 0 0:26:48 0.3% java/30
22396 a 897M 551M sleep 59 0 6:45:25 1.5% java/30
18180 a 468M 366M cpu0 21 0 29:18:35 7.5% java/26
ZONEID NPROC SWAP RSS MEMORY TIME CPU ZONE
0 238 31G 20G 83% 1020:05:3 96% global
Total: 238 processes, 4370 lwps, load averages: 25.22, 26.96, 33.10

echo ::memstat | mdb -k

Page Summary Pages MB %Tot
------------ ---------------- ---------------- ----
Kernel 196209 1532 6%
Anon 2614375 20424 84%
Exec and libs 6415 50 0%
Page cache 110035 859 4%
Free (cachelist) 102065 797 3%
Free (freelist) 101092 789 3%

Total 3130191 24454
Physical 3079480 24058

Thanks for the Reply ... Can you please explain the meaning of all these and Usage of mamory as well as what is the meanng when u said "you might have computed shared memory segments more than once by using pmap output."

Please add code tags to your previous posting; It is hard to read as is.

What is unclear in my sentence about shared memory segments ?

PLease find below Output .... Sorry for inconvenience ,i am new on the forums ...

swap -s
total: 28946352k bytes allocated + 3414784k reserved = 32361136k used, 3885104k available
vmstst 5 5

kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr m0 m1 m3 m4 in sy cs us sy id
10 0 0 5100944 886776 164 974 154 493 494 0 116 2 5 0 1 18113 196973 39266 69 16 15
13 0 0 3875264 1252720 229 587 690 428 412 0 0 0 0 0 0 21647 383666 38999 76 24 0
16 0 0 3865208 1246056 68 422 3 460 439 0 0 0 0 0 0 33147 377207 46801 75 25 0
20 0 0 3824328 1234288 289 1238 326 471 447 0 0 10 0 0 0 30461 383568 48936 75 25 0
15 0 0 3849016 1230616 206 809 231 327 305 0 0 7 0 0 5 18192 363225 31013 78 22 0

prstat -Z -s rss -c -n 4 1 1

PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
22375 a 1402M 1291M sleep 59 0 3:28:06 0.9% java/120
6600 a 1632M 1197M sleep 59 0 0:26:48 0.3% java/30
22396 a 897M 551M sleep 59 0 6:45:25 1.5% java/30
18180 a 468M 366M cpu0 21 0 29:18:35 7.5% java/26
ZONEID NPROC SWAP RSS MEMORY TIME CPU ZONE
0 238 31G 20G 83% 1020:05:3 96% global
Total: 238 processes, 4370 lwps, load averages: 25.22, 26.96, 33.10
echo ::memstat | mdb -k


Page Summary Pages MB %Tot
------------ ---------------- ---------------- ----
Kernel 196209 1532 6%
Anon 2614375 20424 84%
Exec and libs 6415 50 0%
Page cache 110035 859 4%
Free (cachelist) 102065 797 3%
Free (freelist) 101092 789 3%

Total 3130191 24454
Physical 3079480 24058

---------- Post updated at 08:04 PM ---------- Previous update was at 07:58 PM ----------

I guess I have not computed the shared memory ... Below is the script which i created to check the Memory usage ... Kindly let me know if i need to refine this or if you want to give me some suggeston on these ... Thanks

pids=`ps -fu a | grep -v grep | grep -v PID | grep -v memory_total_usage | awk '{print $2}'`

count=0

for i in $pids
do
memory=`pmap -x $i | grep -i total | awk '{ print $3 }'`
echo "Memory usage for this process PID $i is $memory"
if [ "$memory" -gt 0 ] ; then
count=`expr $count + $memory`
fi
done
echo "$memory"
MemoryinMB=`expr $count / 1024 `
MemoryinGB=`expr $MemoryinMB / 1024 `

echo "memory in Gb is $MemoryinGB"

Well, you missed again to post something readable. You need to cut/paste the command output from your terminal emulator to the web editor to keep its correct formatting. Adding code tags to something that has lost its formatting is pretty useless.

Anyway, go buy some RAM to your server, it will be grateful to you.

You are using 29 GB of virtual memory on a server with 24 GB of RAM. Although it isn't currently starving, performance will be impacted sooner or later.

Alternatively, you can randomly kill one of these java processes, that's the Gnu/Linux way to save memory :wink:

okay ! Thanks for such a great idea Sir :slight_smile:

Any ways I will be so thankful to you if you can please explain me How can i find that from where the Server is using virtual memory i.e. which command will tell that which slice of disk is associated to be used as a virtual memory .

Also why is it using 29GB of virtual memory , it does have 24 GB RAM , then can t it use 24 GB RAM and 5 GB Virtual memory i.e. disk memory or swap space or input /output ....

I havn t worked in memory manegement etc at all . Will appreciate your answers on this

That would be

swap -l

It uses ~24 GB of RAM and ~5 GB of swap space.

Request someone s help in solving my doubts ....

Very much Thanks in Advance ...

What are these doubts ?