Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Azure

Accessing the Surveys Application : Content Delivery Network

7/11/2011 5:52:44 PM
- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
The Windows Azure Content Delivery Network (CDN) allows you to have binary large object (BLOB) content cached at strategic locations around the world in order to make that content available with the maximum possible bandwidth to users and minimize any latency. The CDN is designed to be used with BLOB content that is relatively static. For the Surveys application, the developers at Tailspin have identified two scenarios where they could use the CDN:

The CDN enables you to have data that is stored in BLOBs cached at strategic locations around the world.

  • Tailspin is planning to commission a set of training videos with titles such as “Getting Started with the Surveys Application,” “Designing Great Surveys,” and “Analyzing your Survey Results.”

  • Hosting the custom images and style sheets that subscribers upload.

In both of these scenarios, users will access the content many times before it’s updated. The training videos are likely to be refreshed only when the application undergoes a major upgrade, and Tailspin expects subscribers to upload standard corporate logos and style sheets that reflect corporate branding. Both of these scenarios will also account for a significant amount of bandwidth used by the application. Online videos will require sufficient bandwidth to ensure good playback quality, and every request to fill out a survey will result in a request for a custom image and style sheet.

One of the requirements for using the CDN is that the content must be in a BLOB container that you configure for public, anonymous access. Again, in both of the scenarios, the content is suitable for unrestricted access.

For information about the current pricing for the CDN, visit the Windows Azure Platform website at http://www.microsoft.com/windowsazure/offers/.


Note:

For data cached on the CDN, you are charged for outbound transfers based on the amount of bandwidth you use and the number of transactions. You are also charged at the standard Windows Azure BLOB storage rates for the transfers that move data from BLOB storage to the CDN. Therefore, it makes sense to use the CDN for relatively static content. With highly dynamic content, you could, in effect pay double, because each request for data from the CDN triggers a request for the latest data from BLOB storage.


The Solution

To use the CDN with the Surveys application, Tailspin will have to make a number of changes to the application. The following sections describe these changes. This section describes the planned solution; the current version of the Surveys application does not include the use of the CDN.

1. Setting the Access Control for the BLOB Containers

Any BLOB data that you want to host on the CDN must be in a BLOB container with permissions set to allow full public read access. You can set this option when you create the container by calling the BeginCreate method of the CloudBlobContainer class or by calling the SetPermissions method on an existing container. The following code shows an example of how to set the permissions for a container.

protected void SetContainerPermissions(String containerName)
{
CloudStorageAccount cloudStorageAccount =
CloudStorageAccount.FromConfigurationSetting(
"DataConnectionString");
CloudBlobClient cloudBlobClient =
cloudStorageAccount.CreateCloudBlobClient();

CloudBlobContainer cloudBlobContainer =
new CloudBlobContainer(containerName, cloudBlobClient);

BlobContainerPermissions blobContainerPermissions =
new BlobContainerPermissions();
blobContainerPermissions.PublicAccess =
BlobContainerPublicAccessType.Container;
cloudBlobContainer.SetPermissions(blobContainerPermissions);
}

Notice that the permission type used to set full public access is BlobContainerPublicAccessType.Container.

2. Configuring the CDN and Storing the Content

You configure the CDN at the level of a Windows Azure storage account through the Windows Azure Developer Portal. After you enable CDN delivery for a storage account, any data in public BLOB containers is available for delivery by the CDN.

The application must place all the content to be hosted on the CDN into BLOBs in the appropriate containers. In the Surveys application, media files, custom images, and style sheets can all be stored in these BLOBs. For example, if a training video is packaged with a player application in the form of some HTML files and scripts, all of these related files can be stored as BLOBs in the same container.


Note:

You must be careful if scripts or HTML files contain relative paths to other files in the same BLOB container because the path names will be case sensitive. This is because there is no real folder structure within a BLOB container, and any “folder names” are just a part of the file name in a single, flat namespace.


3. Configuring URLs to Access the Content

Windows Azure allocates URLs to access BLOB data based on the account name and the container name. For example, if Tailspin created a public container named “video” for hosting their training videos, you could access the “Getting Started with the Surveys Application” video directly in Windows Azure BLOB storage at http://tailspin.blob.core.windows.net/video/gettingstarted.html. This assumes that the gettingstarted.html page is a player for the media content. The CDN provides access to hosted content using a URL in the form http://<uid>.vo.msecnd.net/, so the Surveys training video would be available on the CDN at http://<uid>.vo.msecnd.net/video/gettingstarted.html.

Figure 1 illustrates this relationship between the CDN and BLOB storage.

Figure 1. The Content Delivery Network


You can configure a CNAME entry in DNS to map a custom URL to the CDN URL. For example, Tailspin might create a CNAME entry to make http://files.tailspin.com/video/gettingstarted.html point to the video hosted on the CDN. You should verify that your DNS provider configures the DNS resolution to behave efficiently; the performance benefits of using the CDN could be offset if the name resolution of your custom URL involves multiple hops to a DNS authority in a different geographic region.


Note:

In addition to creating the CNAME entry for your custom domain name in the tool you use for managing your DNS entries, you must also configure the custom domain name in the storage account settings. You should use the Custom Domains section on the Summary Page in the Windows Azure Developer Portal to complete this task.


When a user requests content from the CDN, Windows Azure automatically routes their request to the closest available CDN endpoint. If the BLOB data is found at that endpoint, it’s returned to the user. If the BLOB data is not found at the endpoint, it’s automatically retrieved from BLOB storage before being returned to the user and cached at the endpoint for future requests.

4. Setting the Caching Policy

All BLOBs cached by the CDN have a time-to-live (TTL) period that determines how long they will remain in the cache before the CDN goes back to BLOB storage to check for updated data. The default caching policy used by the CDN uses an algorithm to calculate the TTL for cached content based on when the content was last modified in BLOB storage. The longer the content has remained unchanged in BLOB storage, the greater the TTL, up to a maximum of 72 hours.

If the BLOB data is not found at the endpoint, you will incur Windows Azure storage charges when the CDN retrieves the data from blob storage.


Note:

The CDN retrieves content from BLOB storage only if it is not in the endpoint’s cache, or if it has changed in BLOB storage.


You can also explicitly set the TTL by using the CacheControl property of the BlobProperties class. The following code example shows how to set the TTL to two hours.

blob.Properties.CacheControl = "max-age=7200";
Other -----------------
- Accessing the Surveys Application : Authentication and Authorization
- Working with Data in the Surveys Application : Using SQL Azure
- Using Cloud Services : Collaborating on Contact Management - Exploring Contact Management and CRM Applications
- Using Cloud Services : Collaborating on Event Management - Exploring Event Management Applications
- Working with Data in the Surveys Application : Displaying Data (part 3) - Displaying Questions & Displaying the Summary Statistics
- Working with Data in the Surveys Application : Displaying Data (part 2) - Session Data Storage
- Working with Data in the Surveys Application : Displaying Data (part 1) - Paging through Survey Results
- Microsoft Azure: Enterprise Application Development - Queue Storage
- Microsoft : Azure Enterprise Application Development : Web Role
- Microsoft Azure: Enterprise Application Development - Worker Roles
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 windows Phone 7 windows Phone 8
programming4us programming4us
 
programming4us
Natural Miscarriage
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Game Trailer