0
0
AWScloud~5 mins

Why cloud over on-premises in AWS - Performance Analysis

Choose your learning style9 modes available
Time Complexity: Why cloud over on-premises
O(n)
Understanding Time Complexity

We want to understand how the time it takes to manage computing resources changes when using cloud services versus on-premises setups.

Specifically, how does the effort grow as the number of servers or applications increases?

Scenario Under Consideration

Analyze the time complexity of provisioning servers on AWS compared to on-premises.


// AWS example: Provisioning servers using EC2
for (int i = 0; i < n; i++) {
  aws.ec2.runInstances({
    ImageId: 'ami-123456',
    InstanceType: 't3.micro',
    MinCount: 1,
    MaxCount: 1
  });
}

// On-premises: Manually setting up each server one by one
for (int i = 0; i < n; i++) {
  setupPhysicalServer();
}
    

This sequence shows provisioning n servers either by calling AWS API or manually setting up physical servers.

Identify Repeating Operations

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

  • Primary operation: Provisioning one server instance (API call for cloud, manual setup for on-premises)
  • How many times: Exactly n times, once per server
How Execution Grows With Input

As the number of servers n increases, the total provisioning effort grows roughly in direct proportion.

Input Size (n)Approx. API Calls/Operations
1010 provisioning calls
100100 provisioning calls
10001000 provisioning calls

Pattern observation: Doubling the number of servers doubles the provisioning operations needed.

Final Time Complexity

Time Complexity: O(n)

This means the time to provision servers grows linearly with the number of servers.

Common Mistake

[X] Wrong: "Provisioning more servers in the cloud takes the same time as provisioning one server."

[OK] Correct: Each server requires its own setup call, so time grows with the number of servers, even if cloud automates some steps.

Interview Connect

Understanding how provisioning time scales helps you explain the benefits of cloud automation and why it can be faster and easier than on-premises, even if both grow linearly.

Self-Check

"What if we used server templates or auto-scaling groups in the cloud? How would the time complexity change?"