Methods, devices, equipment and media for accelerating cold starts in function computing

CN115509751BActive Publication Date: 2026-04-03CHINA MERCHANTS BANK
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-28
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In a serverless architecture Knative cold start scenario, the slow container startup speed leads to slow link speed, and the stability issues of the activator component are prominent when there is high traffic or large file uploads.

Method used

After a request enters the cluster via the traffic gateway, the application container is expanded to generate multiple target containers. When the target component detects that the function process has not started, the function process is started to handle the request, and the function framework is optimized to achieve millisecond-level cold start.

Benefits of technology

It achieves millisecond-level cold start for function computation, reducing latency and resource memory consumption, and improving the stability and efficiency of function computation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115509751B_ABST
    Figure CN115509751B_ABST
Patent Text Reader

Abstract

This invention relates to the field of serverless computing technology and discloses a method, apparatus, device, and medium for accelerating the cold start of Function Compute. The invention improves the cold start efficiency and stability of Function Compute by detecting when a request enters the cluster via a traffic gateway, checking whether the application container meets a preset load balancing strategy, and scaling up the application container to obtain multiple target application containers if the application container does not meet the preset load balancing strategy. The traffic gateway then routes the request to the target components of each target application container, where each target application container includes a target component and a target function process. If the target component detects that the target function process is not running, it starts the target function process and passes the request to the target function process for processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of serverless computing technology, and in particular to a method, apparatus, device and medium for accelerating the cold start of function computing. Background Technology

[0002] Serverless architecture, or "serverless" architecture, is a completely new architectural approach and a revolutionary architectural model in the era of cloud computing. FaaS (Function as a Service), as the primary computing form in the Serverless field, is rapidly developing on public clouds (such as AWS, Alibaba Cloud, Tencent Cloud, Huawei Cloud, Baidu Cloud, etc.) and is gaining widespread user recognition and application.

[0003] Currently, in a serverless architecture's Knative cold start scenario, when traffic arrives, it is first intercepted by a unified component (activator), the container replica count is changed to a non-zero value, and the routing is modified to allow subsequent requests to enter via a warm start. However, the above operation brings some problems: on the one hand, the container startup speed is very slow, at least 1.5 seconds in a public cloud (Knative scenario) and more than 2 seconds in a private cloud scenario; coupled with the application startup time, the entire chain speed becomes very slow; on the other hand, if there are many cold start requests, or if the requests include large-body scenarios such as file uploads, the stability of the activator component will be affected. Summary of the Invention

[0004] The main objective of this invention is to propose a method, apparatus, device, and medium for accelerating the cold start of function computing, aiming to improve the cold start efficiency and stability of function computing.

[0005] To achieve the above objectives, the present invention provides a method for accelerating cold starts in function computing, the method comprising the following steps:

[0006] After the traffic gateway detects that a request has entered the cluster, if the application container does not meet the preset load policy, the application container is expanded by the scaling controller to obtain multiple target application containers, and the request is routed to each target application container. The target application container includes target components and target function processes.

[0007] If the target component detects that the target function process has not started, the target component starts the target function process and passes the request to the target function process for the target function process to process the request.

[0008] Preferably, before the step of scaling up the initial application container to obtain multiple target application containers by means of a scaling controller after the traffic gateway detects a request entering the cluster, if the application container does not meet the preset load policy, and then routing the request to each target application container, the method further includes:

[0009] When the application container is in its initial state, components and function processes are encapsulated within the application container. The application container retains at least one instance in its initial state. The components are used to intercept the requests and control the lifecycle of the function processes, which are used to process the requests.

[0010] Preferably, the step of scaling up the application container to obtain multiple target application containers after the traffic gateway detects a request entering the cluster, if the application container does not meet the preset load policy, includes:

[0011] After the traffic gateway detects that a request has entered the cluster, it monitors the memory of the application container through the scaling controller and compares the memory with the preset memory of the application container.

[0012] If the memory of the application container is greater than the preset memory, the application container is expanded by the scaling controller to obtain multiple target application containers.

[0013] Preferably, the step of scaling up the application container to obtain multiple target application containers by means of a scaling controller after the traffic gateway detects that a request has entered the cluster, and then routing the request to each target application container, includes:

[0014] After the traffic gateway detects that a request has entered the cluster, it monitors the processing capacity of the application container's processor through the scaling controller and compares the processing capacity with the preset processing capacity of the application container.

[0015] When the processing volume exceeds the preset processing volume, the application container is expanded by the scaling controller to obtain multiple target application containers.

[0016] Preferably, the step of scaling up the application container to obtain multiple target application containers after the traffic gateway detects a request entering the cluster, if the application container does not meet the preset load policy, includes:

[0017] After the traffic gateway detects that a request has entered the cluster, it monitors the request volume through the scaling controller and compares the request volume with the preset request volume of the application container.

[0018] If the number of requests exceeds the preset number of requests, the application container is expanded by the scaling controller to obtain multiple target application containers.

[0019] Preferably, after the step of scaling up the application container to obtain multiple target application containers by means of a scaling controller to obtain multiple target application containers and routing the request to each target application container after the traffic gateway detects that a request has entered the cluster, the method further includes:

[0020] If the target component detects that the target function process has started, the target component passes the request to the target function so that the target function process can process the request.

[0021] Preferably, after the step of starting the target function process through the target component and passing the request to the target function process so that the target function process can process the request when the target component detects that the target function process has not started, the method further includes:

[0022] When the traffic gateway does not receive a request within the target time period, the target component kills the target function process.

[0023] Furthermore, to achieve the above objectives, the present invention also provides an acceleration device for cold starts in function computing, the acceleration device for cold starts in function computing comprising:

[0024] The routing module is used to expand the application container through the scaling controller to obtain multiple target application containers after the traffic gateway detects that the application container does not meet the preset load policy after the application container does not meet the preset load policy. The module then routes the request to each target application container. The target application container includes target components and target function processes.

[0025] The processing module is configured to, when the target component detects that the target function process has not been started, start the target function process through the target component and pass the request to the target function process so that the target function process can process the request.

[0026] In addition, to achieve the above objectives, the present invention also provides an apparatus comprising: a memory, a processor, and a function computing cold start acceleration program stored in the memory and executable on the processor, wherein the function computing cold start acceleration program, when executed by the processor, implements the steps of the function computing cold start acceleration method as described above.

[0027] Furthermore, to achieve the above objectives, the present invention also provides a medium, which is a computer-readable storage medium storing a function computation cold start acceleration program, wherein when the function computation cold start acceleration program is executed by a processor, it implements the steps of the function computation cold start acceleration method as described above.

[0028] This invention proposes a method, apparatus, terminal device, and medium for accelerating cold starts in Function Compute. The invention involves a traffic gateway detecting when a request enters the cluster and checking if the application container meets a preset load balancing strategy. If the application container does not meet the preset load balancing strategy, a scaling controller expands the application container to obtain multiple target application containers. The traffic gateway then routes the request to the target components of each target application container. Each target application container includes a target component and a target function process. If the target component detects that the target function process is not started, it starts the target function process and passes the request to it for processing. By optimizing the function framework—specifically, encapsulating a component and a function process within the application container—when a request enters the application container in its initial state, the target component starts the target function process, which then processes the request. This avoids container-level startup, enabling millisecond (ms) level cold starts, reducing function compute cold start time and resource memory consumption, thereby improving function compute cold start efficiency and stability. Attached Figure Description

[0029] Figure 1 This is a schematic diagram of the device structure of the hardware operating environment involved in the embodiments of the present invention;

[0030] Figure 2 This is a flowchart illustrating the first embodiment of the method for accelerating cold starts in function computation according to the present invention.

[0031] Figure 3 This is a schematic diagram of the function framework for the accelerated function computation cold start method of the present invention;

[0032] Figure 4 This is a flowchart illustrating the second embodiment of the method for accelerating cold starts in function computation according to the present invention.

[0033] Figure 5 This is a flowchart illustrating the third embodiment of the method for accelerating cold starts in function computation according to the present invention.

[0034] Figure 6 This is a flowchart illustrating the fourth embodiment of the method for accelerating cold starts in function computation according to the present invention.

[0035] Figure 7This is a flowchart illustrating the fifth embodiment of the method for accelerating cold starts in function computation according to the present invention.

[0036] Figure 8 This is a schematic diagram of the functional modules of the first embodiment of the acceleration device for cold start of function computation according to the present invention.

[0037] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0038] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0039] like Figure 1 As shown, Figure 1 This is a schematic diagram of the device structure of the hardware operating environment involved in the embodiments of the present invention.

[0040] The device in this embodiment of the invention can be a mobile terminal or a server device.

[0041] like Figure 1 As shown, the device may include: a processor 1001, such as a CPU; a network interface 1004; a user interface 1003; a memory 1005; and a communication bus 1002. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0042] Those skilled in the art will understand that Figure 1 The device structure shown does not constitute a limitation on the device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0043] like Figure 1 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an acceleration program for function computing cold starts.

[0044] The operating system is a program that manages and controls terminal devices and software resources, and supports the operation of the network communication module, user interface module, function computing cold start acceleration program, and other programs or software; the network communication module is used to manage and control the network interface 1002; and the user interface module is used to manage and control the user interface 1003.

[0045] exist Figure 1 In the device shown, the device calls the function stored in the memory 1005 through the processor 1001 to calculate the acceleration program for cold start, and executes the operations in the various embodiments of the function calculation method for cold start described below.

[0046] Based on the above hardware structure, an embodiment of the method for accelerating cold starts of function computation according to the present invention is proposed.

[0047] Reference Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the function computation cold start acceleration method of the present invention. The function computation cold start acceleration method includes:

[0048] Step S10: After the traffic gateway detects that a request has entered the cluster, if the application container does not meet the preset load policy, the application container is expanded by the scaling controller to obtain multiple target application containers, and the request is routed to each target application container. The target application container includes target components and target function processes.

[0049] Step S20: If the target component detects that the target function process has not started, the target component starts the target function process and passes the request to the target function process so that the target function process can process the request.

[0050] This embodiment detects whether an application container meets a preset load balancing strategy after a request enters the cluster via the traffic gateway. If the application container does not meet the preset load balancing strategy, the application container is expanded using a scaling controller to obtain multiple target application containers. The traffic gateway then routes the request to the target components of each target application container. Each target application container includes a target component and a target function process. If a target component detects that the target function process has not started, it starts the target function process and passes the request to the target function process for processing. This reduces the cold start latency of function computing and distributes the computational load.

[0051] The following will provide a detailed explanation of each step:

[0052] Step S10: After the traffic gateway detects that a request has entered the cluster, if the application container does not meet the preset load policy, the application container is expanded by the scaling controller to obtain multiple target application containers, and the request is routed to each target application container. The target application container includes target components and target function processes.

[0053] In this embodiment, the method for accelerating the cold start of function computation is based on Faas function computation and the Severless concept, and a self-designed Faas function computation framework is implemented; refer to Figure 3 , Figure 3 This diagram illustrates a function framework for accelerating cold starts in FaaS (Fast As Compute). It encapsulates a funclet component and a function process within the initial application container. The funclet component controls the lifecycle of the function process, splitting FaaS's conventional scaling capability (0-N) into two segments: (0-1) and (1-N). This avoids directly invoking the application container during function cold starts; only the function process needs to be launched. Through this optimization of the function framework, millisecond-level cold starts are achieved, significantly reducing the latency of FaaS cold starts.

[0054] When the traffic gateway detects a request entering the cluster, it checks whether the application container in its initial state meets the preset load policy through the scaling controller. If the application container does not meet the preset load policy, it expands the application container through the scaling controller to multiple target application containers, so that the expanded multiple target application containers can adapt to the request. In the initial state, the application container is not scaled down to zero, but at least one instance is retained. And a funclet component and function process are encapsulated in the application container.

[0055] The preset load policy refers to the maximum load indicators that an application container can withstand in its initial state, which include, but are not limited to, the preset memory, preset processing capacity (CPU), and preset request volume of the application container. In other words, the scaling controller detects whether one or more of these indicators—memory, processing capacity, and request volume—of the application container in its initial state exceeds the corresponding preset memory, processing capacity, or request volume; if it exceeds the preset limit, it indicates that the application container in its initial state does not meet the preset load policy.

[0056] For example, if the default memory of the application container in the initial state is 80%, and the actual memory of the application container in the initial state is 90% as detected by the scaling controller, it means that the application container in the initial state does not meet the default load policy.

[0057] If the application container in its initial state does not meet the preset load balancing strategy, the scaling controller expands the application container to generate multiple target application containers, enabling the expanded target application containers to adapt to requests. Each target application container encapsulates a funclet component and a function process. The funclet component in the target application container is called the target component, and the function process in the target application container is called the target function process.

[0058] The traffic gateway routes requests to the respective target application containers, where they are then processed by the target components.

[0059] Furthermore, in one embodiment, step S10, after the traffic gateway detects that a request has entered the cluster, the method for accelerating the cold start of Function Compute further includes: if the application container meets the preset load policy, determining the application container as the target application container, and routing the request to the target application container through the traffic gateway.

[0060] In this embodiment, when the scaling controller detects that the application container in the initial state meets the preset load policy, it determines the application container as the target application container; the request is routed to the target application container through the traffic gateway, and the request is handed over to the target component in the target application container for processing; thereby reducing the resource memory consumption of Function Compute cold start.

[0061] Furthermore, in one embodiment, after step S10, the method for accelerating the cold start of Function Compute further includes: when the target component detects that the target function process has been started, the target component passes the request to the target function so that the target function process can process the request.

[0062] In this embodiment, the target component detects whether the target function process has started. If the target component detects that the target function process has started, it passes the request to the target function so that the target function process can process the request. This achieves a 0-1 cold start. The optimized function framework improves the startup speed of the function computation cold start and achieves high performance and high scalability of the entire Faas function computation with extremely low memory consumption.

[0063] Step S20: If the target component detects that the target function process has not started, the target component starts the target function process and passes the request to the target function process so that the target function process can process the request.

[0064] In this embodiment, the target component detects whether the target function process has started. If the target component detects that the target function process has not started, it starts the target function process and passes the request to the target function process for processing. When a request enters the application container in its initial state, the target component starts the target function process and processes the request, thereby avoiding container-level startup, reducing function compute cold start time, and minimizing resource and memory consumption.

[0065] Furthermore, in one embodiment, after step S20, the method for accelerating the cold start of Function Compute further includes: when the traffic gateway does not receive a request within the target time period, killing the target function process through the target component.

[0066] In this embodiment, when the traffic gateway does not receive a request for a period of time (preferably 120 seconds), the control target component will kill the target function process, thereby reducing resource consumption. The target time period is a pre-set period, and the default target time period is 120 seconds. After killing the target function process, the funclet component itself consumes very little memory (less than 9MB).

[0067] This embodiment improves the cold start efficiency and stability of Function Compute by detecting whether the application container meets the preset load policy after the traffic gateway detects that a request has entered the cluster. If the application container does not meet the preset load policy, the application container is expanded by the scaling controller to obtain multiple target application containers. The traffic gateway then routes the request to the target components of each target application container. Each target application container includes a target component and a target function process. If the target component detects that the target function process has not started, it starts the target function process and passes the request to the target function process for processing.

[0068] Furthermore, based on the first embodiment of the accelerated method for cold start of function computation of the present invention, a second embodiment of the accelerated method for cold start of function computation of the present invention is proposed.

[0069] The second embodiment of the function computing cold start acceleration method differs from the first embodiment in that, in this embodiment, before step S10, where the application container is expanded by the scaling controller to obtain multiple target application containers after the traffic gateway detects a request entering the cluster and if the application container does not meet the preset load policy, and the request is routed to each target application container, refer to... Figure 4 Other methods to accelerate cold starts in Function Compute include:

[0070] Step A10: When the application container is in its initial state, the component and the function process are encapsulated into the application container. The application container retains at least one instance in its initial state. The component is used to intercept the request and control the lifecycle of the function process, and the function process is used to process the request.

[0071] In this embodiment, by encapsulating components and function processes within the application container in its initial state, and by maintaining at least one instance of the application container in its initial state, when a request enters the application container in its initial state, the function process is started through the component and the request is processed by the function process. This avoids container-level startup, reduces the cold start time of function computing, and reduces resource memory consumption.

[0072] The following will provide a detailed explanation of each step:

[0073] Step A10: When the application container is in its initial state, the component and the function process are encapsulated into the application container. The application container retains at least one instance in its initial state. The component is used to intercept the request and control the lifecycle of the function process, and the function process is used to process the request.

[0074] In this embodiment, in the initial state of the application container, the application container is not shrunk to zero. At least one instance of the application container is retained to keep the application container alive.

[0075] In the initial state of the application container, the funclet component and the function process are encapsulated within the same application container. The funclet component intercepts requests and controls the lifecycle of the function process; the function process, once started, can be used to handle requests. By adding a funclet component within the application container to control the function process's lifecycle, the original Faas function computation's standard scaling capability (0-N) is split into two segments: (0-1) and (1-N). This avoids the function computation cold start directly calling the application container; only the function process needs to be started. Through optimization of the function framework, the cold start latency can be reduced to the millisecond (ms) level.

[0076] After encapsulating the funclet component and function process within the application container, when the traffic gateway detects a request entering the cluster, it directly forwards the request to the instance reserved by the application container. The traffic gateway can directly forward the request to the reserved application container without any other traffic caching, avoiding container-level startup and reducing startup time. Upon receiving the request, the application container's funclet component starts its function process to handle the request, thus achieving a fast cold start from 0 to 1.

[0077] When no requests are received after a period of time, the function process is killed by the funclet component, but the application container is not stopped. After killing the function process, the funclet component itself consumes very little memory (less than 9M), thus achieving a 1->0 shrinkage and reducing resource consumption.

[0078] By sacrificing minimal memory (less than 9MB) to keep the application container alive, Function Compute cold starts are accelerated, avoiding container-level startup and reducing Function Compute cold start time.

[0079] In this embodiment, when the application container is in its initial state, the components and function processes are encapsulated within the application container, and the application container retains at least one instance in the initial state. When a request enters the application container in the initial state, the function process is started through the component, and the request is processed by the function process, thereby avoiding container-level startup, reducing the cold start time of function computing, and reducing resource memory consumption.

[0080] Furthermore, based on the first and second embodiments of the accelerated method for function computation cold start of the present invention, a third embodiment of the accelerated method for function computation cold start of the present invention is proposed.

[0081] The third embodiment of the function computing cold start acceleration method differs from the first and second embodiments in that this embodiment focuses on step S10. After the traffic gateway detects a request entering the cluster, if the application container does not meet the preset load balancing strategy, the application container is expanded using a scaling controller to obtain a more detailed list of multiple target application containers. (Refer to...) Figure 5 This step specifically includes:

[0082] Step F10: After the traffic gateway detects that a request has entered the cluster, it monitors the memory of the application container through the scaling controller and compares the memory with the preset memory of the application container.

[0083] Step F20: If the memory of the application container is greater than the preset memory, the application container is expanded by the scaling controller to obtain multiple target application containers.

[0084] In this embodiment, after the traffic gateway detects that a request has entered the cluster, the scaling controller controls the scaling of the application container based on the memory metrics of the monitored application container, thereby reducing the cold start latency of Function Compute and the pressure of distributed function computation.

[0085] The following will provide a detailed explanation of each step:

[0086] Step F10: After the traffic gateway detects that a request has entered the cluster, it monitors the memory of the application container through the scaling controller and compares the memory with the preset memory of the application container.

[0087] In this embodiment, after the traffic gateway detects a request entering the cluster, it monitors the memory of the application container through the scaling controller and compares this memory with the preset memory of the application container; this allows it to detect whether the application container in its initial state can adapt to the request. In this initial state, the application container does not scale down to zero, but retains at least one instance; and the application container already encapsulates a funclet component and a function process.

[0088] When the detected memory exceeds the preset memory, it indicates that the application container in its initial state cannot handle the current requests. The application container needs to be expanded through the scaling controller so that the expanded target application containers can adapt to the current requests. The target application container has encapsulated a funclet component and a function process.

[0089] When the detected memory is not greater than the preset memory, it means that the application container in the initial state can handle the current request. The function process is started through the component in the application container, and the current request is processed after the function process starts.

[0090] Step F20: If the memory of the application container is greater than the preset memory, the application container is expanded by the scaling controller to obtain multiple target application containers.

[0091] In this embodiment, when the detected memory is greater than the preset memory, the application container is expanded by the scaling controller to obtain multiple target application containers; wherein, the target application container has encapsulated a funclet component and a function process, and the funclet component of the target application container is also called the target component, and the function process of the target application container is also called the target process.

[0092] In this embodiment, after the traffic gateway detects that a request has entered the cluster, the scaling controller controls the scaling of the application container based on the memory metrics of the monitored application container, thereby reducing the cold start latency of Function Compute and the pressure of distributed function computation.

[0093] Furthermore, based on the first, second, and third embodiments of the accelerated method for function computation cold start of the present invention, a fourth embodiment of the accelerated method for function computation cold start of the present invention is proposed.

[0094] The fourth embodiment of the function computing cold start acceleration method differs from the first, second, and third embodiments in that this embodiment focuses on step S10. After the traffic gateway detects a request entering the cluster, if the application container does not meet the preset load balancing strategy, the application container is expanded using a scaling controller to obtain a refinement of multiple target application containers. (Refer to...) Figure 6 This step specifically includes:

[0095] Step G10: After the traffic gateway detects that a request has entered the cluster, it monitors the processing volume of the application container's processor through the scaling controller and compares the processing volume with the preset processing volume of the application container.

[0096] Step G20: If the processing volume is greater than the preset processing volume, the application container is expanded by the scaling controller to obtain multiple target application containers.

[0097] In this embodiment, after the traffic gateway detects that a request has entered the cluster, the scaling controller controls the scaling of the application container based on the processor metrics of the monitored application container, thereby reducing the cold start latency of Function Compute and the pressure of distributed function computation.

[0098] The following will provide a detailed explanation of each step:

[0099] Step G10: After the traffic gateway detects that a request has entered the cluster, it monitors the processing volume of the application container's processor through the scaling controller and compares the processing volume with the preset processing volume of the application container.

[0100] In this embodiment, after the traffic gateway detects a request entering the cluster, it monitors the processing power of the application container's processor through the scaling controller and compares this processing power with the application container's preset processing power; this allows it to detect whether the application container in its initial state can adapt to the request. In this initial state, the application container does not scale down to zero, but retains at least one instance; and the application container already encapsulates a funclet component and a function process.

[0101] When the processing volume is detected to be greater than the preset processing volume, it means that the application container in the initial state cannot handle the current request. The application container needs to be expanded through the scaling controller so that the expanded target application containers can adapt to the current request. Among them, the target application container has encapsulated a funclet component and a function process.

[0102] When the detected processing volume is not greater than the preset processing volume, it means that the application container in the initial state can handle the current request. The function process is started through the component in the application container, and the current request is processed after the function process starts.

[0103] Step G20: If the processing volume is greater than the preset processing volume, the application container is expanded by the scaling controller to obtain multiple target application containers.

[0104] In this embodiment, when the processing volume is detected to be greater than the preset processing volume, the initial application container is expanded by the scaling controller to obtain multiple target application containers. Each target application container encapsulates a funclet component and a function process. The funclet component of the target application container is also called the target component, and the function process of the target application container is also called the target process.

[0105] In this embodiment, after the traffic gateway detects that a request has entered the cluster, the scaling controller controls the scaling of the application container based on the processor metrics of the monitored application container, thereby reducing the cold start latency of Function Compute and the pressure of distributed function computation.

[0106] Furthermore, based on the first, second, third, and fourth embodiments of the accelerated method for function computation cold start of the present invention, a fifth embodiment of the accelerated method for function computation cold start of the present invention is proposed.

[0107] The fifth embodiment of the function computing cold start acceleration method differs from the first, second, third, and fourth embodiments in that this embodiment focuses on step S10. After the traffic gateway detects a request entering the cluster, if the application container does not meet the preset load balancing strategy, the scaling controller expands the application container to obtain a refinement of multiple target application containers. (Refer to...) Figure 7 This step specifically includes:

[0108] Step H10: After the traffic gateway detects that a request has entered the cluster, it monitors the request volume through the scaling controller and compares the request volume with the preset request volume of the application container.

[0109] Step H20: If the number of requests exceeds the preset number of requests, the application container is expanded by the scaling controller to obtain multiple target application containers.

[0110] This embodiment reduces the cold start latency of Function Compute and the pressure of distributed function computation by controlling the scaling of application containers based on the request volume indicators of the monitored application containers after the traffic gateway detects that a request has entered the cluster.

[0111] The following will provide a detailed explanation of each step:

[0112] Step H10: After the traffic gateway detects that a request has entered the cluster, it monitors the request volume through the scaling controller and compares the request volume with the preset request volume of the application container.

[0113] In this embodiment, after the traffic gateway detects a request entering the cluster, it monitors the request volume in the application container through the scaling controller and compares this request volume with the application container's preset request volume. This allows it to detect whether the application container in its initial state can accommodate the request. In this initial state, the application container does not scale down to zero but retains at least one instance; and the application container already encapsulates a funclet component and a function process.

[0114] When the number of requests is detected to be greater than the preset number of requests, it means that the application container in the initial state cannot handle the current requests. The application container needs to be expanded through the scaling controller so that the expanded target application containers can adapt to the current requests. The target application container has encapsulated a funclet component and a function process.

[0115] When the detected request volume is not greater than the preset request volume, it means that the application container in the initial state can handle the current request. The function process is started through the component in the application container, and the current request is processed after the function process starts.

[0116] Step H20: If the number of requests exceeds the preset number of requests, the application container is expanded by the scaling controller to obtain multiple target application containers.

[0117] In this embodiment, when the number of requests is detected to be greater than the preset number of requests, the initial application container is expanded by the scaling controller to obtain multiple target application containers. Each target application container encapsulates a funclet component and a function process. The funclet component of the target application container is also called the target component, and the function process of the target application container is also called the target process.

[0118] In this embodiment, after the traffic gateway detects that a request has entered the cluster, the scaling controller controls the scaling of the application container based on the request volume indicators of the monitored application container, thereby reducing the cold start latency of Function Compute and the pressure of distributed function computation.

[0119] This invention also provides an acceleration device for cold start of function computation. (See reference...) Figure 8 The acceleration device for cold start of function computation of the present invention includes:

[0120] The routing module 10 is used to expand the application container through the scaling controller to obtain multiple target application containers after the traffic gateway detects that the request has entered the cluster. If the application container does not meet the preset load policy, the module will route the request to each target application container. The target application container includes target components and target function processes.

[0121] Processing module 20 is configured to, when the target component detects that the target function process has not been started, start the target function process through the target component and pass the request to the target function process so that the target function process can process the request.

[0122] Furthermore, the present invention also provides a medium, which is a computer-readable storage medium storing a function computation cold start acceleration program thereon, wherein the function computation cold start acceleration program, when executed by a processor, implements the steps of the function computation cold start acceleration method as described above.

[0123] The method implemented when the function computation cold start acceleration program running on the processor is executed can be referred to in various embodiments of the function computation cold start acceleration method of the present invention, and will not be repeated here.

[0124] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0125] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0126] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0127] The above are merely preferred embodiments of the present invention and do not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for accelerating cold starts in function computation, characterized in that, The method for accelerating cold starts by calculating the function includes the following steps: After the traffic gateway detects that a request has entered the cluster, if the application container does not meet the preset load policy, the application container is expanded by the scaling controller to obtain multiple target application containers, and the request is routed to each target application container. The target application container includes target components and target function processes. If the target component detects that the target function process has not started, the target component starts the target function process and passes the request to the target function process so that the target function process can process the request. The step of scaling up the application container to obtain multiple target application containers and routing the request to each target application container after the traffic gateway detects a request entering the cluster, if the application container does not meet the preset load policy, further includes: When the application container is in its initial state, components and function processes are encapsulated within the application container. The application container retains at least one instance in its initial state. The component is used to intercept the request and control the lifecycle of the function process, which is used to process the request. The component is a funclet component. The step of scaling up the application container to obtain multiple target application containers by means of a scaling controller after the traffic gateway detects a request entering the cluster, if the application container does not meet the preset load policy, includes: After the traffic gateway detects that a request has entered the cluster, it monitors the memory of the application container, the processing capacity of the processor, or the number of requests through the scaling controller. It compares the memory with the preset memory of the application container, or compares the processing capacity with the preset processing capacity of the application container, or compares the number of requests with the preset number of requests of the application container. If the memory of the application container is greater than the preset memory, the application container is expanded by the scaling controller to obtain multiple target application containers, wherein the target application containers have encapsulated funclet components and function processes; If the processing capacity of the application container exceeds the preset processing capacity, the application container is expanded by the scaling controller to obtain multiple target application containers. If the request volume of the application container exceeds the preset request volume, the application container is expanded by the scaling controller to obtain multiple target application containers. The step of scaling up the application container to obtain multiple target application containers and routing the request to each target application container after the traffic gateway detects that a request has entered the cluster, if the application container does not meet the preset load policy, further includes: If the target component detects that the target function process has started, the target component passes the request to the target function so that the target function process can process the request.

2. The method for accelerating cold starts in function computation as described in claim 1, characterized in that, After the step of starting the target function process through the target component when the target component detects that the target function process has not started, and passing the request to the target function process for processing the request, the method further includes: When the traffic gateway does not receive a request within the target time period, the target component kills the target function process.

3. An acceleration device for cold start of function computation, characterized in that, The acceleration device for cold start calculation of the function includes: The routing module is used to expand the application container through the scaling controller to obtain multiple target application containers after the traffic gateway detects that the application container does not meet the preset load policy after the application container does not meet the preset load policy. The module then routes the request to each target application container. The target application container includes target components and target function processes. The processing module is configured to, when the target component detects that the target function process has not started, start the target function process through the target component, and pass the request to the target function process so that the target function process can process the request; The device further includes an encapsulation module, configured to: encapsulate a component and a function process into the application container when the application container is in an initial state, wherein the application container retains at least one instance in the initial state, the component is used to intercept the request and control the lifecycle of the function process, the function process is used to process the request, and the component is a funclet component; The routing module is further configured to: after the traffic gateway detects that a request has entered the cluster, monitor the memory of the application container, the processing capacity of the processor, or the number of requests through the scaling controller, and compare the memory with the preset memory of the application container, or compare the processing capacity with the preset processing capacity of the application container, or compare the number of requests with the preset number of requests of the application container. If the memory of the application container is greater than the preset memory, the application container is expanded by the scaling controller to obtain multiple target application containers, wherein the target application containers have encapsulated funclet components and function processes; If the processing capacity of the application container exceeds the preset processing capacity, the application container is expanded by the scaling controller to obtain multiple target application containers. If the request volume of the application container exceeds the preset request volume, the application container is expanded by the scaling controller to obtain multiple target application containers. The device further includes a transmission module, configured to: when the target component detects that the target function process has been started, transmit the request to the target function through the target component, so that the target function process can process the request.

4. A device, characterized in that, The device includes: a memory, a processor, and a function computing cold start acceleration program stored in the memory and executable on the processor, wherein when the function computing cold start acceleration program is executed by the processor, it implements the steps of the function computing cold start acceleration method as described in any one of claims 1 to 2.

5. A medium, said medium being a computer-readable storage medium, characterized in that, The computer-readable storage medium stores an acceleration program for function computing cold start, which, when executed by a processor, implements the steps of the function computing cold start acceleration method as described in any one of claims 1 to 2.

Citation Information

Patent Citations

  • Function calling method and system

    CN114816713A