how to check memory usage ?


 
Thread Tools Search this Thread
Operating Systems Linux how to check memory usage ?
# 1  
Old 03-11-2011
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 zone. I am not able to trace which thing is consuming more memory. My site has 3000 posts and 50,000 comments. is it because of that ? is it because of apache and mysql connections ? it is because of any plug-ins ?

how to trace that ? I have installed putty and typed "top" which is showing me following status at this time :

Code:
Tasks:  41 total,   4 running,  36 sleeping,   0 stopped,   1 zombie
Cpu(s):  2.3%us,  0.7%sy,  0.0%ni, 97.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2097152k total,   387380k used,  1709772k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
21632 readguja  15   0  160m  35m 7072 R 11.3  1.8   0:00.34 php-cgi
21634 readguja  16   0  152m  27m 6768 R  8.6  1.4   0:00.26 php-cgi
20348 apache    16   0     0    0    0 Z  1.7  0.0   0:00.09 httpd <defunct>
30666 mysql     15   0  233m  28m 5860 S  0.7  1.4 188:10.08 mysqld
    1 root      15   0 10348  740  620 S  0.0  0.0   0:03.32 init
 3642 root      18   0 96572 3764 2896 R  0.0  0.2   0:00.06 sshd
 3759 root      15   0 12064 1640 1288 S  0.0  0.1   0:00.05 bash
 8009 postfix   18   0 54208 2376 1816 S  0.0  0.1   0:00.10 tlsmgr
14329 apache    18   0  227m 9580  472 S  0.0  0.5   0:01.16 httpd
19990 apache    18   0  289m  12m 1684 S  0.0  0.6   0:00.13 httpd
20321 apache    18   0  289m  12m 1688 S  0.0  0.6   0:00.06 httpd
20378 apache    16   0  289m  12m 1680 S  0.0  0.6   0:00.05 httpd
21519 apache    18   0  289m  12m 1688 S  0.0  0.6   0:00.01 httpd
21593 root      15   0 12608 1200  924 R  0.0  0.1   0:00.01 top
21608 apache    15   0  288m  12m 1644 S  0.0  0.6   0:00.00 httpd
21613 apache    18   0  288m  12m 1644 S  0.0  0.6   0:00.00 httpd
21615 apache    15   0  288m  12m 1664 S  0.0  0.6   0:00.00 httpd
21770 postfix   16   0 55104 2300 1776 S  0.0  0.1   0:00.00 pickup
25952 root      18  -4 12604  676  360 S  0.0  0.0   0:00.00 udevd
26262 root      15   0  5908  624  500 S  0.0  0.0   0:04.25 syslogd
26295 root      15   0 62624 1208  648 S  0.0  0.1   0:11.85 sshd
26304 root      15   0 21644  936  724 S  0.0  0.0   0:00.08 xinetd
26320 root      21   0 13164  600  468 S  0.0  0.0   0:00.00 couriertcpd
26322 root      18   0  3656  376  308 S  0.0  0.0   0:00.00 courierlogger
26330 root      20   0 13164  600  468 S  0.0  0.0   0:00.00 couriertcpd
26333 root      22   0  3656  380  308 S  0.0  0.0   0:00.00 courierlogger
26339 root      15   0 13164  612  476 S  0.0  0.0   0:00.08 couriertcpd
26341 root      18   0  3788  552  464 S  0.0  0.0   0:00.01 courierlogger
26348 root      20   0 13164  600  468 S  0.0  0.0   0:00.00 couriertcpd
26350 root      20   0  3656  372  308 S  0.0  0.0   0:00.00 courierlogger
26407 root      18   0 54148 2308 1764 S  0.0  0.1   0:12.82 master
26414 postfix   15   0 54396 2424 1836 S  0.0  0.1   0:03.02 qmgr
26418 root      18   0  288m  19m 9812 S  0.0  1.0   0:38.42 httpd
26438 root      15   0 20872 1188  588 S  0.0  0.1   0:01.36 crond

How can i find that which thing is consuming more memory ?

please help. I have no detail idea of linux.

Last edited by pludi; 03-11-2011 at 03:36 AM..
# 2  
Old 03-11-2011
Kind of common with VPS's that run OpenVZ. I believe Virtuozzo uses OpenVZ or something similiar.

I would submit a ticket to your provider letting them see your output from TOP. Let them know that it does not appear that you are using much memory.

Then cat your user_beancounters and include that. I would assume that you are exceeding something there.

Make sure you include this info to them.

Code:
cat /proc/user_beancounters

Code:
free

Code:
ps aux | awk '{sum +=$4}; END {print sum}'


Last edited by truecall; 03-11-2011 at 10:52 AM..
# 3  
Old 03-11-2011
memory details

[1] when I run "cat /proc/user_beancounters" on server, it showed me following details :

here is the image :

how to check memory usage ?-reportjpg




uid resource held maxheld barrier limit failcnt
62375702: kmemsize 14493878 16603817 20971520 23068672 18561
lockedpages 0 0 256 256 0
privvmpages 81264 91477 524288 576716 0
shmpages 888 888 20480 20480 115
dummy 0 0 9223372036854775807 9223372036854775807 0
numproc 55 58 96 96 0
physpages 24198 32957 2147483647 2147483647 0
vmguarpages 0 0 131072 2147483647 0
oomguarpages 24199 32958 9223372036854775807 2147483647 0
numtcpsock 24 26 360 360 0
numflock 11 11 188 206 0
numpty 1 1 16 16 0
numsiginfo 0 1 256 256 0
tcpsndbuf 358112 466024 1720320 2703360 19232554
tcprcvbuf 214112 219512 1720320 2703360 0
othersockbuf 204072 289440 1126080 2097152 0
dgramrcvbuf 0 0 262144 288358 0
numothersock 122 124 360 360 0
dcachesize 1162482 1196286 3145728 3460300 0
numfile 2129 2258 4096 4096 653
dummy 0 0 0 0 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
numiptent 18 18 100 105 0



[2] when I run "free" command, it showed me following details :



total used free shared buffers cached
Mem: 2097152 323980 1773172 0 0 0
-/+ buffers/cache: 323980 1773172
Swap: 0 0 0


[3] when I run "ps aux | awk '{sum +=$4}; END {print sum}'" command, it show me following output :
output : 12.4


my server goes to yellowzone because of kemsize.

now please guide me, what I can do to remove high load. what are the reasons for highload.

please help.

Last edited by mrugesh78; 03-11-2011 at 12:35 PM..
# 4  
Old 03-11-2011
Well removing high load on a web application really depends on many things. Poor coding, lots of traffic, how you have sql setup will all play a role in performance.

I would check the php-cgi application.

Are you getting a lot of web traffic?

Run the below command and report with what you see:

Code:
ps auxw| awk '{print $6" "$0}' | grep MEM | grep -v grep && ps auxw| awk '{print $6" "$0}' | sort -n | tail -5

---------- Post updated at 10:46 AM ---------- Previous update was at 10:38 AM ----------

Take a look at this interesting URL
# 5  
Old 03-11-2011
I am using wordpress installation and using some standard plugins.

I have 400 visitors per hour and daily 1500 unique visitors. Database size is 50MB. but it has 1200 posts and 25,000 comments. I think it is creating number of connections when readers connects and stay long time on site for reading articles. I have not made any manual php files. everything is wordpress.


here is the output by running the following command :

ps auxw| awk '{print $6" "$0}' | grep MEM | grep -v grep && ps auxw| awk '{print $6" "$0}' | sort -n | tail -5



Code:
12560 apache   19698  0.0  0.5 296128 12560 ?        S    10:43   0:00 /usr/sbin/httpd
20456 root     26418  0.0  0.9 295104 20456 ?        Ss   Mar08   0:48 /usr/sbin/httpd
28440 mysql    30666  5.3  1.3 239548 28440 ?        Sl   Mar08 231:03 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/        run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock
45068 popuser  31873  0.0  2.1 107864 45068 ?        S    Mar08   0:00 spamd child
46528 root     31867  0.0  2.2 107864 46528 ?        Ss   Mar08   0:04 /usr/bin/spamd --username=popuser --daemonize --nouser-config --helper-home-dir=/var/qmai        l --max-children 1 --create-prefs --virtual-config-dir=/var/qmail/mailnames/%d/%l/.spamassassin --pidfile=/var/run/spamd/spamd_full.pid --socketpath=/tmp/spamd_        full.sock

# 6  
Old 03-11-2011
Get with your hosting company and ask them to increase your kmemsize. You are over this resource. Many hosting companies advertise lots of ram, but limit the kmemsize so that you don't actually use much of it.

uid resource held maxheld barrier limit failcnt
kmemsize 14493878 16603817 20971520 23068672 18561

---------- Post updated at 10:56 AM ---------- Previous update was at 10:51 AM ----------

Also you may want to check spamassassin. Looks like that may be taking a beating.
# 7  
Old 03-11-2011
so from my side, the data, and resource usage is OK ?

it is service providers fault ?

i just want to know that whether my site's load is too much or it is normal ?

---------- Post updated at 11:58 AM ---------- Previous update was at 11:57 AM ----------

but how to check spamassassin ? from where to check ?

Quote:
Originally Posted by truecall
Get with your hosting company and ask them to increase your kmemsize. You are over this resource. Many hosting companies advertise lots of ram, but limit the kmemsize so that you don't actually use much of it.

uid resource held maxheld barrier limit failcnt
kmemsize 14493878 16603817 20971520 23068672 18561

---------- Post updated at 10:56 AM ---------- Previous update was at 10:51 AM ----------

Also you may want to check spamassassin. Looks like that may be taking a beating.
---------- Post updated at 12:00 PM ---------- Previous update was at 11:58 AM ----------

but how to check spamassassin ? from where to check ?
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. Solaris

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... (8 Replies)
Discussion started by: EAGL€
8 Replies

3. 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

4. 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

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