Sunday, 27 May 2012

Amazon EC2 Micro Instance and Stolen CPU / Throttling

Last week I started using EC2 for more than just testing a few things and found that my micro instance was for some reason running incredibly slowly. It took me a little while to find out why:

Amazon's description for micro instances is as follows: 
Micro instances (t1.micro) provide a small amount of consistent CPU resources and allow you to increase CPU capacity in short bursts when additional cycles are available. They are well suited for lower throughput applications and web sites that require additional compute cycles periodically.

The description doesn't make it obvious that short bursts can only be about 10 seconds long. After that the instance slows to a snail's pace! This can be explained by having a quick look at 'top'.

The 98.0%st refers to the 98% of CPU time that is reallocated by the host server and not available to your micro instance. This means that after a 'short burst' your instance can only use 2% of its CPU.

The only solution is to upgrade to a small instance or above - this seems to be Amazon's way of persuading people to pay higher fees for their servers. Micro instances can be good for certain uses, but for consistent performance you'll have to fork out the extra fees for a bigger server.