Security Command Center overview in GCP - Time & Space Complexity
We want to understand how the time to gather security data grows as we add more cloud resources.
How does Security Command Center handle more assets and findings over time?
Analyze the time complexity of scanning assets and findings in Security Command Center.
// Pseudocode for listing assets and findings
client = SecurityCenterClient()
assets = client.listAssets(parent="organizations/123")
for asset in assets:
findings = client.listFindings(parent=asset.name)
process(findings)
This sequence lists all assets in an organization, then for each asset, lists its findings.
Look at what repeats as the input grows.
- Primary operation: API calls to list assets and list findings per asset.
- How many times: One call to list assets, then one call per asset to list findings.
As the number of assets grows, the number of API calls grows too.
| Input Size (n assets) | Approx. Api Calls/Operations |
|---|---|
| 10 | 1 (list assets) + 10 (list findings) = 11 |
| 100 | 1 + 100 = 101 |
| 1000 | 1 + 1000 = 1001 |
Pattern observation: The calls grow roughly in direct proportion to the number of assets.
Time Complexity: O(n)
This means the time to gather all findings grows linearly with the number of assets.
[X] Wrong: "Listing findings is a single call regardless of assets."
[OK] Correct: Each asset has its own findings, so you must call the API for each asset separately, increasing calls as assets increase.
Understanding how API calls scale with resources helps you design efficient cloud security tools and shows you think about real-world system limits.
"What if we batch findings retrieval for multiple assets in one call? How would the time complexity change?"