Reader small image

You're reading from  Hands-On Azure for Developers

Product typeBook
Published inNov 2018
PublisherPackt
ISBN-139781789340624
Edition1st Edition
Tools
Right arrow
Author (1)
Kamil Mrzygłód
Kamil Mrzygłód
author image
Kamil Mrzygłód

Kamil Mrzygłód is a technical lead and technology advisor, working with multiple companies on designing and implementing Azure-based systems and platforms. He's a former Microsoft Azure Microsoft Most Valuable Professional (MVP) and certified trainer, who shares his knowledge via various channels, including conference speeches and open source projects and contributions. Kamil lives in Poland with his two cats and one dog, dedicating some of his time to video games, cooking, and traveling.
Read more about Kamil Mrzygłód

Right arrow

Serving Static Content Using Azure CDN

Hosting many static files, especially when we're developing a highly popular application, is a serious task, which impacts both the performance of our web service, and overall user experience. If we load images, files, or document too slowly, our customers may choose one of our competitors that provides similar features, but performs better. Thanks to cloud services such as Azure Content Delivery Network (CDN), we're able to handle high-bandwidth content quickly, due to integration with Azure Storage and using components native to Azure.

The following topics will be covered in this chapter:

  • CDNs
  • Using and configuring Azure CDN
  • Optimizing serving static content using Azure CDN
  • Developing applications using Azure CDN

Technical requirements

To perform exercises from this chapter, you will need the following:

  • An Azure subscription
  • Visual Studio 2017

Azure CDN fundamentals

If you are hosting a popular website that contains many static files, you may wonder what is the best way to optimize serving them to your users. When searching for a solution, you have to take into consideration many different factors; HTTP protocol specification, browser capabilities, your server performance, network latencies, and so on. The whole problem is far from being trivial and requires significant resources to be implemented in the right way. To overcome the listed difficulties, the idea of CDNs was developed. CDN stands for content delivery network, and encapsulates the concept of a complex service that takes care of delivering the content to everyone who browses your website. In this chapter, you will learn about Azure CDN, which is an Azure component that is designed to be a fast and reliable solution for all the listed problems.

...

Optimization and caching

CDNs are all about optimizing the content and caching it. In that way, they improve the performance of your website and user experience. In the previous section, you learned a little bit about the concept of Content Delivery Networks and configured your instance of Azure CDN. Now we will try to learn some more advanced features, such as compression, caching rules, and optimization.

Configuring the endpoint

To access the endpoint configuration, you have to click on it on the Overview blade:

This will display a new screen, where you can find all information regarding that particular CDN endpoint, such as its hostname, available protocols, and configured rules for content optimization. In fact, the...

Developing applications with Azure CDN

Azure CDN itself does not give you anything special—it just caches content and takes responsibility for serving it without delays. The important thing, however, is to know how you can use it in your applications. In Azure, integrating Azure CDN with, for example, Azure App Services, is a piece of cake. It only takes a few mouse clicks to get your CDN working with your existing web applications. In the last section of this chapter, you will see what is required to get the integration set up and ready to improve your website's performance.

Configuring Azure App Service with Azure CDN

To configure Azure App Service to work with your instance of Azure CDN, you will have to find...

Summary

In this chapter, you learned what CDNs are and how they may help you in achieving better performance and user experience for your web applications. We have configured an Azure CDN instance, and saw how to optimize serving content by compressing it. After reading this chapter, you should be able to filter particular content for particular countries, and be able to develop proper caching rules, so that you can define how your instance will behave.

In the next chapter, which is the last chapter in this book describing Azure services, we will cover one more advanced scenario—distributing load and securing data from outages with Azure Traffic Manager.

Questions

  1. What problems does using Azure CDN solve?
  2. What are the available CDN providers for Azure CDN?
  3. What is the origin of the CDN?
  4. How does compression work in Azure CDN?
  5. What is the default TTL of content stored within Azure CDN?
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Hands-On Azure for Developers
Published in: Nov 2018Publisher: PacktISBN-13: 9781789340624
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $19.99/month. Cancel anytime

Author (1)

author image
Kamil Mrzygłód

Kamil Mrzygłód is a technical lead and technology advisor, working with multiple companies on designing and implementing Azure-based systems and platforms. He's a former Microsoft Azure Microsoft Most Valuable Professional (MVP) and certified trainer, who shares his knowledge via various channels, including conference speeches and open source projects and contributions. Kamil lives in Poland with his two cats and one dog, dedicating some of his time to video games, cooking, and traveling.
Read more about Kamil Mrzygłód