Tuesday, July 8, 2014

Part 13 : Windows Azure Web Sites - Basics 2 - Web Hosting Plan mode

Windows Azure Region
We have seen in the previous tutorial that we have to select the region while creating a website in Windows Azure Management portal. Windows Azure uses the idea of regions to manage the physical distribution of your applications and data. A region represents a Microsoft data center where you can deploy your application. There are many regions available in Windows Azure like Asia, Europe, North America and it keeps on increasing.


Choosing a region will have direct impact on Network Latency. You want to deploy your application to the data-center that is closest to your user base. Also you want to replicate your data across multiple regions so that if one region or data center is offline, your application still be available. Windows Azure have options to deal with this (Traffic Manager, CDN) and we will learn  that in later tutorial.


Web Hosting Plan Mode
Web Hosting Plans can be shared across multiple web sites. Each plan has a mode associated with it. Different modes expose different sets of features and capabilities. Currently Azure Web sites is offered in four modes for hosting your websites : Free, Shared, Basic and Standard.

Shared mode is in preview feature as time of writing.  Plans in the Free and Shared modes run on a shared infrastructure with sites managed by other customers. These sites will have strict quotas for resource utilization. Plans in the Basic and Standard modes run on resources that are dedicated to your sites and have fewer restrictions.

Free
Free is the default scale for any website that is newly created in Windows Azure Websites.You can run upto 10 free websites in this mode. In Free mode your website is hosted on the same Virtual Machines as other sites (also known as multi-tenant hosting environment) and you cannot scale a single website on multiple web servers.  So the same server where your website is hosted can  be shared by many different websites. Shared means each website is taking up some amount of memory and utilizing some portion of the CPU.

Using this free mode, you can start your development and testing of websites at no cost at all. Obviously "free" comes with some limitations. In this case you can run websites that can serve 165MB of outbound traffic per day(5GB/month) , 60 minutes of CPU per day, per region. Storage is limited to 1GB.

Also with free mode, you cannot assign custom domain to the site. With free mode the site name will always be <sitename>.azurewebsites.net.

And yes one more thing, free site does not have any SLA.

Free mode is generally used by developers and testers during development.

Shared (Preview Mode)
Hosting website in this mode reduce some of the restrictive quotas associated with Free Mode, but computing resources are still shared.  Your website will still be hosted on the same Virtual Machine as other sites. In the Shared mode your CPU usage quota is 4 hours per day with storage limited to 1GB. The first 5 GB/month of bandwidth you serve with a shared web-site is free, and then you pay the standard “pay as you go” Windows Azure outbound bandwidth rate for outbound bandwidth above 5 GB.

You can scale out your website to maximum of 6 shared instances. Windows Azure will automatically configure load balancing for it.  In shared mode, you can set up multiple custom domain for your website rather than stuck up with .azurewebsites.

The price for the Shared tier during preview is $0.013 per hour (~$10/month). This price reflects a 33% preview discount.

Shared website also don't have any SLA.

Shared mode is good for personal sites or for the sites that doesn't have large amount of traffic and can withstand some duration of down time in case of crossing the quota.

I would like to point out here that it is very essential to have put quota on Free and Shared mode, so that one website should not eat up all the memory or dominate the CPU. And when I said CPU usage quota is 1 hour per day, that doesn't means that your website can be up only for 1 hour per day. That actually means is that your website can use 1 hour of CPU time in 24 hours. Your website needs CPU cycles only when it is serving some page requests, provided it's not coming from cache. Each request uses only seconds of CPU time. So it may be possible that your website is up for hours if traffic is low or use the quota in minutes if traffic is very high.

Remember that both in Free and Shared mode, once you cross the quota, any request to your website will be redirected to a page that tells that this site has exceeded the quotas. If this is your mission critical website or any website that generates revenue, you don't want this to happen. In this case you need to go for either Basic or Standard mode.

Basic
In Basic mode, you websites are guaranteed to run in a seperate VM which is dedicated for your website.
This option removes any need for the memory and CPU quotas since you are the only tenant on the machine.
You can choose the size of the VM Small, Medium or Large VM and you can run any number of web-sites within a VM. The storage is increased to 10GB for all your websites. You can also set up multiple custom domain for your website

Note that with this option all your website in that region or datacenter are hosted by the same reserved instance. There is no per site cost  in this mode. You pay only for the reserved instance you use and you can run any number of websites in that instance. You can choose between the small, medium or large instance.
So lets say you have very high traffic websites that require 2 large VM instance and another site with very low traffic, both will enjoy the benefit of 2 instance if they are in the same data-center(region).
So basically even though you are paying more, you can save by deploying multiple websites on an instance that is dedicated to you.


You can run sites on a single reserved VM instance or scale up to have multiple instance all running your websites. You can scale upto 3 dedicated VM instances. You can also scale up a single instance by increasing the size of your VM instance (small to medium or large). Windows Azure will automatically configure load balancing for it.

Standard
Everything we say about Basic mode is applicable to standard with more quota and features. In standard mode also, your websites run in a separate VM without any quota for CPU and memory. You can run any number of sites in that reserved instance. The storage is increased to 50 GB and Custom domains are supported.

You can choose between small, medium or large instance. You can scale up to 10 dedicated instances. You can also scale up a single instance by increasing the size of your VM instance. Windows Azure will automatically configure load balancing for it.

One of the biggest feature of Standard mode is Auto Scale. In other modes, you have to manually monitor the traffic and scale up or down based on the traffic (we can scale up or down through Windows Azure Management Portal, i'll show this in just a moment). Auto Scale allows you to dynamically adjust the capacity based on the load your websites is experiencing. You can set rules to trigger the scaling of your instances. For example, you can set a trigger that if CPU becomes overloaded , add one more instance, or you can also schedule it, on weekends increased the number of instance to 4. You can auto scale up or down your instances.

Also note that if you choose an option of reserved instance, all your websites under your subscription will be moved to the reserved instance. You don't have an option to run some websites in shared mode and other in reserved mode. If you wish to do that, you have to divide the websites in different subscriptions.


In the next tutorial we will see how we can scale websites up and down depending on our needs.


No comments:

Post a Comment