MaxCompute resources include storage resources and computing resources. Storage resources are used to store tables or resources. Computing resources are compute units (CUs) that are used to run jobs. To provide sufficient resources at low costs, you must plan resources as needed. This topic describes how to plan storage and computing resources and select an appropriate resource package. The recommendations in this topic are for reference only.
Background information
An optimal resource planning solution helps you achieve the following objectives:
Storage resources are sufficient to store all inventory data and accommodate the incremental data that is generated during a specific period of time in the future.
Sufficient resources are available to meet the demands of all computing jobs without being wasted.
Jobs with different priorities do not interfere with each other, and high-priority jobs are guaranteed to obtain sufficient computing resources.
Even when some jobs process large data volumes and consume many computing resources, other jobs can still obtain computing resources and run without being blocked.
Varying resource requirements at different times are met. Resources are allocated by time period based on the resource usage of different projects to improve resource utilization.
Plan storage resources and select a resource package
MaxCompute storage is pay-as-you-go. You do not need to purchase a specific storage capacity in advance. You can use storage on demand. When your storage usage becomes stable, you can evaluate whether to purchase a storage resource plan for cost optimization.
Plan computing resources and select a resource package
Compute Resource Planning Frequency
You can evaluate the computing-to-storage ratio and storage capacity every six months and adjust the amount of computing resources. To change specifications or switch the billing method after re-evaluation, see Upgrades and downgrades or Switch between billing methods.
NoteThe computing-to-storage ratio is the ratio of computing resources to the actual storage data size (in TB). The formula is:
Computing-to-storage ratio = Computing resources / Actual storage data size. For example, if a project has 50 CUs of computing resources and 10 TB of actual storage data, the computing-to-storage ratio is50 CU / 10 TB = 5.Recommended specifications
If your project is in the development and testing phase, you can select the pay-as-you-go Standard Edition.
If your project is developed and ready for production, you can select the subscription Standard Edition to purchase subscription computing resources. You can estimate the amount of computing resources to purchase based on the computing-to-storage ratio or the actual computing resource consumption of the project.
Planning basis
Method 1: Plan computing resources based on the computing-to-storage ratio
Estimate the storage capacity and computing-to-storage ratio. Then, estimate the minimum amount of computing resources that you must purchase.
Method 2: Plan computing resources based on the actual computing resource consumption of the project
Before your project is running or after your project is running for a period of time, estimate the CPU utilization of computing resources and calculate the optimal amount of computing resources at the lowest cost based on your business periods per day.
Billing methods
MaxCompute provides the following billing methods for computing resources:
Pay-as-you-go: This billing method is suitable for projects in the testing phase. Because the amount of computing resources consumed is small during this phase, the pay-as-you-go method is more cost-effective.
Subscription: This billing method is suitable for projects that are developed and in production. The amount of reserved computing resources purchased in a subscription is fixed. This ensures that jobs do not compete for computing resources in the public resource pool, which allows for smooth job execution.
Hourly billing: This billing method is suitable for projects in production. If your subscription-based computing resource requests have clear peak and off-peak cycles, you can schedule a daily scale-out of a specific amount of resources during peak hours. This practice meets the resource demands of business peaks and enables elastic, time-based scaling for your subscription resources.
Plan computing resources based on the computing-to-storage ratio
To plan computing resources based on the computing-to-storage ratio, follow these steps:
Estimate the storage capacity.
Storage capacity = Current storage volume + (Estimated data volume increase per month × Number of months)
You can obtain the current storage volume after your project is running. After the project is running for two or three months, you can estimate the data volume increase per month by dividing the total increased volume by the number of months. If more services need to be processed on Data Mid-end in the future or data volume increases every month, you can increase the estimated value to reserve sufficient resources.
Estimate the computing-to-storage ratio.
Estimate the computing-to-storage ratio based on the data statistics in the project development and testing phases and the data statistics after a project is running for one or two months.
The computing-to-storage ratio is typically planned to be between 2 and 10. You can purchase computing resources based on the planned ratio and the estimated storage capacity:
If the project runs many batch processing jobs daily and the SQL programs have high computational complexity, you can plan for a computing-to-storage ratio of 10.
If the project runs few batch processing jobs daily and the SQL programs have low computational complexity, you can plan for a computing-to-storage ratio of 2.
If the project runs a moderate number of batch processing jobs daily and the SQL programs have medium computational complexity, you can plan for a ratio between 2 and 10.
Estimate the amount of computing resources.
You can estimate the amount of computing resources based on the estimated storage capacity and computing-to-storage ratio. The formula is: Amount of computing resources = Estimated storage capacity × Estimated computing-to-storage ratio.
NoteWhen you estimate the computing resources a project will consume based on the computing-to-storage ratio, both the storage capacity and the ratio are estimates and may not be precise. Therefore, this method requires a technical lead with extensive project implementation experience to ensure that each estimation step is as accurate as possible.
Plan computing resources based on the amount of computing resources consumed by a project
To plan computing resources based on the actual computing resource consumption of a project, follow these steps:
Check the project's CPU consumption.
Information Schema provides the TASKS_HISTORY view, which records the computing resources consumed by all computing jobs in a MaxCompute project. You can query the cost_cpu field in the TASKS_HISTORY view using the MaxCompute client. You can use this field to calculate the amount of consumed resources. The following command is an example of how to query the TASKS_HISTORY view:
select * from information_schema.tasks_history where ...;cost_cpu indicates the CPU utilization of a computing job in the project. For example, the value of cost_cpu is 5000, which is calculated using the following formula: 10 × 100 × 5. 10 indicates the number of CPU cores that are used. 5 indicates the duration (in seconds) in which the job runs.
Plan the amount of computing resources.
Calculate the total sum of the daily average cost_cpu values for all jobs across all projects under your Alibaba Cloud account.
For example, an average of 1,000 jobs run per day in a MaxCompute project, and the cost_cpu values for these jobs are W1 to W1000. Calculate the total sum of W1 to W1000 to obtain the total sum of cost_cpu of this project. The total sum is Wz in this example.
NoteTypically, a data mid-end is divided into the following six MaxCompute projects:
ods_dev: development and testing project for the operational data store (ODS) layer
ods_prod: production project for the ODS layer
cdm_dev: development and testing project for the common data model (CDM) layer
cdm_prod: production project for the CDM layer
ads_dev: development and testing project for the application layer
ads_prod: production project for the application layer
In this case, you need to calculate the total sum of cost_cpu of all computing jobs that run in these six projects.
Convert the calculated cost_cpu sum.
Because the cost_cpu value is measured in seconds, it is too granular for project evaluation. Typically, you can divide the cost_cpu value by 100 and then by 3,600 to obtain the value in
core×h(CPU cores consumed × hours). This makes it easier to estimate the minimum amount of computing resources required to run all jobs within a specified time frame. Assume that this value is W.Confirm the daily time window in which all jobs must be completed.
For example, you must complete all batch processing jobs between 00:00:00 and 06:00:00. This means that the total running duration of all jobs in a day is 6 hours. For example, all jobs must be completed in N hours.
Estimate the minimum amount of computing resources to purchase.
Use the W and N values from the previous two steps to calculate W (CPU core consumption × hours) / N (job runtime in hours). The result is the minimum amount of computing resources that you need to purchase for the MaxCompute project.
Before you estimate the minimum amount, make sure that the value of cost_cpu does not fluctuate for all batch processing jobs, all jobs are running in N hours, and no resources are wasted. However, the total running duration of jobs may be longer than N hours in some scenarios. For example, if the amount of data that you need to calculate increases, the value of W increases. In addition, latency may occur when you use DataWorks or Dataphin to run scheduled jobs or when jobs attempt to obtain computing resources. This latency increases the intervals between jobs. In this case, the actual period in which all jobs are running is less than N. As above mentioned, the value of W increases, and the value of N decreases in practical application. You need to add more computing resources to run jobs faster. Therefore, we recommend that you double the value of W/N.
After you purchase computing resources, you can use the Quota Management feature in the MaxCompute console to set up quota groups. This helps you further plan and fully utilize your computing resources. For more information, see Manage computing resources - Quota management. For information about resource planning best practices, see Time-based quotas for subscription resources, Isolate subscription resources, or Best practices for elastic reserved CUs.