This topic describes the specification adjustment logic for VCI instances when conflicts arise between the specified instance type, instance family, and the resource configurations (such as CPU, memory, and GPU) during instance creation.
General-purpose instance
Create an instance by specifying an instance family
When creating an instance, if you only specify the instance family and configure the vCPU and memory of containers but do not specify a specific instance type, VCI calculates the specific VCI instance type required by your Pod as follows:
- Calculate the total upper limits for the CPU and memory of pods separately:
- The total CPU value is the higher of the two values: the maximum CPU limit among all Init containers in the pod and the sum of the CPU limits of all application containers.
tip
If no CPU limit is configured for an Init container or an application container, the CPU request value of the container is used.
- The total memory value is the higher of the two values: the maximum memory limit among all Init containers in the pod and the sum of the memory limits of all application containers.
tip
If no memory limit is configured for an Init or application container, the memory request value of the container is used.
- If neither the limit nor the request for memory or CPU is configured for a container in the pod, the value of that item is counted as 0.
- The system automatically adjusts the pod specifications based on the total values and charges fees based on the instance specifications after the automatic adjustment. The adjustment method is as follows:
Create an instance by specifying a specific instance type
When creating a general‑purpose instance, if you specify a specific VCI instance type but it conflicts with the vCPU and memory settings of your containers, VCI handles it as follows:
- Calculate the total upper limits for the CPU and memory of pods separately. The calculation method for the total value is the same as that described in the Create an instance by specifying only the instance family section.
- The system automatically adjusts the pod specifications based on the total values and charges fees based on the instance specifications after the automatic adjustment. The adjustment method is as follows:
GPU-accelerated instances
Specification matching logic
- The specifications are matched in the following priority order: first GPU requirements, then CPU and memory resource claims.
- If you do not specify the limits of CPU and memory for containers, the number of GPUs is used to match the corresponding instance specifications of the GPU-accelerated instance family. In most cases, the number of GPUs can determine the pod instance specification.
- For some GPU-accelerated instance families, multiple instance specifications may be available with a single GPU. In this case, the minimum available instance specification is matched by default.
- If you specify the limits of CPU and memory for some or all containers, the number of GPUs is used to match the target instance specifications and perform related validation and confirmation.
- Scenario 1: Both CPU and memory limits are specified
- Make sure that the specified resource limit values are less than or equal to the relevant configurations of the target instance specification matched by the GPU. Otherwise, the matching will fail. The specific rules are as follows:
- First, filter out and match the target instance specifications based on the number of GPUs. In this scenario, one or more instance specifications may be matched based on the GPU type.
- Then, among the filtered instance specifications, select instance specifications that are consistent with or close to but larger than the total value of CPU resources. If the total value of CPU resources exceeds the highest specification among the filtered specifications, the instance fails to be created.
- Finally, among the filtered instance specifications, select an instance specification that is consistent with or close to but larger than the total value of memory resources. If the total value of memory resources exceeds the highest specification among the filtered specifications, the instance fails to be created.
- Scenario 2: When CPU or memory limits are specified
- Make sure that the specified resource limit values are less than or equal to the relevant configurations of the target instance specification matched by the GPU. Otherwise, the matching will fail. The specific rules are as follows:
- First, filter out and match the target instance specifications based on the number of GPUs. In this scenario, one or more instance specifications may be matched based on the GPU type.
- Finally, among the filtered instance specifications, select an instance specification that is consistent with or close to but larger than the number of resources for which the limit is not zero. If the number of resources for which the limit is not zero exceeds the highest specification among the filtered specifications, the instance fails to be created.
Specification normalization logic
When you create a GPU-accelerated instance, the adjustment method for instance specifications is as follows:
- Calculate the total upper limits for the CPU, memory, and GPU of pods separately:
- The total CPU value is the higher of the two values: the maximum CPU limit among all Init containers in the pod and the sum of the CPU limits of all application containers.
- The total memory value is the higher of the two values: the maximum memory limit among all Init containers in the pod and the sum of the memory limits of all application containers.
- The total GPU value is the higher of the two values: the maximum GPU limit among all Init containers in the pod and the sum of the GPU limits of all application containers.
- If the CPU, memory, or GPU limit is not configured for the containers in the pod, the limit on that resource is 0.
- Obtain the corresponding vCPU, memory, GPU, and other values from the GPU-accelerated instance (specification values) based on the value specified in the annotation.
- The total value and specification value must meet all of the following conditions:
- The <vendor> of the Pod.spec.container[].resources.limit.'<vendor>.com/gpu' field must be consistent with the vendor of the instance family GPU.
tip
The current GPU is an NVIDIA GPU. Therefore, <vendor> is nvidia.
- The GPU value in the total values must be greater than 0.
- The CPU, memory, and GPU values in the total values must all be less than or equal to the corresponding values in the specification values.
warning
If the total values are less than the specification values, the instance is created and billed based on the specification values. If the GPU value specified in the container is less than the specification value, resource waste may occur. Plan the instance specifications based on your business requirements.