One of the popular instance types supported by Amazon EC2 is the Micro Instance. In November 2010, Amazon announced the free tier and started offering 750 hours of Micro Instance usage free per month for the first one year. Initially this offer was available only to Amazon Linux instances but last month AWS announced that they are extending this to Microsoft Windows Server instances.
Looking at the technical specifications, the Micro Instance type doesn’t have the muscle required for heavy lifting. It comes with burst CPU capacity that can go up to 2 Elastic Compute Units (ECU). That means the CPU performance is not predictable. The main memory offered is 613MB! This is just not sufficient for running any serious workloads. Of course, storage can be added through EBS and the free tier covers up to 30GB of storage.But it doesn’t mean Micro Instances are totally useless. They offer excellent value in certain scenarios. In this article, I want to share how to get the best out of the Amazon EC2 Micro Instances and the dos and don’ts of using them.
Consider Scaling Out – The mantra on the Cloud is scaling out. Running a fleet of low-end servers in parallel is efficient and cost effective on any virtualized infrastructure. Based on the workload and use-case, splitting a job across ten’s of Micro Instances may be cheaper and faster than running the same job on a single Large Instance. This scale out architecture provides better fail over and faster processing. Do consider splitting the job or process and running it on a bunch of Micro Instances.
Optimize Swap Memory - This is applicable to Linux based Micro Instances. By default, these instances do not have swap space configured. I ran my WordPress blog on a Micro Instance for a few weeks. During the peak loads, I have experienced Apache or MySQL crashing unexpectedly. It didn’t take me long to realize that it is the memory which is the culprit. With just 613 MB at your disposal, you got to make sure that you have set aside enough disk space for the swap. This will dramatically increase the reliability of Micro Instance. Below are the commands that you need to run to add swap space to your Linux based Micro Instance. Here is a step-by-step guide to add the swap space on Linux.
Consider Caching – If you are planning to host websites on Micro Instances, make sure that they are not very dynamic. Dynamic websites demand more CPU and memory due to the way each request is processed. Simple websites like blogs and marketing sites with a few dynamic pages are good candidates for the Micro Instances. Even there, consider caching the content to avoid CPU spikes. For example, if you are running WordPress, you can enable plug-ins like W3 Total Cache or WP Super Cache to increase the performance.
Tweak the Running Services – Micro Instances can offer tremendous value for if leveraged properly. I know many customers running a Linux Micro Instance to run cron jobs and specific background tasks that monitor and manage their complete AWS infrastructure. To get the best out of a Micro Instance, decide one and only thing that you want from that instance. If you want to run a cron job, stop all the services, add swap space and tweak it to make it a lean and mean cron job machine. Same is the case with running a Web Server or any other server role. But avoid the temptation of running the entire stack on the same Micro Instance. This will degrade the performance further and makes it unreliable.
Go for 64-bit – Always choose 64-bit when running Micro Instances. This is guaranteed to give you better performance than the 32-bit counterpart. You will see the difference when you are running batch processing that deals with large files.
Windows Server on Micro Instance – Please don’t even attempt it! Though AWS added Windows Server to the free tier and it may be tempting to launch Windows instances running as Micro Instances, let’s be realistic! It is nowhere close to the minimum configuration recommended by Microsoft. Even Windows XP that came a decade ago demanded a better configuration than the Micro Instance specifications. 613 MB with half-a-CPU can turn out to be quite adventurous if you run Windows Server. I personally wouldn’t recommend anything less than a large instance to run Microsoft Windows Server on Amazon EC2.
Hope this gave you the tips to get best out of the Micro Instances. Please do share your experiences running a Micro Instance.
- Janakiram MSV, Chief Editor, CloudStory.in
- Micro Instance
- Elastic Compute Cloud
- Microsoft Windows Server
- Amazon Web Services