Optimize resource usage Stay organized with collections Save and categorize content based on your preferences.
This principle in the cost optimization pillar of theGoogle Cloud Well-Architected Framework provides recommendations to help you plan and provision resources to match the requirementsand consumption patterns of your cloud workloads.
Principle overview
To optimize the cost of your cloud resources, you need to thoroughly understandyour workloads resource requirements and load patterns. This understanding isthe basis for a well defined cost model that lets you forecast the total cost ofownership (TCO) and identify cost drivers throughout your cloud adoption journey.By proactively analyzing and forecasting cloud spending, you can make informedchoices about resource provisioning, utilization, and cost optimization. Thisapproach lets you control cloud spending, avoid overprovisioning, and ensure thatcloud resources are aligned with the dynamic needs of your workloads andenvironments.
Recommendations
To effectively optimize cloud resource usage, consider the following recommendations.
Choose environment-specific resources
Each deployment environment has different requirements for availability,reliability and scalability. For example, developers might prefer an environmentthat lets them rapidly deploy and run applications for short durations, but mightnot need high availability. On the other hand, a production environment typicallyneeds high availability. To maximize the utilization of your resources, defineenvironment-specific requirements based on your business needs. The followingtable lists examples of environment-specific requirements.
Note: The requirements that are listed in this table are not exhaustive orprescriptive. They're meant to serve as examples to help you understand howrequirements can vary based on the environment type.| Environment | Requirements |
| Production |
|
| Development and testing |
|
| Other environments (like staging and QA) |
|
Choose workload-specific resources
Each of your cloud workloads might have different requirements for availability,scalability, security, and performance. To optimize costs, you need to alignresource choices with the specific requirements of each workload. For example,a stateless application might not require the same level of availability orreliability as a stateful backend. The following table lists more examples ofworkload-specific requirements.
Note: The requirements that are listed in this table are not exhaustive orprescriptive. They're meant to serve as examples to help you understand howrequirements can vary based on the workload type.| Workload type | Workload requirements | Resource options |
| Mission-critical | Continuous availability, robust security, and high performance | Premium resources and managed services likeSpanner for high availability and global consistency of data. |
| Non-critical | Cost-efficient and autoscaling infrastructure | Resources with basic features and ephemeral resources likeSpot VMs. |
| Event-driven | Dynamic scaling based on the current demand for capacity and performance | Serverless services likeCloud Run andCloud Run functions. |
| Experimental workloads | Low cost and flexible environment for rapid development, iteration, testing, and innovation | Resources with basic features, ephemeral resources likeSpot VMs, and sandbox environments with defined spending limits. |
A benefit of the cloud is the opportunity to take advantage of the mostappropriate computing power for a given workload. Some workloads are developedto take advantage of processor instruction sets, and others might not be designedin this way. Benchmark and profile your workloads accordingly. Categorize yourworkloads and make workload-specific resource choices (for example, chooseappropriatemachine families for Compute Engine VMs). This practice helpsto optimize costs, enable innovation, and maintain the level of availability andperformance that your workloads need.
The following are examples of how you can implement this recommendation:
- For mission-critical workloads that serve globally distributed users, considerusingSpanner. Spanner removes the need for complex database deployments byensuring reliability and consistency of data in allregions.
- For workloads with fluctuating load levels, use autoscaling to ensure thatyou don't incur costs when the load is low and yet maintain sufficientcapacity to meet the current load. You can configure autoscaling for manyGoogle Cloud services, includingCompute Engine VMs,Google Kubernetes Engine (GKE) clusters,andCloud Run. When you set upautoscaling, you can configure maximum scaling limits to ensure that costsremain within specified budgets.
Select regions based on cost requirements
For your cloud workloads, carefully evaluate the available Google Cloudregions and choose regions that align with your cost objectives. The region withlowest cost might not offer optimal latency or it might not meet yoursustainability requirements. Make informed decisions about where to deploy yourworkloads to achieve the desired balance. You can use theGoogle Cloud Region Picker to understand the trade-offs between cost, sustainability, latency, and otherfactors.
Use built-in cost optimization options
Google Cloud products provide built-in features to help you optimizeresource usage and control costs. The following table lists examples of costoptimization features that you can use in some Google Cloud products:
| Product | Cost optimization feature |
| Compute Engine |
|
| GKE |
|
| Cloud Storage |
|
| BigQuery |
|
| Google Cloud VMware Engine |
|
Optimize resource sharing
To maximize the utilization of cloud resources, you can deploy multipleapplications or services on the same infrastructure, while still meeting thesecurity and other requirements of the applications. For example, in developmentand testing environments, you can use the same cloud infrastructure to test allthe components of an application. For the production environment, you can deployeach component on a separate set of resources to limit the extent of impact incase of incidents.
The following are examples of how you can implement this recommendation:
- Use a singleCloud SQL instance for multiple non-production environments.
- Enable multiple development teams to share a GKE cluster by using thefleet team management feature in GKEwith appropriate access controls.
- UseGKE Autopilot to take advantage ofcost-optimization techniques like bin packing and autoscaling thatGKE implements by default.
- For AI and ML workloads, save GPU costs by usingGPU-sharing strategies like multi-instance GPUs, time-sharing GPUs, and NVIDIA MPS.
Develop and maintain reference architectures
Create and maintain a repository of reference architectures that are tailored tomeet the requirements of different deployment environments and workload types.To streamline the design and implementation process for individual projects, theblueprints can be centrally managed by a team like aCloud Center of Excellence (CCoE). Project teamscan choose suitable blueprints based on clearly defined criteria, to ensurearchitectural consistency and adoption of best practices. For requirements thatare unique to a project, the project team and the central architecture team shouldcollaborate to design new reference architectures. You can share the referencearchitectures across the organization to foster knowledge sharing and expand therepository of available solutions. This approach ensures consistency, acceleratesdevelopment, simplifies decision-making, and promotes efficient resourceutilization.
Review thereference architectures provided by Google for various use cases andtechnologies. These reference architectures incorporate best practices forresource selection, sizing, configuration, and deployment. By using thesereference architectures, you can accelerate your development process and achievecost savings from the start.
Enforce cost discipline by using organization policies
Consider usingorganization policiesto limit the available Google Cloud locations and products that teammembers can use. These policies help to ensure that teams adhere to cost-effectivesolutions and provision resources in locations that are aligned with your costoptimization goals.
Estimate realistic budgets and set financial boundaries
Develop detailed budgets for each project, workload, and deployment environment.Make sure that the budgets cover all aspects of cloud operations, includinginfrastructure costs, software licenses, personnel, and anticipated growth. Toprevent overspending and ensure alignment with your financial goals, establishclear spending limits or thresholds for projects, services, or specific resources.Monitor cloud spending regularly against these limits. You can useproactive quota alerts to identify potential cost overruns early and take timely corrective action.
In addition to setting budgets, you can usequotas and limits to help enforce cost discipline andprevent unexpected spikes in spending. You can exercise granular control overresource consumption by setting quotas at various levels, including projects,services, and even specific resource types.
The following are examples of how you can implement this recommendation:
- Project-level quotas: Set spending limits or resource quotas at theproject level to establish overall financial boundaries and control resourceconsumption across all the services within the project.
- Service-specific quotas: Configure quotas for specific Google Cloudservices like Compute Engine or BigQuery to limit thenumber of instances, CPUs, or storage capacity that can be provisioned.
- Resource type-specific quotas: Apply quotas to individual resource typeslike Compute Engine VMs, Cloud Storage buckets,Cloud Run instances, or GKE nodes torestrict their usage and prevent unexpected cost overruns.
- Quota alerts: Get notifications when your quota usage (at the projectlevel) reaches a percentage of the maximum value.
By using quotas and limits in conjunction with budgeting and monitoring, you cancreate a proactive and multi-layered approach to cost control. This approachhelps to ensure that your cloud spending remains within defined boundaries andaligns with your business objectives. Remember, these cost controls are notpermanent or rigid. To ensure that the cost controls remain aligned with currentindustry standards and reflect your evolving business needs, you must review thecontrols regularly and adjust them to include new technologies and best practices.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-25 UTC.