Caching and Content Delivery Flashcards
Steps to create a CDN resource
- Name
- Subscription
- Resource Group
- Select Pricing Tier (Standard, Premium)
- Endpoint Name
- Orign Type
- Origin Name
What is CDN and what are some of the benefits?
- Global distrubtion network
- Reduce asset load times
- Reduce hosting bandwidth costs
- Increase availabitlity and redundancy
- Protection from denial-of-service attaches
Content Types
Static
* Images
* CSS
* JS Files
Dynamic Content
* Changes or user interaction
* Dashboards
* Query Results
What is the default Time To Live if none is specified?
7 Days is the default
What are the 4 CDN products?
- Azure CDN Standard (Verizon)
- Azure CDN Standard (Akamai)
- Azure CDN (Microsoft)
- Azure CDN Premium (Verizon)
What are the 3 caching rules?
- Global
- Custom
- Query String
What are the features of the Global rule?
- Only one per CDN endpoint
- Overrides cache headers sent by client
What are the features of a Custom rule?
- Can create as many as you want
- Can be on extension type or path in your application
- Are applied in order
- They override ANY global caching rules that you may have defined
What are the features of the Query String rule?
Ignore Query Strings
* The first request goes to origin service if doesn’t exist in CDN
* Returns the results and caches the results on CDN
* Any add’l requests for that asset are served from the CDN and ignores the query string until the expiration
Bypass Query String
* No caching
Cache Every Unique URL
* Each is treated as a unique asset with its own cache AND OWN TIME TO LIVE
* Shouldn’t really use this mode if you have query strings that change with every request (low hit ratio and bad performance)
What are the 4 caching behaviors for Global?
By Pass Cache
* Not cached al all even if cache headers are sent
Override
* Override the cache headers settings setting a default cache duration for all items
Set if Missing
* Apply a custom time to live if the cache control header hasn’t been set by the requesting client
Not Set
* Which will honor any cache control headers that have been set, but won’t change the TTL value
Under the custom caching, what are the fields you need to set values for?
- Match Condition
- Match value(s)
- Caching Behavior
- Days
- Hours
What is Redis Cache
- Operates like an in-memory database
- Can work as a database cache
- Event a message broker
What are the 5 pricing tiers for Redis Cache?
- Basic
- Standard
- Premium
- Enterprise
- Enterprise Flash
Redis Cache
What are the features of the Basic pricing tier?
- Supports less throughput and has high latecy
- No SLA
- Should not be used in a PRODUCTION environment
- Upt to 53GB of memory and 20,000 connected clients
Redis Cache
What are the features of the Standard pricing tier?
- 2 replicated nodes
- 99.9% availability
- 53 GB of memory and 20,000 connected clients
Redis Cache
What are the features of the Premium pricing tier?
- Redis cluster
- Enterpise-grade
- High throughput and low latecy
- 99.95% availability
- 100 GB and 40,000 connected clients
Redis Cache
What are the features of the Enterprise pricing tier?
- Full Redis feature set
- 99.99% availability
- Designed for massive yet cost-effective cache implementations
Redis Cache
What are the features of the Enterprise Flash pricing tier?
- Same features as Enterpreise but has the addition of fast, novolatile flash storage
Redis Cache
Scaling
Can always scale up but can never scale down
Important
For the exam that you understand how caching policy can have on the performance and itegrity of an application. Things to consider are…
- Improve performances and scalability
- Move frequency accessed data closer to the application
- Faster response times
Redis Cache
When should we cache
- When an application is repeatedly reading the same data
- Data source performance (database)
- Data contention
- Physical Location of the Data (other region or on-premises)
What are some of the principals when considering managing lifetime in Redish Cache?
- There is no default expiration and must be set manually
- Ratge of change of the underlying data
- Shorter expiry for volatile data
- Risk of outdated data
- Lower TTL to match data change
- Even if your caching is for seconds or minutes, you can greatly improve the performance of your application for frequenty access data
Redis Cache
Provide an example of setting a cache value
client.StringSet(“Key”, “Value”, new TimeSpan(3,0,0));
The above example is set for 3 hours
Azure Redis Cache Best Practices
- Watch for data loss
- We typically use in between our application and the primary source of data
- Always set the expiry time
- Keys that are created with no TTL can live forever but Redis Cache could remove them if running out of memory
- Add Jitter to spread database loads (Don’t what all cache items to expire at the same time)
- Avoid caching large objects and consider breaking them down into smaller objects (Storing large objects can lead to timeouts)
- Redish cache MUST be in the same region as your application