Believe me when I say that we regularly overestimate the actual resource requirements for our applications. To be fair, it used to be the right thing to do. But when it comes to the cloud, the right way to go about resource requirements is to start small and to scale out to maintain your applications’ target performance. If scaling out isn’t working because the Virtual Machine lack RAM, CPU or local temporary storage its time to think about scaling up.
Scaling out and scaling up are quite different. In a cloud environment like Windows Azure, scaling out should always be your first choice. Scaling up should be a last resort! Some of the main reasons behind favoring scaling out are durability (tolerance to hardware failure), scalability and availability (benefiting from the 99.995% uptime guarantee).
Scaling out means that you are distributing the load over a various Virtual Machine. If there is a need for greater availability, it can be achieved by adding more Virtual Machine instances. Scaling out will not make your code run faster, but it will provide a constant end user experience. For example, if your website is supposed to respond under 100ms and you have a lot of traffic, you can spin up new instances of your Web Role to reduce the response time.
Choosing the right Virtual Machine size can be difficult. As of 01/01/2013 the following are available on Windows Azure.
Regularly, the extra small Virtual Machine provides more than enough resources. On occasions, when it does not meet your processing requirements I recommended scaling up to a small Virtual Machine. It will provide the same CPU clock speed as the extra large Virtual Machine. Scaling up from a small Virtual Machine should happen when your application takes advantage of parallelism (multi-threading), more RAM, better I/O performance or more local storage make sense. Be sure that to fully exploits one or all of these characteristics before scaling up. Beware that underutilizing resources will result in overspending.
When choosing the Virtual Machine size for a Role, start with an extra small Virtual Machine. Then through diagnostics and profiling optimize your processes. If the predetermined target performance requirements are not met, test the Role on different Virtual Machine sizes. All applications are unique and consume resources differently, the key to finding the right Virtual Machine size is testing.
Summary
- Start small and scale up to satisfy predetermined performance targets
- Underutilizing resources results in overspending
- Regularly, the extra small Virtual Machine provides more than enough resources
- Prefer scaling out to scaling up
- Reasons to favor scaling out include durability, scalability and availability
- Keep in mind that larger Virtual Machine configurations do not provide higher CPU clock speeds