Knowledgebase

Wpress & CPanel processes

Posted by kthomas, 03-30-2011, 05:58 PM
Our wordpress site was recently booted from our shared hosting for "using excessive resources." We're on a 768MB VPS now and after serious cuts, we're still chewing up large amounts of RAM. I'd sure appreciate an outside, server/hosting admins opinion about what's going on here - because I just don't think our site warrants a VPS. I'd at least like to reduce our usage (and cost) to a 512MB partition. Background: dailyegyptian.com 9k posts 1k comments 26 pages 6,100 tages 1k users Google Analytics reports 3/1/2011- 3/30/2011: 30,946 Visits 57k pageviews 18,880 Absolute Unique Visitors 00:01:47 Time on Site all in all, a pretty normal month... Please have a look at some stats from TOP-> imgur. com/Rwuhw We're barely tweaking the processor and the bandwidth. Tasks will creep up to about 57 over time until everything kind-of stops working. Rebooting the server immediately creates 10-17 httpd processes, (40+ all together) nearly all of which sleep but seem to take about 50mb RAM each. Instant 600+ mb gone. You'll see two little spikes on the bytes/sec, that's where we've done a backup prior to a reboot. There was also a reboot late Friday night where you see the Memory drop. Why the ramp up Monday? dunno. People using the web site? What we've done so far - killed a bunch of plug-ins and reduced the # of calls (86 queries in 1.069 seconds see bottom of page near copyright.) it was over 200 before I started whacking away... I've also turned off W3 Total Cache but the plug-in is still "installed. " My questions would be: a) are we somehow running more httpd processes than "normal" ? What can we check/do/install to reduce those processes? b) based on the # of posts and traffic of our site, what VPS size do you recommend? c) is this a template problem or a plug-in rich problem or something else? d) some people crab that we don't need cpanel (using gMail on our domain) and that it takes up too much memory - but I'm not seeing so many cpanel processes... any other ideas or places to that I can look under the rug to get this site running it's best? Thanks!

Posted by viGeek, 03-30-2011, 06:01 PM
You can get most of this information via... # Total apache memory usage. ps aux | grep apache | grep -v "grep" | awk '{ s += $6 } END { print s/1024, "Mb"}' # Total daemons: ps -ef | grep apache | grep -v "grep" | wc -l # Total port 80 connections: netstat -n | grep :80 |wc -l

Posted by IDediServer Kevin, 03-30-2011, 06:04 PM
Enable your MySQL slow query log with 1 second long query time. When things get slow check the slow query log and see if you have many slow running queries or a few that are taking a very long time to finish. This can be a plugin or template issue thou it is typically plugin related. Most slow issues with WP are DB related in regards to way too many bad queries hitting the database in a redundant manner (as mentioned typically plugin related).

Posted by kthomas, 03-31-2011, 12:00 AM
Total port 80 connections: = 203 # Total daemons = 9 # Total apache memory usage = 331.387 Mb ok, now what? :-)

Posted by ClaudiuPopescu, 03-31-2011, 07:59 AM
Try Nginx? Might help. Anyway, 330MB for 200 connections is in the acceptable limits...

Posted by viGeek, 03-31-2011, 10:27 AM
Everything looks good here. AS Kevin had mentioned it could be an issue with some slow queries, feel free to use this to scan for slow queries.

Posted by IDediServer Kevin, 03-31-2011, 01:06 PM
Out of curiosity can you post the output of ps auwx --sort rss | tail -n 10 Rename any usernames or etc that you do not want in a public forum

Posted by kthomas, 03-31-2011, 04:19 PM
ps auwx --sort rss | tail -n 10 root 9653 0.0 1.5 86492 12148 ? S Mar31 0:00 cpsrvd - waiting for connections root 9655 0.0 1.7 90408 13780 ? S Mar31 0:00 cpdavd - accepting connections on 2077 and 2078 root 9510 0.0 2.5 160892 20356 ? Ss Mar31 0:03 /usr/local/apache/bin/httpd -k start -DSSL mysql 9342 3.2 2.8 188236 22608 ? Sl Mar31 33:03 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/vps.dailyegyptian.com.pid --skip-external-locking nobody 30273 3.4 5.8 189776 45776 ? S 00:08 0:08 /usr/local/apache/bin/httpd -k start -DSSL nobody 9423 2.6 5.9 190856 46636 ? S 00:09 0:04 /usr/local/apache/bin/httpd -k start -DSSL nobody 26572 3.7 6.1 192668 48568 ? S 00:08 0:09 /usr/local/apache/bin/httpd -k start -DSSL nobody 20019 3.7 6.1 192680 48584 ? S 00:06 0:13 /usr/local/apache/bin/httpd -k start -DSSL nobody 19575 5.1 6.2 193832 49540 ? S 00:06 0:18 /usr/local/apache/bin/httpd -k start -DSSL nobody 11464 1.3 6.8 197944 53664 ? S 00:10 0:01 /usr/local/apache/bin/httpd -k start -DSSL [~]# late yesterday, we changed the apache settings from the default and it seems to kill off httpd processes a little better, usually no more than 6 running now. These configurations are in use: /usr/local/apache/conf/httpd.conf added values: KeepAlive: Off StartServers 3 MinSpareServers 4 MaxSpareServers 6 MaxClients 100 MaxReguestsPerChild 0 We seem to be avg about 420MB of ram out of 768 We sure appreciate your thoughts, expertise & guidance! /kelly thomas SIU DailyEgyptian.com

Posted by IDediServer Kevin, 03-31-2011, 04:29 PM
So you are using currently worst case scenario about 52MB per apache process (worst case)... Your maxclients should be calculated using this. (52 MB) MySQL is not using that much memory, nor are other things. When you have a moment stop apache, type free -m and see how much free memory you have. Take that number minus about 120 or so and divide the rest by 52, this is roughly how many maxclients you can support without hitting swap. Other than that you will need to dig into MySQL or disable some plugins to speed things up. I personally use strace extensively to dig into such issues but you would have to do some reading to understand that.

Posted by IDediServer Kevin, 03-31-2011, 04:32 PM
The netstat/ps does 100% identify 200 connections as currently being serviced by apache, they could be in a fin_wait1/2,TIME_WAIT or opening.. who knows.

Posted by IDediServer Kevin, 03-31-2011, 04:43 PM
Also when you use free -m add up the free column with the cached column before removing 120 and dividing by 52.

Posted by kthomas, 04-01-2011, 12:32 PM
Thanks! We'll try Monday, I'm out 2day! /kt



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
jquery pagination (Views: 573)
Apache modules (Views: 664)
Solarvps down (Views: 645)


Language:

Client Login

Email

Password

Remember Me

Search