Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi.
Im running Apache 2.2.3 on a CentOS release 5.3 (Final) with 100 Sites.
I've notice that Apache is making my server Swap around 200 MBs.
"http://www.xxx.yyy.zzz/server-status" doesnt show me too much to, so i'm looking the beahaviur of specific httpd process.
ProcessID "18753" is the one for "http://www.xxx.yyy.zzz/server-status" in my browser.
This command show me (In KBs) how much virtual memory is that specific process using:
# /etc/init.d/httpd start
# grep Private_Dirty /proc/18753/smaps | awk '{ print $2 }' | xargs ruby -e 'puts ARGV.inject { |i, j| i.to_i + j.to_i }'
3012
... Running this command a lot of times it gives me the same output, but suddenly...
# grep Private_Dirty /proc/18753/smaps | awk '{ print $2 }' | xargs ruby -e 'puts ARGV.inject { |i, j| i.to_i + j.to_i }'
21708
Something make that process (and all the others httpd process too) to use a lot more memory!
• Part of my httpd.conf:
#############################################
Timeout 120
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 3
My server is running Mysql 5.1.34, vsftpd 2.0.5, BIND 9.3.4-P1 (as slave).
I couldnt found anything running in the specific time that httpd processes start to use that much memory.
What could be wrong?
Is there a tool i could use to track the problem?
This command show me (In KBs) how much virtual memory is that specific process using:
# /etc/init.d/httpd start
# grep Private_Dirty /proc/18753/smaps | awk '{ print $2 }' | xargs ruby -e 'puts ARGV.inject { |i, j| i.to_i + j.to_i }'
Why do you think the amount of Private_Dirty memory is a meaningful measure of "how much virtual memory is that specific process using"?
I don't know a meaningful measure (I know other not very meaningful measures, such as the VIRT column in top). But I think Private_Dirty memory is less meaningful than most measures.
Quote:
Running this command a lot of times it gives me the same output, but suddenly...
If I'm reading the units right, it suddenly jumped from 3MB to 21MB.
How many of these processes are there and how tight are you for memory? Is 21MB per httpd process big enough to worry about?
Why do you think the amount of Private_Dirty memory is a meaningful measure of "how much virtual memory is that specific process using"?
I don't know a meaningful measure (I know other not very meaningful measures, such as the VIRT column in top). But I think Private_Dirty memory is less meaningful than most measures.
If I'm reading the units right, it suddenly jumped from 3MB to 21MB.
How many of these processes are there and how tight are you for memory? Is 21MB per httpd process big enough to worry about?
Hi.
I read that Private_Dirty its more important than the VSZ (ps) or VIRT (top). DO you know anythink else to look for?
There are about 25-20 process running at the same time when they jump from 3 to 21 MBs (aprox) each one.
Most of the time its not something to worry about, however sometimes it is. For example... Yesterday my server go down for cause it was swaping a lot! (Arround 600 MBs, notice that its a VPS).
I would like to know why those process start to eat so much memory!
Is probably too high for the amount of memory you have. Bring it down to maybe 25 for 512 MB RAM, or scale that number to the amount of memory you have (e.g., 50 for 1 GB). That's just a ballpark figure to start. Then monitor your memory/swap usage and watch Apache's main error_log for MaxClients notices (which will appear when Apache hits the MaxClients limit.) If you hit the MaxClients limit without any memory issues then you can safely increase the MaxClients setting a little.
Is probably too high for the amount of memory you have. Bring it down to maybe 25 for 512 MB RAM, or scale that number to the amount of memory you have (e.g., 50 for 1 GB). That's just a ballpark figure to start. Then monitor your memory/swap usage and watch Apache's main error_log for MaxClients notices (which will appear when Apache hits the MaxClients limit.) If you hit the MaxClients limit without any memory issues then you can safely increase the MaxClients setting a little.
Hi.
I've found a script that should "guide" me in wich number should i use in "MaxClients" directive.
# cat /root/mem.stat
Code:
#!/bin/bash
echo "This is intended as a guideline only!"
if [ -e /etc/debian_version ]; then
APACHE="apache2"
elif [ -e /etc/redhat-release ]; then
APACHE="httpd"
fi
RSS=`ps -aylC $APACHE |grep "$APACHE" |awk '{print $8'} |sort -n |tail -n 1`
RSS=`expr $RSS / 1024`
echo "Stopping $APACHE to calculate free memory"
/etc/init.d/$APACHE stop &> /dev/null
MEM=`free -m |head -n 2 |tail -n 1 |awk '{free=($4); print free}'`
echo "Starting $APACHE again"
/etc/init.d/$APACHE start &> /dev/null
echo "MaxClients should be around" `expr $MEM / $RSS`
Running it...
# /root/mem.stat
Code:
This is intended as a guideline only!
Stopping httpd to calculate free memory
Starting httpd again
MaxClients should be around 13
I've changed my MaxClients to 15 in prefork.c, restarted apache and i'm going to monitor the logs.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.