Bird
Raised Fist0
Azurecloud~20 mins

Purging CDN cache in Azure - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
CDN Cache Purging Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What happens when you purge a CDN cache?
When you purge a CDN cache, what is the immediate effect on the content delivery?
AThe CDN permanently disables caching for the purged content, serving all requests directly from the origin.
BThe CDN compresses the cached content to save space but continues serving it without contacting the origin.
CThe cached content is deleted from all CDN edge servers, forcing fresh content retrieval from the origin on next request.
DThe CDN redirects all requests for the purged content to a backup CDN provider.
Attempts:
2 left
💡 Hint
Think about what 'purging' means in terms of cached data.
❓ Architecture
intermediate
2:00remaining
Designing a system to purge CDN cache efficiently
You need to design a system that triggers CDN cache purges automatically when content updates occur. Which architecture best supports this?
AA webhook from the content management system triggers a serverless function that calls the CDN purge API for updated content paths.
BA scheduled batch job runs daily to purge the entire CDN cache regardless of content changes.
CUsers manually submit purge requests through a web portal after content updates.
DThe CDN is configured to never cache content, so no purge system is needed.
Attempts:
2 left
💡 Hint
Consider automation and minimizing unnecessary purges.
❓ scaling
advanced
2:00remaining
Handling large-scale CDN cache purges
Your application serves millions of users globally and updates content frequently. What is the best approach to scale CDN cache purging without causing performance issues?
ABatch purge requests by grouping updated URLs and rate-limit purge API calls to avoid CDN overload.
BPurge the entire CDN cache every time any content changes to ensure freshness.
CDisable CDN caching during high update periods to avoid purging.
DUse multiple CDN providers and purge only one at a time.
Attempts:
2 left
💡 Hint
Think about balancing freshness and system load.
❓ tradeoff
advanced
2:00remaining
Tradeoffs in purging CDN cache aggressively vs. lazily
What is a key tradeoff when choosing to purge CDN cache aggressively (immediately after every update) versus lazily (periodically)?
AAggressive purging reduces origin load but increases stale content; lazy purging increases origin load but ensures freshness.
BAggressive purging ensures freshest content but increases origin load; lazy purging reduces load but risks serving stale content.
CAggressive purging disables CDN caching permanently; lazy purging disables caching temporarily.
DAggressive purging only works with static content; lazy purging only works with dynamic content.
Attempts:
2 left
💡 Hint
Consider freshness versus system resource usage.
❓ estimation
expert
2:00remaining
Estimating purge request volume for a global CDN
Your website updates 10,000 unique content items daily. Each update requires purging the CDN cache for that item. If your CDN provider limits purge API calls to 1,000 per minute, what is the minimum time in minutes to complete all purges?
A0.1 minutes
B100 minutes
C1 minute
D10 minutes
Attempts:
2 left
💡 Hint
Divide total purge requests by the rate limit per minute.

Practice

(1/5)
1. What is the main purpose of purging a CDN cache in Azure?
easy
A. To increase the storage capacity of the CDN
B. To remove outdated content so users get the latest version
C. To add new content to the CDN cache
D. To monitor traffic statistics on the CDN

Solution

  1. Step 1: Understand CDN cache role

    CDN caches store copies of content to serve users faster.
  2. Step 2: Purpose of purging cache

    Purging removes old cached content so fresh content is served.
  3. Final Answer:

    To remove outdated content so users get the latest version -> Option B
  4. Quick Check:

    Purging = Remove outdated content [OK]
Hint: Purging means clearing old cache to refresh content [OK]
Common Mistakes:
  • Thinking purging adds content instead of removing
  • Confusing purging with monitoring or scaling
  • Believing purging increases storage capacity
2. Which Azure CLI command correctly purges the CDN cache for a specific content path?
easy
A. az cdn endpoint purge --resource-group MyGroup --profile-name MyProfile --name MyEndpoint --content-paths '/images/*'
B. az cdn endpoint create --resource-group MyGroup --profile-name MyProfile --name MyEndpoint --content-paths '/images/*'
C. az cdn endpoint start --resource-group MyGroup --profile-name MyProfile --name MyEndpoint --content-paths '/images/*'
D. az cdn profile purge --resource-group MyGroup --name MyProfile --content-paths '/images/*'

Solution

  1. Step 1: Identify correct command for purging

    The command to purge cache is az cdn endpoint purge.
  2. Step 2: Check parameters

    It requires resource group, profile name, endpoint name, and content paths.
  3. Final Answer:

    az cdn endpoint purge --resource-group MyGroup --profile-name MyProfile --name MyEndpoint --content-paths '/images/*' -> Option A
  4. Quick Check:

    Purging uses az cdn endpoint purge [OK]
Hint: Purge command uses 'endpoint purge' with content paths [OK]
Common Mistakes:
  • Using 'create' or 'start' commands instead of 'purge'
  • Confusing profile purge with endpoint purge
  • Omitting required parameters like endpoint name
3. Given this Azure CLI command:
az cdn endpoint purge --resource-group RG1 --profile-name Profile1 --name Endpoint1 --content-paths '/css/*' '/js/app.js'
What will happen after running it?
medium
A. The command will fail due to incorrect syntax
B. Only the '/css/*' files will be purged from the CDN cache
C. Both '/css/*' and '/js/app.js' files will be purged from the CDN cache
D. Only '/js/app.js' will be purged, '/css/*' will be ignored

Solution

  1. Step 1: Analyze content-paths parameter

    The command lists two paths: '/css/*' and '/js/app.js'. Both are valid and separated by space.
  2. Step 2: Understand purge effect

    Both specified paths will be purged from the CDN cache after command runs.
  3. Final Answer:

    Both '/css/*' and '/js/app.js' files will be purged from the CDN cache -> Option C
  4. Quick Check:

    Multiple paths purge all listed [OK]
Hint: Multiple content paths purge all specified files [OK]
Common Mistakes:
  • Assuming only first path is purged
  • Thinking command syntax is invalid with multiple paths
  • Believing wildcard and file path cannot be combined
4. You run this command to purge CDN cache:
az cdn endpoint purge --resource-group RG1 --profile-name Profile1 --name Endpoint1 --content-paths '/images/logo.png'
But the cache is not cleared. What is the most likely cause?
medium
A. The content path is incorrect or does not match cached files
B. The resource group name is misspelled
C. The Azure CLI command does not support purging images
D. The CDN endpoint is not created yet

Solution

  1. Step 1: Check command correctness

    The command syntax is correct and supports purging images.
  2. Step 2: Identify common purge failure reason

    If cache is not cleared, often the content path does not match cached files exactly.
  3. Final Answer:

    The content path is incorrect or does not match cached files -> Option A
  4. Quick Check:

    Incorrect path = purge fails [OK]
Hint: Verify content path matches cached files exactly [OK]
Common Mistakes:
  • Assuming CLI cannot purge images
  • Ignoring typos in resource group or endpoint names
  • Thinking purge works instantly without matching paths
5. You manage a global website using Azure CDN. You want to purge cache for a frequently updated JavaScript file but minimize performance impact. Which strategy is best?
hard
A. Disable CDN caching for all files to avoid purging
B. Purge the entire CDN endpoint cache every hour
C. Purge cache only once a month to reduce load
D. Purge only the specific JavaScript file path instead of the entire CDN endpoint

Solution

  1. Step 1: Understand impact of purging scope

    Purging entire endpoint cache causes high load and delays for all users.
  2. Step 2: Choose targeted purging

    Purging only the specific JavaScript file updates that content with minimal performance impact.
  3. Final Answer:

    Purge only the specific JavaScript file path instead of the entire CDN endpoint -> Option D
  4. Quick Check:

    Targeted purge = minimal impact [OK]
Hint: Purge specific files, not whole endpoint, to save performance [OK]
Common Mistakes:
  • Purging entire cache too often causing slowdowns
  • Disabling caching loses CDN benefits
  • Purging too rarely causing stale content