DataCache overview

Updated at:

DataCache lets you cache large datasets—such as machine learning models—on local storage before creating an elastic container instance. Mount the cached data when you launch the instance to shorten startup time, avoid repeated downloads, and reduce usage costs.

How it works

DataCache decouples data from container images. Instead of bundling your data into an image, you create a DataCache that pulls the data independently. When you deploy an application, mount the DataCache alongside the image cache. If the data changes, re-create the DataCache—no image rebuild required.

When you mount a DataCache, Elastic Container Instance (ECI) automatically creates a pay-as-you-go cloud disk whose capacity equals the DataCache size. When you create the instance, specify the DataCache bucket and mount the data storage path directly through HostPath. The cloud disk is created and released together with the elastic container instance.

Use cases

DataCache is a good fit when:

  • Your application relies on large datasets that are slow to download at startup

  • Data changes frequently and you want to avoid rebuilding container images on each update

  • You want to separate data lifecycle management from application image management

Example: deploying a machine learning model

Step Without DataCache With DataCache
1 Download model data to the development environment Create a DataCache to pull the model
2 Package model and app into a container image Package the app only into a container image
3 Build image cache Build image cache
4 Deploy application Deploy using the image cache and DataCache

Without DataCache, the container image grows large. Updating the model then requires re-creating the image, republishing the image tag, re-creating the image cache, and re-deploying the application. With DataCache, you only re-create the DataCache and mount it again.

Without DataCache

Deploy a model application without DataCache

With DataCache

Deploy a model application with DataCache

Create a DataCache

Configure the following properties when creating a DataCache.

Storage path

Specify a bucket and storage path within that bucket. If no bucket is specified, ECI stores the DataCache in the bucket named default.

Data source

DataCache supports the following data sources:

Type Description
URL A direct download link, or a model or dataset on ModelScope or Hugging Face
NAS An Apsara File Storage NAS (NAS) file system
OSS An Object Storage Service (OSS) bucket
SNAPSHOT An Alibaba Cloud snapshot

Size

Specify the size based on your actual data volume. The default size is 20 GiB. If your data exceeds the specified size, the DataCache creation fails.

Retention period

By default, a DataCache is retained indefinitely. Set a retention period if you do not plan to use the DataCache long-term, to avoid incurring unnecessary snapshot costs.

Billing

Creating a DataCache

ECI creates temporary resources—an elastic container instance and a cloud disk—and generates a snapshot based on the temporary resources. You are charged for the temporary resources and the snapshot.

Using a DataCache

ECI creates a cloud disk equal in size to the DataCache and mounts it to the elastic container instance. You are charged for the cloud disk and the elastic container instance.

For detailed pricing, see DataCache billing.