Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I 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.

share|improve this question

migrated from stackoverflow.com Apr 7 '11 at 19:30

This question came from our site for professional and enthusiast programmers.

    
Matthew, are you sure that's the traffic stats on the site? I checked the alexa on this site and the numbers are not that high. I know of WordPress based sites which are running higher traffic and on smaller servers. –  Prasad Mar 8 '13 at 13:48

4 Answers 4

Before concerning yourself with the machine, have you done a thorough audit of your WordPress install's plugins, templates, etc. yet?

I have a client in the 30-40k/day range on a shared host, with a large portion of the site requiring authentication to read(so we can't quite do full-on "static" SuperCaching), and they've yet to have any significant performance complaints.

If you're chewing through a dedicated machine with only another ~10k visits, there might be more going on than just an underpowered server.

share|improve this answer

APC (Alternative PHP Cache) would help save CPU cycles since it caches PHP code that has been compiled already. That means that on every page load, your PHP files aren't getting compiled first and then executed by the virtual machine, they go straight to PHP virtual machine and performance boost is significant (I've seen performance increase from 2 to 12 times).

Next step would be optimizing MySQL. Obvious step is checking whether you're using InnoDB or not. Increasing InnoDB's buffer_pool_size to about 90% of your RAM would make MySQL store dataset it works with directly in RAM, so disk IO is avoided as much as possible.

However, what you'd ideally try to do is cache all of your pages (I assume you don't have that many new content-related things posted per day).

That probably requires some work (or there might be a WordPress mod out there, I'm not really sure because I'm not that faimilliar with WP and its plugins). Caching your content would alleviate load on your database. 40k - 50k views a day implicates high read rate so you should optimize for read rather than write.

Also, you might look into swapping to nginx rather than staying with Apache and utilizing PHP FPM with nginx. That should boost your performance by a huge margin.

Without seeing what actually burdens your server (my guess is Apache spawning a lot of processes that frequently access MySQL), these are the only things that pop into mind at this point.

share|improve this answer

For a highly trafficked site, you should tune all MySQL buffers for the content that is in place now. Regardless of the version of WordPress, the MySQL layer can have its configuration computed.

In fact, if you have InnoDB data without enabling innodb_file_per_table, you need to cleanup InnoDB by segmenting each table into its own physical tablespace. It is possible to do decent MySQL tuning even if you have a limited hardware. There are many scenarios for doing such InnoDB optimizations.

IMHO, you cannot plan good settings for my.cnf without knowing the amount of data to configure for. You would have to periodically load a current dataset from production into a staging environment, perform optimizations and come away with the numbers to configure in the my.cnf of the production server.

share|improve this answer

You might also want to look at whether your caching is correctly happening. I had a look at your home page and came up with these points -

  1. most of your thumbnails are being resized by a php script and being served through your server only. You could have tried to save this overhead.
  2. If you do have repeat visitors (which should be the case looking at your content), then you need to implement browser side caching to reduce requests to your server.
  3. You are running a tonne of javascripts (ads, analytics, et al) .. can you defer them and ensure that their js also are cached.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.