Workload identity federation in GCP - Time & Space Complexity
We want to understand how the time to authenticate and access Google Cloud resources changes as the number of external workloads grows.
Specifically, how does the process of workload identity federation scale when many workloads request access?
Analyze the time complexity of the following operation sequence.
// Assume multiple external workloads
// Each workload requests a token via workload identity federation
for workload in workloads:
token = requestToken(workload)
accessResource(token)
This sequence shows each external workload requesting a token and then accessing a Google Cloud resource using that token.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: Token request via workload identity federation API.
- How many times: Once per workload requesting access.
Each workload independently requests a token, so the total number of token requests grows directly with the number of workloads.
| Input Size (n) | Approx. API Calls/Operations |
|---|---|
| 10 | 10 token requests |
| 100 | 100 token requests |
| 1000 | 1000 token requests |
Pattern observation: The number of token requests grows linearly as the number of workloads increases.
Time Complexity: O(n)
This means the time to complete all token requests grows directly in proportion to the number of workloads.
[X] Wrong: "Requesting tokens for multiple workloads happens all at once and takes the same time as one request."
[OK] Correct: Each workload must individually request a token, so the total time grows with the number of workloads, not stays constant.
Understanding how authentication scales helps you design systems that handle many external workloads efficiently and predict performance as demand grows.
What if workloads shared tokens instead of requesting individually? How would the time complexity change?