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.
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.
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.
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.
AccelerationType: It is the default under the existing configuration of
CustomContainerConfig. If it needs to be closed, configure
CustomContainerConfig: Image: registry-vpc.cn-beijing.aliyuncs.com/fc-demo/python-flask:v0.1 AccelerationType: Default
FC image acceleration has the following features:
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:
The steps above are simple, but they are the main reasons for slow image pull:
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.
FC applies Alibaba Group's mature image acceleration technology to public cloud services. The acceleration technology is based on two key ideas:
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.
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.
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.
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).
Alibaba Container Service - July 28, 2021
ApsaraDB - October 22, 2020
Alibaba Cloud Serverless - April 21, 2022
Aliware - July 21, 2021
Alibaba Container Service - February 17, 2020
youliang - February 5, 2021
Link IoT Edge allows for the management of millions of edge nodes by extending the capabilities of the cloud, thus providing users with services at the nearest location.Learn More
High-performance virtual machines with data transfer plan, starting from $2.50 per monthLearn More
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
Deploy custom Alibaba Cloud solutions for business-critical scenarios with Quick Start templates.Learn More
More Posts by Alibaba Cloud Serverless