All Products
Search
Document Center

Elastic Container Instance:Specify the number of vCPUs and memory size to create an elastic container instance

Last Updated:Feb 24, 2023

If you do not require special specifications such as GPUs and local disks, we recommend that you specify the number of vCPUs and memory size instead of Elastic Compute Service (ECS) instance types to create elastic container instances. Then, the system can try a variety of ECS instance types based on the specified vCPU and memory specifications to select a suitable instance type. This method provides better elasticity and resource provisioning than the method of specifying only ECS instance types.

Specifications

If the number of vCPUs or memory size that you specify is invalid when you create an elastic container instance, the system adjusts the number or size based on the specifications supported by Elastic Container Instance. When the system adjusts the number or size, the system selects the most similar specifications supported by Elastic Container Instance to create an elastic container instance, and the specifications selected by the system are higher than or equal to the specifications that you specified for the elastic container instance. For example, if you specify 7 vCPUs and 13 GiB of memory to create an elastic container instance, but these specifications are invalid, the system adjusts the number of vCPUs and memory size and selects 8 vCPUs and 16 GiB of memory that are supported by Elastic Container Instance to create an elastic container instance.

The following table describes the specifications supported by Elastic Container Instance.

Note
  • Each elastic container instance can have only one elastic network interface (ENI) bound.

  • If you do not specify the number of vCPUs and memory size, the system uses 2 vCPUs and 4 GiB of memory to create an elastic container instance by default.

Number of vCPUs

Memory (GiB)

emptyDir volume (GiB)

Bandwidth (bidirectional, Gbit/s)

Packet forwarding rate (bidirectional, Kpps)

Number of ENI queues

0.25

0.5 and 1

30

0.1

40

1

0.5

1 and 2

30

0.2

50

1

1

2, 4, and 8

30

0.5

50

1

2

1, 2, 4, 8, and 16

30

1

300

2

4

2, 4, 8, 16, and 32

30

1.5

500

2

8

4, 8, 16, 32, and 64

30

2.0

800

4

12

12, 24, 48, and 96

30

2.5

900

4

16

16, 32, 64, and 128

30

3.0

1,000

4

24

48, 96, and 192

30

4.5

1,500

6

32

64, 128, and 256

30

6.0

2,000

8

52

96, 192, and 384

30

12.5

3,000

32

64

128, 256, and 512

30

20.0

4,000

16

Specify the number of vCPUs and memory size for containers in an elastic container instance

You can create a maximum of 20 containers within each elastic container instance and specify the vCPU and memory specifications of each container. For each elastic container instance, the total vCPU and memory specifications of all containers must be lower than or equal to the vCPU and memory specifications of the instance. If the total vCPU or memory specifications of all containers are higher than the vCPU or memory specifications of the instance, the system adjusts the container specifications and then charges you based on the new specifications.

Note

Elastic Container Instance allows you to set environment variables for a specific container, such as a sidecar container, to ignore the container when the system adjusts resources. This prevents waste of resources. For more information, see Ignore specific containers during resource adjustment.

API mode

When you call the CreateContainerGroup API operation to create an elastic container instance, you can use the Container.N.Cpu and Container.N.Memory parameters to specify the number of vCPUs and memory size for each container. The following table describes these parameters. For more information, see CreateContainerGroup.

Parameter

Type

Example

Description

Container.N.Cpu

number

2

The number of vCPUs that you want to allocate to container N. N specifies the serial number of the container. Maximum value of N: 20.

Container.N.Memory

number

4

The memory size of container N. Unit: GiB. N specifies the serial number of the container. Maximum value of N: 20.

Console mode

When you create an elastic container instance in the Elastic Container Instance console, you can configure the number of vCPUs and memory size of each container in the Advanced Settings section for the container. The sum of vCPUs and sum of memory size of all containers in an elastic container instance must be smaller than or equal to the vCPU and memory size of the instance.

Container configurations

Specify the number of vCPUs and memory size for an elastic container instance

When this method is used, the system tries a variety of ECS instance types based on the specified number of vCPUs and memory size to select a suitable ECS instance type for better elasticity and resource provisioning. This method provides the following benefits:

  • You do not need to specify the number of vCPUs, memory size, or resource limits for containers in the elastic container instance. This provides the containers with greater flexibility to share the requested resources.

  • In genetic computation and Istio scenarios, the service framework automatically deploys sidecar containers in pods. You can seamlessly connect Elastic Container Instance to the service framework by specifying the number of vCPUs and memory size for elastic container instances.

Note

Some specifications such as 2 vCPUs and 1 GiB memory size cannot be configured in the Elastic Container Instance console. If you cannot select the specifications that are supported by elastic container instances in the console, you can use the API mode.

API mode

When you call the CreateContainerGroup API operation to create an elastic container instance, you can use the Cpu and Memory parameters to specify the number of vCPUs and memory size for the elastic container instance. The following table describes these parameters. For more information, see CreateContainerGroup.

Parameter

Type

Example

Description

Cpu

number

2

The number of vCPUs that you want to allocate to the elastic container instance.

Memory

number

4

The memory size that you want to allocate to the elastic container instance. Unit: GiB.

Console mode

When you create an elastic container instance in the Elastic Container Instance console, you can specify the number of vCPUs and memory size of the instance (container group) in the Container Group Configuration section.

Container group configurations