Function caching method and system

The main controller manages the instance caching strategy on the computing node, distinguishes between hotspot and non-hotspot functions, and caches hotspot functions first. This solves the problem of response delay and cache resource waste in cold start calls in cloud computing, and improves the utilization of cache resources. and user experience.

WO2024188037A1PCT designated stage expired Publication Date: 2024-09-19HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD +1
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/078364
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-06-21
Filing Date
2024-02-23
Publication Date
2024-09-19

AI Technical Summary

Technical Problem

In cloud computing, cold start calls of functions lead to response delays and affect user experience, and existing instance caching solutions may lead to waste and redundancy of cache resources.

Method used

The main controller manages the instance caching strategy on each computing node, determines or adjusts the caching strategy of the instance based on global information, distinguishes between hot and non-hot functions, prioritizes allocating resources to cache hot functions, adjusts the target cache duration of the instance, and adapts to function calls. The fluctuation of requests makes reasonable use of cache resources.

Benefits of technology

It reduces the incidence of cold start calls, avoids the waste of cache resources, improves the utilization of cache resources, and reduces cache competition and load tilt within the node.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024078364_19092024_PF_FP_ABST
    Figure CN2024078364_19092024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a function caching method and apparatus. The method comprises: a master controller sends first indication information to a first sub-controller among a plurality of sub-controllers, wherein the first indication information is used for determining a caching strategy for an instance on a first computing node in a cluster; the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication information; the master controller sends second indication information to a second sub-controller among the plurality of sub-controllers, wherein the second indication information is used for determining a caching strategy for an instance on a second computing node in the cluster; and the second sub-controller performs instance caching processing on the instance on the second computing node according to the second indication information. The solution in the embodiments of the present application can avoid the waste of cached resources while reducing the occurrence rate of cold start calling.
Need to check novelty before this filing date? Find Prior Art

Description

Function caching method and system

[0001] This application claims priority to the Chinese patent application with application number 202310231686.4 filed with the State Intellectual Property Office of China on March 10, 2023, priority to the Chinese patent application with invention name “Method and device for function caching”, priority to the Chinese patent application with application number 202310745731.8 filed with the State Intellectual Property Office of China on June 21, 2023, priority to the Chinese patent application with invention name “Method and system for function caching”, all contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of the present application relate to the field of cloud computing technology, and more specifically, to a method and system for function caching. Background Art

[0003] Server-aware computing, with its advantages of no maintenance, on-demand billing, and elastic scalability, has become an increasingly popular cloud computing development paradigm. When a function call request arrives, the server-aware computing platform provides the service through the corresponding function instance. If no function instance is available on the server-aware computing platform's nodes when the function call request arrives, a cold start call is triggered. Currently, cold start calls to lightweight container-based function instances typically take hundreds of milliseconds to hundreds of seconds, resulting in significant response latency for the function service and impacting the user experience.

[0004] Function instance caching is a widely used method to reduce cold start calls. Instance caching means that after a function instance completes a call request, the function instance is not immediately released. Instead, it is cached within the node for a period of time, allowing subsequent calls within a short period of time to reuse the function instance, thus avoiding cold starts. In related solutions, as many instances as possible can be cached within each node to reduce the incidence of cold starts. However, this solution can cause cache redundancy, generate unnecessary cache overhead, and waste node resources.

[0005] How to ensure a low incidence of cold start calls while avoiding the waste of cache resources has become an urgent problem to be solved.

[0006] Summary of the Invention

[0007] The embodiments of the present application provide a method and system for function caching, which are beneficial for reducing the occurrence rate of cold start calls while avoiding waste of cache resources.

[0008] In a first aspect, a method for function caching is provided, including: a main controller sends first indication information to a first sub-controller among multiple sub-controllers, the first indication information is used to determine a caching strategy for an instance on a first computing node in a cluster; the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication information; the main controller sends second indication information to a second sub-controller among the multiple sub-controllers, the second indication information is used to determine a caching strategy for an instance on a second computing node in the cluster; the second sub-controller performs instance caching processing on the instance on the second computing node according to the second indication information.

[0009] In the solution of the embodiment of the present application, the main controller manages the cache strategy of the instance on each computing node, so that the cache strategy of the instance on each computing node can be determined or adjusted based on global information, which is beneficial to reduce the occurrence rate of cold start calls while reducing unnecessary instance caching, thereby reducing cache redundancy. At the same time, this can rationally utilize the cache resources of each computing node, alleviate the load tilt problem, and thus reduce cache competition within the node. For example, the main controller can determine or adjust the cache strategy of the instance on each computing node based on the situation of each computing node and / or the call information of each function, and then instruct the sub-controller to perform corresponding processing.

[0010] The first sub-controller and the second sub-controller are different sub-controllers. The first computing node and the second computing node are different computing nodes.

[0011] Illustratively, the first indication information and the second indication information may be the same or different.

[0012] Exemplarily, the first indication information may be a global hot function list. The second indication information may be a global hot function list.

[0013] In combination with the first aspect, in some implementations of the first aspect, the first sub-controller is deployed in the first computing node, the second sub-controller is deployed in the second computing node, and the main controller is deployed in the control node.

[0014] The control node is a node different from the computing node.

[0015] Exemplarily, the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication information, which may include at least one of the following: the first sub-controller caches the uncached instance on the first computing node according to the first indication information, the first sub-controller releases the cached instance on the first computing node according to the first indication information, or the first sub-controller adjusts the caching strategy of the cached instance on the first computing node according to the first indication information.

[0016] In conjunction with the first aspect, in some implementations of the first aspect, the memory of the first computing node includes a first area and a second area.

[0017] Before the main controller sends the first indication information to the first sub-controller among the multiple sub-controllers, the instance of the first function on the first computing node is cached in the first area, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication information, including: the first sub-controller transfers the instance of the first function from the first area to the second area; or, before the main controller sends the first indication information to the first sub-controller among the multiple sub-controllers, the instance of the second function on the first computing node is cached in the second area, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication information, including: the first sub-controller transfers the instance of the second function from the second area to the first area.

[0018] In combination with the first aspect, in some implementations of the first aspect, a target cache duration of the instance cached in the first zone is greater than a target cache duration of the instance cached in the second zone.

[0019] In an embodiment of the present application, the cache location of the instance of the function can be adjusted according to the cache strategy of the instance, that is, the target cache duration of the function can be adjusted, which is conducive to further improving the utilization of cache resources. For example, if the original call request of the function is relatively small, the instance of the function can be cached in the second area. When the call request of the function increases, the cache strategy can be adjusted to transfer the instance of the function from the second area to the first area; if the original call request of the function is relatively large, the instance of the function can be cached in the first area. When the call request of the function decreases, the cache strategy can be adjusted to transfer the instance of the function from the first area to the second area. This can adapt to the fluctuation of the call request of the function, thereby helping to further increase the utilization of cache resources.

[0020] In combination with the first aspect, in certain implementations of the first aspect, the caching strategy of the instance on the first computing node includes the target cache duration of the instance of at least one function on the first computing node, the first indication information indicates the type of at least one function, the type of at least one function includes a hotspot function or a non-hotspot function, and the target cache duration of the instance of the at least one function whose type is a hotspot function is greater than the target cache duration of the instance of the function whose type is a non-hotspot function.

[0021] In the solution of the embodiment of the present application, a distinction is made between hot functions and non-hot functions. The target cache duration of hot functions is greater than that of non-hot functions. That is, resources are preferentially allocated to cache hot functions. This helps to reduce the incidence of cold start calls while avoiding the waste of cache resources, that is, it helps to improve the utilization rate of cache resources. At the same time, functions are divided into hot functions and non-hot functions. The target cache duration of the function instance can be determined based on the function type, which is simpler and more efficient to implement.

[0022] In combination with the first aspect, in some implementations of the first aspect, the target cache duration corresponding to the non-hotspot function is greater than 0.

[0023] In the solution of the embodiment of the present application, cache resources can be allocated to non-hotspot functions for caching, which helps reduce decision-making errors caused by insufficient heat recognition accuracy or delays, thereby helping to reduce the frequency of cold starts.

[0024] In combination with the first aspect, in certain implementations of the first aspect, the target cache duration corresponding to the hotspot function is not limited by the life cycle.

[0025] In combination with the first aspect, in certain implementations of the first aspect, the memory of the first computing node includes a first area and a second area, the first area is used to cache instances of functions of the type hotspot function on the first computing node, and the second area is used to cache instances of functions of the type non-hotspot function on the first computing node.

[0026] In combination with the first aspect, in certain implementations of the first aspect, at least one function includes a first function, and before the main controller sends a first indication message to the first sub-controller among the multiple sub-controllers, an instance of the first function is cached in the first area, the first indication message indicates that the type of the first function is a non-hotspot function, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication message, including: the first sub-controller transfers the instance of the first function from the first area to the second area; or, at least one function includes a second function, before the main controller sends the first indication message to the first sub-controller among the multiple sub-controllers, the instance of the second function is cached in the second area, the first indication message indicates that the type of the second function is a hotspot function, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication message, including: the first sub-controller transfers the instance of the second function from the second area to the first area.

[0027] Since the number of function call requests fluctuates over time, the function type will also fluctuate over time. In the embodiments of the present application, the cache location of the function instance can be adjusted according to the change of the function type, that is, the target cache duration of the function can be adjusted to adapt to the change of hot spots, which is conducive to further improving the utilization of cache resources.

[0028] In combination with the first aspect, in some implementations of the first aspect, the method further includes: the main controller determines the type of the function in the cluster based on the number of times the function in the cluster is called in the cluster, and the functions in the cluster include at least one function.

[0029] In combination with the first aspect, in certain implementations of the first aspect, the method also includes: when a call request for a third function arrives, the main controller determines a third computing node from the cluster based on the cumulative heat of multiple computing nodes in the cluster, and the third computing node is used to create an instance of the third function, and the cumulative heat of each computing node in the multiple computing nodes is determined based on the number of calls of the function on each computing node in the cluster.

[0030] In the solution of the embodiment of the present application, instance scheduling can be implemented based on the cumulative heat of the computing node, which is conducive to achieving reasonable resource allocation, avoiding single-node performance bottlenecks caused by heat accumulation on the computing node, reducing load tilt, and helping to avoid resource competition between hot functions, thereby reducing the incidence of cold start calls. The cumulative heat of each computing node can be determined based on the number of calls of the function on each computing node in the cluster. In this way, the access behavior of the function can be analyzed from a global perspective, and the cumulative heat of each computing node can be determined based on this, which is conducive to obtaining more accurate and comprehensive cumulative heat, and is conducive to further tilting hot functions, thereby avoiding resource competition between hot functions.

[0031] In combination with the first aspect, in certain implementations of the first aspect, the cumulative heat of each computing node among multiple computing nodes is determined based on the heat of the function of type hotspot function on each computing node and the number of instances of the function of type hotspot function on each computing node, and the heat of the function of type hotspot function on each computing node is determined based on the number of calls of the function of type hotspot function on each computing node in the cluster.

[0032] Furthermore, the heat of a function can be obtained by taking a weighted sum of the number of times the function is executed in each counting cycle.

[0033] In combination with the first aspect, in certain implementations of the first aspect, the ratio of the cumulative heat of the third computing node to the available resources of the third computing node is less than or equal to the ratio of the cumulative heat of other computing nodes among the multiple computing nodes except the third computing node to the available resources of the other computing nodes.

[0034] In the solution of the embodiment of the present application, the available resources of the computing node are taken into consideration when determining the third computing node, which is beneficial to further avoid heat accumulation on the computing node.

[0035] In combination with the first aspect, in some implementations of the first aspect, the instances in the cluster do not include an available instance of the third function.

[0036] In the solution of the embodiment of the present application, when a function call request arrives, if there is no available instance of the function in the multiple computing nodes in the cluster, a cold start call is triggered and instance scheduling is performed to create a new instance. This helps reduce instance cache redundancy between computing nodes and improve the utilization of cache resources.

[0037] In combination with the first aspect, in certain implementations of the first aspect, the method also includes: when a call request for a third function arrives, the load distributor forwards the call request for the third function to a fourth computing node in the cluster, and the instance on the fourth computing node includes an available instance of the third function.

[0038] In combination with the first aspect, in certain implementations of the first aspect, the method also includes: the first computing node creates an instance of the fourth function, the first indication information indicates that the type of the instance of the fourth function is a hotspot function, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication information, including: the first sub-controller caches the instance of the fourth function to the first area.

[0039] In combination with the first aspect, in certain implementations of the first aspect, the method also includes: the first computing node creates an instance of the fifth function, the first indication information indicates that the type of the instance of the fifth function is a non-hotspot function, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication information, including: the first sub-controller caches the instance of the fifth function to the second area.

[0040] Optionally, the method further includes: the first sub-controller adjusting the number of instances of the sixth function according to the load of the sixth function on the first computing node, where the type of the sixth function is a hotspot function.

[0041] In the solution of the embodiment of the present application, the sub-controller can monitor the load changes of the hot function on the corresponding computing node. If the load decreases, the number of instances of the hot function can be reduced accordingly. This helps further reduce the memory consumption of cached instances, avoids unnecessary instance caching, and helps avoid cache redundancy.

[0042] In a second aspect, a function caching system is provided, which includes a main controller and multiple sub-controllers, wherein the main controller is used to send first indication information to a first sub-controller among the multiple sub-controllers, the first indication information is used to determine the caching strategy of the instance on the first computing node in the cluster; the first sub-controller is used to perform instance caching processing on the instance on the first computing node according to the first indication information; the main controller is also used to send second indication information to a second sub-controller among the multiple sub-controllers, the second indication information is used to determine the caching strategy of the instance on the second computing node in the cluster; the second sub-controller is used to perform instance caching processing on the instance on the second computing node according to the second indication information.

[0043] In combination with the second aspect, in some implementations of the second aspect, the first sub-controller is deployed in the first computing node, the second sub-controller is deployed in the second computing node, and the main controller is deployed in the control node.

[0044] In conjunction with the second aspect, in some implementations of the second aspect, the memory of the first computing node includes a first area and a second area.

[0045] Before the main controller sends the first indication information to the first sub-controller among the multiple sub-controllers, the instance of the first function on the first computing node is cached in the first area, and the first sub-controller is specifically used to: transfer the instance of the first function from the first area to the second area; or, before the main controller sends the first indication information to the first sub-controller among the multiple sub-controllers, the instance of the second function on the first computing node is cached in the second area, and the first sub-controller is specifically used to: transfer the instance of the second function from the second area to the first area.

[0046] In conjunction with the second aspect, in certain implementations of the second aspect, a target cache duration of the instance cached in the first zone is greater than a target cache duration of the instance cached in the second zone.

[0047] In combination with the second aspect, in certain implementations of the second aspect, the caching strategy of the instance on the first computing node includes the target cache duration of the instance of at least one function on the first computing node, the first indication information indicates the type of at least one function, the type of at least one function includes a hotspot function or a non-hotspot function, and the target cache duration of the instance of the at least one function whose type is a hotspot function is greater than the target cache duration of the instance of the function whose type is a non-hotspot function.

[0048] In combination with the second aspect, in certain implementations of the second aspect, the memory of the first computing node includes a first area and a second area, the first area is used to cache instances of functions of the type hotspot function on the first computing node, and the second area is used to cache instances of functions of the type non-hotspot function on the first computing node.

[0049] In combination with the second aspect, in certain implementations of the second aspect, at least one function includes a first function, and before the main controller sends a first indication message to the first sub-controller among the multiple sub-controllers, an instance of the first function is cached in the first area, the first indication information indicates that the type of the first function is a non-hotspot function, and the first sub-controller is specifically used to transfer the instance of the first function from the first area to the second area; or, at least one function includes a second function, before the main controller sends a first indication message to the first sub-controller among the multiple sub-controllers, the instance of the second function is cached in the second area, the first indication information indicates that the type of the second function is a hotspot function, and the first sub-controller is specifically used to transfer the instance of the second function from the second area to the first area.

[0050] In combination with the second aspect, in some implementations of the second aspect, the main controller is further used to: determine the type of the function in the cluster based on the number of times the function in the cluster is called in the cluster, and the functions in the cluster include at least one function.

[0051] In combination with the second aspect, in certain implementations of the second aspect, the main control is also used to: when a call request for a third function arrives, determine a third computing node from the cluster based on the cumulative heat of multiple computing nodes in the cluster, and the third computing node is used to create an instance of the third function. The cumulative heat of each computing node in the multiple computing nodes is determined based on the number of calls to the function on each computing node in the cluster.

[0052] In combination with the second aspect, in certain implementations of the second aspect, the cumulative heat of each computing node among multiple computing nodes is determined based on the heat of the function of type hotspot function on each computing node and the number of instances of the function of type hotspot function on each computing node, and the heat of the function of type hotspot function on each computing node is determined based on the number of calls of the function of type hotspot function on each computing node in the cluster.

[0053] In combination with the second aspect, in certain implementations of the second aspect, the ratio of the cumulative heat of the third computing node to the available resources of the third computing node is less than or equal to the ratio of the cumulative heat of other computing nodes among the multiple computing nodes except the third computing node to the available resources of the other computing nodes.

[0054] In conjunction with the second aspect, in some implementations of the second aspect, the instances in the cluster do not include an available instance of the third function.

[0055] In combination with the second aspect, in certain implementations of the second aspect, the system also includes a load distributor, which is used to: when a call request for the third function arrives, forward the call request for the third function to a fourth computing node in the cluster, and the instance on the fourth computing node includes an available instance of the third function.

[0056] It should be understood that the expansion, limitation, explanation and description of the relevant content in the above-mentioned first aspect also apply to the same content in the second aspect.

[0057] In a third aspect, a computing device cluster is provided, comprising at least one computing device, each computing device including a processor and a memory. The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster performs the method of the first aspect and any implementation of the first aspect.

[0058] In a fourth aspect, a computer-readable medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method in the first aspect and any one of the implementations of the first aspect.

[0059] In a fifth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device cluster, the computing device cluster executes the method in the above-mentioned first aspect and any one of the implementations of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] FIG1 is a schematic diagram of a distributed cache control architecture.

[0061] FIG2 is a schematic flowchart of a method for function caching provided in an embodiment of the present application.

[0062] FIG3 is a schematic diagram showing the number of times a function is called in multiple counting cycles.

[0063] FIG4 is a schematic diagram of a memory partitioning situation provided in an embodiment of the present application.

[0064] FIG5 is a schematic diagram of a conversion situation of a cache area in an example provided in an embodiment of the present application.

[0065] FIG6 is a schematic block diagram of a cache control system provided in an embodiment of the present application.

[0066] FIG7 is a schematic diagram of a cache control process provided in an embodiment of the present application.

[0067] FIG8 is a schematic diagram of a centralized cache architecture provided in an embodiment of the present application.

[0068] FIG9 is a schematic flowchart of a method for function caching provided in an embodiment of the present application.

[0069] FIG10 is a schematic block diagram of a function caching system according to an embodiment of the present application.

[0070] FIG11 is a schematic block diagram of a computing device according to an embodiment of the present application.

[0071] FIG12 is a schematic block diagram of a computing device cluster according to an embodiment of the present application.

[0072] FIG13 is a schematic diagram of a connection method of a computing device cluster according to an embodiment of the present application. DETAILED DESCRIPTION

[0073] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.

[0074] In order to better describe the solutions of the embodiments of the present application, the terms that may be involved in the embodiments of the present application are explained below.

[0075] (1) Serverless computing:

[0076] Server-aware computing, which can be expressed as Function as a Service (FaaS), is a cloud computing programming paradigm. Compared to traditional cloud computing models based on virtual machines, server-aware computing features zero user maintenance, event-driven operation, elastic scaling, and pay-as-you-go billing. In server-aware computing, user applications are abstracted into multiple stateless functions, making functions the basic unit of computing. Functions can be triggered in an event-driven manner. When a call request arrives, the server-aware computing platform provides the service through the corresponding function instance (such as a lightweight virtual machine or container). When the instance becomes idle, the function instance can be released, enabling on-demand resource utilization and saving user costs.

[0077] With the help of server-aware computing, developers only need to upload business code, and cloud providers can automatically complete operations such as function building, deployment, runtime scaling, and rolling upgrades, greatly simplifying the development and deployment process of cloud applications and reducing users' cloud computing costs.

[0078] (2) Cold start:

[0079] A cold start refers to the process of creating a function instance on a server-unaware computing platform.

[0080] When a call request arrives, if there is no available instance of the function in the server-agnostic computing platform, a cold start call is triggered. That is, when a call request arrives, if there is no available instance of the function, the server-agnostic computing platform will create a corresponding instance (such as a lightweight virtual machine or container) to provide the service. For example, instance creation can be achieved through a series of operations such as image pulling, importing user code and libraries, and initializing the runtime environment. This process is called a cold start.

[0081] Currently, the cold start process for lightweight containers typically takes hundreds of milliseconds to hundreds of seconds, resulting in significant response latency for function services. The duration of the cold start process is also known as initialization overhead.

[0082] (3) Instance Cache

[0083] If a function call request arrives and there are no available function instances in the compute nodes of the server-aware computing platform, a cold start call is triggered. This cold start call can introduce significant response latency to the function service, impacting the user experience. In server-aware computing scenarios, functions are often interactive services, and the workloads are latency-sensitive, short-lived, and highly dynamic. Related research shows that cold starts can increase the end-to-end latency of functions by more than tenfold. Especially when experiencing bursty traffic, the server-aware platform cold-starting a large number of function instances in a short period of time can place significant pressure on platform scheduling and system performance.

[0084] Instance caching is a common method for reducing cold start calls. After a function instance completes a call request, it isn't immediately released. Instead, it is cached within the node for a period of time. This allows subsequent calls within a short period of time to reuse the same function instance, thus avoiding cold start calls.

[0085] Figure 1 shows a schematic diagram of a decentralized cache control architecture. In the decentralized cache control architecture, each computing node independently controls and manages the instance cache.

[0086] As shown in Figure 1, the cluster includes multiple compute nodes, namely compute node S1, compute node S2, and compute node Sn. Each compute node caches instances of deployed functions. As shown in Figure 1, the cached instances include instances of hot functions and instances of non-hot functions. Each compute node can be used to process function call requests. If a function call request does not arrive for a period of time or at a certain moment, the instance of the function cached on the compute node is idle, namely the idle instance in Figure 1. When a function call request arrives, the load distributor distributes the call request to each compute node for execution, that is, distributes the workload to each compute node for execution. If the compute node that receives the call request has an available instance of the function, that is, if there is an idle instance of the function on the compute node, the compute node can reuse the instance of the function to execute the call request. If there is no available instance of the function on the compute node, the compute node creates an instance of the function, for example, using resources from an uncached instance to create the instance, and caches the instance on the compute node after the instance is executed.

[0087] The following describes the relevant solutions for instance caching.

[0088] Related solutions use a static keep-alive mechanism for instance caching. Specifically, after a function instance on a compute node completes its call request and no subsequent requests arrive, the function instance is cached for the keep-alive duration and then automatically released. For example, the keep-alive duration can range from 1 minute to 15 minutes. However, this approach cannot adapt to dynamic load fluctuations and results in significant waste of cache resources during low traffic periods, resulting in high caching costs.

[0089] Related solutions use a reservation mechanism for instance caching. In addition to the server-aware computing platform's internal keep-alive mechanism, users can also customize the number of reserved instances for a function, better accommodating traffic peaks. For example, a function concurrency setting interface is provided to the user. After the user sets the number of reserved instances, the number of function instances within the server-aware computing platform remains near that value. However, since the number of function instances must be maintained at the user-set value, this solution can result in a significant waste of cache resources during low traffic periods, leading to high caching costs.

[0090] In related solutions, a passive caching strategy based on priority replacement is used for instance caching. Specifically, the priority of a function instance is determined by analyzing its load characteristics, and then the function instances are cached using a priority eviction method. When cache resources are sufficient, all function instances are cached in memory for a long time and not released. When cache resources are insufficient, lower-priority function instances are evicted to free up resources for creating new instances. This approach reduces cold start calls by caching as many instances as possible within limited node resources. However, this consumes a large amount of cache resources, potentially causing cache redundancy and generating unnecessary cache overhead.

[0091] In view of this, an embodiment of the present application provides a method for function caching, which configures cache resources based on the popularity of the function and prioritizes allocating resources to cache functions with higher popularity. This is beneficial for reducing the occurrence rate of cold start calls while avoiding the waste of cache resources, thereby improving the utilization rate of cache resources.

[0092] FIG2 illustrates a method for function caching provided in an embodiment of the present application, which performs instance caching on an instance based on a target cache duration of the instance.

[0093] Optionally, caching the instance based on the target cache duration of the instance may include: if the instance is not cached in the computing node, caching the instance based on the target cache duration of the instance. For a detailed description, please refer to steps 210 and 220.

[0094] Optionally, performing instance caching processing on the instance based on the target cache duration of the instance may include: if the instance is already cached in the computing node, adjusting the caching status of the instance based on the target cache duration of the instance. For a detailed description, please refer to step 230.

[0095] As shown in FIG2 , the method 200 includes steps 210 to 220 . The method 200 is described below.

[0096] 210 , cache the instance of function #21 based on the target cache duration of the instance of function #21.

[0097] 220, caches the instance of function #22 based on the target cache duration of the instance of function #22. The target cache duration of the instance of function #21 is greater than the target cache duration of the instance of function #22. The popularity of function #22 is less than the popularity of function #21. The popularity of function #21 is based on the number of executions of function #21, and the popularity of function #22 is based on the number of executions of function #22.

[0098] After a function instance completes execution, it is cached based on its target cache duration. If no call requests for the function arrive within the target cache duration, the instance is released after the target cache duration expires. The target cache duration for the instance of function #22 can be 0. In this case, the instance of function #22 is released directly after execution, meaning it is not cached.

[0099] For example, the popularity of a function is positively correlated with the number of times the function is executed, that is, the more times a function is executed, the higher the popularity of the function.

[0100] In the solution of the embodiment of the present application, cache resources are configured based on the popularity of the function, and the target cache duration of the instance of the function with higher popularity is greater than the target cache duration of the instance of the function with lower popularity, that is, resources are allocated preferentially to cache instances of functions with higher popularity, which is beneficial to reducing the incidence of cold start calls while avoiding the waste of cache resources, that is, it is beneficial to improve the utilization rate of cache resources. Specifically, the more likely a function with higher popularity is to be called frequently, resources are allocated preferentially to instances of functions with higher popularity, which is beneficial to improving the hit rate of cache instances, thereby reducing the frequency of cold starts to reduce response delays, and at the same time avoiding allocating a large amount of cache resources to instances of functions with lower popularity. The instances can be released after reaching the target cache duration, which is beneficial to avoiding the waste of cache resources.

[0101] The popularity of a function can be determined in a variety of ways. The following is an example of how to determine a function.

[0102] The number of times a function is executed can also be called the number of times the function is called or the number of times the function is accessed.

[0103] For example, a corresponding call counter may be set for each function, and the call counter corresponding to the function is used to count the number of times the function is executed.

[0104] The business scenarios of server-aware computing include a large number of interactive application services, such as web services and artificial intelligence (AI) reasoning. The working characteristics of functions are affected by user behavior, resulting in unpredictable request load fluctuations (such as sudden requests).

[0105] Alternatively, the popularity of a function can be calculated by taking a weighted sum of the number of times the function is executed in each counting period. The weight corresponding to each counting period is negatively correlated with the distance between each counting period and the current moment. That is, the closer the counting period is to the current moment, the greater the weight corresponding to that counting period.

[0106] The sum of the product of the number of executions of the function in each counting cycle and the weight corresponding to each calculation cycle can be used as the heat of the function.

[0107] Exemplarily, the current moment can be understood as the moment of calculating the heat of the function, or the moment of reading the number of executions of each counting cycle.

[0108] For example, the call counter corresponding to each function may be reset every certain period, which is called a counting period. For example, the counting period may be 1 hour, 24 hours, or 48 hours. The number of counting periods may be set as needed.

[0109] Figure 3 shows a diagram of the number of function calls over multiple counting cycles. Figure 3 shows nine counting cycles, where each counting cycle can be 48 hours. The vertical axis represents the number of requested visits. This is a relative value, meaning the number of visits at each moment is normalized by the maximum number of visits across all moments.

[0110] For example, for a function, a binary decay algorithm can be used to perform a weighted summation of the number of executions of the function in each counting cycle to obtain the heat of the function. The heat of the function can satisfy the following formula:

[0111] H i Indicates the heat of the i-th function, T indicates the number of counting cycles, and t indicates the t-th counting cycle. i [t] represents the number of times the i-th function is executed in the t-th counting cycle. i=1,2,…,m. m is the number of all functions. m is a positive integer. T is a positive integer. counter i[t] is an integer greater than or equal to 0.

[0112] In the scheme of the embodiment of the present application, the heat of the function is weighted and determined by the number of times the function is executed in each counting cycle. This is beneficial to reducing the impact of load fluctuations on the accuracy of the judgment of the heat of the function. At the same time, the closer the function call situation is to the current moment, the more it can reflect the current load situation of the function. In the embodiment of the present application, the closer the counting cycle is to the current moment, the greater the weight corresponding to the counting cycle, that is, the closer the counting cycle is, the greater the impact on the heat judgment. The heat of the function determined in this way can better reflect the current function call situation, which is beneficial to improving the accuracy of the judgment of the heat of the function.

[0113] It should be understood that the above is only an example and does not constitute a limitation to the solutions of the embodiments of the present application. The heat of the function can also be determined by other means.

[0114] Exemplarily, the target cache duration of a function instance is positively correlated with the popularity of the function.

[0115] That is, the higher the popularity of a function, the longer the target cache duration of the function instance.

[0116] Optionally, function #21 is a hotspot function, and function #22 is a non-hotspot function. The target cache duration of the instance of function #21 is the target cache duration corresponding to the hotspot function, and the target cache duration of the instance of function #22 is the target cache duration corresponding to the non-hotspot function.

[0117] In other words, functions are divided into two types: hot functions and non-hot functions. If a function (such as function #21) is a hot function, its instance is cached based on the target cache duration corresponding to the hot function. If a function (such as function #22) is a non-hot function, its instance is cached based on the target cache duration corresponding to the non-hot function.

[0118] In the solution of the embodiment of the present application, hot functions and non-hot functions are distinguished, and the target cache duration of hot functions is greater than the target cache duration of non-hot functions, that is, resources are allocated preferentially to cache hot functions, which is beneficial to reducing the incidence of cold start calls while avoiding the waste of cache resources, that is, it is beneficial to improve the utilization rate of cache resources. Specifically, since hot functions are called more frequently, resources are allocated preferentially to cache hot functions, which is beneficial to improving the hit rate of cache instances, thereby reducing the frequency of cold starts to reduce response delays, and at the same time avoiding allocating a large amount of cache resources to non-hot functions, which is beneficial to avoiding the waste of cache resources. At the same time, functions are divided into hot functions and non-hot functions, and the target cache duration of the function instance can be determined based on the type of function, which is simpler and more efficient to implement.

[0119] The hot function is determined based on the heat of m functions.

[0120] The set of m functions can be expressed in descending order of function heat as {H j |j=1,2,...,m}. Among them, H j H represents the heat of the jth function. j ≥H j+1 , j=1,2,…,m.

[0121] For example, the hot function may be a function whose popularity ranks in the top N among m functions.

[0122] Except for the N hotspot functions, the remaining functions among the m functions may be non-hotspot functions.

[0123] The set of functions in the top N positions is the set of hot functions.

[0124] The value of N can be a fixed value, or a variable value.

[0125] For example, the ratio of the sum of the heats of the top N functions to the sum of the heats of the m functions is greater than or equal to threshold #1, and the ratio of the sum of the heats of the top N-1 functions to the sum of the heats of the m functions is less than threshold #1. In other words, N is the value that minimizes the number of hot functions while ensuring that the ratio of the sum of the heats of all heat functions to the sum of the heats of the m functions is greater than or equal to threshold #1.

[0126] The sum of the heat of m functions can also be called the total heat.

[0127] Threshold #1 can be set as needed. For example, threshold #1 can be 90%, that is, the sum of the heats of the functions in the top N positions is greater than or equal to 90% of the total heat.

[0128] For example, the hotspot function may satisfy the following formula:

[0129] r represents the threshold value #1.0 <r<1。

[0130] Exemplarily, the hotspot function may be a function whose heat is greater than or equal to threshold #2.

[0131] Threshold #2 can be set as needed.

[0132] It should be understood that the above method of determining the hotspot function is only an example and does not limit the solution of the embodiment of the present application.

[0133] Exemplarily, the memory of the computing node may include a first area and a second area. The first area and the second area may be used to cache instances. The target cache duration of the instance in the first area is greater than the target cache duration of the instance in the second area.

[0134] Optionally, the first area can be used to cache hotspot functions, and the second area can be used to cache non-hotspot functions.

[0135] For example, a compute node creates an instance of function #21. After the instance is executed, function #21 is designated as a hotspot function and cached in the first zone of the compute node. A compute node creates an instance of function #22, designated as a hotspot function. After the instance is executed, the instance is cached in the second zone of the compute node.

[0136] Optionally, the target cache duration corresponding to the non-hotspot function is greater than 0.

[0137] In the solution of the embodiment of the present application, cache resources can be allocated to non-hotspot functions for caching, which helps reduce decision-making errors caused by insufficient heat recognition accuracy or delays, thereby helping to reduce the frequency of cold starts and reduce response delays.

[0138] For example, the target cache duration corresponding to the hotspot function can be unlimited. For example, the target cache duration corresponding to the hotspot function can be a larger value. In other words, instances of the hotspot function are not limited by the life cycle and can be stored for a long time.

[0139] In an embodiment of the present application, instances of hotspot functions can be stored for a long time, which helps to further reduce the frequency of cold starts and reduce response delays.

[0140] The target cache duration for non-hotspot functions is limited. The cache of non-hotspot function instances is limited by their lifecycle duration. Specifically, when a non-hotspot function instance on a compute node is idle for a period of time, that is, when the target cache duration of the non-hotspot function instance exceeds a period of time, the instance is released. Alternatively, the target cache duration for a non-hotspot function can be 0, meaning that the non-hotspot function instance is not cached.

[0141] In an embodiment of the present application, the target cache duration corresponding to the non-hotspot function is a finite value. If no call request arrives within the target cache duration, the instance of the non-hotspot function will be released and will not occupy cache resources for a long time, which is conducive to avoiding waste of cache resources.

[0142] Furthermore, instances of hot functions cached on a computing node are not evicted by creation events of other instances on the computing node.

[0143] Instances of non-hot functions cached on a compute node may be evicted by the creation of other instances on the same compute node. For example, if the available resources on the compute node are insufficient to create new instances, instances of non-hot functions cached on the compute node may be forcibly evicted to free up resources if the target cache duration for the non-hot function has not been reached.

[0144] Taking the first and second zones as an example, for example, instances cached in the first zone have no lifecycle limit and will not be evicted by creation events of other instances on the compute node. The first zone can also be called the persistent memory zone. Instances cached in the second zone are subject to lifecycle limits. After the target cache duration of an instance cached in the second zone exceeds a certain period of time, the instance is released. If the available resources in the compute node are insufficient to create a new instance, some or all instances cached in the second zone will be forcibly evicted to free up resources. The second zone can also be called the temporary memory zone.

[0145] For non-hot functions, their instances can be cached on a best-effort basis. The target cache duration for non-hot functions is shorter than that for hot functions, and they may be evicted by creation events of other instances on the compute node.

[0146] FIG4 is a schematic diagram showing a memory partitioning situation according to an embodiment of the present application.

[0147] The reserved memory area in a computing node may include a first area, a second area, and an unused area. The division method of the reserved memory area in different computing nodes may be the same or different, as shown in Figure 4. It should be understood that Figure 4 only uses two computing nodes (i.e., computing node #A and computing node #B) as an example for illustration, and does not limit the number of computing nodes in the embodiments of the present application.

[0148] In the solution of the embodiment of the present application, instances of hot functions will not be evicted by creation events of other instances, thereby avoiding the evicting of instances of hot functions due to resource competition, which is beneficial to ensuring the cache status of instances of hot functions, and thus helps to further reduce the frequency of cold starts.

[0149] Optionally, method 200 may include step 230 (not shown in the figure).

[0150] 230. Adjust the cache status of the instance of function #23 based on the target cache duration of the instance of function #23.

[0151] Optionally, when the type of function #23 is adjusted from a hotspot function to a non-hotspot function, the cache duration of the cached instance of function #23 is adjusted based on the target cache duration corresponding to the non-hotspot function, or, when the type of function #23 is adjusted from a non-hotspot function to a hotspot function, the cache duration of the cached function #23 is adjusted based on the target cache duration corresponding to the hotspot function.

[0152] For a cached function instance on a compute node, when the type of the function changes, the cache duration of the cached function instance can be adjusted based on the target cache duration corresponding to the changed type.

[0153] It should be noted that steps 210, 220, and 230 are relatively optional steps. That is, method 200 may only perform steps 210 and 220. Alternatively, method 200 may only perform step 230. Alternatively, method 200 may perform steps 210, 220, and 230.

[0154] Taking the first and second zones as an example, for example, when the instance of function #23 is executed, function #23 is a hotspot function and the instance is cached in the first zone. After a period of time, if the type of function #23 is adjusted from a hotspot function to a non-hotspot function, the instance of function #23 in the first zone is transferred to the second zone. For another example, when the instance of function #23 is executed, function #23 is a non-hotspot function and the instance is cached in the second zone. After a period of time, if the type of function #23 is adjusted from a non-hotspot function to a hotspot function, the instance of function #23 in the second zone is transferred to the first zone.

[0155] Figure 5 shows a schematic diagram of the conversion of the cache area of ​​an instance of an embodiment of the present application. For example, as shown in Figure 5, the computing node can use the resources of the unused area to create an instance of a function. If the function is a hot function, the instance of the function is cached in the first area after the execution of the instance is completed. If the function is a non-hot function, the instance of the function is cached in the second area after the execution of the instance of the function is completed. The instance cached in the second area can be released after the cache duration reaches the target cache duration corresponding to the non-hot function. If the resources in the unused area are not enough to create a new instance, the instance cached in the second area will be evicted to release resources. When the type of function changes, that is, when the hot spot is updated, it can be converted between the first area and the second area according to the type of instance.

[0156] For example, after the cache location of an instance changes, the cache duration of the instance can be reset. For example, after an instance is transferred from the first zone to the second zone, the current cache duration can be considered to be 0. If no call request arrives within the target cache duration corresponding to a non-hotspot function, the instance is released.

[0157] For example, after the cache location of an instance changes, the timer can continue to count based on the duration of the instance being cached. For example, after the instance is transferred from the first zone to the second zone, the current cache duration is 20 minutes. If this duration is greater than or equal to the target cache duration corresponding to the non-hotspot function, the instance is released. If this duration is less than the target cache duration corresponding to the non-hotspot function, the instance continues to be cached until the target cache duration corresponding to the non-hotspot function is reached. If no call request arrives during this period, the instance is released.

[0158] Since the number of function call requests fluctuates over time, in the embodiment of the present application, the cache duration of the function can be adjusted according to the change of the function type to adapt to the change of the hotspot, which is conducive to further improving the utilization of cache resources.

[0159] The computing node can also monitor the load changes of hot functions in the computing node and adjust the number of cached hot function instances according to the load changes.

[0160] Optionally, method 200 may further include: adjusting the number of cached instances of function #21 according to the load of function #21.

[0161] Specifically, when the load of function #21 decreases, the number of cached instances of function #21 can be reduced.

[0162] Exemplarily, the load of a hot function can be indicated by the request arrival rate of the hot function. For example, if the average concurrent arrival rate of function #21 over a period of time is 10, and the number of instances of function #21 cached on the compute node is 20, a cache shrink operation is triggered, and the compute node can reclaim the extra 10 cached instances. The concurrent arrival rate refers to the number of requests to a function instance that arrive per unit time. The unit time is usually 1 second, and the concurrent arrival rate is the number of requests to a function instance that arrive per second.

[0163] This helps to further reduce the memory consumption of cache instances, avoid unnecessary instance caching, and avoid cache redundancy.

[0164] In a possible implementation, the method 200 may be applied in a distributed cache architecture. For example, in the distributed cache architecture shown in FIG. 1 , the method 200 may be executed by any computing node.

[0165] A compute node can cache instances on that compute node based on the target cache duration of the function.

[0166] Exemplarily, the heat of a function is based on the number of times the function is executed on the computing node. In this case, the heat of a function can also be referred to as the heat of the function on the computing node.

[0167] For example, as described above, a corresponding call counter can be set for each function on the computing node. The call counter corresponding to the function is used to count the number of times the function is executed on the computing node.

[0168] For example, as described above, the heat of a function can be obtained by weighted summing the number of times the function is executed in each counting cycle. The number of times the function is executed in each counting cycle refers to the number of times the function is executed on the computing node in each counting cycle.

[0169] As mentioned above, the hot functions are determined based on the popularity of m functions. The m functions can be all functions on the computing node, that is, all functions processed by the computing node. The N hot functions are the hot functions on the computing node.

[0170] The decentralized cache control architecture shown in Figure 1 suffers from low cache resource efficiency. If functions on the same server experience heavy load—for example, if requests for one or more hot functions are forwarded to the same server—that server may bear a higher load than other servers, a phenomenon known as hot function skew or load skew. As shown in Figure 1, multiple hot function requests are forwarded to Sn, resulting in load skew. In a decentralized cache architecture, hot function skew can easily lead to internal server contention, impacting function processing efficiency. For example, the passive caching strategy reduces cold start calls by caching as many instances as possible within limited node resources. When hot function skew occurs, cache resources are insufficient, and functions on the server compete for resources. Cached instances frequently need to be evicted to free up resources for new instances, resulting in a high cold start rate. Furthermore, in a decentralized cache architecture, each compute node independently manages instances. Instances of the same function may be cached on multiple nodes, leading to cache redundancy and wasted cache resources.

[0171] In view of this, an embodiment of the present application provides a cache control system, which is a centralized cache control architecture that implements cluster-level instance cache management and / or instance scheduling. The cache control system can be applied in server-unaware scenarios.

[0172] In a possible implementation, the method 200 may be applied to a centralized cache control architecture, for example, a cache control system as shown in FIG6 . Detailed descriptions may be found later and are not detailed here.

[0173] Figure 6 shows a schematic diagram of a cache control system provided by an embodiment of the present application. As shown in Figure 6, cache control system 600 includes a main controller 610 and multiple sub-controllers (cachelets) 620. Cache control system 600 adopts a two-tier architecture. Specifically, the two-tier architecture includes a top-level controller and bottom-level sub-controllers.

[0174] The main controller 610 is the top-level controller. The sub-controller 620 is the bottom-level sub-controller. The main controller 610 is responsible for scheduling decisions and / or management decisions of the cache. For example, the main controller 610 can establish a communication connection with each sub-controller 620 to implement the sending of control instructions and data collection. The sub-controller corresponding to each computing node can report relevant information of each computing node to the main controller 610. For example, the relevant information of each computing node may include: at least one of the cache information of the instance on each computing node or the resources of each computing node. For example, the cache information of the instance on the computing node may include at least one of the following: the number of instances on the computing node or the status of the instance cached on the computing node.

[0175] In the embodiment of the present application, the main controller 610 may also be referred to as a cache manager, a centralized cache controller, a cache manager, a function scheduler, or a global cache manager. The system may include one main controller 610, or may include multiple main controllers 610. For clarity of description, FIG6 shows only one main controller 610, and does not limit the number of main controllers 610 in the embodiment of the present application. The cluster may include one or more control nodes, and the control nodes may be used to implement control functions. For example, the main controller 610 may be deployed in a control node of the cluster. Alternatively, the main controller 610 may be distributedly deployed in multiple control nodes in the form of replicas, which is beneficial to improving the reliability of the system and ensuring load balancing, thereby avoiding performance bottlenecks.

[0176] In an embodiment of the present application, a cluster includes multiple computing nodes (nodes), which can be used to execute function call requests. Each of the multiple computing nodes corresponds to a sub-controller 620. Exemplarily, as shown in Figure 6, the sub-controller 620 can be deployed inside the computing node. For example, the sub-controller 620 can be deployed in each computing node as a daemon process. This ensures the scalability of the system. The sub-controller 620 can be used to manage the cache resources in the corresponding computing node.

[0177] Sub-controller 620 may include a lifecycle manager. The lifecycle manager is used to implement lifecycle management of instances cached on the computing node. Specifically, the function instance is kept alive for a period of time, namely, the target cache duration. If no function call request arrives during this period, the instance is released. If a function call request arrives during this period, the call request is executed, and after the execution is completed, the remaining keep-alive time of the function instance is refreshed, that is, the remaining keep-alive time of the function instance is refreshed to the target cache duration.

[0178] The node may be a server. The server may be a physical server or a virtual server. The control node may be a control server. The computing node may be a computing server. For clarity of description, FIG6 only shows the sub-controllers 620 in three computing nodes, and does not limit the number of computing nodes and sub-controllers 620 in the embodiments of the present application.

[0179] The control node and the computing node can be different nodes, so that the control plane and the data plane can be separated in the control and operation logic, thereby improving the flexibility and reliability of the system.

[0180] Exemplarily, the system 600 may serve as a submodule of a function computing framework within a service-aware computing cluster.

[0181] As mentioned above, the cache control system 600 can be used to implement cluster-level instance scheduling. The following describes the instance scheduling.

[0182] The main controller 610 may be used to determine a scheduling node in the cluster. The scheduling node is used to create an instance of a function.

[0183] When a function call request arrives, if a cold start call is triggered, the main controller 610 determines the scheduling node.

[0184] The trigger mechanism of the cold start call can be implemented in various ways. The trigger mechanism of the cold start call is described below by way of example.

[0185] The client can issue a call request to a deployed function. The gateway is used to expose the function service interface to the user and receive function invocation requests sent by the client. The gateway may or may not be part of the cache control system 600.

[0186] In one possible implementation, when a function call request arrives, the load distributor in the gateway forwards it to a compute node. If no instance of the function exists on the compute node, a cold start call is triggered. If an instance of the function exists on the compute node, the call request is processed by the compute node.

[0187] In another possible implementation, when a function call request arrives and there is no available instance of the function in the cluster, a cold start call is triggered. If there is an available instance of the function in the cluster, the call request can be processed by one of the compute nodes with an available instance.

[0188] Alternatively, when a call request for function #3 arrives, the main controller 610 determines compute node #3 from the cluster to create an instance of function #3. The instances in the cluster do not include an available instance of function #3. In this case, compute node #3 is the scheduling node.

[0189] Optionally, when a call request for function #3 arrives, the load distributor may forward the call request for function #3 to computing node #4, where the instance on computing node #4 includes an available instance of function #3.

[0190] Exemplarily, when a function call request arrives, the gateway can determine whether there is an available instance of the function in each computing node based on the status of the cached instances in each computing node. If there is no available instance, a cold start call is triggered.

[0191] The state of an instance may include an idle state and an in-use state, etc. The existence of an available instance of a function on a computing node may be understood as meaning that when a function call request arrives, an instance of the function has been cached on the computing node, and the instance of the function is in an idle state.

[0192] For example, the state of the instances cached in each computing node can be maintained by the gateway. In other words, the gateway stores and updates the state of the instances cached in each computing node. In other words, the gateway can be used to count the state of the instances cached in each computing node.

[0193] Alternatively, the state of the instance cached in each computing node can be obtained by the gateway from other modules. For example, the state of the instance cached in each computing node can be maintained by the main controller 610. In other words, the main controller 610 stores and updates the state of the instance cached in each computing node. That is, the main controller 610 can be used to count the state of the instance cached in each computing node. The sub-controller 620 can report the state of the instance cached in the corresponding computing node to the main controller 610. For example, the sub-controller 620 can periodically report the state of the instance cached in the computing node to the main controller 610. For another example, the sub-controller 620 can also report the state of the instance cached in the computing node to the main controller 610 in response to a status request from the main controller 610.

[0194] Exemplarily, when a function call request arrives, the main controller 610 determines whether there is an available instance of the function in each computing node based on the status of the cached instances in each computing node. If there is no available instance, a cold start call is triggered.

[0195] In this case, the state of the instances cached within each computing node may be maintained by the main controller 610 .

[0196] In the solution of the embodiment of the present application, when a function call request arrives, if there is no available instance of the function in the multiple computing nodes in the cluster, a cold start call is triggered and instance scheduling is performed to create a new instance. This helps reduce instance cache redundancy between computing nodes and improve the utilization of cache resources.

[0197] The following is an exemplary description of how to determine the scheduling node.

[0198] As an example, the main controller 610 may determine the scheduling node based on resources of multiple computing nodes in the cluster.

[0199] For example, the main controller 610 selects the computing node with the lowest resource utilization among the multiple computing nodes as the scheduling node. Resource utilization refers to the ratio between the total resource usage of instances on a computing node and the total resource capacity of the computing node. For example, the resource capacity of the computing node can be the total amount of CPU resources or memory resources.

[0200] For another example, the main controller 610 selects a computing node with the largest amount of idle cache resources among the multiple computing nodes as a scheduling node.

[0201] As an example, the main controller 610 may determine the scheduling node based on the loads of multiple computing nodes in the cluster.

[0202] For example, the main controller 610 may select a computing node with the lightest load among the multiple computing nodes as a scheduling node.

[0203] As an example, the main controller 610 may determine the scheduling node based on the number of instances cached on multiple computing nodes in the cluster.

[0204] For example, the main controller 610 may use the computing node with the smallest number of cached instances among the multiple computing nodes as the scheduling node.

[0205] As an example, the main controller 610 may determine the scheduling node based on the popularity of functions in multiple computing nodes in the cluster.

[0206] Optionally, when a call request for function #3 arrives, the main controller 610 may determine computing node #3 from the cluster based on the popularity of functions on multiple computing nodes in the cluster. Computing node #3 is used to create an instance of function #3. The popularity of the functions on the multiple computing nodes is determined based on the number of times the functions on the multiple computing nodes have been called in the cluster.

[0207] In this case, computing node #3 is the scheduling node.

[0208] Optionally, the main controller 610 determines computing node #3 from the cluster based on the heat of functions on multiple computing nodes in the cluster, which may include: the main controller 610 determines computing node #3 from the cluster based on the cumulative heat of multiple computing nodes in the cluster, and the cumulative heat of multiple computing nodes is determined based on the heat of the functions in the multiple computing nodes and the number of instances of the function in the multiple computing nodes.

[0209] In the embodiment of the present application, the cumulative heat of a computing node may also be referred to as the heat accumulation index of the computing node. The cumulative heat is described below using a computing node as an example.

[0210] As an example, the cumulative popularity of a computing node may be determined by the popularity of all functions on the computing node and the number of instances of all functions.

[0211] The cumulative heat of a compute node can be calculated as the sum of the heat of all functions cached on the compute node multiplied by the number of function instances. Specifically, the heat of each function cached on the compute node is multiplied by the number of instances of the function on the compute node, and the corresponding products of all functions cached on the compute node are summed to obtain the cumulative heat of the compute node.

[0212] As an example, the cumulative popularity of a computing node may be determined by the popularity of all hot functions on the computing node and the number of instances of all hot functions.

[0213] The cumulative heat of a compute node can be the sum of the heat of all hot functions cached on the compute node multiplied by the number of instances of the hot function. Specifically, the heat of each hot function cached on the compute node is multiplied by the number of instances of the hot function on the compute node, and the corresponding products of all hot functions cached on the compute node are summed to obtain the cumulative heat of the compute node.

[0214] Exemplarily, the main controller 610 can determine the cumulative heat of each computing node based on the global hotspot view. The global hotspot view can indicate the hotspot functions in the cluster. For example, the global hotspot view can be represented as a list of global hotspot functions, etc. Further, the global hotspot view can also indicate the heat of the hotspot functions in the cluster and / or the distribution location of the hotspot functions, etc. The main controller 610 can be used to maintain the global hotspot view. Alternatively, the global hotspot view can also be obtained by the main controller from other modules. For example, the global hotspot view can be maintained by the gateway, and the main controller can obtain the global hotspot view from the gateway.

[0215] Exemplarily, the cumulative heat of computing node #3 is less than or equal to the cumulative heat of other computing nodes in the cluster except computing node #3.

[0216] That is, the main controller can use the computing node with the smallest cumulative heat among multiple computing nodes as the scheduling node.

[0217] Optionally, the ratio of the cumulative heat of computing node #3 to the available resources of computing node #3 is less than or equal to the ratio of the cumulative heat of other computing nodes in the cluster except computing node #3 to the available resources of other computing nodes.

[0218] That is, the main controller 610 can select the computing node with the smallest ratio of cumulative heat to idle cache resources among the multiple computing nodes as the scheduling node. The available resources in the computing node refer to the amount of idle cache resources, that is, the remaining available cache resources.

[0219] Exemplarily, the available resources of each computing node may be reported to the main controller 610 by the sub-controller 620 corresponding to each computing node.

[0220] For ease of description, this scheduling strategy is referred to as the minimum heat accumulation principle, that is, the main controller 610 performs instance scheduling based on the minimum heat accumulation principle.

[0221] For example, the main controller 610 may determine computing node #3 from the cluster based on the popularity of functions on multiple computing nodes in the cluster, which may include: the main controller 610 may determine the scheduling node based on the number of hot functions in multiple computing nodes in the cluster.

[0222] For example, the main controller 610 may use the computing node with the smallest number of hotspot functions among the multiple computing nodes as the scheduling node.

[0223] It should be understood that the above is only an example and does not constitute a limitation to the solution of the embodiment of the present application. The main controller 610 can also determine the scheduling node based on other scheduling strategies related to the heat of the function.

[0224] In the solution of the embodiment of the present application, instance scheduling can be implemented based on the cumulative heat of the computing node, which is conducive to achieving reasonable resource allocation, avoiding single-node performance bottlenecks caused by heat accumulation on the computing node, reducing load skew, and helping to avoid resource competition between hot functions, thereby reducing the incidence of cold start calls. For example, instance scheduling based on the minimum heat accumulation principle takes into account the available resources of the computing node, which is conducive to further avoiding heat accumulation on the computing node.

[0225] The heat of a function may be determined in a variety of ways, which are described below using the method 200 as an example.

[0226] For example, the popularity of a function can be determined based on the number of times the function is called within the cluster. In this case, the popularity of the function can also be referred to as the global popularity of the function.

[0227] In the solution of the embodiment of the present application, the cumulative heat of each computing node can be determined based on the global heat of the function on the computing node. In this way, the access behavior of the function can be analyzed from a global perspective, the global heat of the function can be determined, and the cumulative heat of each computing node can be determined based on this. This is conducive to obtaining a more accurate and comprehensive cumulative heat. When implementing instance scheduling based on the minimum heat accumulation principle, the global resource situation is also taken into account, which is conducive to further avoiding the performance bottleneck of a single node caused by the accumulation of hot spots on the computing node, further reducing the tilt of hot function, and thus avoiding resource competition between hot functions.

[0228] Exemplarily, as mentioned above, the popularity of a function can be obtained by weighted summing the number of times the function is executed in each counting cycle. The number of times the function is executed in each counting cycle refers to the number of times the function is executed on all computing nodes in the cluster in each counting cycle. For example, a cluster-level function call counter is set for each function to count the number of times the function is executed on all computing nodes in one counting cycle. For another example, a corresponding function call counter is set on each computing node for each function, and the number of times each function is executed on the computing node in one counting cycle is counted separately, and then the number of times the function is executed on all computing nodes in one counting cycle is determined based on the number of executions counted by the function call counter corresponding to the function on all computing nodes.

[0229] As mentioned above, hot functions are determined based on the popularity of m functions. These m functions can be all functions in the cluster, that is, all functions processed by all compute nodes in the cluster, or all functions deployed by users. The N hot functions are global hot functions, which means that global hot functions are detected at the cluster level, or in other words, hot functions are detected from a global perspective.

[0230] The cumulative heat of the computing node can be calculated by the main controller 610. Alternatively, the cumulative heat of the computing node can be obtained by the main controller 610 from other modules. For example, the main controller 610 and the gateway can be two independently deployed modules, and the cumulative heat of the computing node can be obtained by the main controller 610 from the gateway.

[0231] For example, the main controller 610 calculates the cumulative heat of each computing node based on the heat of the functions on each computing node. The heat of the function can be calculated by the main controller 610. Alternatively, the heat of the function can be obtained by the main controller 610 from other modules. For example, the main controller 610 and the gateway can be two independently deployed modules, and the main controller 610 can obtain the heat of the function from the gateway.

[0232] As mentioned above, the cache control system 600 can be used to implement cluster-level instance cache management. The following describes the instance cache management.

[0233] The main controller 610 may be used to manage the cache policy of instances on each computing node.

[0234] Specifically, the main controller 610 can be used to determine the cache policy for instances on each computing node. The sub-controller 620 can obtain instruction information from the main controller 610, which is used to indicate the cache policy for the instances on the computing node corresponding to the sub-controller 620. The sub-controller 620 corresponding to each computing node can perform instance caching processing on the instances on the computing node based on the instruction information.

[0235] The indication information may be a control instruction.

[0236] Optionally, the main controller 610 may send indication information #1 (an example of first indication information) to sub-controller #1 (an example of the first sub-controller) among the multiple sub-controllers 620, where indication information #1 indicates a cache policy for an instance on computing node #1 (an example of the first computing node) in the cluster. Sub-controller #1 performs instance cache processing on the instance on computing node #1 according to indication information #1. The main controller 610 may send indication information #2 (an example of second indication information) to sub-controller #2 (an example of the second sub-controller) among the multiple sub-controllers 620, where indication information #2 indicates a cache policy for an instance on computing node #2 (an example of the second computing node) in the cluster; sub-controller #2 performs instance cache processing on the instance on computing node #2 according to indication information #2.

[0237] Subcontroller #1 is the subcontroller corresponding to compute node #1, and subcontroller #2 is the subcontroller corresponding to compute node #2. Compute node #1 can be any compute node in the cluster, and compute node #2 can be any compute node in the cluster. Compute node #1 and compute node #2 are different compute nodes.

[0238] The indication information obtained from the main controller 610 can be identical for different sub-controllers 620. That is, indication information #1 and indication information #2 can be identical. For example, the indication information can indicate the cache policy for instances on all compute nodes. Alternatively, the indication information obtained from the main controller 610 can be different for different sub-controllers 620. That is, indication information #1 and indication information #2 can be different. For example, the indication information obtained by each sub-controller 620 only indicates the cache policy for instances on the compute node corresponding to that sub-controller 620.

[0239] For example, the sub-controller 620 may periodically obtain indication information from the main controller 610. For example, the indication information may be a global hot function list, which is synchronized between the main controller and the sub-controller via a timed synchronization mechanism. For example, the main controller 610 compiles a global hot function list every 30 minutes and synchronizes it to the sub-controller 620.

[0240] For example, after the cache policy of the instance on the computing node determined by the main controller 610 changes, indication information may be sent to the sub-controller 620 corresponding to the computing node.

[0241] The above is only an example. The sub-controller 620 can also obtain indication information at other times, and the embodiment of the present application does not limit this.

[0242] Exemplarily, the sub-controller 620 performs instance caching processing on the instances on the computing node according to the indication information, which may include at least one of the following: the sub-controller 620 caches the uncached instances on the computing node according to the indication information, the sub-controller 620 releases the cached instances on the computing node according to the indication information, or the sub-controller 620 adjusts the caching policy of the cached instances on the computing node according to the indication information.

[0243] Exemplarily, the caching policy of the instance on the computing node may include at least one of the following: target cache duration of the instance on the computing node, whether to cache one or more instances on the computing node, or whether to release one or more instances of the computing node.

[0244] The main controller 610 may determine or adjust a cache policy for an instance on each computing node based on call information of each function deployed in the cluster and / or relevant information of each computing node.

[0245] Exemplarily, the function call information may include at least one of the number of function calls or the function load.

[0246] Exemplarily, the relevant information of each computing node may include at least one of: cache information of instances on each computing node or available resources of each computing node.

[0247] Exemplarily, the cache information of the instances on the computing node may include at least one of the following: the number of instances on the computing node or the status of the instances cached on the computing node, etc.

[0248] For example, the master controller 610 may determine a caching strategy for a function instance based on the function load in the cluster. For example, when the function load decreases, the master controller 610 may send an instruction to some computing nodes that have cached instances of the function, instructing them to release idle instances of the function.

[0249] For another example, the main controller 610 can determine a caching policy for a function instance based on the cache information of instances on each computing node in the cluster. For example, when instances of the same function are cached on multiple computing nodes, the main controller 610 can send an instruction to some computing nodes that have cached instances of the function, instructing them to release idle instances of the function.

[0250] For another example, the master controller 610 may determine a caching strategy for a function instance based on the number of function calls in the cluster. For example, if the number of function calls decreases, the master controller 610 may send an instruction to one or more computing nodes caching the function instance to adjust the target cache duration of the function.

[0251] In the solution of the embodiment of the present application, the main controller manages the cache strategy of the instance on each computing node, so that the cache strategy of the instance on each computing node can be determined or adjusted based on global information, which is beneficial to reduce the occurrence rate of cold start calls while reducing unnecessary instance caching, thereby reducing cache redundancy. At the same time, this can rationally utilize the cache resources of each computing node, alleviate the load tilt problem, and thus reduce cache competition within the node. For example, the main controller can determine or adjust the cache strategy of the instance on each computing node based on the situation of each computing node and / or the call information of each function, and then instruct the sub-controller to perform corresponding processing.

[0252] The indication information may be expressed in various forms, as long as the sub-controller 620 can determine the cache policy of the instance on the computing node corresponding to the sub-controller 620 according to the indication information.

[0253] The following exemplifies the instruction information by taking the instruction information used to indicate the cache policy of the instance including the target cache duration of the instance as an example.

[0254] Exemplarily, the indication information may indicate a correspondence between a function and a target cache duration of an instance of the function. The target cache duration of the instance of the function corresponding to the function may also be referred to as the target cache duration corresponding to the function.

[0255] The sub-controller 620 may determine the target cache duration of the instance of the function on the computing node corresponding to the sub-controller 620 and the correspondence between the function and the target cache duration of the instance of the function.

[0256] For example, the indication information may indicate that the target cache duration corresponding to function A1 is duration #1, the target cache duration corresponding to function A2 is duration #2, and the target cache duration corresponding to function A3 is duration #3. Taking a sub-controller 620 as an example, the functions on the computing node corresponding to sub-controller 620 include function A2 and function A3. Based on the correspondence between the target cache durations of functions and function instances, sub-controller 620 may determine that the target cache duration of the instance of function A2 is duration #2, and the target cache duration of the instance of function A3 is duration #3.

[0257] Exemplarily, the sub-controller 620 may determine the target cache duration of the instance of the function on the computing node corresponding to the sub-controller 620 based on the popularity of the function on the computing node and the mapping relationship between the popularity of the function and the target cache duration of the instance of the function.

[0258] In this case, the indication information may include at least one of the following: the popularity of the function, or a function mapping relationship between the target cache duration of the function instance and the popularity of the function.

[0259] For example, a function mapping relationship between the target storage duration of a function instance and the popularity of the function is pre-stored in the compute node, and the indication information indicates the popularity of the function on the compute node. For another example, the indication information indicates a function mapping relationship between the target cache duration of a function instance and the popularity of the function, and the compute node independently determines the popularity of the function.

[0260] Optionally, the target cache duration of the function instance is positively correlated with the popularity of the function.

[0261] That is, the more popular a function is, the longer the target cache duration of the function instance will be.

[0262] Exemplarily, the sub-controller 620 may determine the target cache duration of the instance of the function on the computing node corresponding to the sub-controller 620 based on the type of the function on the computing node and the correspondence between the type of the function and the target cache duration of the instance of the function.

[0263] In this case, the indication information may include at least one of the following: the type of the function, or the correspondence between the type of the function and the target cache duration of the instance of the function.

[0264] For example, the indication information indicates the type of the function and the target cache duration of the instance of the function, and the computing node determines the type of the function by itself.

[0265] For another example, the indication information indicates the type of function and the target cache duration of the function instance, as well as the type of function on the computing node.

[0266] For another example, the type of function and the target cache duration of the function instance are pre-stored in the computing node, and the indication information indicates the type of function on the computing node. This example is used for explanation below.

[0267] Optionally, the function type may include a hot function or a non-hot function. The target cache duration corresponding to a hot function is greater than the target cache duration corresponding to a non-hot function. The target cache duration corresponding to a hot function is the target cache duration of an instance of a function whose type is a hot function. The target cache duration corresponding to a non-hot function is the target cache duration of an instance of a function whose type is a non-hot function.

[0268] For example, the type of a function may be determined based on the number of times the function is called in the cluster. In other words, whether the type of a function is a hotspot function or a non-hotspot function may be determined based on the number of times the function is called in the cluster.

[0269] Optionally, the main controller may determine the type of the function in the cluster based on the number of times the function is called in the cluster.

[0270] The detailed description of hotspot functions and non-hotspot functions can be found in the previous article and will not be repeated here.

[0271] Taking indication information #1 as an example, indication information #1 can indicate the type of at least one function on computing node #1. The cache policy of the instance on computing node #1 includes the target cache duration of the at least one instance. The target cache duration of the instance of the at least one function is determined based on the type of the at least one function and the correspondence between the type of the function on computing node #1 and the target cache duration of the instance of the function. The target cache duration of the instance of the function of the hotspot function type on computing node #1 is greater than the target cache duration of the instance of the function of the non-hotspot function type. In other words, the target cache duration of the instance of the function corresponding to the hotspot function is greater than the target cache duration of the instance of the function corresponding to the non-hotspot function.

[0272] Exemplarily, the indication information may indicate whether the function on the computing node is a hotspot function or a non-hotspot function.

[0273] For example, the indication information may indicate that the type of function A1 is a hotspot function, the type of function A2 is a non-hotspot function, and the type of function A3 is a hotspot function. The correspondence between the type of function and the target cache duration of the instance of the function may include: the target cache duration corresponding to the hotspot function is duration #1, and the target cache duration corresponding to the non-hotspot function is duration #2. Taking a sub-controller 620 as an example, the functions on the computing node corresponding to the sub-controller 620 include function A2 and function A3. The sub-controller 620 can determine that the type of function A2 is a non-hotspot function and the type of function A3 is a hotspot function based on the indication information, and then determine that the target cache duration of the instance of function A2 is duration #2 and the target cache duration of the instance of function A3 is duration #1.

[0274] Exemplarily, the indication information may indicate a hotspot function. For example, the indication information may be a global hotspot view.

[0275] For example, the sub-controller 620 may periodically communicate with the main controller 610 to synchronize a global hotspot view.

[0276] For example, the indication information may include: function A1 and function A3. The correspondence between the type of function and the target cache duration of the instance of the function may include: the target cache duration corresponding to the hotspot function is duration #1, and the target cache duration corresponding to the non-hotspot function is duration #2. Taking a sub-controller 620 as an example, the functions on the computing node corresponding to the sub-controller 620 include function A2 and function A3. The sub-controller 620 can determine that the type of function A2 is a non-hotspot function and the type of function A3 is a hotspot function based on the indication information, and then determine that the target cache duration of the instance of function A2 is duration #2 and the target cache duration of the instance of function A3 is duration #1.

[0277] Exemplarily, the indication information may indicate a non-hotspot function. For example, the indication information may be a list of global non-hotspot functions.

[0278] The above solution can be implemented by partitioning the memory of the computing nodes.

[0279] Exemplarily, the memory of each computing node may include a first area and a second area. The first area and the second area may be used to cache instances.

[0280] For the description of the first area and the second area, reference may be made to the relevant description in method 200 . To avoid repetition, some descriptions are omitted in the following text.

[0281] Optionally, the target cache duration of the instance located in the first zone is greater than the target cache duration of the instance located in the second zone.

[0282] Optionally, the first area may be used to cache instances of hotspot functions, and the second area may be used to cache instances of non-hotspot functions.

[0283] The "first" and "second" in the first area and the second area are only used to define the two areas in the memory and have no other limiting function.

[0284] Taking computing node #1 as an example, the memory of computing node #1 may include a first area and a second area.

[0285] The target cache duration of the instance cached in the first zone is greater than the target cache duration of the instance cached in the second zone.

[0286] Exemplarily, the first area may be used to cache instances of functions that are called more times, and the second area may be used to cache instances of functions that are called less times.

[0287] Optionally, the first area is used to cache instances of functions of the hotspot function type on computing node #1, and the second area is used to cache instances of functions of the non-hotspot function type on computing node #1.

[0288] After the sub-controller 620 obtains the indication information, it may determine the cache area of ​​the instance on the computing node corresponding to the sub-controller 620 according to the indication information.

[0289] The following is an illustrative description using computing node #1 as an example.

[0290] Sub-controller #1 may adjust the number of instances cached in the first zone and the second zone in computing node #1 and update the lifecycle of the instances based on indication information #1 to reduce cache resource redundancy.

[0291] Sub-controller #1 may switch the instance of the function between the first area and the second area according to instruction information #1.

[0292] Optionally, before the main controller sends indication #1 to sub-controller #1, the instance of function #1 on computing node #1 is cached in the first zone. In this case, sub-controller #1 performs instance caching processing on the instance on computing node #1 according to indication #1, which may include: sub-controller #1 transfers the instance of function #1 from the first zone to the second zone. Alternatively, before the main controller sends indication #1 to sub-controller #1, the instance of function #2 on computing node #1 is cached in the second zone, and sub-controller #1 performs instance caching processing on the instance on computing node #1 according to indication #1, which may include: sub-controller #1 transfers the instance of function #2 from the second zone to the first zone.

[0293] For example, the indication information #1 may directly indicate the cache location of the function instance in the memory. The sub-controller #1 may convert the function instance between the first area and the second area according to the cache location of the function instance in the memory indicated by the indication information #1.

[0294] For example, the instance of function #1 is originally cached in the first area, and indication information #1 indicates that the instance of function #1 is cached in the second area, then sub-controller #1 can transfer the instance of function #1 from the first area to the second area.

[0295] Alternatively, the indication information #1 may indicate the number of times the function has been called. The sub-controller #1 may switch the instance of the function between the first area and the second area according to the number of times the function has been called indicated by the indication information #1.

[0296] When the function is called many times, the instance of the function may be cached in the first area. When the function is called few times, the instance of the function may be cached in the second area.

[0297] For example, if the instance of function #1 is originally cached in the first area, and the number of calls of function #1 indicated by indication information #1 is greater than the set value, then sub-controller #1 can transfer the instance of function #1 from the first area to the second area.

[0298] In an embodiment of the present application, the cache location of the instance of the function can be adjusted according to the cache strategy of the instance, that is, the target cache duration of the function can be adjusted, which is conducive to further improving the utilization of cache resources. For example, if the original call request of the function is relatively small, the instance of the function can be cached in the second area. When the call request of the function increases, the cache strategy can be adjusted to transfer the instance of the function from the second area to the first area; if the original call request of the function is relatively large, the instance of the function can be cached in the first area. When the call request of the function decreases, the cache strategy can be adjusted to transfer the instance of the function from the first area to the second area. This can adapt to the fluctuation of the call request of the function, thereby helping to further increase the utilization of cache resources.

[0299] Exemplarily, sub-controller #1 may convert the instance of the function between the first area and the second area according to the type of the function indicated by indication information #1.

[0300] Optionally, the instance on computing node #1 includes an instance of function #1, the instance of function #1 is cached in the first zone, indication information #1 indicates that the type of the instance of function #1 is a non-hotspot function, and sub-controller #1 performs instance caching processing on the instance on computing node #1 according to indication information #1, which may include: sub-controller #1 transfers the instance of function #1 from the first zone to the second zone.

[0301] For example, function #1 is currently a hotspot function, and its instance is cached in the first area. The main controller updates the global hotspot function list. The updated global hotspot function list does not include function #1, that is, the type of function #1 is adjusted from a hotspot function to a non-hotspot function. Sub-controller #1 transfers the instance of function #1 from the first area to the second area.

[0302] Optionally, the instance on computing node #1 includes an instance of function #2, the instance of function #2 is cached in the second zone, indication information #1 indicates that the type of the instance of function #2 is a non-hotspot function, and sub-controller #1 performs instance caching processing on the instance on computing node #1 according to indication information #1, which may include: sub-controller #1 transfers the instance of function #2 from the second zone to the first zone.

[0303] For example, function #2 is currently a hotspot function, and its instance is cached in the second zone. The main controller updates the global hotspot function list. The updated global hotspot function list includes function #2, that is, the type of function #2 is adjusted from a non-hotspot function to a hotspot function. Sub-controller #1 transfers the instance of function #2 from the second zone to the first zone.

[0304] Optionally, the instance on computing node #1 includes an instance of function #4, indication information #1 indicates that the type of the instance of function #4 is a hotspot function, and sub-controller #1 performs instance caching processing on the instance on computing node #1 according to indication information #1, which may include: sub-controller #1 caches the instance of function #4 to the first area.

[0305] For example, computing node #1 is a scheduling node. The scheduling node creates an instance of function #4. After executing the call request of function #4, sub-controller #1 obtains a list of global hot functions, which includes function #4, and caches the instance in the first zone of the scheduling node.

[0306] Optionally, the instance on computing node #1 includes an instance of function #5, indication information #1 indicates that the type of the instance of function #5 is a non-hotspot function, and sub-controller #1 performs instance caching processing on the instance on computing node #1 according to indication information #1, which may include: sub-controller #1 caching the instance of function #5 to the second zone.

[0307] For example, computing node #1 is a scheduling node. The scheduling node creates an instance of function #5. After executing the call request of function #5, sub-controller #1 obtains a list of global hot functions. The list of global hot functions does not include function #5, and caches the instance in the second zone of the scheduling node.

[0308] Optionally, the target cache duration corresponding to the non-hotspot function is greater than 0.

[0309] In the solution of the embodiment of the present application, cache resources can be allocated to non-hotspot functions for caching, which helps reduce decision-making errors caused by insufficient heat recognition accuracy or delays, thereby helping to reduce the frequency of cold starts.

[0310] Optionally, the target cache duration corresponding to the hotspot function can be unlimited. For example, the target cache duration corresponding to the hotspot function can be a larger value. In other words, instances of the hotspot function are not limited by the life cycle and can be stored for a long time.

[0311] The target cache duration for non-hotspot functions is limited. The cache of non-hotspot function instances is limited by their lifecycle duration. Specifically, when a non-hotspot function instance on a compute node is idle for a period of time, that is, when the target cache duration of the non-hotspot function instance exceeds a period of time, the instance is released. Alternatively, the target cache duration for a non-hotspot function can be 0, meaning that the non-hotspot function instance is not cached.

[0312] Furthermore, instances of hot functions cached on a computing node are not evicted by creation events of other instances on the computing node.

[0313] Instances of non-hot functions cached on a compute node may be evicted by the creation of other instances on the same compute node. For example, if the available resources on the compute node are insufficient to create new instances, instances of non-hot functions cached on the compute node may be forcibly evicted to free up resources if the target cache duration for the non-hot function has not been reached.

[0314] For a detailed description of caching based on hotspot functions and non-hotspot functions, please refer to the method 200 mentioned above, which will not be repeated here.

[0315] In the solution of the embodiment of the present application, the instance of the hotspot function will not be evicted by the creation events of other instances, thereby avoiding the evicting of the instance of the hotspot function due to resource competition, ensuring the cache status of the instance of the hotspot function, and thus helping to further reduce the frequency of cold starts.

[0316] In the solution of the embodiment of the present application, hot functions and non-hot functions are distinguished, and the target cache duration of hot functions is greater than the target cache duration of non-hot functions, that is, resources are allocated preferentially to cache hot functions, which is beneficial to reducing the incidence of cold start calls while avoiding the waste of cache resources, that is, it is beneficial to improve the utilization rate of cache resources. Specifically, since hot functions are called more frequently, resources are allocated preferentially to cache hot functions, which is beneficial to improving the hit rate of cache instances, thereby reducing the frequency of cold starts to reduce response delays, and at the same time avoiding allocating a large amount of cache resources to non-hot functions, which is beneficial to avoiding the waste of cache resources. At the same time, functions are divided into hot functions and non-hot functions, and the target cache duration of the function instance can be determined based on the type of function, which is simpler and more efficient to implement.

[0317] It should be understood that the above is only an example, and the indication information can also be expressed in other forms, which is not limited in the embodiments of the present application.

[0318] Optionally, the sub-controller 620 may also be configured to adjust the number of instances of the hotspot function according to the load of the hotspot function on the computing node corresponding to the sub-controller 620 .

[0319] The sub-controller 620 may monitor the load changes of the hotspot function on the corresponding computing node, and if the load decreases, the number of instances of the hotspot function may be reduced accordingly.

[0320] For a detailed description, please refer to the method 200 above, which will not be repeated here.

[0321] This helps to further reduce the memory consumption of cache instances, avoid unnecessary instance caching, and avoid cache redundancy.

[0322] Furthermore, the solution of the embodiment of the present application can also be used in combination with an active caching strategy based on load prediction.

[0323] The proactive caching strategy predicts the arrival interval of function call requests and dynamically releases and preheats the corresponding function instances.

[0324] Exemplarily, an active caching strategy is used to perform instance caching for some functions in the cluster, and a solution in an embodiment of the present application is used to cache another part of the functions in the cluster.

[0325] For example, a total of 10,000 functions are deployed in a cluster, of which 1,000 functions use the active caching strategy for instance caching. The remaining 9,000 functions can be cached using the solution of the embodiment of the present application.

[0326] For example, an active caching strategy is used to cache instances of some functions in the cluster. When a cold start is triggered, all functions can be cached based on the solution in the embodiment of the present application.

[0327] A master controller 610 can also be implemented by multiple controllers. For example, the master controller 610 can be used to schedule instances and manage instance caches. These two functions can be performed by two controllers, respectively. The master controller 610 can include controller #1 and controller #2. Controller #1 is used to schedule instances. Controller #2 is used to manage instance caches. Controller #1 and controller #2 can be located on the same node or on different nodes. For example, controller #1 can be deployed in a gateway. In other words, the functions of controller #1 can be implemented by the gateway.

[0328] It should be understood that the system 600 shown in FIG6 is merely an example and does not limit the solutions of the embodiments of the present application.

[0329] FIG7 shows a schematic diagram of a cache control process provided in an embodiment of the present application.

[0330] The cache control process shown in Figure 7 can be implemented by the cache system shown in Figure 6. As shown in Figure 7, the main controller can implement cluster-level instance scheduling and management. Under the decentralized cache architecture, there is no collaboration between the various computing nodes. For example, as shown in Figure 1, the load borne by Sn is higher than the load borne by other computing nodes, but under the decentralized cache architecture, the gateway may still forward the call request of the hotspot function to Sn for processing, further aggravating the load skew problem. Under the centralized cache architecture shown in Figure 7, the main controller can use S0 and S1 as the scheduling nodes of the hotspot function, and S0 and S1 create instances of the hotspot function. As shown in Figure 7, the main controller schedules S1 to execute the call request of the hotspot function forwarded to Sn in Figure 1, and the call request of the hotspot function forwarded to Sn in Figure 1 is forwarded to S1 in Figure 7.

[0331] In the solution of the embodiment of the present application, idle instances of non-hotspot functions can be evicted. As shown in Figure 7, the idle instance on S0 is evicted. For example, when the available resources on a computing node (such as S0) are insufficient to start a new instance, the idle instance can be evicted. For another example, when there are instances of the same function on multiple computing nodes, the idle instances of the function on some computing nodes (such as S0) can be evicted.

[0332] For clarity, Figure 7 shows only three compute nodes. In practical scenarios, a cluster may include more or fewer compute nodes, and each compute node may cache more or fewer instances. Furthermore, the cluster may include other modules, such as a load distributor, which forwards call requests.

[0333] A possible application scenario of an embodiment of the present application is described below.

[0334] The solution of the embodiment of the present application can be used to provide the function of instance cache acceleration to reduce the sending rate of cold start and reduce cache occupancy. Specifically, an interface can be provided on the interactive interface, which is used for the user to choose whether to turn on the function of instance cache acceleration. If the user enables this function, the cache control system 600 can execute the solution in the embodiment of the present application. For example, the cache control system 600 can collect the call information of the user's function, such as the number of times the function is called, detect hot functions at the cluster level, and cache the instances of the functions deployed by the user using the cache strategy of the hot function or the cache strategy of the non-hot function based on the type of function. For a specific description, please refer to method 200, system 600 or method 1000, which will not be repeated here. If the user disables this function, the functions deployed by the user can be filtered, and the instances of the functions deployed by the user can be cached based on the cache strategy of the non-hot function. Alternatively, if the user disables this function, the existing solution can also be used to cache the instances of the functions deployed by the user, and the embodiment of the present application does not limit this.

[0335] Figure 8 shows a schematic diagram of a centralized cache architecture provided by an embodiment of the present application. The cache control architecture is based on software defined network (SDN) centralized control, and is a centralized cache control architecture that can realize cluster-level instance caching and resource allocation. The control architecture shown in Figure 8 can be regarded as a specific implementation of the system shown in Figure 6. For related descriptions, reference can be made to the system 600 shown in Figure 6. To avoid repetition, some descriptions are appropriately omitted when describing the system 600. The control architecture shown in Figure 8 is a "top-level controller + bottom-level sub-controller" two-layer architecture, including a centralized cluster-level main controller and multiple sub-controllers located in each computing node. The cache architecture can communicate in a variety of ways. For example, the communication method can include any of the following: communication based on remote procedure call (RPC), or communication based on message queues, or communication based on Web-based transmission of JS object notation (JSON) string streams, or communication based on remote method invocation (RMI). The embodiment of the present application does not limit the communication method.

[0336] For example, the master controller can be used to collect statistics about each computing node in the cluster. For example, the information about each computing node in the cluster includes resource information about each computing node in the cluster. The master controller can also be used to maintain a global resource view. The global resource view is used to indicate the resource information of each computing node. For another example, the information about each computing node in the cluster can include cache information of instances on each computing node in the cluster.

[0337] Exemplarily, as shown in FIG8 , the main controller can be used for hotspot function detection. For example, the main controller can collect call counter data to dynamically detect hotspot functions. For example, the call counter data can be stored as workload status information in a separate module (such as a database). As shown in FIG8 , the main controller can determine the call counter data based on the workload status information. The gateway can send the function call volume statistics to the database as workload status storage.

[0338] Furthermore, the main controller may update the global hotspot view based on the detection result of the hotspot function, that is, the main controller may be used to maintain the global hotspot view.

[0339] For example, as shown in FIG8 , the master controller can be used to implement instance scheduling based on the heat of a function, that is, to implement heat-differentiable scheduling. For example, the master controller can calculate the cumulative heat of each computing node based on a global hotspot view, that is, calculate the heat value (hot-score) of each computing node, and determine the available resources of each computing node. Then, based on the minimum heat accumulation principle, the master controller can determine the scheduling node, that is, determine the creation location of the function instance, which can be the function cache placement.

[0340] For example, the gateway may forward the function call request to the sub-controller. After the call request is executed, the sub-controller may return the execution result to the gateway.

[0341] For example, as shown in Figure 8, a sub-controller can be used to synchronize cluster status. For example, a sub-controller can collect information about the corresponding compute nodes and synchronize it to the main controller. For another example, a sub-controller can obtain a global hotspot view from the main controller.

[0342] Furthermore, the sub-controller may also synchronize relevant information of the computing node, such as cache information of the instance, to the gateway.

[0343] For example, as shown in Figure 8, the sub-controller can be used to manage the lifecycle of the cached instances in the corresponding computing node. For example, the sub-controller can include a lifecycle manager, which can manage the lifecycle of the cached instances in the corresponding computing node based on the global hotspot view.

[0344] Exemplarily, the sub-controller can be used to implement resource management. For example, as shown in FIG8 , the sub-controller can be used to implement the transfer of cached instances in the first zone and the second zone.

[0345] For example, the sub-controller may be configured to execute control instructions of the main controller.

[0346] In the solution shown in Figure 8, the basic information of a function is indicated by function metadata. For example, the basic information of a function may include at least one of the following: the function name, memory specifications, the execution time of the function, or the name of the function image.

[0347] For detailed description, please refer to the relevant description in system 600 or method 1000, which will not be described in detail here.

[0348] The method 1000 of the embodiment of the present application is exemplarily described below in conjunction with Figure 8. Method 1000 can be regarded as a specific implementation of method 200. Method 1000 can be executed by the cache control system 600 shown in Figure 6. In method 1000, the cache control system can analyze the workload characteristics of the cluster, that is, analyze the call information of the functions in the cluster, detect the hot functions in the cluster, and implement caching in combination with a distinguishable cache strategy for the hot functions, which is beneficial to reduce the frequency of cold starts while avoiding the inevitable cache overhead, that is, reduce the cache overhead while improving service latency, thereby improving the utilization of cache resources in the cluster.

[0349] Method 1000 includes steps 1010 to 1060 , and method 1000 is described below.

[0350] At 1010, the front-end FaaS gateway determines whether an available instance of the function exists. If so, step 1020 is executed. If not, a cold start call is triggered, and step 1030 is executed.

[0351] Users can issue call requests for deployed functions. These call requests first reach the gateway, which can then determine whether there are available instances of the function on each compute node.

[0352] It should be understood that step 1010 is merely an example and does not limit the solutions of the embodiments of the present application. For example, in other possible implementations, the actions in step 1010 may also be performed by the main controller, that is, determining whether there is an available instance of the function may also be performed by the main controller.

[0353] 1020. The gateway forwards the function call request to a computing node where an available instance of the function exists.

[0354] Exemplarily, the gateway may forward the function call request based on a hash consistency policy.

[0355] Exemplarily, the gateway may randomly forward function call requests.

[0356] For example, the gateway may forward the function call request based on the principle of least load, that is, select the node with the least load from among the computing nodes that have available instances of the function to forward the call request.

[0357] For example, the gateway receives a call request for function B1. Instances of function B1 are available on five compute nodes in the cluster: A1, A2, A3, A4, and A5. Their loads are 80%, 70%, 55%, 25%, and 90%, respectively. A4 is the compute node with the lowest load. The gateway forwards the call request to A4. After execution, A4 returns the result to the gateway.

[0358] It should be understood that the above is only an example, and the gateway can also forward based on other forwarding rules.

[0359] 1030. The main controller determines a scheduling node.

[0360] The gateway can call the main controller to schedule instances.

[0361] The main controller is triggered to execute the scheduling request and determine the node where the function instance is created, namely the scheduling node. As shown in Figure 9, the gateway forwards the function call request to the sub-controller in the scheduling node.

[0362] The sub-controller of each computing node can perform cluster state synchronization. Specifically, the sub-controller of each computing node can report relevant information of the computing node to the main controller.

[0363] Exemplarily, the main controller may determine the scheduling node based on a minimum heat accumulation principle.

[0364] The cumulative heat of a computing node can be calculated by the main controller. For example, for a computing node, the cumulative heat of the computing node can be the sum of the heat of all hot functions on the computing node and the number of cached hot function instances. The heat of the function can be determined by the main controller or received by the main controller from other modules, such as from a gateway. The hot function can be determined by the main controller or by other modules, such as a gateway determining the hot function and notifying the main controller.

[0365] Illustratively, after being triggered to execute a scheduling request, the main controller may calculate the cumulative heat of each computing node in the cluster, and then determine the scheduling node based on a minimum heat accumulation principle.

[0366] For example, after being triggered to execute a scheduling request, the main controller can read the global list of hotspot functions, or receive the global list of hotspot functions from the gateway. The global list of hotspot functions can indicate all hotspot functions in the cluster. Furthermore, the global list of hotspot functions can also indicate the heat of all hotspot functions. The main controller can calculate the cumulative heat of each computing node based on the global list of hotspot functions. For example, if the number of function call requests arriving between the update time of the stored global list of hotspot functions and the reading time of the global list of hotspot functions is less than or equal to threshold #3, the main controller can directly read the stored global list of hotspot functions, otherwise the main controller can re-detect the hotspot function to update the global list of hotspot functions, or the gateway re-detects the hotspot function to update the global list of hotspot functions. For another example, if the distance between the update time of the stored global hotspot function list and the reading time of the global hotspot function list is less than or equal to threshold #4, the main controller can directly read the stored global hotspot function list, otherwise the main controller can re-detect the hotspot function to update the global hotspot function list, or the gateway re-detects the hotspot function.

[0367] Exemplarily, after being triggered to execute a scheduling request, the main controller can read the cumulative heat of each computing node in the cluster, and then determine the scheduling node based on the minimum heat accumulation principle. The cumulative heat of each computing node in the cluster can be pre-calculated and stored by the main controller. For example, if the number of function call requests arriving between the update time of the stored cumulative heat of each computing node and the reading time of the cumulative heat of each computing node is less than or equal to threshold #3, the main controller can directly read the stored cumulative heat of each computing node, otherwise the main controller can recalculate the cumulative heat of each computing node. For another example, if the distance between the update time of the stored cumulative heat of each computing node and the reading time of the cumulative heat of each computing node is less than or equal to threshold #4, the main controller can directly read the stored cumulative heat of each computing node, otherwise the main controller can recalculate the cumulative heat of each computing node.

[0368] For example, after being triggered to execute a scheduling request, the master controller may receive the cumulative heat of each computing node in the cluster and then determine the scheduling node based on the minimum heat accumulation principle. For example, the cumulative heat of each computing node in the cluster may be calculated by a gateway and sent to the master controller by the gateway.

[0369] The following example illustrates how to calculate the cumulative heat of a computing node.

[0370] Assume that the functions deployed in the cluster include function B1, function B2, function B3, function B4, and function B5. The cluster includes five compute nodes: node A1, node A2, node A, node A4, and node A5. The following uses function B1 as an example to illustrate one method for calculating function popularity.

[0371] The call counter for function B1 restarts at regular intervals. The number of calls counted by the call counter for function B1 over the five counting cycles, in descending order of time, is 540, 230, 200, 100, and 590. Using the binary decay algorithm, the popularity of function B1 is calculated as 540*1 / 16+230*1 / 8+200*1 / 4+100*1 / 2+590=752.5. Using the same method, we can obtain a score of 249.2 for function B2, 158.6 for function B3, 83.6 for function B4, and 63.5 for function B5.

[0372] It should be understood that the above is only an example, and the heat of a function may also be determined in other ways.

[0373] The heat of these five functions is ranked from highest to lowest as follows: 752.5, 249.2, 158.6, 83.6, and 63.5. The number of hot functions can satisfy the following condition: the number of hot functions is minimized when the ratio of the sum of the heats of all hot functions to the sum of the heats of these five functions is greater than or equal to 80%. That is, m = 5, and threshold #1 is 80%. 80% of the sum of the heats of these five functions is 1307.4 * 0.8 = 1045.92. The sum of the heats of functions B1, B2, and B3 is 752.5 + 249.2 + 158.6 > 1045.92, resulting in the hot functions being functions B1, B2, and B3. A global list of hot functions can include functions B1, B2, and B3, along with their corresponding heats. The master controller can read the global list of hot functions and, based on this, calculate the cumulative heat of each compute node.

[0374] The instance cache situation on node A1 is as follows: the number of instances of function B1, function B2, function B3, function B4, and function B5 is 10, 4, 8, 8, and 1, respectively. The instance cache situation on node A2 is as follows: the number of instances of function B1, function B2, function B3, function B4, and function B5 is 5, 5, 7, 6, and 8, respectively. The instance cache situation on node A3 is as follows: the number of instances of function B1, function B2, function B3, function B4, and function B5 is 2, 2, 7, 4, and 7, respectively. The instance cache situation on node A4 is as follows: the number of instances of function B1, function B2, function B3, function B4, and function B5 is 6, 9, 8, 1, and 0, respectively. The instance cache status on node A5 is as follows: the number of instances of function B1, function B2, function B3, function B4, and function B5 is 0, 5, 8, 8, and 4, respectively. The cumulative heat of a node can be the sum of the product of the number of instances of the hot functions on the node and the heat of the hot functions. The hot functions on node A1 are function B1, function B2, and function B3. The cumulative heat of node A1 is 752.5*10+249.2*4+158.6*8=9790.6. Using the same method, we can obtain the cumulative heat of node A2 to be 6118.7, the cumulative heat of node A3 to be 3113.6, the cumulative heat of node A4 to be 8026.6, and the cumulative heat of node A5 to be 2514.8.

[0375] Each compute node in nodes A1, A2, A3, A4, and A5 has a resource capacity of 25600 MB. The memory requirements of the instances of functions B1, B2, B3, B4, and B5 are 256 MB, 128 MB, 512 MB, 256 MB, and 1024 MB, respectively. The remaining available cache resources on nodes A1, A2, A3, A4, and A5 are 15360 MB, 10368 MB, 13056 MB, 18560 MB, and 14720 MB, respectively. The ratios of the cumulative popularity of each compute node to the remaining available cache resources are 0.63, 0.59, 0.24, 0.43, and 0.17, respectively. Node A5, with the smallest ratio (0.17), is selected as the instance creation node, or scheduling node, to execute the function call request. The gateway forwards the function call request to node A5, which then creates and executes the instance.

[0376] 1040, create an instance of the function and execute the call request. After the request is executed, if the function is a hot function, execute step 1050, otherwise execute step 1060.

[0377] The dispatch node receives and executes the function call request forwarded by the gateway. Specifically, the sub-controller can pull the function image and create an instance of the function to execute the call request. After the call request is executed, the sub-controller can return the execution result to the gateway.

[0378] For example, after the function call request is executed, the sub-controller can query the local global hot function list to determine whether to cache it. If it is necessary to cache it, the sub-controller manages the life cycle of the instance. For example, the main controller can be used to maintain a global hot function list, and the sub-controller can synchronize the global hot function list from the main controller and manage the life cycle of the instance based on the list.

[0379] For example, the sub-controller may periodically synchronize the global hot function list.

[0380] Exemplarily, the sub-controller may synchronize the updated global hotspot function list when the global hotspot function list is updated.

[0381] After the request is executed, the sub-controller can determine whether the function is a hot function or a non-hot function based on the global hot function list, and adopt different caching strategies for hot functions and non-hot functions respectively. In other words, the sub-controller can update the cache area of ​​hot function instances and non-hot function instances based on the global hot function list, that is, cache hot function instances and non-hot function instances in different cache areas.

[0382] It should be understood that the above is merely an example and does not limit the embodiments of the present application. For example, in other possible implementations, after the function call request is executed, the main controller can also notify the sub-controller corresponding to the scheduling node whether to cache the instance. If caching is required, the sub-controller manages its lifecycle.

[0383] 1050, cache the function instance to the first area.

[0384] 1060, cache the function instance to the second area.

[0385] Taking node A5 as an example, the instance cache on node A5 is as follows: the number of instances of function B1, function B2, function B3, function B4, and function B5 is 0, 5, 8, 8, and 4, respectively. The memory requirements of these five function instances are 256MB, 128MB, 512MB, 256MB, and 1024MB, respectively. The total cache resources on node A5 are 25,600MB. For example, the global hot function list indicates that the hot functions are function B1, function B2, and function B3. The amount of resources occupied by cached hot function instances in the first zone is 5*128 + 8*512 = 4736MB. The amount of resources occupied by cached non-hot function instances in the second zone is 8*256 + 4*1024 = 6144MB. Node A5 receives a call request for function B1, creates an instance of function B1, and after executing the call request, the instance of function B1 is cached in the first zone. At this time, the amount of resources occupied by the cached hotspot function instances in the first zone is: 1*256+5*128+8*512=4992MB.

[0386] Furthermore, the sub-controller can update the global list of hot functions. After the sub-controller updates the global list of hot functions, the cache resources on the computing node are adjusted according to the updated global list of hot functions. For example, the updated global list of hot functions indicates that the hot functions are function B1 and function B2. Function B3 changes from a hot function to a non-hot function. The sub-controller transfers the instance of function B3 cached in the first area to the second area. At this time, the amount of resources occupied by the cached hot function instance in the first area is: 1*256+5*128=896MB, and the amount of resources occupied by the cached non-hot function instance in the second area is: 8*512+8*256+4*1024=10240MB.

[0387] After the function call in the second zone of the computing node ends, that is, after the call request is executed, if the type of the function has not changed, that is, it is still a non-hotspot function, the sub-controller can monitor its survival time based on the keep-alive duration, that is, the target cache duration corresponding to the non-hotspot function. Taking function B3 as an example, if no subsequent call request for function B3 arrives during the keep-alive period, the instance of function B3 is automatically released. At this time, the amount of resources occupied by the cached non-hotspot function instances in the second zone is: 8*256+4*1024=6144MB.

[0388] The solution of the embodiment of the present application adopts an instance caching solution with distinguishable hotspot functions. Compared with the passive caching strategy based on priority replacement, this solution can reduce the cold start rate by 20 times. While maintaining the same cold start rate, this solution can save 35% of cache resource usage.

[0389] Figure 9 shows a schematic flow chart of a method for function caching provided by an embodiment of the present application. Method 900 shown in Figure 9 can be executed by cache control system 600 shown in Figure 6 . Method 900 can be understood as an example of the execution process of cache control system 600 shown in Figure 6 . For a detailed description, please refer to the relevant description of system 600. To avoid repetition, some descriptions of method 900 will be omitted as appropriate.

[0390] 910. The main controller sends first indication information to a first sub-controller among the multiple sub-controllers, where the first indication information indicates a cache policy of an instance on a first computing node in the cluster.

[0391] 920. The first sub-controller performs instance cache processing on the instance on the first computing node according to the first indication information.

[0392] 930. The main controller sends second indication information to a second sub-controller among the multiple sub-controllers, where the second indication information indicates a cache policy of an instance on a second computing node in the cluster.

[0393] 940. The second sub-controller performs instance cache processing on the instance on the second computing node according to the second indication information.

[0394] It should be understood that the numbering of the steps in method 900 is for ease of description only and does not limit the order in which the steps are to be performed. For example, step 910 and step 930 may be performed simultaneously, and step 920 and step 940 may be performed simultaneously.

[0395] For example, the first sub-controller may be the sub-controller #1 mentioned above, and the second sub-controller may be the sub-controller #2 mentioned above.

[0396] For example, the first computing node may be the computing node #1 mentioned above, and the second computing node may be the computing node #2 mentioned above.

[0397] Illustratively, the first indication information may be the indication information #1 mentioned above, and the second indication information may be the indication information #2 mentioned above.

[0398] In the solution of the embodiment of the present application, the main controller manages the cache strategy of the instance on each computing node, so that the cache strategy of the instance on each computing node can be determined or adjusted based on global information, which is beneficial to reduce the occurrence rate of cold start calls while reducing unnecessary instance caching, thereby reducing cache redundancy. At the same time, this can rationally utilize the cache resources of each computing node, alleviate the load tilt problem, and thus reduce cache competition within the node. For example, the main controller can determine or adjust the cache strategy of the instance on each computing node based on the situation of each computing node and / or the call information of each function, and then instruct the sub-controller to perform corresponding processing.

[0399] Optionally, the first sub-controller is deployed in the first computing node, the second sub-controller is deployed in the second computing node, and the main controller is deployed in the control node.

[0400] Optionally, the memory of the first computing node includes a first area and a second area. Before the main controller sends a first indication message to the first sub-controller among the multiple sub-controllers, the instance of the first function on the first computing node is cached in the first area, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication message, including: the first sub-controller transfers the instance of the first function from the first area to the second area; or, before the main controller sends the first indication message to the first sub-controller among the multiple sub-controllers, the instance of the second function on the first computing node is cached in the second area, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication message, including: the first sub-controller transfers the instance of the second function from the second area to the first area.

[0401] Optionally, the target cache duration of the instance cached in the first zone is greater than the target cache duration of the instance cached in the second zone.

[0402] Optionally, the caching policy of the instance on the first computing node includes a target cache duration of an instance of at least one function on the first computing node, the first indication information indicates a type of at least one function, the type of at least one function includes a hotspot function or a non-hotspot function, and the target cache duration of an instance of the at least one function whose type is a hotspot function is greater than the target cache duration of an instance of a function whose type is a non-hotspot function.

[0403] Optionally, the memory of the first computing node includes a first area and a second area, the first area is used to cache instances of functions of the hotspot function type on the first computing node, and the second area is used to cache instances of functions of the non-hotspot function type on the first computing node.

[0404] Optionally, at least one function includes a first function, and before the main controller sends a first indication message to the first sub-controller among the multiple sub-controllers, an instance of the first function is cached in the first area, the first indication message indicates that the type of the first function is a non-hotspot function, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication message, including: the first sub-controller transfers the instance of the first function from the first area to the second area; or, at least one function includes a second function, before the main controller sends the first indication message to the first sub-controller among the multiple sub-controllers, the instance of the second function is cached in the second area, the first indication message indicates that the type of the second function is a hotspot function, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication message, including: the first sub-controller transfers the instance of the second function from the second area to the first area.

[0405] For example, the first function may be the function #1 mentioned above, and the second function may be the function #2 mentioned above.

[0406] Optionally, the method further includes: the main controller determining the type of the function in the cluster based on the number of times the function in the cluster is called in the cluster, and the functions in the cluster include the at least one function.

[0407] Optionally, the method also includes: when a call request for a third function arrives, the main controller determines a third computing node from the cluster based on the cumulative heat of multiple computing nodes in the cluster, and the third computing node is used to create an instance of the third function, and the cumulative heat of each computing node in the multiple computing nodes is determined based on the number of calls of the function on each computing node in the cluster.

[0408] For example, the third function may be the function #3 mentioned above. The third computing node may be the computing node #3 mentioned above.

[0409] Optionally, the cumulative heat of each computing node among the multiple computing nodes is determined based on the heat of the function of type hot function on each computing node and the number of instances of the function of type hot function on each computing node, and the heat of the function of type hot function on each computing node is determined based on the number of calls of the function of type hot function on each computing node in the cluster.

[0410] Optionally, the ratio of the cumulative heat of the third computing node to the available resources of the third computing node is less than or equal to the ratio of the cumulative heat of other computing nodes in the plurality of computing nodes except the third computing node to the available resources of the other computing nodes.

[0411] Optionally, the instances in the cluster do not include an available instance of the third function.

[0412] Optionally, the method further includes: when a call request for the third function arrives, the load distributor forwards the call request for the third function to a fourth computing node in the cluster, and the instance on the fourth computing node includes an available instance of the third function.

[0413] Exemplarily, the fourth computing node may be the computing node #4 mentioned above.

[0414] Optionally, method 900 also includes: the first computing node creates an instance of the fourth function, the first indication information indicates that the type of the instance of the fourth function is a hotspot function, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication information, including: the first sub-controller caches the instance of the fourth function to the first area.

[0415] Exemplarily, the fourth function may be the function #4 mentioned above.

[0416] Optionally, the method 900 also includes: the first computing node creates an instance of the fifth function, the first indication information indicates that the type of the instance of the fifth function is a non-hotspot function, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication information, including: the first sub-controller caches the instance of the fifth function to the second area.

[0417] Exemplarily, the fifth function may be the function #5 mentioned above.

[0418] Optionally, the method 900 further includes: the first sub-controller adjusting the number of instances of the sixth function according to the load of the sixth function on the first computing node. The type of the sixth function is a hotspot function.

[0419] The solution of the embodiment of the present application can also be applied to other cloud fields, for example, in the field of storage services, image hosting, and other fields where "hotspot effects" exist. "Hotspot effect" refers to the fact that most data operations or object operations are concentrated on a small amount of hot data or objects. The centralized control architecture provided in the embodiment of the present application can be used to manage hot data or hot objects, for example, to give priority to providing advantageous resources to hot data or objects, thereby achieving higher service performance at a lower service cost.

[0420] The apparatus of the embodiment of the present application is described below with reference to Figures 10 to 13. It should be understood that the apparatus described below can execute the method of the aforementioned embodiment of the present application. To avoid unnecessary repetition, repeated descriptions are appropriately omitted when introducing the apparatus of the embodiment of the present application.

[0421] FIG10 is a schematic block diagram of a function cache system according to an embodiment of the present application. The system 2000 shown in FIG10 can be used to execute the method shown in FIG2 or FIG9. The system shown in FIG10 can be considered an example of the system shown in FIG6. The system 2000 includes a main controller and multiple sub-controllers.

[0422] The main controller is used to send first indication information to a first sub-controller among multiple sub-controllers, the first indication information is used to determine a caching strategy for an instance on a first computing node in the cluster; the first sub-controller is used to perform instance caching processing on the instance on the first computing node according to the first indication information; the main controller is also used to send second indication information to a second sub-controller among the multiple sub-controllers, the second indication information is used to determine a caching strategy for an instance on a second computing node in the cluster; the second sub-controller is used to perform instance caching processing on the instance on the second computing node according to the second indication information.

[0423] The detailed description of the main controller and sub-controller can be found in the previous text. To avoid repetition, they will not be repeated here.

[0424] The main controller and the sub-controller can be implemented by software or hardware. For example, the main controller is used as an example to introduce the implementation of the main controller. Similarly, the implementation of the sub-controller can refer to the implementation of the main controller.

[0425] As an example of a software functional unit, the main controller may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the computing instance may be one or more. For example, the main controller may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.

[0426] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.

[0427] As an example of a hardware functional unit, the main controller may include at least one computing device, such as a server. Alternatively, the main controller may be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0428] The multiple computing devices included in the main controller can be distributed in the same region or in different regions. They can be distributed in the same AZ or in different AZs. Similarly, they can be distributed in the same VPC or in multiple VPCs. These multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.

[0429] This application also provides a computing device 100. As shown in Figure 11, computing device 100 includes a bus 102, a processor 104, a memory 106, and a communication interface 108. Processor 104, memory 106, and communication interface 108 communicate with each other via bus 102. Computing device 100 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 100.

[0430] Bus 102 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG11 shows a single bus line, but this does not imply a single bus or type of bus. Bus 104 may include a path for transmitting information between various components of computing device 100 (e.g., memory 106, processor 104, and communication interface 108).

[0431] The processor 104 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0432] The memory 106 may include volatile memory, such as random access memory (RAM). The processor 104 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0433] The memory 106 stores executable program codes, and the processor 104 executes the executable program codes to implement the functions of the main controller and the sub-controller, thereby implementing the function caching method. That is, the memory 106 stores instructions for executing the function caching method.

[0434] The communication interface 103 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 100 and other devices or a communication network.

[0435] Embodiments of the present application also provide a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.

[0436] As shown in Figure 12, the computing device cluster includes at least one computing device 100. The memory 106 of one or more computing devices 100 in the computing device cluster may store the same instructions for executing the function cache method.

[0437] In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions for executing the method for function caching. In other words, the combination of one or more computing devices 100 may jointly execute the instructions for executing the method for function caching.

[0438] It should be noted that the memory 106 in different computing devices 100 in the computing device cluster can store different instructions, each for executing a portion of the functions of the function cache system. In other words, the instructions stored in the memory 106 in different computing devices 100 can implement one or more functions of the main controller and the sub-controller.

[0439] In some possible implementations, one or more computing devices in a computing device cluster may be connected via a network. The network may be a wide area network (WAN) or a local area network (LAN), etc. FIG13 shows a possible implementation. As shown in FIG13 , two computing devices 100A and 100B are connected via a network. Specifically, the connection to the network is made via a communication interface in each computing device. In this type of possible implementation, the memory 106 in the computing device 100A stores instructions for executing the functions of a main controller. Simultaneously, the memory 106 in the computing device 100B stores instructions for executing the functions of a sub-controller.

[0440] It should be understood that the functions of the computing device 100A shown in FIG13 may also be completed by multiple computing devices 100. Similarly, the functions of the computing device 100B may also be completed by multiple computing devices 100.

[0441] The present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device is caused to perform a function caching method.

[0442] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute a method for function caching.

[0443] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the protection scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for function caching, characterized in that: The method comprises: The main controller sends first indication information to a first sub-controller among the multiple sub-controllers, where the first indication information is used to determine a cache strategy for an instance on a first computing node in the cluster; The first sub-controller performs instance cache processing on the instance on the first computing node according to the first indication information; The main controller sends second indication information to a second sub-controller among the multiple sub-controllers, where the second indication information is used to determine a cache strategy for an instance on a second computing node in the cluster; The second sub-controller performs instance cache processing on the instance on the second computing node according to the second indication information.

2. The method according to claim 1, characterized in that The first sub-controller is deployed in the first computing node, the second sub-controller is deployed in the second computing node, and the main controller is deployed in a control node in the cluster.

3. The method according to claim 1 or 2, characterized in that: The memory of the first computing node includes a first area and a second area, Before the main controller sends the first indication information to the first sub-controller among the multiple sub-controllers, the instance of the first function on the first computing node is cached in the first area, and the first sub-controller performs instance cache processing on the instance on the first computing node according to the first indication information, including: The first sub-controller transfers the instance of the first function from the first area to the second area; or, Before the main controller sends the first indication information to the first sub-controller among the multiple sub-controllers, the instance of the second function on the first computing node is cached in the second area, and the first sub-controller performs instance cache processing on the instance on the first computing node according to the first indication information, including: The first sub-controller transfers the instance of the second function from the second zone to the first zone.

4. The method according to claim 3, characterized in that A target cache duration of the instances cached in the first zone is greater than a target cache duration of the instances cached in the second zone.

5. The method according to claim 1 or 2, characterized in that: The caching strategy of the instance on the first computing node includes a target cache duration of an instance of at least one function on the first computing node, the first indication information indicates a type of the at least one function, the type of the at least one function includes a hotspot function or a non-hotspot function, and the target cache duration of an instance of the at least one function whose type is the hotspot function is greater than the target cache duration of an instance of a function whose type is the non-hotspot function.

6. The method according to claim 5, characterized in that The memory of the first computing node includes a first area and a second area, the first area is used to cache instances of functions of the hotspot function type on the first computing node, and the second area is used to cache instances of functions of the non-hotspot function type on the first computing node.

7. The method according to claim 6, characterized in that The at least one function includes a first function, before the main controller sends first indication information to a first sub-controller among the multiple sub-controllers, an instance of the first function is cached in the first area, the first indication information indicates that the type of the first function is the non-hotspot function, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication information, including: The first sub-controller transfers the instance of the first function from the first area to the second area; or, The at least one function includes a second function, before the main controller sends first indication information to a first sub-controller among the multiple sub-controllers, an instance of the second function is cached in the second area, the first indication information indicates that the type of the second function is the hotspot function, and the first sub-controller performs instance caching processing on the instance on the first computing node according to the first indication information, including: The first sub-controller transfers the instance of the second function from the second zone to the first zone.

8. The method according to any one of claims 5 to 7, characterized in that The method further comprises: The main controller determines the type of the functions in the cluster based on the number of times the functions in the cluster are called in the cluster, and the functions in the cluster include the at least one function.

9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: When a call request for a third function arrives, the main controller determines a third computing node from the cluster based on the cumulative heat of multiple computing nodes in the cluster, and the third computing node is used to create an instance of the third function. The cumulative heat of each computing node in the multiple computing nodes is determined based on the number of times the function on each computing node is called in the cluster.

10. The method according to claim 9, characterized in that The cumulative heat of each of the multiple computing nodes is determined based on the heat of the function of the hotspot function type on each computing node and the number of instances of the function of the hotspot function type on each computing node, and the heat of the function of the hotspot function type on each computing node is determined based on the number of calls of the function of the hotspot function type on each computing node in the cluster.

11. The method according to claim 9 or 10, characterized in that: The ratio of the cumulative heat of the third computing node to the available resources of the third computing node is less than or equal to the ratio of the cumulative heat of other computing nodes among the multiple computing nodes except the third computing node to the available resources of the other computing nodes.

12. The method according to any one of claims 9 to 11, characterized in that The instances in the cluster do not include an available instance of the third function.

13. The method according to any one of claims 1 to 8, characterized in that The method further comprises: When a call request for the third function arrives, the load distributor forwards the call request for the third function to a fourth computing node in the cluster, and the instance on the fourth computing node includes an available instance of the third function.

14. A function caching system, characterized in that: It includes a main controller and multiple sub-controllers, wherein: The main controller is used to send first indication information to a first sub-controller among the multiple sub-controllers, where the first indication information is used to determine a cache strategy for an instance on a first computing node in the cluster; The first sub-controller is used to perform instance cache processing on the instance on the first computing node according to the first indication information; The main controller is further used to send second indication information to a second sub-controller among the multiple sub-controllers, where the second indication information is used to determine a cache strategy for an instance on a second computing node in the cluster; The second sub-controller is used to perform instance cache processing on the instance on the second computing node according to the second indication information.

15. The system according to claim 14, characterized in that The first sub-controller is deployed in the first computing node, the second sub-controller is deployed in the second computing node, and the main controller is deployed in a control node in the cluster.

16. The system according to claim 14 or 15, characterized in that The memory of the first computing node includes a first area and a second area, Before the main controller sends the first indication information to the first sub-controller among the multiple sub-controllers, the instance of the first function on the first computing node is cached in the first area, and the first sub-controller is specifically used to: transfer the instance of the first function from the first area to the second area; or, Before the main controller sends the first indication information to the first sub-controller among the multiple sub-controllers, the instance of the second function on the first computing node is cached in the second area, and the first sub-controller is specifically used to transfer the instance of the second function from the second area to the first area.

17. The system according to claim 16, characterized in that A target cache duration of the instances cached in the first zone is greater than a target cache duration of the instances cached in the second zone.

18. The system according to claim 14 or 15, characterized in that The caching strategy of the instance on the first computing node includes a target cache duration of an instance of at least one function on the first computing node, the first indication information indicates a type of the at least one function, the type of the at least one function includes a hotspot function or a non-hotspot function, and the target cache duration of an instance of the at least one function whose type is the hotspot function is greater than the target cache duration of an instance of a function whose type is the non-hotspot function.

19. The system according to claim 18, characterized in that The memory of the first computing node includes a first area and a second area, the first area is used to cache instances of functions of the hotspot function type on the first computing node, and the second area is used to cache instances of functions of the non-hotspot function type on the first computing node.

20. The system according to claim 19, characterized in that The at least one function includes a first function, before the main controller sends a first indication message to a first sub-controller among the multiple sub-controllers, an instance of the first function is cached in the first area, the first indication message indicates that the type of the first function is the non-hotspot function, and the first sub-controller is specifically used to transfer the instance of the first function from the first area to the second area; or, The at least one function includes a second function, and before the main controller sends a first indication message to a first sub-controller among the multiple sub-controllers, an instance of the second function is cached in the second area, the first indication information indicates that the type of the second function is the hot spot function, and the first sub-controller is specifically used to transfer the instance of the second function from the second area to the first area.

21. A system according to any one of claims 18 to 20, characterized in that The main controller is also used for: The types of the functions in the cluster are determined based on the number of times the functions in the cluster are called in the cluster, and the functions in the cluster include the at least one function.

22. The system according to any one of claims 14 to 21, characterized in that The main controller is also used for: When a call request for the third function arrives, a node is determined from the cluster according to the accumulated heat of multiple computing nodes in the cluster. A third computing node is determined, where the third computing node is used to create an instance of the third function, and the cumulative heat of each computing node in the plurality of computing nodes is determined according to the number of calls of the function on each computing node in the cluster.

23. The system according to claim 22, characterized in that The cumulative heat of each of the multiple computing nodes is determined based on the heat of the function of the hotspot function type on each computing node and the number of instances of the function of the hotspot function type on each computing node, and the heat of the function of the hotspot function type on each computing node is determined based on the number of calls of the function of the hotspot function type on each computing node in the cluster.

24. The system according to claim 22 or 23, characterized in that The ratio of the cumulative heat of the third computing node to the available resources of the third computing node is less than or equal to the ratio of the cumulative heat of other computing nodes among the multiple computing nodes except the third computing node to the available resources of the other computing nodes.

25. A system according to any one of claims 22 to 24, characterised in that The instances in the cluster do not include an available instance of the third function.

26. The system according to any one of claims 14 to 21, characterized in that The system further comprises a load distributor for: When a call request for a third function arrives, the call request for the third function is forwarded to a fourth computing node in the cluster, and the instance on the fourth computing node includes an available instance of the third function.

27. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 13.

28. A computer-readable storage medium, characterized in that: The method comprises computer program instructions, and when the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 13.

29. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster is caused to perform the method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Function caching method and system

    CN118626241A

  • Hot spot data management method, device and system

    CN110569233A

  • Data replacement method of hierarchical storage system

    CN111427969A

  • Function calculation cold start acceleration method and device, equipment and storage medium

    CN111475235A

  • Data scheduling method and device

    CN112685670A