Skip to content

Instantly share code, notes, and snippets.

@getsource
Created October 11, 2011 03:20
Show Gist options
  • Save getsource/1277191 to your computer and use it in GitHub Desktop.
Save getsource/1277191 to your computer and use it in GitHub Desktop.
OC WordPress Meetup Shared->VPS->Dedicated Q&A 10-10-2011
Fair warning -- this is going to be quite technical, and as such is actually for developers ;)
Also, you *WILL* need to use the shell, but don't worry!
It's not as scary as it sounds, as there are plenty of commands and explanations on the web.
Okay! Going with John's suggestions on how to run through the questions involved.
1. How do you know, objectively, when you need move from shared hosting to VPS
(ie. what metrics can you test beyond the subjective "the site seems slow"). Error Logs?
* First Step: Optimize! If you're not caching, you SHOULD be:
http://i.qkme.me/504s.jpg
* Error logs can indeed be helpful in finding out if you're getting frequent page-loads that aren't completing.
** You can do a pretty simple grep for 500 errors
grep "Premature end" /path/to/error.log
or
grep 500 /path/to/access.log
** In error.log, they look something like:
[Mon Oct 10 01:21:33 2011] [error] [client 255.255.255.255] Premature end of script headers: index.php
To be more specific, you can take a look at the logs, and pick a closer string.
like: grep "HTTP/1.1\" 500"
** In access.log, they look something like:
255.255.255.255 - - [10/Oct/2011:15:36:15 -0700] "GET /wp-admin/ HTTP/1.1" 500 21380 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1"
Another big thing you can do is to contact your host and simply ask them if you're frequently hitting any performance limits on your shared hosting plan.
I'm only familiar with DreamHost in this regard, but TS has a super-simple way of searching for hits on over-RAM or CPU usage, and can give you a quick approximation of how often it is happening.
* Use Top to check your processes' RAM and CPU usage in real time.
* See all processes you're running, along with RAM usage:
ps aux | grep userName
* To kill processes, if you see hanging ones in the list above:
pkill -9 -u userName
* See total free RAM:
<h1><blink>REMEMBER http://www.linuxatemyram.com/ </blink></h1>
free -m
If you're on a shared host, and having trouble finding out which domains are causing the problems, you can try moving domains to different users, to make it more obvious how much RAM you're using on each site.
2) Is the traffic legitimate?
Find out! If it's not, block it, and you might save yourself some serious cash.
These two tutorials can help -- although you'll want to make sure you're using your host's paths to your error/access logs:
http://wiki.dreamhost.com/Finding_Causes_of_Heavy_Usage
http://wiki.dreamhost.com/Block_IP_Abuse
3) What is important and how does one size a VPS? (ie. memory? cpu? storage?)
I'd say that RAM is most important, followed by CPU.
WordPress -- especially with a lot of plugins -- likes to eat RAM for breakfast.
Fortunately, you can mitigate a lot of this with proper caching, and view the amount of RAM used for a particular page-load with the Debug Bar.
http://wordpress.org/extend/plugins/debug-bar/
http://wordpress.org/extend/plugins/debug-bar-console/
http://wordpress.org/extend/plugins/debug-bar-extender/
This will tell you the amount of RAM used for *EACH* pageview that isn't cached.
Remember, you probably want to stay beneath 100-300mb for shared hosting, so if you're using 100mb per page-load, you have a problem.
4) When/how do you know it's time for multiple servers? Split DB and Web Server first or 3 servers or ? etc...
If you're hitting your RAM limits or topping out your CPU usage frequently, splitting them can help.
Watch out, though -- because with moving to separate servers, you can have different potential problems, including both latency and congestion issues.
So, you'll have to be more careful with what code you're running.
If you're hitting query/SQL connection limits, you or the plugin author is likely *DOING IT WRONG*.
Your host usually has an easy way to check all of these, so ask them!
If not, you can tell this from the different methods above.
5) CDNs... do they help? how?
Yes! Maybe.
They help by offloading bandwidth usage from your primary server, and potentially speeding up resource loading.
Do you need one?
Maybe. If your host is charging for bandwidth, and you have particularly large files, or your Shared/VPS/Dedi's NIC simply doesn't have enough bandwidth available for your users' demand.
If it's simply a matter of speed, and using a CDN isn't going to save you any money, then only "maybe".
6) How much does uptime matter?
You're generally going to have > Uptime/Reliability as you increase from
Shared -> VPS -> Dedicated
Also, gradually fewer users means less probability of problematic users that could cause issues with your site.
You have further dedicated resources as you move down the chain.
* For VPS, this means you have guaranteed RAM (and perhaps CPU)
* For Dedicated, this means you have Dedicated RAMm CPU, NIC, and Drives (yes, the entire machine).
7) Before you upgrade from VPS to Dedicated, look into using Nginx!
It takes a bit of configuration to get started, but once it's set up, it's not difficult to keep running.
You can find rules for Wp-SuperCache in the following article, and W3 Total Cache supports writing an Nginx configuration file by default.
http://wiki.dreamhost.com/Nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment