0
0
Azurecloud~5 mins

CDN with custom domains in Azure - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: CDN with custom domains
O(n)
Understanding Time Complexity

When setting up a CDN with custom domains in Azure, it is important to understand how the time to configure and deploy grows as you add more custom domains.

We want to know how the number of custom domains affects the total operations needed.

Scenario Under Consideration

Analyze the time complexity of the following operation sequence.

// Create a CDN profile
az cdn profile create --name MyCDNProfile --resource-group MyResourceGroup --location eastus

// Create a CDN endpoint
az cdn endpoint create --name MyCDNEndpoint --profile-name MyCDNProfile --resource-group MyResourceGroup --origin www.example.com

// For each custom domain, add it to the CDN endpoint
foreach domain in customDomains:
  az cdn custom-domain create --endpoint-name MyCDNEndpoint --profile-name MyCDNProfile --resource-group MyResourceGroup --hostname domain

This sequence creates a CDN profile and endpoint, then adds multiple custom domains to the endpoint.

Identify Repeating Operations

Identify the API calls, resource provisioning, data transfers that repeat.

  • Primary operation: Adding each custom domain to the CDN endpoint via the az cdn custom-domain create command.
  • How many times: Once for each custom domain you want to add.
How Execution Grows With Input

Each custom domain requires a separate API call to add it to the CDN endpoint. So, as you add more domains, the total number of calls grows directly with the number of domains.

Input Size (n)Approx. Api Calls/Operations
1010 calls to add custom domains
100100 calls to add custom domains
10001000 calls to add custom domains

Pattern observation: The number of operations grows linearly as you add more custom domains.

Final Time Complexity

Time Complexity: O(n)

This means the time to add custom domains grows directly in proportion to how many domains you add.

Common Mistake

[X] Wrong: "Adding multiple custom domains is a single operation regardless of how many domains there are."

[OK] Correct: Each custom domain requires its own API call and configuration step, so the total time grows with the number of domains.

Interview Connect

Understanding how operations scale with input size helps you design efficient cloud deployments and explain your reasoning clearly in interviews.

Self-Check

What if we batch multiple custom domains in a single API call? How would the time complexity change?