Azure CDN profiles and endpoints - Time & Space Complexity
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?"