A method to eliminate cold starts of serverless computing containers

By introducing function mappers, behavior monitors and I/O forwarders into the serverless computing platform, the function types are classified and processed and corresponding caching strategies are adopted to solve the cold start problem, significantly reduce function call delays and resource overhead, and improve User experience and platform efficiency.

CN114528068BActive Publication Date: 2024-09-24JINAN UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210030339.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-12
Publication Date
2024-09-24
Estimated Expiration
2042-01-12

AI Technical Summary

Technical Problem

The cold start time of functions in serverless computing platforms is long, resulting in high function call delays. Especially when deploying applications with multiple functions, the cascading cold start problem is serious, affecting user experience and platform efficiency.

Method used

Introduce function mapper, behavior monitor and I/O forwarder into the serverless computing system, process function input parameters through hashing, monitor function system calls, and classify functions into computing type, I/O related and environment related, respectively. Caching strategies to reduce cold start overhead and end-to-end latency.

Benefits of technology

It effectively reduces the cold start overhead of computational functions and the end-to-end delay of I/O related functions, optimizing an average of 81.93% and 67.49% respectively, and reducing physical resource overhead by 26.23%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114528068B
    Figure CN114528068B
Patent Text Reader

Abstract

The present invention discloses a method for eliminating cold start of serverless computing container, which aims to: (1) bypass repeated calculations in the process of calling functions on the serverless platform and eliminate container cold start; (2) avoid function requests for external files and reduce the call delay during function execution. The method designs a real-time monitoring mechanism based on container runtime, and divides functions into three categories according to monitoring information: computing functions, I / O functions and environment-related functions. For computing functions, the execution of functions is bypassed by caching and directly returning the calculation results; for I / O functions, the delay overhead caused by function access to external networks is reduced by maintaining the external files required by the function in the local file system. The method eliminates container cold start and reduces the end-to-end delay of function calls. In addition, since the function execution and container startup can be bypassed and the calculation results of the computing function can be directly returned, the physical resources required to process function requests are further reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of serverless computing architecture, and in particular to a method for eliminating cold start of a serverless computing container. Background Art

[0002] Serverless computing architecture is the preferred way to deploy large-scale distributed applications in data centers. Serverless computing mainly uses the Function-as-a-Service (FaaS) model to provide developers with a convenient deployment method and improve the scalability of applications. However, there are many problems that need to be improved on the FaaS platform side, especially the cold start optimization problem of functions.

[0003] When the FaaS platform receives a function call request for the first time, it needs to prepare the corresponding container runtime environment for the function request. Generally, building a container runtime environment includes: (1) creating and starting a basic runtime environment; (2) pulling the function code and installing the corresponding dependencies of the function. This construction phase is called the cold start phase. Only after the cold start phase is completed can the function be executed.

[0004] Related research shows that the startup time of a container is roughly around 1 second, while the execution time of each function is usually distributed in milliseconds to seconds. Compared with the short execution time of the function, the cold start phase mentioned above may take a lot of time, thereby increasing the delay when calling the function and reducing the user experience of FaaS users. In addition, when multiple functions are deployed in a function chain, the cold start problem will be aggravated because the function chain may cause cascading cold starts. Therefore, the cold start of the function is a problem that FaaS providers need to overcome, and reducing the impact of the cold start problem is a key challenge for FaaS platforms. Summary of the invention

[0005] The purpose of the present invention is to solve the above-mentioned defects in the prior art and provide a method for eliminating the cold start of serverless computing containers. When a function call request arrives at a serverless platform, different cold start optimization strategies are provided for different types of functions based on the idea of ​​classification processing, aiming to reduce the cold start overhead and end-to-end delay, and reduce the resource overhead of physical servers.

[0006] The purpose of the present invention can be achieved by adopting the following technical solutions:

[0007] A method for eliminating cold starts of serverless computing containers is applied to a serverless computing system. The serverless computing system adds a function mapper, a behavior monitor, and an I / O forwarder on the basis of an existing serverless platform. The serverless computing system is hereinafter referred to as the system.

[0008] After receiving the function call request, the system preprocesses the corresponding meta information of the called function. First, the function mapper is used to determine whether the calculation result of the function has been cached based on the meta information. If the cache does not hit, the function is executed normally. During the function execution process, the behavior monitor monitors the system calls generated by the running function and determines the type of function. Finally, the calculation results required by the function or the requested external files are stored in the function mapper and the local file system according to the function type.

[0009] In this method, after receiving the function call request, the serverless platform goes through the three-layer processing logic of function mapper, behavior monitor and I / O forwarder, which specifically includes the following steps:

[0010] S1. When the system receives a function call request, it performs a hash operation on the input parameters of the called function and initializes a nested key-value pair data structure based on the function name and the hash value of the corresponding parameter. The final "value" is the output corresponding to the function. The function name, the hash value of the function input and the function output are stored in the function mapper in the form of nested key-value pair mapping;

[0011] S2. When a function is executed, the behavior monitor monitors the system calls generated when the function is running. According to the monitoring information, the functions are divided into three types: computing functions, I / O related functions and environment related functions. The function mapper decides whether to cache the corresponding calculation results according to the type of the function.

[0012] S3. Set up cache conditions for computing functions and I / O-related functions respectively. For computing functions, set up cache conditions to eliminate cold start overhead when calling functions; for I / O-related functions, set up cache conditions to reduce end-to-end delays caused by external access to object storage files when executing functions.

[0013] Furthermore, in step S1, the system receives a function call request and performs hash preprocessing on the meta information corresponding to the called function. On the one hand, this is to quickly detect the cache status of the function calculation result; on the other hand, this is to reduce the memory overhead of the cache calculation result. The process is as follows:

[0014] S11, parse the function name and the input parameter param carried by the calling function, perform hash calculation on the input parameter, and retain the calculated hash value Hash(param);

[0015] S12. Using the hash value Hash(param) of the input parameter of the above function as the key, initialize an empty key-value pair {Hash(param):value}, using the function name func as the key and the above empty key-value pair as the value to initialize a nested key-value pair {func:{Hash(pram):value}}, where value is the function calculation result to be filled in;

[0016] S13. When the function request is received by the system, first determine whether the function name exists in the nested key-value pair, and then determine whether there is a calculation result mapped to the corresponding function input parameter; if the calculation result required by the function exists, it is returned directly to the function caller; if the corresponding calculation result does not exist, go to steps S2 and S3 and execute the function normally.

[0017] Furthermore, hash calculation is used to link functions, function inputs, and function calculation results, which speeds up the retrieval speed of the function mapper while eliminating the container startup overhead. At the same time, hashing the input parameters of the function can convert the input parameters into fixed-length strings, reducing the memory space required by the function mapper to store function mapping information.

[0018] Furthermore, in step S2, the behavior monitor monitors the system call information issued by the function during the function execution process, and the process of classifying the function into three types according to the monitoring information is as follows:

[0019] S21. For I / O related functions, in Unix-like operating systems, many different types of I / O operations are uniformly identified by file descriptors. File descriptors have an indirect reference to open file instances. File descriptors can be obtained through open() system calls, that is, I / O operations need to be supported by open() system calls. The behavior monitor embedded in the function container determines whether it belongs to an I / O related function based on whether the function generates an open() system call.

[0020] S22. For the environment-related function, the system determines whether the output corresponding to the function call is consistent within the T execution threshold. If the function output is inconsistent in the T executions, the function is classified as an environment-related function.

[0021] S23. For a calculation function, if both steps S21 and S22 are not hit, the target function is classified as a calculation function. For a calculation function, each input corresponds to a unique calculation result.

[0022] Furthermore, serverless functions are divided into computing functions, I / O-related functions, and environment-related functions. The function mapper and I / O forwarder determine the optimization strategy of the function according to the type of function. Among them, the computing function is the target of the function mapper to cache the calculation results, and the external files requested by the I / O-related function are the objects maintained by the I / O forwarder.

[0023] Furthermore, the process of step S3 is as follows:

[0024] S31. When the system receives a computing function request with cached computing results, it directly goes to the function mapper to obtain its computing results according to the function name and input parameters, thus eliminating the overhead of container startup and repeated function execution.

[0025] S32, when the system receives and executes an I / O related function, the file request issued to the external object storage is first intercepted by the I / O forwarder, and then it is determined whether the requested file exists in the local file system; if the local file system does not exist, the file request is obtained from the outside, and a copy is saved in the local file system while being transmitted to the function;

[0026] Among them, the I / O forwarder acts as an external request agent in the actual system. When a function requests a file externally, the I / O forwarder will first intercept the corresponding file request, and then determine whether the local file system has cached the latest version of the file requested by the function; if the local cache does not hit, it will request the remote file and save it locally.

[0027] The optimization purpose after classifying the functions according to their monitoring information in the above steps S31 and S32 is as follows:

[0028] For each individual serverless function, it is regarded as a classification problem during the execution process. The classification goal is to find an optimization method based on the different characteristics of the function to reduce the cold start and end-to-end delay overhead of the serverless platform.

[0029] Furthermore, we optimized computing functions and I / O-related functions to eliminate container cold starts and reduce end-to-end call delays, respectively. For computing functions, the end-to-end delay was reduced by an average of 81.93%, and for I / O-related functions, the end-to-end delay was reduced by an average of 67.49%.

[0030] Furthermore, the function mapper saves the calculation results corresponding to the input parameters of the computational function. When the serverless platform receives the corresponding request, the function mapper can directly return the calculation results, bypassing the overhead of container initialization and function startup execution, and reducing physical resource overhead by 26.23%.

[0031] Compared with the prior art, the present invention has the following advantages and effects:

[0032] (1) The present invention divides serverless functions into three categories according to their different characteristics during execution, namely, computing functions, I / O functions, and environment-related functions, and adopts different optimization schemes according to the classification of functions.

[0033] (2) For computational functions, the present invention avoids repeated execution of functions by directly caching their calculation results, thereby eliminating the overhead of container cold start; for I / O-related functions, the local file system is used as a cache, and the latest version of the external file requested by the function is saved in the local cache, reducing the high end-to-end latency caused by accessing external files.

[0034] (3) The present invention considers reducing the physical resource overhead of the serverless platform while eliminating the cold start of the computing function container and reducing the I / O-related function call delay. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0036] Figure 1 It is an application architecture diagram of a method for eliminating cold start of serverless computing containers disclosed in the present invention;

[0037] Figure 2 This is a comparison chart of the end-to-end delay generated by a single-step function under different strategies;

[0038] Figure 3 This is another end-to-end delay comparison chart generated by the single-step function under different strategies;

[0039] Figure 4 This is a diagram of the call delay of a multi-step function under different strategies;

[0040] Figure 5 It is a schematic diagram of the physical resource utilization during the execution of a single-step function;

[0041] Figure 6 It is a schematic diagram of the utilization of physical resources during the execution of a multi-step function. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0043] Example 1

[0044] like Figure 1 Shown is an application architecture diagram of a method for eliminating cold starts of serverless computing containers. When applied in a serverless computing architecture, it optimizes the high latency problems caused by cold starts of containers and function execution processes when functions are called. For computing functions, the cold start of functions is bypassed by caching calculation results; for I / O-related functions, the end-to-end latency of function execution is reduced by caching external requests to the local file system. The present invention conducts comparative tests on this optimization strategy and evaluates the cold start optimization effect of the present invention on serverless platforms from multiple angles.

[0045] In order to more clearly illustrate the application scenario of the present invention, the following is a detailed analysis combined with the application architecture diagram, which is mainly divided into three steps:

[0046] 1) Check the calculation result of the computational function. After receiving the function request from the user, the function mapper first performs a hash calculation on the input of the function, and then queries whether the corresponding function calculation result has been cached based on the calculated hash value combined with the function name. The specific process is as follows. Assume that the function name of the current request is func, the input parameter is param, and the input parameter after hash calculation is Hash(param). In the function mapper, first check whether there is a value func→V with the key func. If so, check whether there is a key Hash(param) in func→V, and the corresponding calculation result of the function is func→V→Hash(param). If one step of the above process does not hit, it means that the cache corresponding to the requested function has not yet been saved in the function mapper.

[0047] 2) Function behavior monitoring. In the case of a function mapper miss, the present invention determines the type of function by monitoring the system call information generated by the function during the function execution process. Specifically, the present invention divides functions into computing functions, I / O-related functions, and environment-related functions. The present invention adds a behavior monitoring module to the container runtime to capture the system calls of functions. Among them, if the function initiates an open() system call during execution, it means that the function needs to access external files. At this time, the function is classified as an I / O function. In addition, the present invention distinguishes between computing functions and environment-related functions by comparing the calculation results of the function for T consecutive times in the past. The calculation result of the function func at the i-th time is recorded as Result i If there is a Result i =Result j ,1≤i<j≤T, it means that the calculation results of the function func in the past T consecutive times are consistent, and the function can be determined as a calculation function. Otherwise, the function is an environment-related function. Based on the above classification, the function behavior monitor will cache the calculation results of the calculation function in the form of key-value pairs in the function mapper.

[0048] 3) I / O interceptor. The I / O interceptor aims to reduce the end-to-end latency of I / O-related functions. The I / O interceptor works with the function monitor, and the function monitor monitors the I / O system calls generated during the function execution. When the interceptor captures an external file request from an I / O-related function, it first determines whether the local file system has the corresponding latest version of the file based on the requested file name. If the local file system has cached the file requested by the function, it will be loaded directly from the local file system; if the local file system does not have the file requested by the function, or the file version is not the latest, a remote file I / O request will be issued. After obtaining the file from the remote, the I / O interceptor updates a copy to the local cache to facilitate subsequent function requests.

[0049] In summary, this embodiment provides a method for eliminating cold starts in a serverless computing architecture, which uses the characteristics of serverless functions to divide them into three categories. For computing functions, the calculation results are cached to bypass the repeated execution of functions and the startup of containers, further reducing the physical resource overhead required by the serverless platform to start containers; for I / O-related functions, a local file system is provided as an I / O cache for remote files to reduce the end-to-end delay of function calls.

[0050] Example 2

[0051] This embodiment tests the proposed technology in terms of function end-to-end delay and resource usage from two function loads: single-step function and multi-step function. Single-step function refers to an application that contains only one function, as shown in the table; and multi-step function refers to an application that contains multiple functions, as shown in Table 2. The present invention uses a function data set disclosed by the academic community to evaluate the effect. The present invention involves a parameter T during operation, that is, the data after the function is executed continuously for T times is used to determine whether the function belongs to a computational function or an environment-related function. In the experimental evaluation, the T parameter is set to 3.

[0052] Table 1 Single-step function categories and descriptions

[0053]

[0054] Table 2. Multi-step function description

[0055] function describe FINRA Bank audit application, including 5 single-step functions Prediction Image classification application, including 3 single-step functions Set computation Collection-related computing applications, including three single-step functions

[0056] In a serverless platform, function execution requires a container as a carrier. When the platform starts the container, it needs to allocate certain physical resources to it, such as the number of CPU cores, memory, etc. The time interval from the moment the platform receives the user request to the moment the user receives the response is the end-to-end call delay of the function. The present invention tests the end-to-end delay of the function and the utilization of physical resources by repeatedly executing the function 10 times. The test platform includes 2 Intel(R) Xeon(R) Silver4216 processors (each processor includes 32 processing cores), 128GB of memory, and Centos 8 system. In the following comparison, the present invention is named HashCache, and the strategy used for comparison is FaaSCache.

[0057] Figure 2 and Figure 3 This is a comparison chart of the end-to-end delay generated by a single-step function under different strategies. Figure 2 In the example, the computational functions of the present invention are optimized by 39.05% to 66.78% compared with FaaSCache. In fact, the present invention determines whether to cache the output of the computational function after comparing the output of the function T times before caching it. Therefore, Figure 2 The end-to-end latency of the computational function in includes the data when HashCache is not activated. After removing this data, Figure 3 This shows the optimization value of the end-to-end latency of the function after HashCache is activated. Figure 3It can be seen that HashCache has optimized the latency of computing functions by up to 94.8% and the average by 81.94% compared to FaaSCache, and optimized the latency of I / O-related functions by an average of 67.4%. The above experimental results confirm that the HashCache proposed in this invention can effectively cache the calculation results of computing functions, and can also cache the remote files requested by I / O functions, thereby reducing their end-to-end latency.

[0058] Figure 4 The figure shows the call latency of multi-step functions under different strategies. As can be seen from the figure, HashCache is optimized by 34.6%, 54.26%, and 53.9% in the three applications of FINRA, Prediction, and Set computation respectively compared with FaaSCache.

[0059] In general, the proposed HashCache has better performance in terms of end-to-end latency for both single-step and multi-step functions. This is because with HashCache, the FaaS platform can return the calculation result of the function after caching the corresponding output data. In addition, HashCache maintains a local file system cache layer to store the latest external request for each I / O-related operation.

[0060] Figure 5 and Figure 6 The physical resource utilization during the execution of single-step functions and multi-step functions is described. On average, HashCache reduces memory usage by 26.23% compared to the comparison strategy FaaSCache. At the same time, the CPU peak generated by HashCache is much less than the CPU peak generated under the FaaSCache strategy. The above results confirm that the present invention can effectively bypass the startup of containers and the execution of functions by caching the calculation results of computing functions. Bypassing the startup of containers avoids memory allocation, and bypassing the execution of functions avoids consuming CPU resources.

[0061] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. A method for eliminating cold starts of serverless computing containers, applied to a serverless computing system, hereinafter referred to as a system, characterized in that: The method comprises the following steps: S1. When the system receives a function call request, it performs a hash operation on the function name and the input parameters related to the function call, and initializes a nested key-value pair data structure according to the function name and the hash value of the corresponding parameter. The final "value" is the output corresponding to the function. The function name, function input and function output are stored in the function mapper as a key-value pair mapping relationship; S2. When a function is executed, the behavior monitor monitors the system calls generated when the function is running. According to the monitoring information, the functions are divided into three types: computing functions, I / O related functions and environment related functions. The function mapper decides whether to cache the corresponding calculation results according to the type of the function. S3. Set up cache conditions for computing functions and I / O-related functions respectively. For computing functions, set up cache conditions to eliminate cold start overhead when calling functions; for I / O-related functions, set up cache conditions to reduce end-to-end delays caused by external access to object storage files when executing functions.

2. A method for eliminating cold starts of serverless computing containers according to claim 1, characterized in that: In step S1, the system receives a function call request, and the process of preprocessing the corresponding meta information of the called function is as follows: S11, parsing the function name and the input parameters carried by the calling function, performing hash calculation on the function input parameters, and retaining the calculated hash value; S12. Initialize an empty key-value pair using the hash value as a key, and initialize a nested key-value pair using the function name as a key and the empty key-value pair as a value; S13. When a function request is received by the system, it is first determined whether there is a nested key-value pair with the function name as the key, and then it is determined whether there is a calculation result mapped by the hash value of the corresponding function input parameter; if the calculation result required by the function exists, it is returned directly to the function caller.

3. A method for eliminating cold starts of serverless computing containers according to claim 1, characterized in that: Hash calculation is used to associate function names, function inputs, and function calculation results, thereby accelerating the key value retrieval speed of the function mapper while eliminating the container startup overhead.

4. A method for eliminating cold starts of serverless computing containers according to claim 1, characterized in that: In step S2, the process of classifying functions into three types according to monitoring information is as follows: S21. For an I / O-related function, a behavior monitor embedded in the function container intercepts the system call of the function execution process, and determines whether it is an I / O-related function according to whether the function generates an open() system call, wherein the open() system call indicates that the function is allowed to open and operate a file; S22. For the environment-related function, the system determines whether the calculation results corresponding to the function call are consistent within the T execution threshold. If the function calculation results are inconsistent in the T executions, the function is classified as an environment-related function. S23. For a calculation function, if both steps S21 and S22 are not successful, the target function is classified as a calculation function. For a calculation function, each input corresponds to a unique calculation result.

5. A method for eliminating cold starts of serverless computing containers according to claim 1, characterized in that: Serverless functions are divided into computing functions, I / O-related functions, and environment-related functions. The function mapper and I / O forwarder decide whether to optimize the function based on its type. Computational functions are the target of the function mapper to cache the calculation results, while the external files requested by I / O-related functions are the objects maintained by the I / O forwarder. The I / O forwarder maintains the external files requested by the function in the local file system.

6. A method for eliminating cold starts of serverless computing containers according to claim 1, characterized in that: The process of step S3 is as follows: S31. When the system receives a computing function request with cached computing results, it directly goes to the function mapper to obtain its computing result according to the function name and the hash value of the input parameter, thus eliminating the overhead of container startup and repeated function execution. S32. When the system receives and executes an I / O related function, the file request issued by the function to the external object storage is first intercepted by the I / O forwarder, and then the I / O interceptor determines whether the requested file exists in the local file system; if not, it obtains the file request from the outside, and saves another copy in the local file system while transmitting it to the function.

7. A method for eliminating cold starts of serverless computing containers according to claim 1, characterized in that: Computational functions and I / O-related functions are optimized to eliminate container cold starts and reduce end-to-end call latency, speeding up the time it takes for the platform to process function requests and reducing the overhead of physical resources.

8. A method for eliminating cold starts of serverless computing containers according to any one of claims 1 to 7, characterized in that: The serverless computing system adds a function mapper, a behavior monitor and an I / O forwarder on the basis of the existing serverless platform.