Barley any free memory, but top doesn't indicate as such
I'm running a small Drupal site that sees ~600 visitors a day. It seems my IO have been averaging at around 2-3k, but it spiked to 7k earlier today. I ran the cmd "free" and this is the output:
total used free shared buffers cached
Mem: 435296 429280 6016 0 15336 16980
-/+ buffers/cache: 396964 38332
Swap: 262140 156372 105768
So it seems that the system is always swapping. I run the cmd "top" but there is nothing using more than 1% of memory. When I load a page on the site, apache/httpd comes in and eats up about 7-11%. But how does that explain that I have virtually no free memory?
Here is my my.cnf file
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# To allow mysqld to connect to a MySQL Cluster management daemon, uncomment
# these lines and adjust the connectstring as needed.
#ndbcluster
#ndb-connectstring="nodeid=4;host=localhost:1186"
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[ndbd]
# If you are running a MySQL Cluster storage daemon (ndbd) on this machine,
# adjust its connection to the management daemon here.
# Note: ndbd init script requires this to include nodeid!
connect-string="nodeid=2;host=localhost:1186"
[ndb_mgm]
# connection string for MySQL Cluster management tool
connect-string="host=localhost:1186"
I could copy php.ini but it is large. Mem limit is set to 128mb (drupal is a memory hog), but I don't see how that could be the issue?
Hope you have patience for someone trying to learn. Thank you.
6 Replies
ps aux --sort -rss
will sort processes by ram usage.
What's your apache MaxClients value?
obs:
I went into httpd.conf and changed my prefork settings to this:
MinSpareServers 2
MaxSpareServers 4
ServerLimit 13
MaxClients 13
MaxRequestsPerChild 4000
My linode has 512MB RAM, and each apache process eats up ~30MB. So I figured 13 for max would be a good number. I also lowered the others to make more 'sense'. Not sure what ServerLimit is revelant to, but I set it to match MaxClients. I didn't touch max requests though.
There is also a similar set of settings that I did not modify:
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
How can I test to see if worker.c is being used instead?
Thank you!!!!
@bkosborne:
How can I test to see if worker.c is being used instead?
Thank you!!!!
apache2 -l (or maybe it's httpd -l in centos?) will list compiled in modules, you'll see worker.c or prefork.c in that list.
apache2 -V is a similar list of compiled options, a little more verbose, in that one, look for the APACHEMPMDIR