Optimize Performance and Cost
Spend where it buys reliability
Cost work starts with visibility. Label every resource by team, environment, and cost center, enforce label presence with org policy, export billing to BigQuery, and set budgets with alerts - budgets notify, they do not cap spend. Active Assist and Recommender surface idle resources, rightsizing opportunities, and unattended projects.
Compute: sustained use discounts apply automatically to long-running VMs within a month, while committed use discounts for 1 or 3 years require a deliberate purchase and suit steady baseline load; spend-based CUDs flex across some services. Spot VMs and Spot pods slash cost for batch and fault-tolerant workloads. Rightsize requests so HPA on CPU or custom metrics and the cluster autoscaler or node auto-provisioning receive accurate signals - over-requested pods waste money because bin-packing cannot fill nodes.
Storage and data: Cloud Storage lifecycle rules transition objects to Nearline, Coldline, or Archive. BigQuery bills bytes scanned, so partition by date, cluster on high-cardinality filter columns, select only needed columns, and buy flat-rate reservation slots only when usage is predictable. Network egress and cross-zone traffic are the most commonly underestimated line items.
Serverless: Cloud Run scales to zero, but minimum instances trade cost for latency, and higher concurrency per instance lowers cost per request if the code handles it.
Trap: performance fixes that add memory or always-on capacity can double the bill. Always tie the change to an SLO or latency target before approving it.
Rule of thumb: cost per successful request - total spend divided by good events - is the single number that links reliability work to the bill, and it justifies or kills an optimization.