Peak and OOMing
I have problem with some peaks on my linode. Support says server is OOMing. Ok so i need to determin what is using my memory. Lets say i do that with
ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r | less
and i get some info, lets say i see apache is using a lot of small fragments and i have 30 of lines like these
2.7 3.6 28124 50700 /usr/sbin/apache2 -k start
how do i determin and go from here to see what is starting apache and using resources? Or to be exact, which web page as i have 10 drupal pages on my server and some of them are taking too much resources. How to get to that information so i can optimize my sites and see which one to optimize?
13 Replies
The relevant configuration files can be found in /etc/apache2 for Debian and Ubuntu, and /etc/httpd in CentOS.
mod_status
Azathoth have you some idea what i need to configure for this to work?
this is what i have
last hit: 00:00:00 atop runtime: 0 days, 00:00:05 15:48:13
All: 0 reqs ( 0.0/sec) 0.0B ( 0.0B/sec) 0.0B/req
2xx: 0 ( 0.0%) 3xx: 0 ( 0.0%) 4xx: 0 ( 0.0%) 5xx: 0 ( 0.0%)
R ( 5s): 0 reqs ( 0.0/sec) 0.0B ( 0.0B/sec) 0.0B/req
2xx: 0 ( 0.0%) 3xx: 0 ( 0.0%) 4xx: 0 ( 0.0%) 5xx: 0 ( 0.0%)
apachetop -f /path/to/your/access.log
Also:
man apachetop
````
And hit ? when in apachetop to see options.
Keep in mind you'd need a common log file for all the vhosts on the server. My own common log file writes hostname instead of remote IP as first field, so that I can make nice webalizer stats and use the Remote section to see most active domains.
Tried it with apachetop -f /var/logs/apache2/access.log
but still zeroes. Is it this apache2/access.log I am supposed to use? or some other? as this one is empty file (checked it)?
If your (default) /var/logs/apache2/access.log is empty, you either do not have access logging set up, or individual vhosts are logging elsewhere.
For apachetop to work as intended here you need a common log where ALL your vhosts will post.
ServerName example.org
ServerAlias
DocumentRoot /srv/www/example.org/public_html/
ErrorLog /srv/www/example.org/logs/error.log
CustomLog /srv/www/example.org/logs/access.log combined
so this is where log of each site is. But then i will have just one site and its logs and i need to have concurent sites to display their usage so there is none use to see log file of one.
Ok how do i setup then apache log file or where do i check current setup and make a common log file?
@marko_roi:
so this is where log of each site is. But then i will have just one site and its logs and i need to have concurent sites to display their usage so there is none use to see log file of one.
A vhost can log to more than one log at once, just add another CustomLog directive pointing to – for example /srv/www/common.log -- for all your vhosts, ASIDE to their default logs. Then point apachetop -f to that common log.
That will automatically set up rotation for most system logs under /var/log, and you can add rules for other logs in other places in /etc/logrotate.d/. This (along with etckeeper and sl) is on my essential operational maintenance tools list.