EC2 Micro Instance Limitations

EC2 offers a lot of advantages over many web site hosting options.  I am a bit of a control freak and like having full control over my web server.  This has advantages and disadvantages of course, meaning more work but more flexibility.  Running a WordPress blog on a micro instance can be a serious challenge.  I have fought with getting my site to have a minimum level of stability, and here are some of my notes on what helped.  Amazon offers a free EC2 micro instance for a year to new users, so it is a very attractive option for hosting a web site.

The EC2 micro instance is pretty cheap compared to the other system options that Amazon offers, but there are some caveats that may shock you after using it for a while.  There are a couple of major problems with using this option for hosting a website:

  • CPU Usage restrictions: If you use 100% CPU for more than a few minutes, Amazon will “steal” CPU time from the instance, meaning that they throttle your instance.  This can last (from my observations) as long as five minutes, and then you get a few seconds of 100% again, then the restrictions are back.  This will cripple your website, making it slow, and even timing-out requests.
  • Limited Memory: The instance is limited to 613MB of RAM, and does not have a swap partition.  If you run out of memory the system will panic and reboot.
Here is one symptom of CPU throttling from EC2, looking at the CPU usage from the “top” command:
According to the top man page: “st = steal (time given to other DomU instances)

 

If you have more than 1000 visitors or so a day, a micro instance probably isn’t worth your time.  But for many small sites (like mine) it does make sense.  I wasn’t aware of these limitations before setting up my site, and I very quickly ran into site reliability issues.  Here are a few of the things that I did to make my site more stable.

You can save a lot of money by purchasing a reserved instance for a year, but my advice is to run for a few months before making the leap.  If you find that your micro instance doesn’t cut it, you have just thrown away a chunk of cash.

So, let’s look at a few of the things you can do to make a WordPress site run reasonably well on a Micro Instance:

  • Configuration:
  • Tune Apache to run the correct number of threads.
  • Use the minimum required memory for MySQL.
  • Pre-cache your web pages.
  • Use a content distribution network (CDN) such as CloudFront.
  • Setup a swap partition.
  • Reacting to site overload:
    • Configure alerting for CPU usage and network traffic.
    • Be ready to rent a larger instance if you get a big traffic spike.
    • Use a 32 bit operating system.

    Continue reading »

    I am back in school, and that means research papers, hooray.  I am being smarter about it all these days though–templates and citation management software are definitely the way to go!

    It would sure be nice if Apple would include templates for the major paper formats with their word processor.  And all the ones I could find that others had posted were either not really templates, or got the formatting wrong.

    So I created one based off of their research paper template that references the latest rules at Purdue.  I couldn’t have done it so quickly if it weren’t for this great tutorial over at the Mac Law Students website, thanks for the handy write-up.

    So, if you came here looking for a free APA template for Pages, try this one out and let me know if it works for you: APA template for Pages 09′.

    Updated July 17, 2009: Fixed a few annoyances in the template (page titles were not repeating and hyphenation was set for document.)