Why security matters in GCP - Performance Analysis
We want to understand how the effort to keep cloud systems secure changes as the system grows.
How does the work to protect resources increase when we add more users or data?
Analyze the time complexity of checking user permissions for multiple resources.
for user in users:
for resource in resources:
check_access(user, resource)
log_access_attempt(user, resource)
enforce_security_policies(user, resource)
# This sequence checks and logs access for each user-resource pair.
This code checks if each user can access each resource and applies security rules.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: Checking access permissions for each user-resource pair.
- How many times: Once for every combination of user and resource.
As the number of users or resources grows, the number of checks grows quickly.
| Input Size (n users, m resources) | Approx. Api Calls/Operations |
|---|---|
| 10 users, 10 resources | 100 checks |
| 100 users, 100 resources | 10,000 checks |
| 1000 users, 1000 resources | 1,000,000 checks |
Pattern observation: The work grows by multiplying users and resources, so it grows very fast as both increase.
Time Complexity: O(n * m)
This means the time to check security grows proportionally to the number of users times the number of resources.
[X] Wrong: "Security checks only grow with the number of users or resources, not both."
[OK] Correct: Each user must be checked against each resource, so both numbers multiply the work, not just one.
Understanding how security checks scale helps you design systems that stay safe even as they grow.
"What if we cache permission results for users? How would that change the time complexity?"