Hi folks. I hope one of your gurus can point me in the right direction.
I have two servers, one for Apache and one for MySQL, 4GB and 2GB RAM respectively. They run about 10 wordpress sites with very low traffic, and resources have not been a problem.
I now added another WP site with about 3000 pageviews per day and the server that runs Apache is sitting at 100% CPU all the time. Page load speed is dismal, somewhere around 6 seconds.
The site is www.fairtattoo.com. It has about 5000 posts currently.
Plugins are W3Total Cache, SEO by Yoast, WP Optimize. The theme is a professional theme from mythemeshop (truepixel) and I have used it without a problem on other sites.
Apache uses mpm_prefork.
Strangely, apache will use only about half the available RAM, approx 2GB of teh 4GB available. I’ve tried tweaking mpm_prefork with a few variations, but no luck so far.
Here’s the mpm_prefork:
<IfModule mpm_prefork_module>
# Default 5
StartServers 5
# Default 5
MinSpareServers 5
# Default 10
MaxSpareServers 10
# default 256
ServerLimit 256
# default 256, less or same as Server Limit
MaxRequestWorkers 256
# deprecated: Called MaxRequestWorkers now
#MaxClients 128
# Can be a high number like 20000 but do not set to 0 (unlimited)
MaxConnectionsPerChild 20000
# No need to Keep alive, just keeps threads busy
KeepAlive On
Where next? How to diagnose?
Thanks in advance
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Also, as a quid pro quo, I thought I’d describe to other readers of this thread how to get Theme-My-Login to disable wp-login.php.
Step 1: Install Theme My Login. Just look for a new plugin from your wordpress admin console Step 2: Enable the Security Module from TML Settings
http://www.fairtattoo.com/wordpress/wp-content/uploads/2015/01/tml_enable_security.png
Step 3: Go to the Security Module’s settings and “Disable wp-login”
http://www.fairtattoo.com/wordpress/wp-content/uploads/2015/01/tml_disable_wp-login.png
That’s it!
I also like to set up Recaptcha. Easy enough to do.
PS: Jonathan, would you link to the media files in this comment please? No idea how to do that.
Good thought! I installed Theme-My-Login, and that redirects and puts Recaptchas whereever I want them
OK, found the problem!
The THEME! Really, no jokes. Who woulda thought?
I load a different theme (twenty-fifteen) and life is good.
Goes to show.
top - 11:58:29 up 11:36, 1 user, load average: 27.45, 30.32, 38.95
Tasks: 131 total, 19 running, 111 sleeping, 0 stopped, 1 zombie
%Cpu0 : 96.7 us, 2.7 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.7 hi, 0.0 si, 0.0 st
%Cpu1 : 97.3 us, 2.7 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 4048356 total, 1665908 used, 2382448 free, 123444 buffers
KiB Swap: 3906244 total, 80 used, 3906164 free. 645800 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
30513 www-data 20 0 452972 48640 28352 S 11.3 1.2 0:01.58 apache2
30512 www-data 20 0 450304 45668 27912 S 11.0 1.1 0:03.54 apache2
30633 www-data 20 0 450580 43536 25520 R 11.0 1.1 0:01.45 apache2
30570 www-data 20 0 452640 44888 25272 R 10.0 1.1 0:04.97 apache2
30533 www-data 20 0 452896 45084 25204 R 9.3 1.1 0:02.35 apache2
30553 www-data 20 0 453404 45748 25140 S 9.3 1.1 0:02.26 apache2
30572 www-data 20 0 453220 48004 27804 R 9.3 1.2 0:01.59 apache2
30523 www-data 20 0 452960 47456 27484 R 9.0 1.2 0:01.44 apache2
30571 www-data 20 0 470120 86828 49700 R 9.0 2.1 0:02.14 apache2
30591 www-data 20 0 450336 42860 25092 R 9.0 1.1 0:03.88 apache2
30574 www-data 20 0 453152 45588 25224 R 8.6 1.1 0:02.18 apache2
30632 www-data 20 0 452120 44460 25120 R 8.6 1.1 0:01.02 apache2
30507 www-data 20 0 457268 53112 28408 R 8.3 1.3 0:05.94 apache2
30552 www-data 20 0 453164 45592 25224 R 8.3 1.1 0:02.19 apache2
30515 www-data 20 0 475780 105148 62596 S 7.0 2.6 0:03.52 apache2
30585 www-data 20 0 452888 45036 25108 S 6.3 1.1 0:01.80 apache2
30590 www-data 20 0 451864 43912 25096 R 5.3 1.1 0:01.68 apache2
30560 www-data 20 0 450332 42908 25136 R 5.0 1.1 0:04.42 apache2
30593 www-data 20 0 452864 45244 25128 R 5.0 1.1 0:01.75 apache2
30556 www-data 20 0 450336 42996 25220 S 4.3 1.1 0:01.93 apache2
30589 www-data 20 0 450340 42984 25208 S 4.0 1.1 0:01.89 apache2
30509 www-data 20 0 454144 49332 27888 S 3.7 1.2 0:02.92 apache2
30524 www-data 20 0 452888 45164 25140 R 3.3 1.1 0:02.37 apache2
30562 www-data 20 0 452864 45240 25124 S 2.7 1.1 0:01.87 apache2
30564 www-data 20 0 450080 42656 25136 R 2.7 1.1 0:02.03 apache2
30602 www-data 20 0 453144 45496 25136 R 2.7 1.1 0:01.59 apache2
30545 www-data 20 0 450328 42928 25160 R 2.3 1.1 0:01.60 apache2
30558 www-data 20 0 452968 46724 26520 S 2.3 1.2 0:02.06 apache2
30618 www-data 20 0 453148 45488 25152 S 2.3 1.1 0:01.13 apache2
30554 www-data 20 0 450328 42884 25116 S 1.7 1.1 0:01.52 apache2
30565 www-data 20 0 450328 42892 25124 S 1.7 1.1 0:02.25 apache2
Edge Side Includes: http://en.wikipedia.org/wiki/Edge_Side_Includes
Would you like to tweak it for me? What would that cost?
Glad you found the problem and the solution, but your setup sounds like it might be overkill, unless you really need to actual disk storage space. And having the db server on a different droplet makes no sense - even if on the same private network, you’ll be adding so much latency.
Have a look at my post here - https://www.digitalocean.com/community/questions/i-have-many-domains-should-i-get-one-droplet-at-80-month-or-a-couple-at-20month?answer=19750
You could probably get away with it all on one $20 droplet with the right tweaking. Just sayin’…
Oh, the problem isn’t with the DB as far as I can tell. The DB server sits idle most of the time and the total query time for a page is under 1s. You can see the query time value at the bottom left of each page in the footer.