I am about to get lifehackered
I run my business by myself (i.e., I'm my own tech support). Is there anything I can do at this late stage to prepare for a possible traffic spike?
(It's a psychology blog - not tech).
3 Replies
Most of the problems people have with sudden load spikes is that they're running Apache with a maxclients set way too high, so the load causes their server to run out of memory and at that point it's basically dead. The solution to this is either to reconfigure Apache (or switch to a different webserver), or to throw more memory at the problem.
If you don't mind throwing money at the problem, and you don't want to try reconfiguring Apache, you could always just temporarily resize your linode. It's pro-rated by the day, so for example, resizing from a 512 to a 2048 for a single week would cost you an extra $15 or so.
@Alice:
I run my business by myself (i.e., I'm my own tech support). Is there anything I can do at this late stage to prepare for a possible traffic spike?
I suppose if I were in your shoes, the first thing I'd want to know (if I didn't already) was how large a load my current setup could support.
Pick a representative page (or your blog home page perhaps if you know that's where the load increase is likely to hit) and stress test it to see how much it can handle. This can be with a tool like "ab" or through any of the various third party services that exist to load test sites. If you want to be more representative (or think people may be clicking through) run a few tests in parallel to different pages.
You may find that that you're fine up to hundreds or thousands of requests per second, in which case there might not be much to worry about. Or, you may find that you fall over almost immediately such as if you have MaxClients too high as Guspaz suggests). If you do find the site collapsing quickly, fixing items such as MaxClients can go a long way before needing more extreme work. At the very least you should be able to quickly shake out any really bad issues.
Without knowing more about the current server and application stack you are using it's hard to be more concrete about optimization. Certainly I would review posts here in regards to tuning whichever web server and blog software you are using. There's lots of good information for improving responsiveness of Apache and Wordpress, for example.
As a general matter within a given Linode you'll want to consider fastest serving of static resources (so if the blog is a PHP app for example, offload that from the web server with FPM, or if operating within the server like Apache, offload static content to nginx up front), and some level of caching of dynamic content (like APC for PHP, or if the blog is WordPress there are WordPress-specific solutions). Then, if still needed, scaling your Linode or offloading the content to a CDN.
But some of those changes may be more extreme than you need, which is why testing first would be my suggestion. At the very least, you'll have a baseline you can repeat as a test as you make config changes.
– David
If you want to get fancy, you can use a referrer code so that the rush from lifehacker goes to the static page, and the normal everyday people see your normal everyday site.