Compared with function code packages, container images provide better portability and a more diverse ecosystem of toolchains. However, the irrelevant data contained makes the cold start of an image that is gigabytes in size last several minutes. When you enable the image pull acceleration feature, the cold start speed can be increased in two phases by approximately 90%, and the period of time that is required to pull an image can be decreased from a few minutes to a few seconds. This topic describes how does image pull acceleration for Container Registry Enterprise Edition works and how to configure image pull acceleration.

Benefits (compared with the image pull acceleration of Container Registry Personal Edition)

Images in Container Registry Enterprise Edition support all acceleration features of Container Registry Personal Edition and provide the following benefits:
  • Network isolation is supported. You can configure independent virtual private cloud (VPC) security rules to manage access to image repositories.
  • Exclusive bandwidth helps improve the flexibility of image pull tasks.
  • The built-in image conversion feature of image repositories helps prevent occasional unaccelerated cold starts before a cached image is available in Function Compute.

Principles

If you enable the image pull acceleration feature for a function that runs a custom container and uses a container image in Container Registry Enterprise Edition, Function Compute assumes a RAM role and uses a temporary AccessKey pair to pull the image when function requests are processed. The speed for pulling the image is improved.

Usage notes

  • The image pull acceleration feature is supported in the following regions: China (Beijing), China (Zhangjiakou), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Hong Kong), Singapore (Singapore), US (Silicon Valley), and US (Virginia).
  • Function Compute uses the default VPC IP address of your image repository to resolve the domain name of the container image in Container Registry Enterprise Edition.
  • After you create or update a function that uses a container image in Container Registry Enterprise Edition, Function Compute preferentially pulls the accelerated image from your image repository.

    If the accelerated image does not exist in your image repository, Function Compute pulls the original image in your image repository.

Prerequisites

If you want to use a container image in Container Registry Enterprise Edition to create a function, submit a ticket or join the DingTalk group for Function Compute to contact Function Compute technical support to activate related services.

Configuration methods

  1. Standard Edition and Advanced Edition instances of Container Registry Enterprise Edition provide the image acceleration feature. You can enable the image pull acceleration feature when you create or update an image repository. For more information, see Enable image acceleration.
  2. When you create or update a function, we recommend that you use an accelerated image whose name ends with _accelerated and enable the image pull acceleration feature. After the function is configured, you can immediately call the accelerated image. This ensures that the image pull is accelerated when you invoke the function. You can configure image pull acceleration by using one of the following methods when you create or update a function:
    • Use the Function Compute console. For more information, see Create a function in the console.
      The following figure shows how to configure image pull acceleration when you create a function.acree_accelerated
    • Use Serverless Devs. For more information, see YAML syntax.
      To configure image pull acceleration, add the accelerationType parameter to the CustomContainerConfig structure. Valid values:
      • Default: enables the image pull acceleration feature.
      • None: disables the image pull acceleration feature.
      The following sample code shows how to enable the image pull acceleration feature:
      customContainerConfig:
        image: registry-vpc.<regionId>.aliyuncs.com/fc-demo/python-flask:[Image version_accelerated]
        accelerationType: Default
    • Use SDKs.

What to do next

You can log on to the Function Compute console or call the GetFunction operation to view the status of image pull acceleration. For more information, see View the status of image pull acceleration.