Community Blog Function Compute Image Acceleration: A Leap from Minutes to Seconds

Function Compute Image Acceleration: A Leap from Minutes to Seconds

This article reviews the release of Function Compute container image acceleration.

By Shuaichang, Senior Technical Expert of the Alibaba Cloud Cloud-Native Serverless Team.

Function Compute (FC) container image acceleration has officially been released. FC speeds up 50% to 80% in different scenarios through on-demand reading and more efficient decompression technology. Even a GB-level image can complete an end-to-end start in a few seconds.

Image pull acceleration documentation

FaaS and Containers

A container image has become a standard application deployment format in the cloud-native era due to its disruptive innovations. FaaS of leading cloud vendors, such as Alibaba Cloud FC and AWS Lambda, embrace the container ecology as they supported the use of container images to deploy functions in 2020. Image acceleration with Serverless has been used in multiple scenarios, such as machine learning, audio and video processing, event-driven offline data processing, and frontend automation, to improve efficiency and reduce costs. However, a cold start has always been an issue that Serverless cannot avoid. Container images need to download data remotely over the network and then decompress. It may take several minutes to pull GB-level images. This magnifies the side effects of cold start and hinders the Serverless evolution of real-time applications.

Function Compute Image Acceleration

Traditional image pull acceleration emphasizes developer responsibilities, including simplifying images, rationally allocating image layers, multi-stage build, using tools (such as docker-slim) to remove unnecessary data, and constructing best practices. These increase users' burden with limited acceleration effect and potential stability risks during running. The ultra-large-scale container environment with highly complex scenarios of Alibaba Group has gained rich accumulation in image storage and acceleration technology. It has taken on challenges, such as Double 11, Double 12, and promotion and flash sales during Spring Festival and other festivals for three years. Alibaba Cloud's Serverless has in-depth cooperation with services, such as container image and storage, to export internal innovations to FC. It officially released the image acceleration function in Hangzhou, Beijing, Shanghai, the Eastern United States, and the Western United States. This function transfers the image optimization workload of developers to FC, thus enabling developers to improve productivity and focus on business innovation.

Acceleration Effect

We selected the workloads of internal production environments and open-source communities, covering seven different combinations of image size, IO access mode, and start command (such as machine learning, artificial intelligence (AI), frontend automation, and Web applications) as benchmarks. They are deployed in the FC Beijing region. As shown in the figure below, after enabling image acceleration, the speed of FC rises by over 50%. The acceleration effect is clearer, with about 70%-86% acceleration for bloated images common in machine learning, such as basic images shared by multiple teams, ml-small-import, ml-large-import, and ai-cat-or-dog; the larger the image, the bigger the optimization space.



Image acceleration can be enabled through consoles, command-line Interface (CLI) tools, or FC SDK. For more information, please see the Images pull acceleration documentation.

  • Method 1: In the FC console, enable Image Acceleration under Settings


  • Method 2: Use Funcraft for deployment

Add AccelerationType: It is the default under the existing configuration of CustomContainerConfig. If it needs to be closed, configure AccelerationType: None.

          AccelerationType: Default


FC image acceleration has the following features:

  1. Easy to Use: You only need to enable image acceleration for the function. FC creates accelerated images and caches automatically. After the conversion is completed, which is within 5 minutes, the function can adopt accelerated image caches automatically.
  2. Focus on Business Innovation: Developers do not have to spend time streamlining and optimizing the image size or strictly distinguishing the building methods of Serverless and Serverfull application images. FC is in charge of pulling and decompressing data based on the actual use of applications.
  3. Free Acceleration with a Low Threshold: There is no additional fee for enabling image acceleration, and developers do not need to buy or upgrade any other services. Less image pull time requires fewer fees.
  4. Ultimate Elasticity, Scale-to-Zero, and Event-Driven: FaaS combined with container images have simplified the application migration to Serverless, and the acceleration function unlocks real-time and quasi-real-time workloads. Containers that previously needed a few minutes to start can start quickly within several seconds, achieving scale-to-zero.

Reasons for Slow Image Pull

An OCI V1 container image contains multiple layers. Each layer is a compressed file system or folder, which is usually stored in tar.gz format in remote services, such as objects and file storage. The steps to pull images are listed below:

  1. Download the tar.gz files of each layer to a local device
  2. Decompress each layer in sequence
  3. Combine the layers, such as Overlay, as the rootfs startup container

The steps above are simple, but they are the main reasons for slow image pull:

  • File Format Defects, Coarse-Grained Data Layering, and Sequential Decompression: The gzip layer makes it impossible to randomly read the data needed by applications in a fine-grained manner. It also requires all layers to be decompressed with a single thread. Observations show that the image layer can be downloaded faster with concurrent downloading. However, it is difficult to improve decompression with the gzip format.
  • Inefficient Compression and Decompression Algorithms: Gzip is used in the image layer. On average, the decompression speed of benchmark gzip is nearly 9 times slower than lz4.
  • Full Data Download: Due to the coarse-grained layering and gzip format that does not support seek, all image data must be downloaded to the local device regardless of whether it is useful.

In conclusion, image pull time is directly proportional to the image size. When a container image is built, apt/yum install, useless tests and data files, chmod/chown, and other commands are carried out, which results in multiple copies of the same data and the introduction of unnecessary data for applications.

Principles of Acceleration

FC applies Alibaba Group's mature image acceleration technology to public cloud services. The acceleration technology is based on two key ideas:

  • On-Demand Load: Only read the data that applications need to reduce the amount of data transmission.
  • More Efficient Storage and Algorithms: Data of the same size can be decompressed more quickly.

On-Demand Load

The loading amount of image data in the benchmark is between 12% and 84%. The utilization rate of most scenario data is less than 50%, except for web applications with small images. The original image with a layer as the data distribution unit is converted to a data format that supports fine-grained on-demand reading and stored in storage with better delay and throughput.


Efficient Decompression

In addition to reducing download time by an on-demand load, image acceleration technology has also improved the data decompression process. The following figure shows that the optimization effect exceeds 60% even when more than 70% of the full data is loaded.


Future Plans

Function Compute container image acceleration has officially been released. In different scenarios, FC speed rises by 50%-80% through an on-demand load with more efficient decompression technology. Even the GB-level image can complete end-to-end start in a few seconds. The acceleration function combines the ultimate elasticity and event-triggered features of FC, thus unlocking more workloads with high real-time requirements. Container applications can enjoy Serverless features more easily, truly realizing scale-to-zero and rapidly expanding to a large scale. In the future, FC will continue to optimize all phases of the cold start processes to provide ultimate elasticity and assume more user responsibilities to enable developers to focus on business innovation.

Appendix: Data from Experimental Scenarios


About the Author

Shuaichang is a Senior Technical Expert of the Alibaba Cloud Cloud-Native Serverless Team. He led the ecological integration of Function Compute and container technology and cloud-native observability of Function as a Service (FaaS).


0 0 0
Share on

Alibaba Cloud Serverless

77 posts | 6 followers

You may also like


Alibaba Cloud Serverless

77 posts | 6 followers

Related Products

  • Function Compute

    Alibaba Cloud Function Compute is a fully-managed event-driven compute service. It allows you to focus on writing and uploading code without the need to manage infrastructure such as servers.

    Learn More
  • Elastic High Performance Computing Solution

    High Performance Computing (HPC) and AI technology helps scientific research institutions to perform viral gene sequencing, conduct new drug research and development, and shorten the research and development cycle.

    Learn More
  • Quick Starts

    Deploy custom Alibaba Cloud solutions for business-critical scenarios with Quick Start templates.

    Learn More
  • Super Computing Cluster

    Super Computing Service provides ultimate computing performance and parallel computing cluster services for high-performance computing through high-speed RDMA network and heterogeneous accelerators such as GPU.

    Learn More