1

I have a self managed VPS that I inherited from a previous administrator inside my Company, with lots of Wordpress websites running on it. The VPS has 2 CPUs, 6Gb or RAM and runs Ubuntu 10.04 64bit.

I noticed that the server was slow, very slow at times. So I used top command to check what was running and found out that there were many apache2 services who had been running for long times, up to 60 minutes, in some occasions. CPU and Memory usage to the roof.

The apache2 processes often run for too long - from 4 minutes to 8, 15, 30, 45 or even one hour, clogging CPU and Memory and basically killing everything.

  • I drastically lowered the number of MaxClients
  • I took out all the apache modules, one by one, and kept the ones needed to keep the website up
  • I protected all the applications with spam and http requests filters

Nothing really changed.

How can I track down where the problem is coming from? All our wordpress are secure, both with denial of unexpected requests and secure non standard login pages and bot automatic blocking.

I want to track the problem down and fix it, so that the VPS will run smoothly.

This is the result of apache2ctl -S:

109.228.21.231:80      is a NameVirtualHost
default server server109-228-21-231.live-servers.net (/etc/apache2/plesk.conf.d/ip_default/server109-228-21-231.live-servers.net.conf:8)
port 80 namevhost server109-228-21-231.live-servers.net (/etc/apache2/plesk.conf.d/ip_default/server109-228-21-231.live-servers.net.conf:8)
port 80 namevhost default (/etc/apache2/plesk.conf.d/server.conf:67)
port 80 namevhost lists (/etc/apache2/plesk.conf.d/server.conf:139)
port 80 namevhost atmail.webmail (/etc/apache2/plesk.conf.d/atmail.conf:9)
port 80 namevhost horde.webmail (/etc/apache2/plesk.conf.d/horde.conf:9)
port 80 namevhost accessaa.co.uk (/etc/apache2/plesk.conf.d/vhosts/accessaa.co.uk.conf:112)
port 80 namevhost bighandmedia.org (/etc/apache2/plesk.conf.d/vhosts/bighandmedia.org.conf:8)
port 80 namevhost c-mw.net (/etc/apache2/plesk.conf.d/vhosts/c-mw.net.conf:8)
port 80 namevhost centralexhibitioncentres.org (/etc/apache2/plesk.conf.d/vhosts/centralexhibitioncentres.org.conf:8)
port 80 namevhost conference-news.co.uk (/etc/apache2/plesk.conf.d/vhosts/conference-news.co.uk.conf:112)
port 80 namevhost engage-magazine.co.uk (/etc/apache2/plesk.conf.d/vhosts/engage-magazine.co.uk.conf:8)
port 80 namevhost exhibitingmagazine.co.uk (/etc/apache2/plesk.conf.d/vhosts/exhibitingmagazine.co.uk.conf:8)
port 80 namevhost exhibitionnews.co.uk (/etc/apache2/plesk.conf.d/vhosts/exhibitionnews.co.uk.conf:8)
port 80 namevhost exhibitionworld.co.uk (/etc/apache2/plesk.conf.d/vhosts/exhibitionworld.co.uk.conf:124)
port 80 namevhost h2openmagazine.com (/etc/apache2/plesk.conf.d/vhosts/h2openmagazine.com.conf:103)
port 80 namevhost holdsworthevents.co.uk (/etc/apache2/plesk.conf.d/vhosts/holdsworthevents.co.uk.conf:8)
port 80 namevhost om-pa.co.uk (/etc/apache2/plesk.conf.d/vhosts/om-pa.co.uk.conf:8)
port 80 namevhost peoplepeoplemedia.co.uk (/etc/apache2/plesk.conf.d/vhosts/peoplepeoplemedia.co.uk.conf:8)
port 80 namevhost productivepr.org (/etc/apache2/plesk.conf.d/vhosts/productivepr.org.conf:8)
port 80 namevhost redpavementgroup.com (/etc/apache2/plesk.conf.d/vhosts/redpavementgroup.com.conf:8)
port 80 namevhost show-pro.co.uk (/etc/apache2/plesk.conf.d/vhosts/show-pro.co.uk.conf:8)
port 80 namevhost stgeorgeshalls.com (/etc/apache2/plesk.conf.d/vhosts/stgeorgeshalls.com.conf:76)
port 80 namevhost whitebook.co.uk (/etc/apache2/plesk.conf.d/vhosts/whitebook.co.uk.conf:8)
port 80 namevhost www.redrecruitment.net (/etc/apache2/plesk.conf.d/vhosts/www.redrecruitment.net.conf:8)
port 80 namevhost exhibitionnewsawards.co.uk (/etc/apache2/plesk.conf.d/forwarding/exhibitionnewsawards.co.uk_httpd.conf:6)
109.228.21.231:443     is a NameVirtualHost
default server default-109_228_21_231 (/etc/apache2/plesk.conf.d/server.conf:103)
port 443 namevhost default-109_228_21_231 (/etc/apache2/plesk.conf.d/server.conf:103)
port 443 namevhost lists (/etc/apache2/plesk.conf.d/server.conf:168)
port 443 namevhost atmail.webmail (/etc/apache2/plesk.conf.d/atmail.conf:58)
port 443 namevhost horde.webmail (/etc/apache2/plesk.conf.d/horde.conf:46)
port 443 namevhost accessaa.co.uk (/etc/apache2/plesk.conf.d/vhosts/accessaa.co.uk.conf:10)
port 443 namevhost conference-news.co.uk (/etc/apache2/plesk.conf.d/vhosts/conference-news.co.uk.conf:10)
port 443 namevhost exhibitionworld.co.uk (/etc/apache2/plesk.conf.d/vhosts/exhibitionworld.co.uk.conf:10)
port 443 namevhost h2openmagazine.com (/etc/apache2/plesk.conf.d/vhosts/h2openmagazine.com.conf:10)
port 443 namevhost stgeorgeshalls.com (/etc/apache2/plesk.conf.d/vhosts/stgeorgeshalls.com.conf:10)
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
default server server109-228-21-231.live-servers.net (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost server109-228-21-231.live-servers.net (/etc/apache2/sites-enabled/000-default:1)
Syntax OK

closed as off-topic by masegaloeh, Ward, mdpc, kasperd, HBruijn Jul 6 '15 at 12:23

This question appears to be off-topic. The users who voted to close gave these specific reasons:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • It's not hosting, it's a self managed VPS. I think that there is sufficient information, as far as my knowledge let me understand. If I were able to track everything on my own, I would not need the help of community, wouldn't I? – Alessandro Valentini Jul 20 '15 at 14:11
  • You haven't even clearly described the problem! What is crashing? How do you know? What log entries relate to the crash? – Michael Hampton Jul 20 '15 at 15:55
  • Isn't the sentence "The apache2 processes often run for too long - from 4 minutes to 8, 15, 30, 45 or even one hour, clogging CPU and Memory and basically killing everything." self explanatory? Ok. I noticed that the server was slow, very slow at times. So I used top command to check what was running and found out that there were many apache2 services who had been running for long times, up to 60 minutes, in some occasions. CPU and Memory usage to the roof. – Alessandro Valentini Jul 22 '15 at 7:48
  • No, that's not self explanatory, and it's not at all clear. You should provide specific data. – Michael Hampton Jul 22 '15 at 12:50
  • This is an ongoing problem, with different specific results every day, but general identical problems. 20 or 25 processes, 28 or 48 minutes. All this doesn't really make any difference. Different specifics but same result: clogged server. Thankfully there's people who is able to understand the situation and provide guidance nonetheless. – Alessandro Valentini Jul 23 '15 at 11:36
1

To check what particular apache2 process is doing, use strace. # strace -p <pid> Look at systemcalls and make your way.

  • An AWFUL lot of lstat commands there. – Alessandro Valentini Jun 4 '15 at 14:04
  • What is the path you see for the files in the lstat calls, check which host name is having most of those requests? – maqsimum Jun 4 '15 at 14:13
  • It's lots and lots of different pages on different websites we have – Alessandro Valentini Jun 4 '15 at 14:30
  • What MPM you use on Apache? – maqsimum Jun 4 '15 at 16:00
  • Also note that, to control maximum concurrent connections, in case of prefork, you need to set MaximumRequestWorkers to desired number. To have your apache terminate the old or free processes, you need to set MaxSpareThreads number, if free processes goes above this number, apache will exist those process. But it appears that your VPS is very busy, and apache keep serving the requests. As you already mentioned, strace -p pid shows you lot of systemcalls, this indicates that current running apache process is serving the requests, that means, there is real traffic. – maqsimum Jun 5 '15 at 5:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.