A method, apparatus and de-serverized system for message management

By controlling the time-sharing operation of stateful functions on stateful instances through message management, the problem of resource waste caused by locking and mutual exclusion in stateful functions on the cloud is solved, and more efficient resource utilization is achieved.

CN114077504BActive Publication Date: 2026-06-26HUAWEI TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2020-08-13
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Stateful functions running in the cloud may waste resources due to locking and mutual exclusion operations, especially when stateful functions are waiting for locks to be released, resulting in resource waste and low utilization.

Method used

A message management approach is used to control the time-sharing operation of state instances by different stateful functions. The scheduling of stateful functions is managed through a message queue to ensure that the operation of state instances only begins after an operation message is received, thus avoiding resource waiting.

Benefits of technology

This effectively avoids resource waste, improves resource utilization, and enhances the overall performance and efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114077504B_ABST
    Figure CN114077504B_ABST
Patent Text Reader

Abstract

The application discloses a kind of de-server systems, comprising: message management device can receive first message, first message is used to indicate scheduling first stateful function operation first state instance;First message is stored in the first message queue corresponding to first state instance, first message queue is also used to store multiple messages, each message in multiple messages is used to indicate one stateful function operation first state instance;Second message is transmitted to the second stateful function corresponding to second message, and the second stateful function corresponding to second message is operated to idle first state instance, wherein, second message is the message located at the front end of first message queue.The technical scheme of the application controls the time-sharing operation of different stateful functions to state instance by the way of message management, and the stateful function only operates the state instance after obtaining the message of the state instance, so as to avoid resource waste.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to a message management method, apparatus, and serverless system. Background Technology

[0002] Serverless computing refers to cloud providers offering the resources to run functions and dynamically managing resource allocation. Users can write functions in a serverless manner without purchasing servers to run them in advance. The location of the function in the cloud is controlled by the cloud platform. A key feature of cloud platforms is on-demand deployment; functions are quickly deployed when there is a business need, enabling rapid business processing.

[0003] Functions running on the cloud typically include stateless functions and stateful functions. Stateless functions are those whose state data cannot be retained during execution, and each subsequent run of the function does not depend on the state data from previous runs. State data refers to transient data or context data during the function's execution. Stateful functions, on the other hand, are those whose state data can be retained during execution, and the function can manipulate this state data on subsequent runs.

[0004] State data is contained within state instances. The state data within a state instance can be modified, but the instance's identifier remains unchanged. A state instance can only be operated on by one function at a time. If two different stateful functions need to use the same state instance, a locking mechanism is required for mutual exclusion. For example, if stateful function B and stateful function C both need to operate on state instance S, and stateful function B operates on state instance S first, it will acquire a lock to prevent other functions from modifying it. If stateful function C also needs to operate on state instance S, it will prepare the resources needed for that operation. However, until stateful function B releases the lock, stateful function C cannot operate on state instance S and must wait for B to release the lock. During this waiting period, stateful function C occupies the resources prepared for operating on state instance S, resulting in resource waste. Summary of the Invention

[0005] This application provides a serverless system that uses message management to control the time-sharing operations of different stateful functions on state instances. A stateful function only begins operating on a state instance after receiving a message to do so, without needing to occupy resources while waiting for a stateful function currently operating on the state instance to release a lock, thus avoiding resource waste. This application also provides a corresponding message management method and apparatus.

[0006] This application provides a serverless system, comprising: a message management device, the message management device being configured to: receive a first message, the first message being configured to instruct a first stateful function to operate on a first state instance; store the first message in a first message queue corresponding to the first state instance, the first message queue being further configured to store multiple messages, each of the multiple messages being configured to instruct a stateful function to operate on the first state instance; and pass a second message to a second stateful function corresponding to the second message, and execute the second stateful function corresponding to the second message to operate on the first state instance in an idle state, wherein the second message is the message located at the front of the first message queue.

[0007] In this first aspect, the serverless system can be a clustered system, including control nodes and worker nodes. There may be one or more control nodes and multiple worker nodes, typically one control node manages multiple worker nodes. In this application, "multiple" includes "two." "Multiple" can also be described as "at least two." A message management device (statemessagemanager) can be located on a worker node. One worker node may have one message management device, or some worker nodes may have a message management device while others may not. When some worker nodes do not have a message management device, the message management device can manage state instances and state functions on multiple worker nodes. The message management device can be an instance or a container. The first message may include the identifier (state ID) of the first state instance and the function name of the first stateful function. A stateful function refers to a function whose state data during execution can be retained, and the function can manipulate this state data again during subsequent executions. State data refers to transient data or context data during function execution. State data is contained within a state instance; the state data within a state instance can be modified, but the identifier of the state instance will not change. The first message queue is used to store multiple messages, meaning it can store multiple messages, not just multiple messages currently stored. Because messages in the first message queue are dequeued, at any given time, there may be one message, multiple messages, or none. The second message can enter the first message queue before the first message. If the first message enters the first message queue when it is empty, then the second message is the same as the first message, and its corresponding second stateful function is the same as its first stateful function. Messages in the first message queue follow a first-in, first-out (FIFO) rule. The second message being at the front of the first message queue indicates that it entered the queue earlier than any other message currently in the queue. A first state instance being in an idle state means that it has not been operated on by any other stateful functions associated with it. As can be seen from the first aspect, the first aspect adopts a message management method to control the time-sharing operation of different stateful functions on the first state instance. The second stateful function will only operate on the first state instance after being scheduled for the second message. Similarly, other stateful functions associated with the first state instance will only operate on the first state instance after being scheduled for the corresponding message. This avoids other stateful functions occupying resources and waiting while one stateful function operates on the state instance, avoids resource waste, and improves resource utilization.

[0008] In one possible implementation of the first aspect, the message management device is further configured to: if the second message is not the same message as the first message, after passing the second message to the second stateful function corresponding to the second message, pass the first message located at the front of the first message queue to the first stateful function, and run the first stateful function to operate the first state instance in the idle state.

[0009] In this possible implementation, if the second message is located before the first message in the first message queue, the second message will be scheduled to the second stateful function, which will then operate on the first state instance. Then, once the first state instance is idle and the first message is at the front of the first message queue, the first message will be scheduled to the first stateful function, which will then operate on the first state instance.

[0010] In one possible implementation of the first aspect, the serverless system further includes a routing device, a function state scheduler, and multiple worker nodes. The scheduling device is used to: receive an address request sent by the routing device, the address request including an identifier of a first state instance; deploy the first state instance on a first worker node among the multiple worker nodes according to the identifier of the first state instance; and establish a correspondence between the identifier of the first state instance and the address of a message management device, the message management device corresponding to the first worker node.

[0011] In this possible implementation, the scheduling device resides on the control node, and this scheduling device can be an instance or a container. The routing device can be deployed on routing devices such as switches or routers, or it can be deployed on the client side. If the scheduling device receives an address request, it indicates that the first state instance has not yet been deployed to a worker node. This address request instructs the scheduling device to deploy the first state instance on the first worker node and establish a mapping between the identifier of the first state instance and the address of the message management device, which corresponds to the first worker node. The scheduling device can arbitrarily select one worker node from multiple worker nodes as the first worker node, or it can select the first worker node according to some selection strategy. Then, it deploys the first state instance on the first worker node. After the first state instance is deployed, the message management device corresponding to the first state instance can be determined, thereby determining the address of the corresponding message management device.

[0012] In one possible implementation of the first aspect, the scheduling device is further configured to: migrate a first stateful function deployed on a second working node to a first working node, wherein the migration cost of the first stateful function is less than the migration cost of the first state instance.

[0013] In this possible implementation, migration cost refers to the resource consumption incurred due to stateful function migration or state instance migration, such as transmission resource consumption. This possible implementation shows that the migration cost of stateful functions and the migration cost of the first state instance determine whether to migrate data or a function. This allows for achieving better system performance with less migration overhead.

[0014] In one possible implementation of the first aspect, the address request also includes the function name of the first stateful function; the first worker node is determined based on the load information of multiple worker nodes, the size of the first state instance, and the demand strategy of at least two stateful functions, and the at least two stateful functions are located in a function business group associated with the function name of the first stateful function.

[0015] In this possible implementation, the scheduling device can determine the first worker node for deploying the first state instance based on the load information of the multiple worker nodes it manages, the size of the first state instance, and the demand strategy of at least two stateful functions with operational permissions to the first state instance. The load information of the worker node indicates the current load status on the worker node, and may include at least one of the following: function deployment status on the worker node, CPU utilization or idle rate, and memory utilization or idle rate. The size of the first state instance represents the amount of data in the first state instance. The demand strategy of the at least two stateful functions with operational permissions to the first state instance refers to the location requirements of the at least two stateful functions relative to the first state instance during deployment, or the requirements for available resources on the deployed worker node. For example, whether the state instance and its corresponding stateful function need to be deployed on the same worker node. Alternatively, it may specify the requirements for available computing or memory resources on the deployed worker node, such as requiring the CPU idle rate to reach a first threshold, or the memory idle rate to reach a second threshold. Both the first and second thresholds can be set according to requirements. As can be seen from this possible implementation, deploying the first state instance on a first worker node with a low load or resources that meet the requirements of at least two state functions can improve the overall performance of the server system.

[0016] In one possible implementation of the first aspect, the address request also includes the function name of the first stateful function; the first worker node is the worker node with the highest total score among multiple worker nodes, and the total score of a worker node is related to the worker node's computing resources, storage resources, or whether at least two stateful functions have been deployed, and the at least two stateful functions are located in a function service group associated with the function name of the first stateful function.

[0017] In this possible implementation, an averaging algorithm can be used to calculate the total score for each worker node. The evaluation algorithm can be resource-related, such as CPU-related, memory-related, or affinity-related algorithms, such as algorithms that determine whether state functions and state instances reside on the same worker node. For each worker node, at least one evaluation algorithm can be used to calculate a score. Then, the scores from all evaluation algorithms are summed to obtain the total score. Finally, the worker node with the highest total score is selected for deploying the first state instance. This possible implementation shows that deploying the first state instance on the highest-scoring worker node can improve the overall performance of the server system.

[0018] In one possible implementation of the first aspect, the message management device is further configured to: pass the third message located at the front of the second message queue to a third stateful function in parallel with respect to the first message queue, and run the third stateful function to operate the second state instance which is in an idle state, wherein the second message queue corresponds to the second state instance.

[0019] In this possible implementation, a message management device can manage multiple message queues, each message queue corresponding to a state instance. For message queues of different state instances, a parallel scheduling method can be used to schedule messages in different queues, which can improve the operational efficiency of different stateful functions on different state instances.

[0020] In one possible implementation of the first aspect, the message management device is further configured to: after all messages in the first message queue and the second message queue have been scheduled, pass the fourth message located at the front of the third message queue to the fourth stateful function in parallel, and run the fourth stateful function to operate the first state instance and the second state instance that are in an idle state, the third message queue corresponding to the first state instance and the second state instance, and the scheduling order of the fourth stateful function is after the first stateful function, the second stateful function and the third stateful function.

[0021] In this possible implementation, the fourth stateful function has operational authority over the combined instance of the first and second state instances. Furthermore, the fourth stateful function operates on the first, second, and third stateful functions in the order they operate on the first and second state instances. Therefore, the combined instance is only scheduled to operate on messages in the third message queue after messages in the first and second message queues have been dispatched. This possible implementation provides a multi-level management approach for stateful functions.

[0022] In one possible implementation of the first aspect, the serverless system further includes an address management device, which is also configured to: send to the address management device a mapping relationship between the identifier of the first state instance and the address of the message management device corresponding to the first working node. The address management device stores the mapping relationship.

[0023] In this possible implementation, the address management device can also be called a name service device. After the scheduling device determines the address of the message management device, it can send the mapping between the identifier (state ID) of the first state instance and the address (endpoint) of the message management device to the address management device for storage. Thus, when a subsequent call request containing that state ID is received, the corresponding endpoint can be retrieved from the address management device, or the mapping can be retrieved from the address management device, and then the endpoint corresponding to the state ID can be determined based on the mapping, and the first message can be sent based on that endpoint. This method of storing the mapping between state IDs and endpoints through the address management device can quickly locate the message management device corresponding to the call request, thereby quickly sending the message.

[0024] In one possible implementation of the first aspect, the routing device is further configured to: receive a client's call request for a first stateful function, the call request including an identifier of a first state instance and a function name of the first stateful function; obtain the address of a message management device corresponding to the identifier of the first state instance; and send a first message to the message management device indicated by the address of the message management device.

[0025] In this possible implementation, the routing device can obtain the address of the message management device locally, from the address management device, or from the scheduling device.

[0026] In one possible implementation of the first aspect, the routing device is configured to: obtain from the scheduling device the address of the message management device corresponding to the identifier of the first state instance; or, obtain from the address management device the address of the message management device corresponding to the identifier of the first state instance.

[0027] In this possible implementation, if the address management device stores the mapping between state IDs and endpoints, the address of the message management device can be obtained from the address management device. If the address management device does not store the mapping between state IDs and endpoints, the scheduling device needs to deploy a first state instance and then determine the address of the corresponding message management device.

[0028] A second aspect of this application provides a message management method, comprising: receiving a first message, the first message being used to instruct a first stateful function to operate on a first state instance; storing the first message in a first message queue corresponding to the first state instance, the first message queue being used to store multiple messages, each message being used to instruct a stateful function to operate on the first state instance; passing a second message to a second stateful function corresponding to the second message, and running the second stateful function corresponding to the second message to operate on the first state instance in an idle state, wherein the second message is the message located at the front of the first message queue.

[0029] In one possible implementation of the second aspect, the method further includes: if the second message is not the same message as the first message, after passing the second message to the second stateful function corresponding to the second message, passing the first message at the front of the first message queue to the first stateful function, and running the first stateful function to operate the first state instance in the idle state.

[0030] In one possible implementation of the second aspect, relative to the first message queue, the third message located at the front of the second message queue is passed to the third stateful function in parallel, and the third stateful function is run to operate the second state instance which is in an idle state, the second message queue corresponding to the second state instance.

[0031] In one possible implementation of the second aspect, after all messages in the first message queue and the second message queue have been scheduled, the fourth message located at the front of the third message queue is passed to the fourth stateful function in parallel, and the fourth stateful function is run to operate the first state instance and the second state instance that are in an idle state. The third message queue corresponds to the first state instance and the second state instance, and the scheduling order of the fourth stateful function is after the first stateful function, the second stateful function and the third stateful function.

[0032] The second aspect provides a message management method applicable to the aforementioned service-free system. The features and effects involved in this second aspect and any possible implementation can be understood by referring to the descriptions in the first aspect and its corresponding possible implementations.

[0033] A third aspect of this application provides a message management method applied to a serverless system. The serverless system includes a message management device, a routing device, a scheduling device, and multiple worker nodes. The method includes: receiving an address request sent by the routing device, the address request including an identifier of a first state instance; deploying the first state instance on a first worker node among the multiple worker nodes according to the identifier of the first state instance; and establishing a correspondence between the identifier of the first state instance and the address of the message management device, wherein the message management device corresponds to the first worker node.

[0034] In one possible implementation of the third aspect, the method further includes: migrating a first stateful function deployed on a second worker node to a first worker node, wherein the migration cost of the first stateful function is less than the migration cost of the first state instance.

[0035] In one possible implementation of the third aspect, the address request also includes the function name of the first stateful function, the first worker node is determined based on the load information of multiple worker nodes, the size of the first state instance, and the demand strategy of at least two stateful functions, the at least two stateful functions being located in a function service group associated with the function name of the first stateful function.

[0036] In one possible implementation of the third aspect, the address request also includes the function name of the first stateful function, the first worker node being the worker node with the highest total score among multiple worker nodes, and the total score of a worker node being related to the worker node's computing resources, storage resources, or whether at least two stateful functions have been deployed, the at least two stateful functions being located in a function service group associated with the function name of the first stateful function.

[0037] In one possible implementation of the third aspect, the serverless system further includes an address management device, and the method further includes: sending to the address management device the correspondence between the identifier of the first state instance and the address of the message management device corresponding to the first working node.

[0038] The features and corresponding effects involved in this third aspect can be understood by referring to the first aspect and the corresponding descriptions of the possible implementation methods in the first aspect, and will not be repeated here.

[0039] A fourth aspect of this application provides a message management device that has the function of implementing the method of the second aspect or any possible implementation of the second aspect. This function can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above function, such as a receiving unit, a first processing unit, and a second processing unit.

[0040] A fifth aspect of this application provides a scheduling apparatus, which is a message management apparatus that has the function of implementing the method of the third aspect or any possible implementation of the third aspect. This function can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-described function, such as a receiving unit, a first processing unit, and a second processing unit.

[0041] The sixth aspect of this application provides a computer device including at least one processor, a memory, an input / output (I / O) interface, and computer-executable instructions stored in the memory and executable on the processor. When the computer-executable instructions are executed by the processor, the processor executes a method as described in the second aspect above or any possible implementation thereof.

[0042] The seventh aspect of this application provides a computer device including at least one processor, a memory, an input / output (I / O) interface, and computer-executable instructions stored in the memory and executable on the processor. When the computer-executable instructions are executed by the processor, the processor executes a method as described in the third aspect above or any possible implementation of the third aspect.

[0043] The eighth aspect of this application provides a computer-readable storage medium storing one or more computer-executable instructions, wherein when the computer-executable instructions are executed by a processor, the processor performs a method as described in the second aspect above or any possible implementation thereof.

[0044] The ninth aspect of this application provides a computer-readable storage medium storing one or more computer-executable instructions, wherein when the computer-executable instructions are executed by a processor, the processor performs a method as described in the third aspect above or any possible implementation thereof.

[0045] The tenth aspect of this application provides a computer program product storing one or more computer-executable instructions, wherein when the computer-executable instructions are executed by a processor, the processor executes a method as described in the second aspect above or any possible implementation thereof.

[0046] The eleventh aspect of this application provides a computer program product that stores one or more computer execution instructions, wherein when the computer execution instructions are executed by a processor, the processor executes a method as described in the third aspect or any possible implementation thereof.

[0047] The twelfth aspect of this application provides a chip system including at least one processor. The at least one processor is used to implement the functions described in the second aspect or any possible implementation thereof, supporting inter-process communication. In one possible design, the chip system may further include a memory for storing program instructions and data necessary for message management devices. This chip system may be composed of chips or may include chips and other discrete devices.

[0048] The thirteenth aspect of this application provides a chip system including at least one processor. The at least one processor is used to implement the functions described in the third aspect or any possible implementation thereof, supporting inter-process communication. In one possible design, the chip system may further include a memory for storing program instructions and data necessary for scheduling devices. This chip system may be composed of chips or may include chips and other discrete devices.

[0049] This application embodiment uses message management to control the time-sharing operation of different stateful functions on the first state instance. The first stateful function only prepares to operate on the resources of the first state instance after being scheduled by the first message, and then operates on the first state instance. This avoids other stateful functions occupying resources and waiting while one stateful function operates on the state instance, avoids resource waste, and improves resource utilization. Attached Figure Description

[0050] Figure 1 This is a schematic diagram of the structure of a serverless system provided in an embodiment of this application;

[0051] Figure 2A This is another schematic diagram of the serverless system provided in the embodiments of this application;

[0052] Figure 2B This is another schematic diagram of the serverless system provided in the embodiments of this application;

[0053] Figure 3 This is a schematic diagram of an embodiment of the message management method provided in this application;

[0054] Figure 4A This is a schematic diagram of a scenario example provided in an embodiment of this application;

[0055] Figure 4B This is a schematic diagram illustrating another scenario provided in the embodiments of this application;

[0056] Figure 5A This is a schematic diagram illustrating another scenario provided in the embodiments of this application;

[0057] Figure 5BThis is a schematic diagram illustrating another scenario provided in the embodiments of this application;

[0058] Figure 5C This is a schematic diagram illustrating another scenario provided in the embodiments of this application;

[0059] Figure 6 This is a schematic diagram of an example video scene provided in an embodiment of this application;

[0060] Figure 7 This is a schematic diagram of an embodiment of a message management method for a video scene provided in this application.

[0061] Figure 8A This is a comparison diagram of the effects provided in the embodiments of this application;

[0062] Figure 8B This is another effect comparison diagram provided by the embodiments of this application;

[0063] Figure 9 This is a schematic diagram of an embodiment of the message management device provided in this application;

[0064] Figure 10 This is a schematic diagram of an embodiment of the scheduling device provided in this application;

[0065] Figure 11 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application;

[0066] Figure 12 This is another structural schematic diagram of the computer device provided in the embodiments of this application. Detailed Implementation

[0067] The embodiments of this application are described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. As those skilled in the art will recognize, with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0068] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0069] This application provides a serverless system that uses message management to control the time-sharing operations of different stateful functions on state instances. A stateful function only needs to prepare resources after receiving a message to operate on a state instance, thus avoiding resource waste. This application also provides corresponding message management methods and apparatus. These will be described in detail below.

[0070] Figure 1 This is a schematic diagram of one embodiment of the serverless system in this application.

[0071] like Figure 1 As shown, this serverless system includes clients, routing devices, control nodes, and worker nodes. There can be one or multiple control nodes, such as: Figure 1 In this application, there are control nodes 1 to X, where X is an integer greater than 1. There are typically multiple worker nodes, such as worker nodes 1, 2, 3 to M, and worker nodes P to S, where M, P, and S are all integers greater than 3, and S > P > M. Control node 1 can manage worker nodes 1 to M. Control node M can manage worker nodes P to S. However, this management method is not limited to this; control nodes 1 to X can also jointly manage worker nodes 1 to M and worker nodes P to S. Alternatively, control nodes 1 to M can take turns managing worker nodes 1 to M and worker nodes P to S. In this application, "multiple" includes "two." "Multiple" can also be described as "at least two."

[0072] The client can be a computer device such as a mobile phone, tablet, laptop, or personal computer (PC). The client can also be a service process in the cloud. Routing devices can be switches or routers. Both control nodes and worker nodes can be independent physical machines or virtual machines (VMs) virtualized from cloud resources.

[0073] Users can publish functions to the control node through the client. The control node records the function information, which may include the function's business group, function name, and function code. Of course, the function information may also include other parameters, not limited to the business group, function name, and function code listed here. The business group will include the name of the state instance to which the function is bound, as well as the names of other functions bound to that state instance.

[0074] In the embodiments of this application, such as Figure 2A and Figure 2B As shown, the control node may include a function state scheduler, the worker nodes may include a state message manager, and the routing device may include a routing device. The scheduler, message manager, and routing device can be an instance or a container, and their respective functions can be implemented in software on the control node, worker nodes, and routing device. Additionally, this serverless system may include an address management device, also known as a name service device. This address management device can be a standalone physical machine or a virtual machine virtualized from cloud resources. The address management device stores the addresses of the message manager.

[0075] Figure 2A Each worker node is configured with a message management device. Figure 2B The message management device is configured only on some worker nodes. In fact, the message management device in this application is not limited to being configured on worker nodes; it can also be configured on control nodes. Furthermore, the routing device can also be configured on the client instead of on the routing device.

[0076] Additionally, it should be noted that, Figure 2A and Figure 2B The schematic diagram of the serverless system shown is only an example of control node 1 and the worker nodes under that control node. In reality, the serverless system may also include, for example, control node 1 and the worker nodes under that control node. Figure 1 The relationships between the control node M, worker nodes P to S, and the aforementioned message management device, scheduling device, routing device, and address management device can be found in [reference needed]. Figure 2A and Figure 2B To understand the corresponding relationships.

[0077] The above Figure 2A and Figure 2B The serverless system shown can manage stateful functions and state instances, and uses message management to enable time-sharing operations on the same state instance for multiple stateful functions. The following section will combine... Figure 3 This application introduces a message management method provided in its embodiments.

[0078] like Figure 3 As shown, one embodiment of the message management method provided in this application includes:

[0079] 101. The client initiates a request to call the first stateful function.

[0080] The call request includes the identifier (state ID) of the first state instance and the function name of the first stateful function.

[0081] A stateful function is one whose state data during execution can be preserved, and the function can manipulate this state data again the next time it runs. State data refers to transient data or context data during the function's execution.

[0082] State data is contained within state instances. The state data in a state instance can be modified, but the identifier of the state instance, that is, the state ID of the state instance, will not change.

[0083] 102. The routing device receives the call request and obtains the address of the message management device corresponding to the identifier of the first state instance.

[0084] Step 102 can obtain the address (endpoint) of the message management device corresponding to the information (state ID) of the first state instance in the following three ways.

[0085] The first method: Obtain it locally from the routing device.

[0086] The routing device can look up whether the address of the message management device corresponding to the identifier of the first state instance is stored locally. If the local storage contains such a correspondence, the endpoint corresponding to the state ID can be found.

[0087] The second method: obtain it from the address management device.

[0088] The address management unit is used to store the mapping between state IDs and endpoints.

[0089] The routing device can send a state ID to the address management device. Based on this state ID and the stored correspondence described above, the address management device determines the endpoint corresponding to that state ID. The address management device then sends this endpoint to the routing device.

[0090] Alternatively, the routing device can obtain the mapping relationship from the address management device and then determine the endpoint corresponding to the state ID itself.

[0091] The third method: obtain from the scheduling device.

[0092] If neither the first nor the second method can obtain the endpoint corresponding to the state ID, it indicates that the correspondence between the state ID and the endpoint does not exist. In this case, the routing device can send an address request to the scheduling device. This address request instructs the scheduling device to deploy the first state instance on the first working node and establish a correspondence between the identifier of the first state instance and the address of the message management device, which corresponds to the first working node. The address request includes the identifier (state ID) of the first state instance and may also include the function name of the first stateful function.

[0093] If the address request does not include the function name of the first stateful function, then any one of the multiple worker nodes can be selected as the first worker node.

[0094] If the address request includes the function name of the first stateful function, the scheduling device determines the function service group to which the function belongs, as well as the function-related information within the function service group, such as the state instance to which the function is bound, and the function names of other functions bound to the state instance, based on the function name of the first stateful function.

[0095] The scheduling device can schedule the first state instance to the first working node, and then record the correspondence between the address of the message management device corresponding to the first working node and the identifier of the first state instance. In other words, the scheduling device determines the address of the message management device corresponding to the identifier of the first state instance, and this address is used to indicate the recipient of the first message, that is, the message management device that receives the first message.

[0096] The scheduling device sends the message management device of the first state instance and the address of the message management device to the address management device. In other words, the scheduling device sends the mapping relationship between the state ID and the endpoint to the address management device.

[0097] The scheduling device can also return the address (endpoint) of the message management device to the routing device.

[0098] 103. The routing device sends the first message to the message management device indicated by the address of the message management device.

[0099] The first message includes the identifier of the first state instance and the function name of the first stateful function. The first message is used to instruct the scheduling of the first stateful function to operate on the first state instance.

[0100] 104. The message management device receives the first message and stores the first message in the first message queue corresponding to the first state instance.

[0101] The first message queue is also used to store multiple messages, each of which instructs a stateful function to operate on a first-state instance.

[0102] The first message queue is used to store multiple messages, meaning it can store multiple messages, not that it currently stores multiple messages. Because messages in the first message queue are dequeued, at any given time, the first message queue may contain one message, multiple messages, or none at all.

[0103] Messages entering the first message queue are arranged in order and are dispatched from the first message queue according to the first-in-first-out principle.

[0104] 105. Pass the second message to the second stateful function corresponding to the second message, and run the second stateful function corresponding to the second message to operate the first state instance that is in an idle state.

[0105] The second message is the message located at the very front of the first message queue. The fact that the second message is at the front of the first message queue indicates that it entered the first message queue earlier than any other messages currently contained in it.

[0106] The second message can enter the first message queue before the first message. If there are no messages in the first message queue when the first message enters it, then the second message is the same as the first message, and the second stateful function corresponding to the second message is the same as the first stateful function.

[0107] The fact that a first-state instance is in an idle state means that the first-state instance has not been operated on by any other stateful functions associated with it.

[0108] Only after the second message is passed to the second stateful function will the second stateful function operate on the first state instance.

[0109] If the second message is not the same as the first message, after passing the second message to the second stateful function corresponding to the second message, the first message at the front of the first message queue is passed to the first stateful function, and the first stateful function is run to operate the first state instance that is in an idle state.

[0110] In the above scheme, the process of obtaining the correspondence between state ID and endpoint through the address management device is as follows: Figure 4AAs shown: After scheduling state instances and state functions, the scheduling device registers the state instance's state ID and the endpoint of the message management device deployed to that state instance, storing these in the address management device. In this state ID-endpoint mapping, the corresponding value (endpoint) can be found using the key:state ID. The routing device subscribes to relevant information from the address management device, obtains the state ID-endpoint mapping, determines the endpoint (i.e., the message receiving device) using the state ID, and forwards the message to the message management device containing that state instance. For example... Figure 4A In the process, messages related to state instance 1 and state instance 2 are forwarded to message management device 1, and messages related to state instance 3 and state instance 4 are forwarded to message management device 2.

[0111] In each message management device, a message queue is maintained for each state instance, and each message queue can be identified by the state ID of the corresponding state instance. For example... Figure 4B As shown, in message management device 1, there is a message queue for state instance 1, identified by state 1, and a message queue for state instance 2, identified by state 2. State functions B and C operate on state instance 1 using a time-sharing method, according to the message order in the message queue identified by state 1. State functions E and F operate on state instance 2 using a time-sharing method, according to the message order in the message queue identified by state 2.

[0112] The solution provided in this application uses message management to control the time-sharing operation of different stateful functions on the first state instance. The second stateful function will only operate on the first state instance after being scheduled with the second message. Similarly, other stateful functions associated with the first state instance will only operate on the first state instance after being scheduled with the corresponding message. This avoids other stateful functions occupying resources and waiting while one stateful function operates on the state instance, thus avoiding resource waste and improving resource utilization.

[0113] In this embodiment, if the scheduling device receives an address request, it indicates that the first state instance has not yet been deployed to a worker node. The address request is used to instruct the scheduling device to allocate a message management device to the first state instance and to establish a correspondence between the identifier of the first state instance and the address of the allocated message management device.

[0114] The scheduling device can determine the first working node for deploying the first state instance based on the load information of the multiple working nodes it manages, the size of the first state instance, and the demand strategy of at least two stateful functions that have operational permissions to the first state instance.

[0115] The worker node load information indicates the current load status on the worker node, which may include at least one of the following: function deployment status on the worker node, CPU utilization or idle rate, and memory utilization or idle rate. The size of the first state instance represents the amount of data in the first state instance. This data amount can be determined by defining the binding relationship between the two stateful functions and the first state instance when the user publishes the aforementioned first or second stateful function, and defining the size of the first state instance. Alternatively, the size of the first state instance can be determined by collecting and evaluating existing similar state instances. The requirement strategy for at least two stateful functions with operational permissions to the first state instance may include: whether the state instance and its corresponding stateful function need to be deployed on the same worker node, requiring the CPU idle rate to reach a first threshold, or requiring the memory idle rate to reach a second threshold, etc. Both the first and second thresholds can be set according to requirements.

[0116] This process can be found in [reference]. Figure 5A and Figure 5B Use the scene diagram shown to understand the concept. Figure 5A As shown, both stateful function B and stateful function C can operate on state instance 1. Figure 5B As shown, the control node of the scheduling device manages four worker nodes: worker node 1, worker node 2, worker node 3, and worker node 4. State function B and state function C are both deployed on worker node 1, while state function D is deployed on worker node 2. Worker node 3 has a CPU utilization rate of only 30%, with 70% idle. Worker node 4 has a memory idle rate of 80%.

[0117] If the remaining memory on worker node 1 is sufficient to store state instance 1, it is preferable to deploy state instance 1 on worker node 1. In this way, stateful function B and stateful function C and state instance 1 are all located on the same worker node, eliminating the need to operate on state instance 1 across worker nodes and reducing communication overhead.

[0118] If the remaining memory on worker node 1 is insufficient to store state instance 1, then one of the worker nodes (worker node 2, worker node 3, and worker node 4) needs to be selected to deploy state instance 1. If the demand policy indicates a high CPU requirement, then worker node 3 can be selected to deploy state instance 1; if the demand policy indicates a high memory requirement, then worker node 4 can be selected to deploy state instance 1.

[0119] In addition, this application embodiment also provides another working node selection scheme, in which each working node can be scored first, and the working node with the highest score can be selected to deploy state instance 1.

[0120] The process of scoring each working node can be calculated using the following formula:

[0121]

[0122] In the above relationship, f(x) represents the total score of a working node after evaluation by various evaluation algorithms, n represents the number of evaluation algorithms, α represents the weight of the current evaluation algorithm, and t(x) represents the current evaluation algorithm.

[0123] Evaluation algorithms can be resource-related (e.g., CPU-related algorithms, memory-related algorithms) or affinity-related algorithms (e.g., algorithms that determine whether state functions and state instances reside on the same worker node).

[0124] The total score of each working node is determined using the above relationship, and then the working node with the largest total score is selected from the m working nodes using the following relationship.

[0125]

[0126] In the above relation, `node` represents the selected node, such as the first working node mentioned above. f(C m ) represents the total score of each of the m worker nodes, and max represents the worker node with the largest score selected from the m worker nodes to be used to deploy the first state instance.

[0127] The selection process of the first working node by calculating the total score can also be described as follows: the first working node is the working node with the highest total score among multiple working nodes. The total score of a working node is related to the working node's computing resources, storage resources, or whether at least two state functions have been deployed.

[0128] If, after deploying the first state instance, according to the above-mentioned first working node selection process, the first state instance and the first stateful function are not on the same working node, the migration cost of the first stateful function and the migration cost of the first state instance can be determined. If the migration cost of the first stateful function is less than the cost of migrating the first state instance, then the first stateful function will be migrated from the working node where the first state function is currently located to the first working node.

[0129] If the second stateful function and the first state instance are not on the same working node, the migration cost of the second stateful function and the migration cost of the first state instance can also be determined. If the migration cost of the second stateful function is less than the cost of migrating the first state instance, then the second stateful function is migrated from the working node where the second stateful function is currently located to the first working node.

[0130] Migration cost refers to the resource consumption caused by the migration of stateful functions or stateful instances, such as: transmission resource consumption, loading load (e.g., loading time) caused by the migration of stateful instances, and deployment load (e.g., loading time) caused by the migration of stateful functions. In addition, the resource status of each worker node in the cluster can also be considered when migrating stateful instances or stateful functions.

[0131] The factors that need to be considered in the above migration can be expressed by the following formula: y = f(x1, x2, x3).

[0132] Here, x1 represents the data loading load (data_migration_overhead) of the state instance, such as the loading time.

[0133] x2 represents the function deployment overhead (functions_deploy_overhead) for stateful functions, such as loading time.

[0134] x3 represents the resource status of the previous cluster.

[0135] This application's embodiments determine whether to ship data or a shipping function by using the migration cost of a state function and the migration cost of the corresponding state instance. This allows for better system performance with less migration overhead.

[0136] y = f(data_migration_overhead (data loading load, such as loading time), functions_deploy_overhead (function deployment load, such as loading time), resource (current cluster resource status).

[0137] The above describes the management process of the first message queue. If the message management device also maintains message queues for other state instances, the message management device is also used to: relative to the first message queue, pass the third message located at the front of the second message queue to the third stateful function in parallel, and run the third stateful function to operate the second state instance in the idle state. The second message queue corresponds to the second state instance.

[0138] In one possible embodiment, a message management device can manage multiple message queues, each message queue corresponding to a state instance. For message queues of different state instances, messages in different queues can be scheduled in parallel, which can improve the operational efficiency of different stateful functions on different state instances.

[0139] Optionally, the message management device is further configured to: after all messages in the first message queue and the second message queue have been scheduled, pass the fourth message located at the front of the third message queue to the fourth stateful function in parallel, and run the fourth stateful function to operate the first state instance and the second state instance that are in an idle state. The third message queue corresponds to the first state instance and the second state instance, and the scheduling order of the fourth stateful function is after the first stateful function, the second stateful function and the third stateful function.

[0140] In this possible embodiment, the fourth stateful function has operational authority over the combined instance of the first and second state instances. Furthermore, the fourth stateful function operates on the first, second, and third stateful functions in the order of operations on the first and second state instances. Therefore, the combined instance is only scheduled to operate on messages in the third message queue after messages in the first and second message queues have been scheduled. This possible implementation provides a multi-level management approach for stateful functions.

[0141] This process can be found in [reference]. Figure 5C To understand. For example Figure 5CAs shown, state functions B and C can operate on state instance 1, state functions E and F can operate on state instance 2, and state function G can operate on a combined instance of state instance 1 and state instance 2. In terms of operation order, state function G follows the other four functions. The message queue for state instance 1 is identified by state 1, and the message queue for state instance 2 is identified by state 2. The message queue for the combined instance of state instance 1 and state instance 2 is identified by state 12. When scheduling messages, the message management device can use a parallel scheduling method for the message queues of state 1 and state 2. The scheduling rules for messages in each message queue of state 1 and state 2 can be understood by referring to the scheduling process of the first message queue in the above embodiment. Message G in the message queue of state 12 will only be scheduled after all messages in the message queues of state 1 and state 2 have been scheduled.

[0142] The serverless system and message management method provided in this application embodiment can be applied to various application scenarios. The following will further introduce the solution of this application by combining the above-mentioned serverless system and message management method in the video scenario.

[0143] like Figure 6 As shown, in this video scenario, the total video is stored in an object storage service (OBS). This total video can be a live stream, a movie, an episode of a TV series, or a dataset of other programs. When a client requests a total video, because the format of the video stored in OBS cannot be directly used by the client, the total video needs to be processed according to the client's display format (e.g., high-speed, high-definition, ultra-high-definition). The video processing involves splitting the total video stream, then converting each slice, and finally merging all the slices.

[0144] The above slicing process requires the execution of a split function, the transformation process requires the execution of a trans function, each slice corresponds to a trans function, and the merging process requires the execution of a merge function.

[0145] In this scenario, each video slice and its corresponding transcoded video slice can be understood as a state instance. A transformation function corresponds to a state instance, but the slicing function, the compositing function, and the transformation function can all operate on that state instance. For example... Figure 6 In this architecture, each video slice of the total video is deployed on a worker node, residing on the same worker node as the slicing function, transformation function, and compositing function. A transformation process is performed once for each video switch, resulting in a transcoded video slice. For example, the total video can be divided into video slice 1, video slice 2, ..., video slice x. Each transformation function operates on the corresponding video slice once, resulting in x transcoded video slices. The compositing function can then combine these x transcoded video slices and store the transcoded and combined video in OBS, where x is an integer greater than 2.

[0146] Each video slice mentioned above is a state instance. The video content in this state instance can be manipulated, such as being transcoded by a conversion function to obtain a transcoded video slice. However, the identifier of this state instance remains unchanged. Before and after conversion, it can be identified by state 01, state 02, ..., state x.

[0147] The process of message management in the above video scenarios can be found in [reference needed]. Figure 7 To understand. For example Figure 7 As shown, the message management method for this video scene may include the following processes:

[0148] 201. The client sends a call request to the routing device.

[0149] The call request includes the function name (func_split) and the identifier of the state instance (state 01).

[0150] 202. The routing device determines whether the routing relationship for the call request exists.

[0151] If it exists, skip steps 203 to 206 and proceed directly to step 207; otherwise, proceed to step 203.

[0152] 203. The routing device sends an address request to the scheduling device.

[0153] The address request includes func_split and state 01.

[0154] 204. The scheduling device deploys the state instance and determines the address of the message management device corresponding to the state instance.

[0155] This process can be understood by referring to the third approach in step 102 of the aforementioned embodiments: obtaining the endpoint corresponding to the stateID from the scheduling device. Additionally, the process of deploying state instances and whether to migrate the split state function after deploying state instances can also be referred to in the aforementioned embodiments. Figure 5A and Figure 5B To understand this, refer to the corresponding examples.

[0156] 205. The scheduling device sends the correspondence between state 01 and endpoint 1 to the address management device. Correspondingly, the address management device stores the correspondence between state 01 and endpoint 1.

[0157] 206. The scheduling device sends the mapping between state 01 and endpoint 1 to the routing device.

[0158] 207. The routing device sends the first message to the corresponding message management device based on endpoint 1.

[0159] The first message includes func_split and state 01.

[0160] 208. Use queue management to put the first message into the message queue corresponding to state 01.

[0161] 209. The message management device schedules the first message from the message queue to the slice function.

[0162] If there is no slice function locally (that is, on the working node where the message management device is located), a slice function can be created locally.

[0163] It should be noted that the embodiments of this application do not require the split function to be local. If there is no split function locally, the message management device can notify the scheduling device to randomly create a split function, or an existing split function can be used to implement the process of this application.

[0164] For details regarding message queue management in steps 208 and 209, please refer to the aforementioned document. Figure 3 Steps 104 and 105 corresponding to the embodiments, and Figure 4A and Figure 4B The relevant descriptions will be understood and will not be repeated here.

[0165] 210. Run the slicing function to slice the total video.

[0166] 211. After the slicing function completes the slicing, it initiates a call request to the conversion function instance 1.

[0167] The call request for the transformation function instance 1 includes func_trans and state 01.

[0168] Next, steps 202 to 210 above can be performed based on func_trans and state 01, except that the conversion function instance has changed.

[0169] Since each transition function instance corresponds to a state instance, the correspondence between the above transition function instances and state instances can be understood by referring to Table 1.

[0170] Table 1: Identifiers of Transition Function Instances and State Instances

[0171] Conversion function examples Identifier of state instance func_trans 1 state 01 func_trans 2 state 02 … … func_trans x state x

[0172] Since transition function instance 1 corresponds to state 01, only the function instance changes in step 211. After transition function instance 1 completes the corresponding transition operation, transition function instance 2 is called, using the identifier state02 of the state instance, and the process from steps 202 to 210 is repeated. This continues until transition function instance x completes its operation on state instance x. Then step 212 is executed.

[0173] 212. Run the transformation function instance x to initiate a call request to the synthesis function.

[0174] The request to merge functions includes func_merge and state 01-state x.

[0175] Then, based on func_merge and state 01-state x, the above processes 202 to 210 are executed to complete the synthesis of transcoded video slices from state instance to state instance x.

[0176] In the video scenario described in this application, a message management approach is used to control the time-sharing operations of different stateful functions on the first state instance. The first stateful function only prepares to operate on the resources of the first state instance after receiving the first scheduled message, thus avoiding resource waste and improving resource utilization by preventing other stateful functions from occupying resources while one function operates on the state instance. Furthermore, the migration function or the migration state instance can be determined based on the migration cost of the function and the migration cost of the state instance, achieving good system performance with minimal migration overhead.

[0177] This application also provides a comparison chart of the computational performance of machine learning using the solution of this application and the industry-standard PyWren model.

[0178] like Figure 8AAs shown in the comparison chart, this is the test cost (in US dollars) of this application and the industry's PyWren model. Figure 8A As can be seen, the resource cost of this application to complete 1000 tests is 329, while the resource cost of the industry PyWren model to complete 1000 tests is 2105. It can be seen that the resource cost of this application in 1000 tests is 6 times lower than that of the industry PyWren model.

[0179] like Figure 8B As shown, this comparison chart shows the single-task completion time (in seconds) of this application and the industry-standard PyWren model. Figure 8B As can be seen, the completion time of a single task in this application is 140s, while the completion time of a single task in the industry PyWren model is 6190s. This application completes a single task 44 times faster than the industry PyWren model.

[0180] The above describes the methods for implementing server systems and message management. The following describes the message management device and scheduling device provided in the embodiments of this application with reference to the accompanying drawings. Both the message management device and the scheduling device can be a computer device or a virtual machine.

[0181] like Figure 9 As shown, one embodiment of the message management device 30 provided in this application includes:

[0182] The receiving unit 301 is used to receive a first message, which is used to instruct the scheduling of a first stateful function to operate on a first stateful instance.

[0183] The first processing unit 302 is used to store the first message from the receiving unit 301 into a first message queue corresponding to the first state instance. The first message queue is used to store multiple messages, each message being used to indicate a stateful function operation on the first state instance.

[0184] The second processing unit 303 is used to pass the second message to the second stateful function corresponding to the second message, and run the second stateful function corresponding to the second message to operate the first state instance in the idle state, wherein the second message is the message located at the front of the first message queue.

[0185] The solution provided in this application uses message management to control the time-sharing operation of different stateful functions on the first state instance. The second stateful function will only operate on the first state instance after being scheduled with the second message. Similarly, other stateful functions associated with the first state instance will only operate on the first state instance after being scheduled with the corresponding message. This avoids other stateful functions occupying resources and waiting while one stateful function operates on the state instance, thus avoiding resource waste and improving resource utilization.

[0186] Optionally, the second processing unit 303 is further configured to, relative to the first message queue, pass the third message located at the front of the second message queue to the third stateful function in parallel, and run the third stateful function to operate the second state instance in the idle state, wherein the second message queue corresponds to the second state instance.

[0187] Optionally, the second processing unit 303 is further configured to, after all messages in the first message queue and the second message queue have been scheduled, pass the fourth message located at the front of the third message queue to the fourth stateful function in parallel, and run the fourth stateful function to operate the first state instance and the second state instance that are in an idle state. The third message queue corresponds to the first state instance and the second state instance, and the scheduling order of the fourth stateful function is after the first stateful function, the second stateful function and the third stateful function.

[0188] like Figure 10 As shown, the scheduling device 40 provided in this application embodiment is applied to a serverized system. The serverless system also includes a message management device, a routing device, and multiple worker nodes. One embodiment of the scheduling device 40 includes:

[0189] The receiving unit 401 is used to receive an address request sent by the routing device, the address request including the identifier of the first state instance.

[0190] The first processing unit 402 is configured to deploy the first state instance on the first working node among multiple working nodes according to the identifier of the first state instance received by the receiving unit 401.

[0191] The second processing unit 403 is used to establish a correspondence between the identifier of the first state instance and the address of the message management device after the first processing unit 402 deploys the first state instance, and the message management device corresponds to the first working node.

[0192] The solution provided in this application embodiment combines the load information of multiple working nodes, the size of the first state instance, and at least two demand strategies with state functions when deploying the first state instance, which can improve the performance of the server system.

[0193] Optionally, the first processing unit 402 is further configured to migrate the first stateful function deployed on the second working node to the first working node, wherein the migration cost of the first stateful function is less than the migration cost of the first state instance.

[0194] Optionally, the address request may also include the function name of the first stateful function. The first worker node is determined based on the load information of multiple worker nodes, the size of the first state instance, and the demand strategy of at least two stateful functions. The at least two stateful functions are located in the function business group associated with the function name of the first stateful function.

[0195] Optionally, the address request may also include the function name of the first stateful function, the first worker node being the worker node with the highest total score among multiple worker nodes, the total score of a worker node being related to the worker node's computing resources, storage resources, or whether at least two stateful functions have been deployed, and the at least two stateful functions being located in a function service group associated with the function name of the first stateful function.

[0196] Optionally, the serverless system further includes an address management device and a sending unit 404, which is used to send the correspondence between the identifier of the first state instance and the address of the message management device corresponding to the first working node to the address management device.

[0197] The message management device 30 and scheduling device 40 described above can be understood by referring to the corresponding descriptions in the foregoing method embodiment section, and will not be repeated here.

[0198] Figure 11 The diagram shown illustrates a possible logical structure of a computer device 50 provided in an embodiment of this application. The computer device may be the aforementioned message management device 30 or scheduling device 40. The computer device 50 includes a processor 501, a communication interface 502, a memory 503, and a bus 504. The processor 501, communication interface 502, and memory 503 are interconnected via the bus 504. In the embodiments of this application, the processor 501 is used to control and manage the actions of the computer device 50; for example, the processor 501 is used to execute... Figure 3 Steps 101 to 105 in the method embodiments, and Figure 7 In steps 201 to 212 of the method embodiment, the communication interface 502 is used to support communication by the computer device 50. The memory 503 is used to store program code and data of the computer device 50. If the memory 503 stores program code and data for functions executed by the message management device 30, then the communication interface 502 in the computer device 50 will perform the function of receiving the first message by the receiving unit 301, and the processor 501 will perform the functions of the first processor 302 and the second processor 303. If the memory 503 stores program code and data for functions executed by the scheduling device 40, then the communication interface 502 in the computer device 50 will perform the function of the receiving unit 401, and the processor 501 will perform the functions of the first processing unit 402 and the second processing unit 403.

[0199] The processor 501 can be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor 501 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, etc. The bus 504 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 11 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0200] like Figure 12 The diagram illustrates a possible logical structure of a computer device 60 provided in this application embodiment. The computer device 60 includes a hardware layer 601 and a VM layer 602, the VM layer including one or more VMs. The hardware layer 601 provides hardware resources for the VMs, supporting their operation, and includes hardware resources such as a processor, communication interface, and memory. When a VM performs the function of the message management device 30, the communication interface of the hardware layer performs the function of receiving the first message by the receiving unit 301, and the processor performs the functions of the first processor 302 and the second processor 303. When a VM performs the function of the scheduling device 40, the communication interface of the computer device 50 performs the function of receiving the first message by the receiving unit 401, and the processor performs the functions of the first processing unit 402 and the second processing unit 403. The specific process of different VMs performing the functions of different devices can be found in the above description. Figures 3 to 7 Understand the corresponding descriptions in the text.

[0201] In another embodiment of this application, a computer-readable storage medium is also provided, which stores computer-executable instructions. When the processor of the device executes the computer-executable instructions, the device performs the aforementioned... Figures 3 to 7 The message management method executed by the message management device.

[0202] In another embodiment of this application, a computer-readable storage medium is also provided, which stores computer-executable instructions. When the processor of the device executes the computer-executable instructions, the device performs the aforementioned... Figures 3 to 7The message management method executed by the scheduling device.

[0203] In another embodiment of this application, a computer program product is also provided, which includes computer-executable instructions stored in a computer-readable storage medium; when the processor of the device executes the computer-executable instructions, the device performs the above-described... Figures 3 to 7 The message management method executed by the message management device.

[0204] In another embodiment of this application, a computer program product is also provided, which includes computer-executable instructions stored in a computer-readable storage medium; when the processor of the device executes the computer-executable instructions, the device performs the above-described... Figures 3 to 7 The message management method executed by the scheduling device.

[0205] In another embodiment of this application, a chip system is also provided, the chip system including a processor, the processor being used to support the means of inter-process communication to implement the above. Figures 3 to 7 The message management method executed by the message management device. In one possible design, the chip system may also include a memory for storing the program instructions and data necessary for the message management device. The chip system may consist of chips or may include chips and other discrete components.

[0206] In another embodiment of this application, a chip system is also provided, the chip system including a processor, the processor being used to support the means of inter-process communication to implement the above. Figures 3 to 7 The message management method performed by the scheduling device. In one possible design, the chip system may also include a memory for storing the program instructions and data necessary for the scheduling device. This chip system may consist of chips or may include chips and other discrete components.

[0207] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application.

[0208] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0209] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0210] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0211] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0212] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of this application, essentially, or the parts that contribute to the prior art, or parts of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0213] The above are merely specific embodiments of this application, but the protection scope of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the embodiments of this application should be included within the protection scope of this application. Therefore, the protection scope of this application should be determined by the scope of the claims.

Claims

1. A serverless system, characterized in that, include: Message management device; The message management device is used for: Receive a first message, which is used to instruct the scheduling of a first stateful function to operate on a first stateful instance; The first message is stored in the first message queue corresponding to the first state instance. The first message queue is used to store multiple messages, and each message is used to instruct a stateful function to operate on the first state instance. The second message is passed to the second stateful function corresponding to the second message, and the second stateful function corresponding to the second message is run to operate the first state instance that is in an idle state, wherein the second message is the message located at the front of the first message queue; The serverless system also includes a routing device, a scheduling device, and multiple worker nodes. The scheduling device is used for: Receive an address request sent by the routing device, the address request including the identifier of the first state instance; Based on the identifier of the first state instance, deploy the first state instance on the first working node among the plurality of working nodes; Establish a correspondence between the identifier of the first state instance and the address of the message management device, wherein the message management device corresponds to the first working node.

2. The serverless system according to claim 1, characterized in that, The scheduling device is also used for: The first stateful function deployed on the second working node is migrated to the first working node, and the migration cost of the first stateful function is less than the migration cost of the first state instance.

3. The serverless system according to claim 1 or 2, characterized in that, The address request also includes the function name of the first stateful function; The first working node is determined based on the load information of the plurality of working nodes, the size of the first state instance, and the demand strategy of at least two stateful functions, wherein the at least two stateful functions are located in a function business group associated with the function name of the first stateful function; or, The first working node is the working node with the highest total score among the plurality of working nodes. The total score of a working node is related to the computing resources, storage resources, or whether at least two state functions have been deployed on the working node. The at least two state functions are located in a function service group associated with the function name of the first state function.

4. The serverless system according to any one of claims 1-2, characterized in that, The message management device is also used for: In parallel, the third message located at the front of the second message queue is passed to the third stateful function, and the third stateful function is run to operate the second state instance which is in an idle state. The second message queue corresponds to the second state instance.

5. The serverless system according to claim 4, characterized in that, The message management device is also used for: After all messages in the first message queue and the second message queue have been scheduled, the fourth message, which is located at the front of the third message queue, is passed to the fourth stateful function in parallel. The fourth stateful function then operates on the first and second state instances that are in an idle state. The third message queue corresponds to the first and second state instances. The scheduling order of the fourth stateful function is after the first, second, and third stateful functions.

6. The serverless system according to claim 1 or 2, characterized in that, The serverless system also includes an address management device; The scheduling device is also used for: Send the correspondence between the identifier of the first state instance and the address of the message management device to the address management device; The address management device stores the correspondence.

7. The serverless system according to claim 6, characterized in that, The routing device is also used for: Receive a client's call request for the first stateful function, the call request including the identifier of the first state instance and the function name of the first stateful function; Obtain the address of the message management device corresponding to the identifier of the first state instance; The first message is sent to the message management device indicated by the address of the message management device.

8. The serverless system according to claim 7, characterized in that, The routing device is used for: Obtain the address of the message management device corresponding to the identifier of the first state instance from the scheduling device; or, The address of the message management device corresponding to the identifier of the first state instance is obtained from the address management device.

9. The serverless system according to claim 1 or 2, characterized in that, The message management device is located on one of the multiple working nodes, and the scheduling device is located on the control node of the serverless system.

10. A message management method, characterized in that, include: Receive an address request sent by the routing device, the address request including an identifier of the first state instance; Based on the identifier of the first state instance, deploy the first state instance on the first working node among the plurality of working nodes; Establish a correspondence between the identifier of the first state instance and the address of the message management device, wherein the message management device corresponds to the first working node; Receive a first message, which is used to instruct the scheduling of a first stateful function to operate on a first stateful instance; The first message is stored in the first message queue corresponding to the first state instance. The first message queue is used to store multiple messages, and each message is used to instruct a stateful function to operate on the first state instance. The second message is passed to the second stateful function corresponding to the second message, and the second stateful function corresponding to the second message is run to operate the first state instance which is in an idle state, wherein the second message is the message located at the front of the first message queue.

11. The method according to claim 10, characterized in that, The method further includes: In parallel, the third message located at the front of the second message queue is passed to the third stateful function, and the third stateful function is run to operate the second state instance which is in an idle state. The second message queue corresponds to the second state instance.

12. The method according to claim 11, characterized in that, The method further includes: After all messages in the first message queue and the second message queue have been scheduled, the fourth message, which is located at the front of the third message queue, is passed to the fourth stateful function in parallel. The fourth stateful function then operates on the first and second state instances that are in an idle state. The third message queue corresponds to the first and second state instances. The scheduling order of the fourth stateful function is after the first, second, and third stateful functions.

13. A message management method, characterized in that, The method is applied to a serverless system, which includes a message management device, a routing device, a scheduling device, and multiple worker nodes. The method includes: Receive an address request sent by the routing device, the address request including an identifier of the first state instance; Based on the identifier of the first state instance, deploy the first state instance on the first working node among the plurality of working nodes; Establish a correspondence between the identifier of the first state instance and the address of the message management device, wherein the message management device corresponds to the first working node; Receive a first message, which is used to instruct the scheduling of a first stateful function to operate on a first stateful instance; The first message is stored in the first message queue corresponding to the first state instance. The first message queue is used to store multiple messages, and each message is used to instruct a stateful function to operate on the first state instance. The second message is passed to the second stateful function corresponding to the second message, and the second stateful function corresponding to the second message is run to operate the first state instance that is in an idle state, wherein the second message is the message located at the front of the first message queue; The method further includes: The first stateful function deployed on the second working node is migrated to the first working node, and the migration cost of the first stateful function is less than the migration cost of the first state instance.

14. The method according to claim 13, characterized in that, The address request also includes the function name of the first stateful function; The first working node is determined based on the load information of the plurality of working nodes, the size of the first state instance, and the demand strategy of at least two stateful functions, wherein the at least two stateful functions are located in a function business group associated with the function name of the first stateful function; or, The first working node is the working node with the highest total score among the plurality of working nodes. The total score of a working node is related to the computing resources, storage resources, or whether at least two state functions have been deployed on the working node. The at least two state functions are located in a function service group associated with the function name of the first state function.

15. The method according to any one of claims 13-14, characterized in that, The serverless system further includes an address management device, and the method further includes: Send the correspondence between the identifier of the first state instance and the address of the message management device to the address management device.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 10-12.

17. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 13-15.

18. A computing device, characterized in that, Includes a processor and a computer-readable storage medium storing a computer program; The processor is coupled to the computer-readable storage medium, and the computer program, when executed by the processor, implements the method as described in any one of claims 10-12.

19. A computing device, characterized in that, Includes a processor and a computer-readable storage medium storing a computer program; The processor is coupled to the computer-readable storage medium, and the computer program, when executed by the processor, implements the method as described in any one of claims 13-15.

20. A chip system, characterized in that, Includes a processor, which is invoked to perform the method as described in any one of claims 10-12.

21. A chip system, characterized in that, Includes a processor, which is invoked to perform the method as described in any one of claims 13-15.

Citation Information

Patent Citations

  • US10361985B1

  • US20190377604A1

Cited By

  • WO2022033037A1