After you create a data cache, you can mount the cached data to an elastic container instance when you create the elastic container instance. This way, the instance does not need to pull data and starts faster. This topic describes how to use a data cache to create an elastic container instance.
Prerequisites
A data cache is created. For more information, see Create a data cache.
Configurations
When you use a DataCache to create an elastic container instance, you can specify a bucket that is used to store the DataCache and mount the data storage path by using HostPath. In this case, the system automatically creates and mounts a pay-as-you-go cloud disk. The storage capacity of the cloud disk is equal to the size of the DataCache. The cloud disk is created and released together with the elastic container instance.
API mode
The following table lists the parameters that are related to the data cache feature when you call the CreateContainerGroup API operation to create an elastic container instance. For more information, see CreateContainerGroup.
DataCache-related parameters: Only the DataCacheBucket parameter is required. Other parameters are optional.
Volume-related parameters: The following table does not list optional Volume-related parameters, but only lists required Volume-related parameters.
Parameter | Type | Example | Description |
DataCacheBucket | string | default | The bucket that stores the data cache. |
DataCachePL | string | PL1 | The performance level (PL) of the disk that is created based on the data cache. By default, a PL1 enhanced SSD (ESSD) is used. |
DataCacheProvisionedIops | long | 40000 | The read/write IOPS that is provisioned for the ESSD AutoPL disk. Valid values: 0 to min{50000, 1000 × Capacity - Baseline IOPS}. Baseline IOPS = min{1,800 + 50 × Capacity, 50,000}. For more information, see ESSD AutoPL disks. If you specify this parameter, the category of the disk that is created based on the data cache is ESSD AutoPL. |
DataCacheBurstingEnabled | boolean | false | Specifies whether to enable the performance burst feature for the ESSD AutoPL disk. For more information, see ESSD AutoPL disks. If you specify this parameter, the category of the disk that is created based on the data cache is ESSD AutoPL. |
Volume.N.Name | String | datacache-demo | The custom name of the volume. |
Volume.N.Type | String | HostPathVolume | The volume type. Set the value to HostPathVolume. A value of HostPathVolume specifies a HostPath volume. |
Volume.N.HostPathVolume.Path | String | /test/data | The path in which the volume is stored. The data cache is stored in the same path as the volume. |
Container.N.VolumeMount.N.Name | String | datacache-demo | The name of the volume that you want to mount to the container. The value is the same as the value of the Volume.N.Name parameter. |
Container.N.VolumeMount.N.MountPath | String | /data | The path in which the volume is mounted to the container. The original data in the path is overwritten by the data in the mounted volume. Specify an accurate value. |
Console mode
When you create an elastic container instance in the Elastic Container Instance console, you can configure a data cache in the Data Cache section.
The following table describes the parameters.
Parameter | Description |
Data Cache Bucket | The bucket that stores the data cache. |
Add | After you click +Add, you can select a data cache and mount it to the specified directory of the specified container in the dialog box that appears. |
Enable Burst | Specifies whether to enable the performance burst feature for the ESSD AutoPL disk. Select Enable Burst based on your business requirements. If you select Enable Burst, the type of the disk that is created based on the data cache is ESSD AutoPL. For more information, see ESSD AutoPL disks. |