Azure CDN Sequence of how the CDN works 1. User request goes through CDN 2. CDN goes to Point of Presence a. Points around the world b. Comprised as a set of edge servers 3. PoP goes to origin If the edge server at the point of presence does not have the resource, then the edge server will make a request to the Origin server to get the resource. ● The resource is than cached to the edge server ● Based on a TTL Need to Create CDN profile => then create a CDN endpoint Can have multiple endpoints Caching Caching Rules are only available for caching tiers of Azure CDN Standard from Verizon and Azure CDN Standard from Akamai. Can create caching rules that apply to an entire profile or just a single endpoint. Can also control caching based on query strings. ● Default is to ignore query strings ● Can bypass caching for query strings - If requests contains query strings, go straight to origin server ● Can cache every unique URL Azure Redis Data is stored in memory which allows for faster access rather than from disk Design Considerations ● Don’t load all your database items in Redis ● Store user session data ○ Shopping carts ● Azure Redis also has a message queue Package: StackExchange.Redis To connect, you need to specify the Cache connection Azure Redis operates with key value pairs. For example, to set a cache value for a string, you specify a key and value ● cache.StringSet(“Message”, “This is an application message”) ● cache.StringGet(“Message”) ● For objects, you use JsonConvert.SerializeObject(obj) as the value instead of a string ○ Need to deserialize it back into the object when retrieving Key Scenarios: ● Cache Aside pattern: Load data into cache only as needed, and when system makes a change to data, then you update the cache ● Content Cache: Cache static files like HTML, JS, and CSS files as these won’t change ● Session Store - Common for things like shopping carts. Instead of storing all the data in a cookie, you can use the cookie as a key to query the data in a database, or cache in this instance. ● Job and message queueing ● Distributed Transactions - Executing a batch of commands as a single transaction Pricing Tiers: ● Basic ○ 53 GB of memory, and 20,000 connections ○ No SLA ● Standard ○ Production cache, and supports 2 servers ○ Same memory/connection limits as basic ● Premium ○ Enterprise tier, includes persistence, clustering, and scale-out cache support ○ 530 GB of memory and 40,000 connections Application Insights To incorporate into your application, need to install an instrumentation package ● This package will integrate and send telemetry data to Application Insights Features: ● Request rates, response times, failure rates ● Exceptions and stack traces ● User and session counts ● ● ● ● ● Trace events from application Funnels: ○ Used to see how well your application is being used ○ Percentage of users going on different parts of your app ○ Number of users hitting various web pages User flows: ○ How do users navigate away from a page on your site ○ What do users click on a page on your site ○ Places where users repeat the same action over and over Impact: ○ How does the page load time impact the users navigation ○ If page is slow, does it affect how the user navigates Retention: ○ Gives statistics as to how many users return to your application ○ Do users ever return back after completing a particular task Instrumentation You instrument your app by adding the Application Insights SDK and implementing traces Supports the following languages: ● .NET, Java, Python, Node.js, Javascript Sampling The sampling percentage determines how much is sent to your application insights. Ie. if you don’t want to send all the data to your app insights as that may cost more and you won’t need it Azure Monitor Service Monitoring Tiers ● Application monitoring data - data about performance and functionality of code ● Guest OS monitoring data - data about underlying operating system ● Azure resource monitoring data - monitoring data for Azure resources ● Azure subscription monitoring data - data collected about the operation and management of the Azure subscription ● Azure tenant monitoring data - data collected about the tenant such as Azure Active Directory Azure Front Door A routing tool for web traffic that works at Layer 7 or HTTP/HTTPS Optimizes your application by routing your client requests to the fastest and most available application backend ● Can be any internet facing service that is hosted inside or outside of Azure Features ● URL-based routing ○ Can route traffic to different VMs based on the URL ○ Ex: ■ http://www.whizlab.com/videos/* ■ http://www.whizlab.com/images/* ● Priority ○ Route traffic based on a priority assigned to certain virtual machines ■ If one goes down, then next highest priority gets routed too ● Multiple-site hosting ○ Can configure more than one website on the same Front Door configuration ● Session affinity ○ Can ensure the same user session is mapped to the same application backend ● Secure Sockets Layer (SSL) termination ○ The secure request can be terminated at the Front Door itself. This reduces the load on the application backend instances. ● Web Application Firewall - Can enable web app firewall to protect your web application against internet based attacks. Handling Transient Faults Different retry intervals available ● Exponential back-off - The application will exponentially increase the time between each subsequent retry. In the case of a fault, the application might try again after 3 seconds. Then the next time could be 10 seconds, and so on ● Regular Intervals - Retry the operation after a fixed period of time. Ie. retry every 5 seconds.