have a website (www.americanbankingnews.com) that gets 40,000-50,000 page views today. It’s currently sitting on a dedicated quad-core Xeon server with 8GB of ram. The site is powered by WordPress and MySQL (sitting on the same server) and I’m currently using W3 Total Cache for page and MySQL query Caching.
Unfortunately, that doesn’t seem to be enough. During peak traffic times, my servers are getting a few HTTP 500 errors and pages that aren’t cached load slowly.
I’m currently not using Xcache or any other PHP cache/acceleration tools.
Are there additional steps that I should take to try to optimize MySQL and PHP performance? Or should I fork over for an additional server. Specifically, I’d be interested in additional suggestions to improve MySQL performance and whether or not tools like xcache might help in this situation
Hi Matthew Paulson,
I see your using W3 Total Cache but your database and object cache is set to disk. Caching objects and your database to disk can actually have a negative performance effect especially if your getting that much traffic.
You can read more about the effects on caching database and objects to disk in an article I wrote on how to set up W3 Total Cache The plugin author agreed with the instructions in my settings.
To really see the benefit of database and object caching you need to be using a PHP opcode cache like APC. You can follow the copy and paste instructions in the plugin FAQ to compile and set up APC. If your on Ubuntu or Debian you can simply run the command: apt-get apc-php5 to install.
Like others have also mentioned you will get a huge performance boost and enable your site to scale much larger by setting up a reverse proxy with Nginx.
I give detailed instructions on how to configure and set it up in my WordPress Performance Stack. article.
You should also read some of the other questions and answers on here. A lot of good performance and scaling advice has been given.
Good luck on your quest. Managing your own server can be very stressful sometimes.
Edit
Just to show the performance you can gain by installing Nginx as a reverse proxy I’m posting an Apache Benchmark test I just ran on my server:
Theoretically it’s able to handle over 15,000 requests per second. (Same Network)
Lots of similar questions and answers:
https://wordpress.stackexchange.com/search?q=mysql+optimize
It comes down to using tools – like mysqltuner – to investigate the bottlenecks, checking logs for errors and memory usage, php opcode-caching, clearing post/page revisons to get the DB down to size, etc.
Hi @Matthew Paulson:
You may be asking the wrong question.
With your traffic you may want to look at at front-end cache using nginx. Here are Q&As for nginx here on the site, lots of relevant articles in a Google search, and plugin that can interface WordPress to nginx at wordpress.org and lastly an article on installing and configuring:
If that doesn’t help or if you don’t want to do it for some other reason please let us know what plugins you are using. Most of the time with WordPress performance problems are not the obvious but instead they are result of some poorly written plugins.
Do you have insight in what exactly is becoming a bottleneck under high load? It could be different type of resource (CPU load, sustaining network conenctions, running out of memory, etc).
General things:
You weren’t kidding, just tried going to your site and got a 500 internal error. Perhaps you can lower the number of plugins you are using and make sure all images are optimized, etc. to make page sizes smaller so they consume less bandwidth to load hence less errors.
You may also want to look into HIP HOP for PHP . I never implemented it but it was released open source by the facbook people who after creating and using it saw their server load go down by about 30%. Basically it takes regular php files, converts them to C++ binaries and serves those out.
The hardware you have should easily cope with the stated traffic (as a benchmark, a site I run peaks at ~40k daily page views on a 2GB Slicehost VPS) – so that suggests something grossly wrong.
So, as other people have said, the first thing you need to do is understand where the problem(s) is/are.
What information does top give you when you’re under load? Are you using swap memory, is your load spiking, when you sort by memory and cpu% what are the top processes?
Can you install something like munin to give you an insight into your server?
Assuming you’re running Apache, how is it configured – the important things to know are:
Running this command –
ps -ylC httpd --sort:rss
will give you a indication of how much memory Apache processes are using.Install mtop and mysqltuner – from what I remember both are available via apt-get. You should also turn on MySQL slow logging – you normally just need to uncomment a line in your my.cnf file.
As suggested by others, what happens if you turn off plugins during a busy period? Does the site speed up? What plugins do you have installed?
Do you have any idea of how much traffic you’re getting during your busy periods – eg 4000 page views in 10 minutes.
Armed with information from these sources, you’ll have a much better idea of what’s going wrong.
i dont know what programs you installed but maybe its APC – Zend problem:
http://www.ivankristianto.com/web-development/server/alternative-php-cache-apc-not-compatible-with-zend-optimizer/1726/