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
What are the benefits of caching
Scalability and resilience
What are some of the Caching Patterns?
- Cache-asign Pattern
- Content Cache Pattern
- User Session Caching Pattern
- Advanced Patterns such as Job And Message Queuing
Explain the Cache-assign pattern
Does the data exist in the cache?
If not retrieve from the data store
Store the new copy in the cache
Explain the Content Cache Pattern
Cache static content such as Images, Templates, and Style Sheets
Explain the User Session Caching Pattern
An example would be storing shopping cart data for a user for the session
Can use cookies ofr Local Storage but limited on the amount of data these options can have and is slower
Explain the Advance Pattern, Job and Messaing Queuing Pattern
Offload longer running taskes into queues that can run in sequence
Important - Configuring and optimizing Redish Cache on Exam
What are some considerations for provisioning the right Redis Cache
- Number of concurrent cache objects
- Size of the cache objects
- Number of requests to cache
- Standard C3 tier => 100,000 request a second but drops to 90,000 over an SSL connection
- Cache expiration policy
Do not want to overprovision!
Redis Cache Benchmark Utility (Cannot run on Portal)
Redis-benchmark -q -n 100000
Identity and briefly explain the two retry policies in Redis Cache
Linear Retry
* Specify a retry duration (i.e. 5 seconds)
Exponential Retry
* Retry durations increases with each subsequent attempt
* Radom values being chosen between deltaBackoff and maxDeltaBackoff
What are some consideration regarding security in Redis Cache and options for securing
Encryption in Transit
* Uses TLS 1.2
* TLS 1.1 supported for compatibility
* Redis can support HTTP but not recommended for production. Is disabled by default
Encryption at Rest
* In memory data IS NOT ENCRYPTED or not supported in Azure
* Premium tiers does allow backup to Storage Accounts but data can be encrypted there
Note: If you disable HTTPS to allow HTTP, you need to change the Primary and Secondary connection string PORT numbers. Default for HTTPS is 6380.