Thoughts on preparing for higher traffic

I’ve got a 4 cpu/8gb ram vps over at DigitalOcean ($80/month) with a Wordpress site on it. Also on Cloudflare.

So far, my site has been able to handle 16,000 hits a day without any trouble… but I want to prepare for more traffic, and the ‘digg’ effect, as much as possible.

Today I didn’t have a huge traffic surge, but it got pretty busy for an hour or two. The server handled that with no trouble, but the load and memory usage did crank up enough that perhaps I you can help me use it to figure out where my needs are. I’ve attached an image.

What are my best options for dealing with increased traffic?

  • Digital Ocean offers an 8cpu/16gb ram server for $160/month. Rather not make that financial commitment just yet though.

  • Set up a separate mysql server? In this case, would I put the site on something like a 2 cpu/2gb ram server and mysql on a stronger one (maybe have it on the 4 cpu/8gb server)? Or vice versa? Or both on 2 cpu/2gb ram - which would be equivalent to the monthly cost that I have now.

  • Set up some kind of load balancing system between two servers? Or do I need a third server for mysql if I do that? (the more I split the servers up, the smaller resources they will each have of course).

  • Switch to using nginx… would that give me a substantial performance improvement when it comes to handling more traffic?

Or something else?

‘top’ screen capture attached. Do you see any specific resources that need to be strengthened based on that, or is is pretty balanced overall?

Thanks for any help and suggestions -

Chris

PS: I’m not sure how file attachments work here, but it uploaded to: https://virtualmin.com/files/tempServerload.jpg if you need the link here.

Howdy,

Options like increasing the hardware, setting up a load balancer, and moving MySQL to another server are all pretty decent options for solving the problem you’re trying to solve.

Depending on your application(s), one quick and easy thing to consider prior to some of the larger moves is to give memcache a try.

It’s a service that sits between your application, and MySQL, and can really reduce how much work MySQL ends up doing.

While a load balancer is always an option, you do run into the issue of keeping them in sync, as well as how to deal with MySQL-based data.

If you decide you want more than just memcache, moving MySQL to a dedicated server may be a simpler option.

You could configure it to use a lot of available memory, and you could also consider a provider that provides fast disks, perhaps SSD drives.

It looks like MySQL is using quite a bit of your available resources.

Solutions that help MySQL, such as memcache and a dedicated MySQL server, would probably be most beneficial.

It might also be worth reviewing what all MySQL is doing, such as reviewing the queries being run, to make sure there aren’t queries that are bogging it down. In some cases, large improvements can be made just by adding indexes to certain MySQL tables.

-Eric

Hi,

How many hits have you had per hour - in the busiest day?

Thank you!

Ok, Eric, you started me on an hours long journey looking up and studying about memcache. :slight_smile:

From what I’ve read, it looks like I would not use it because I already have apc installed. Correct? Or would I use both. Some of what I read looked like apc was for caching php and memcache mysql, at least that’s what I thought for a while… but then I found other info that suggested they are redundant.

If I go the separate mysql server route, how do I figure resources…? Does the mysql server get, say, double the amount of cpu and ram?

Gstarr - occasional peaks of 10,000 an hour, for a short time through. I’d like to prepare for larger surges. Probably my easiest to manage solution would be to just bite the bullet and get one larger server… might just put off this decision for another month or two until I can do that,

Chris

Hi,

10.000 an hour is great. I don’t use memcache but have seen some great implementations with Xcache which can do both.

If you are looking to increase traffic with minimal cost, I suggest Varnish.
You use W3TC which has support for Varnish so I think you could do it easily.
Setup is not complicated, you have an option to install it on the same server or setup a new server
with Varnish+Nginx for example.

Howdy,

There would indeed be some overlap in functionality between APC and Memcache.

That’s no problem though.

The question is, how can we reduce MySQL usage?

You may end up ultimately needing to use a different solution to do that, a dedicated server, varnish, or the like… however, since memcache is so easy to setup, and it’s goal is to reduce the load on MySQL, it seems like a simple way to start, just to see what kind of help it offers.

You could always put it on your server and load test it a bit.

If it doesn’t provide you the performance enhancements you need, no problem, you have plenty of other options to look into :slight_smile:

Regarding resources for a dedicated MySQL server – well, that’s a bit of trial and error, but the key would be RAM and fast disks. You mentioned setting up a new server with 2GB of RAM – that seems like a good place to start, you can always increase it later if need be.

-Eric

Thank you very much Eric,

I really appreciate the guidance. I’ve put memcache on to try it, and will experiment :slight_smile:

Chris

If your site is mainly serving anonymous users (not logged in) then nothing will beat adding Varnish on top of it. As gstar mentioned above Varnish will serve cached pages to anonymous users with very little configuration. It serves the page without touching apache or the database which means it will scale enormously.

I usually recommend CloudFlare in these kinds of situations.