Azure CDN profiles and endpoints - Time & Space Complexity
Start learning this pattern below
Jump into concepts and practice - no test required
When creating Azure CDN profiles and endpoints, it's important to understand how the time to complete these operations changes as you add more resources.
We want to know: how does the number of API calls or operations grow when we create multiple CDN endpoints under profiles?
Analyze the time complexity of the following operation sequence.
// Create a CDN profile
az cdn profile create --name MyProfile --resource-group MyGroup --location eastus --sku Standard_Microsoft
// Create multiple CDN endpoints under the profile
for endpoint in endpoint1 endpoint2 endpoint3 endpointN
az cdn endpoint create --name $endpoint --profile-name MyProfile --resource-group MyGroup --origin myorigin.azureedge.net
This sequence creates one CDN profile and then multiple CDN endpoints under that profile.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: Creating each CDN endpoint via the API call.
- How many times: Once per endpoint you want to create.
Each new endpoint requires a separate API call to create it. The profile creation is a single call.
| Input Size (n) | Approx. Api Calls/Operations |
|---|---|
| 10 | 1 (profile) + 10 (endpoints) = 11 |
| 100 | 1 + 100 = 101 |
| 1000 | 1 + 1000 = 1001 |
Pattern observation: The total operations grow roughly in direct proportion to the number of endpoints.
Time Complexity: O(n)
This means the time to create all resources grows linearly with the number of endpoints you add.
[X] Wrong: "Creating multiple endpoints happens all at once in a single API call."
[OK] Correct: Each endpoint requires its own API call and provisioning, so the time grows with how many endpoints you create.
Understanding how resource creation scales helps you plan deployments and estimate wait times, a useful skill when designing cloud infrastructure.
"What if we created multiple CDN profiles each with a fixed number of endpoints? How would the time complexity change?"
Practice
Solution
Step 1: Understand the role of a CDN profile
An Azure CDN profile acts as a container for one or more CDN endpoints and defines the pricing and features for those endpoints.Step 2: Differentiate from other Azure services
Profiles do not store content or manage authentication; those are handled by other Azure services.Final Answer:
To group CDN endpoints and define pricing tiers -> Option CQuick Check:
CDN profile = group endpoints + pricing [OK]
- Confusing profiles with storage accounts
- Thinking profiles manage user access
- Assuming profiles store content
Solution
Step 1: Identify the correct Azure CLI command for endpoint creation
The command to create a CDN endpoint isaz cdn endpoint createwith parameters for name, profile, resource group, and origin.Step 2: Eliminate incorrect commands
The other options use commands for profile creation, storage account creation, and virtual machine creation, which are unrelated to endpoint creation.Final Answer:
az cdn endpoint create --name myEndpoint --profile-name myProfile --resource-group myResourceGroup --origin myOrigin -> Option BQuick Check:
Endpoint creation usesaz cdn endpoint create[OK]
- Using profile create command instead of endpoint create
- Confusing storage or VM commands with CDN commands
- Omitting required parameters like origin
mywebsite.azurewebsites.net, what happens when a user requests a file not yet cached by the CDN?Solution
Step 1: Understand CDN cache miss behavior
When a requested file is not in the CDN cache, the CDN fetches it from the origin server.Step 2: Explain caching for future requests
After fetching, the CDN caches the file to serve subsequent requests faster and reduce load on the origin.Final Answer:
The CDN fetches the file from the origin and caches it for future requests -> Option AQuick Check:
Cache miss = fetch + cache [OK]
- Assuming CDN returns error on cache miss
- Thinking CDN redirects to origin URL
- Believing CDN serves placeholder files
Solution
Step 1: Identify cause of stale content
CDNs cache content to improve speed, so updates at origin may not appear immediately due to cached copies.Step 2: Apply the fix by purging cache
Purging the CDN endpoint cache forces the CDN to fetch fresh content from the origin on next requests.Final Answer:
The CDN cache is not refreshed; purge the CDN endpoint cache -> Option DQuick Check:
Stale content = cache purge needed [OK]
- Restarting origin when issue is cache
- Recreating profile unnecessarily
- Changing DNS when endpoint URL is correct
Solution
Step 1: Understand global scalability needs
Multiple CDN endpoints in different regions reduce latency by serving users from nearest edge locations.Step 2: Use features for availability and security
Geo-filtering controls content delivery by region; custom domain HTTPS secures traffic and improves trust.Step 3: Evaluate other options
Single endpoint or disabling caching reduces performance; multiple profiles add complexity without benefit; skipping CDN loses caching advantages.Final Answer:
Create multiple CDN endpoints in different regions under one profile; enable geo-filtering and custom domain HTTPS -> Option AQuick Check:
Multiple endpoints + geo-filter + HTTPS = scalable, low latency [OK]
- Using single endpoint for global users
- Disabling caching reduces performance
- Ignoring HTTPS security best practices
