Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Peak and OOMing
PostPosted: Tue Sep 13, 2011 7:54 am 
Offline
Senior Member

Joined: Tue Sep 13, 2011 7:13 am
Posts: 67
Hello guys,

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?


Top
   
 Post subject:
PostPosted: Tue Sep 13, 2011 8:21 am 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
Two phrases: reduce MaxClients, disable KeepAlive.

The relevant configuration files can be found in /etc/apache2 for Debian and Ubuntu, and /etc/httpd in CentOS.


Top
   
 Post subject:
PostPosted: Tue Sep 13, 2011 9:27 am 
Offline
Senior Member

Joined: Tue Sep 13, 2011 7:13 am
Posts: 67
I'll try that. But i would also like to know how to do what i asked. Determine what site on my VPS run which process?


Top
   
 Post subject:
PostPosted: Tue Sep 13, 2011 11:00 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
If you're using mpm-prefork (which you are, if you're using mod_php), all Apache processes are equally likely to handle any request for any site. The connection is assigned to a process before the HTTP request is received from the client. -rt

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Tue Sep 13, 2011 11:05 am 
Offline
Senior Member
User avatar

Joined: Sat Oct 16, 2004 11:13 am
Posts: 176
mod_status will probably give you an idea of which virtual-host is the busiest, etc.


Top
   
 Post subject:
PostPosted: Tue Sep 13, 2011 12:39 pm 
Offline
Senior Member

Joined: Mon Dec 07, 2009 6:46 am
Posts: 331
Apachetop.


Top
   
 Post subject:
PostPosted: Wed Sep 14, 2011 11:48 am 
Offline
Senior Member

Joined: Tue Sep 13, 2011 7:13 am
Posts: 67
Apachetop seems to be what i am looking for but after i installed it i only get zero values and not like its seen in this image

http://freshmeat.net/screenshots/36/05/ ... 1237052455

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%)


Top
   
 Post subject:
PostPosted: Wed Sep 14, 2011 12:07 pm 
Offline
Senior Member

Joined: Mon Dec 07, 2009 6:46 am
Posts: 331
Code:
apachetop -f /path/to/your/access.log


Also:

Code:
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.


Top
   
 Post subject:
PostPosted: Thu Sep 15, 2011 7:58 am 
Offline
Senior Member

Joined: Tue Sep 13, 2011 7:13 am
Posts: 67
Stll have problems :-)

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)?


Top
   
 Post subject:
PostPosted: Thu Sep 15, 2011 8:18 am 
Offline
Senior Member

Joined: Mon Dec 07, 2009 6:46 am
Posts: 331
Where are your access logs? Assuming each of your vhosts have separate access log, you have to configure them to also post to a common log.

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.


Top
   
 Post subject:
PostPosted: Fri Sep 16, 2011 8:28 am 
Offline
Senior Member

Joined: Tue Sep 13, 2011 7:13 am
Posts: 67
I made a setup as on linode help pages and each site has a

<VirtualHost *:80>
ServerAdmin webmaster@example.org
ServerName example.org
ServerAlias www.example.org
DocumentRoot /srv/www/example.org/public_html/
ErrorLog /srv/www/example.org/logs/error.log
CustomLog /srv/www/example.org/logs/access.log combined
</VirtualHost>

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?


Top
   
 Post subject:
PostPosted: Fri Sep 16, 2011 4:42 pm 
Offline
Senior Member

Joined: Mon Dec 07, 2009 6:46 am
Posts: 331
marko_roi wrote:

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.

https://httpd.apache.org/docs/2.0/logs.html#accesslog


Top
   
 Post subject: Limit log files size
PostPosted: Mon Nov 07, 2011 10:25 am 
Offline
Senior Member

Joined: Tue Sep 13, 2011 7:13 am
Posts: 67
How to limit log file sizes? Or make them truncate? I had some larger than 1 GB. What is the best practice?


Top
   
 Post subject:
PostPosted: Mon Nov 07, 2011 11:11 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
apt-get install logrotate

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.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group