Graph scheduling method and apparatus, electronic device, and computer program product

By dividing the business into processing stages and constructing a DAG, the problem of poor code readability in complex business logic of existing DAG scheduling methods is solved, and more efficient graph scheduling and business processing are achieved.

CN116974750BActive Publication Date: 2026-08-25TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310547768.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-15
Publication Date
2026-08-25
Estimated Expiration
2043-05-15

AI Technical Summary

Technical Problem

Existing DAG scheduling methods suffer from poor code readability and low scheduling convenience when dealing with complex business logic, requiring users to perform cumbersome code organization and data management.

Method used

The target business is divided into multiple business processing stages. The execution order and dependencies between logical processes of each business processing stage are obtained. A directed acyclic graph (DAG) is constructed, and nodes and operators at each layer are scheduled according to the execution order and dependencies.

Benefits of technology

It improves the readability and scheduling convenience of DAG, simplifies the graph scheduling process, and enhances the efficiency and readability of business processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116974750B_ABST
    Figure CN116974750B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a kind of graph scheduling method, device, electronic equipment and computer program product, the method includes: the each service processing stage of target service is as layer node, and each layer node is connected based on the execution order of each service processing stage direction, each logic process in each service processing stage is as the operator in the corresponding layer node, and each operator in the corresponding layer node is connected based on the dependency relationship of each logic process in service processing stage direction, obtain the directed acyclic graph DAG corresponding to target service;When receiving the service request for target service, each layer node in DAG is scheduled according to the execution order of each processing stage, and each operator in layer node is scheduled according to the dependency relationship between each logic process in each layer node, until all operators in DAG are scheduled.The scheme in this paper, since the expression ability of layer node and operator is stronger, the readability of the obtained DAG is higher, and then the convenience of graph scheduling is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a graph scheduling method, apparatus, electronic device, and computer program product. Background Technology

[0002] DAG (Directed Acyclic Graph) is often used to represent complex dependencies between multiple task components (subtasks) in real-time applications and to formally describe fine-grained parallel task scheduling problems, i.e., the DAG scheduling problem.

[0003] Existing DAG scheduling methods mainly focus on the study of orchestration and computation logic. Taking Taskflow as an example, its entire design is based on Functions for task organization and scheduling. Users need to perform tedious code organization and data management design when using it, and data transmission also needs to be continuously passed through using function parameter passing.

[0004] However, when faced with complex business logic, the function-based approach to task organization and scheduling has poor expressive power and poor code readability, which reduces the convenience of graph scheduling. Summary of the Invention

[0005] The purpose of this application is to at least solve one of the aforementioned technical deficiencies. The technical solution provided by the embodiments of this application is as follows:

[0006] In a first aspect, embodiments of this application provide a graph scheduling method, comprising:

[0007] The target business is divided into multiple business processing stages. The execution order of each business processing stage is obtained, and at least one logical process contained in each business processing stage and the dependencies between each logical process are obtained. The execution order of each business processing stage indicates the serial relationship between each business processing stage, and the dependencies between each logical process indicate the connection relationship between each logical process in the business processing stage and the execution order of the connected logical processes.

[0008] Each business processing stage is treated as a layer node, and each layer node is connected in a directed manner based on the execution order of each business processing stage. Each logical process in each business processing stage is treated as an operator in the corresponding layer node, and each operator in the corresponding layer node is connected in a directed manner based on the dependency relationship of each logical process in the business processing stage, thus obtaining the directed acyclic graph (DAG) corresponding to the target business.

[0009] When a business request for a target business is received, the nodes in each layer of the DAG are scheduled according to the execution order of each processing stage, and the operators in each layer node are scheduled according to the dependencies between the logical processes in each layer node, until all operators in the DAG have been scheduled.

[0010] In one optional embodiment of this application, scheduling operators in each layer node according to the dependencies between logical processes in each layer node includes:

[0011] Based on dependencies, determine the executable operators in the current time layer node;

[0012] Based on the runtime context of the target business, the executable operators in the current time layer node are scheduled. The runtime context contains information about the data objects in the target business.

[0013] In one optional embodiment of this application, determining the executable operators in the current time-stack layer node based on dependencies includes:

[0014] Based on dependencies, the preceding operators corresponding to each operator in the layer nodes are determined. The preceding operator of each operator is the operator connected to the operator and executed before the operator. Operators whose preceding operators have been scheduled at the current time are determined as executable operators.

[0015] In one optional embodiment of this application, scheduling the executable operators in the current time-space node based on the runtime context of the target service includes:

[0016] From the runtime context data, obtain information about the target data objects to be processed by each executable operator in sequence;

[0017] Based on the information of the target data object of each executable operator, the update information of the target data object of the executable operator is obtained in parallel.

[0018] The update information of the target data objects of each executable node is sequentially merged into the runtime context.

[0019] In one optional embodiment of this application, the operator includes a first type of operator and a second type of operator. The first type of operator is used to process multiple data objects in the target service, and the second type of operator is used to process one data object in the target service.

[0020] Based on the information of the target data object of each executable operator, obtain the update information of the target data object of the executable operator, including:

[0021] If the executable operator is a first type operator, then the multiple target data objects of the executable operator are divided into multiple parts, and the corresponding target data objects are processed in parallel based on the information of each part of the target data objects to obtain the update information of the target data objects of the executable operator.

[0022] If the executable operator is a second type operator, then the target data object is processed based on the information of the target data object of the executable operator to obtain the updated information of the target data object of the executable operator.

[0023] In one optional embodiment of this application, the corresponding target data objects are processed in parallel based on the information of each target data object, including:

[0024] If the logic process corresponding to the executable operator is local logic, then the first number of threads are used to process the corresponding target data objects in parallel based on the information of each target data object;

[0025] If the logical process corresponding to the executable operator is remote logic, then the second number of coroutines are used to process the corresponding target data objects in parallel based on the information of each target data object;

[0026] The first quantity is not less than the second quantity.

[0027] In one optional embodiment of this application, the operators in the corresponding layer nodes are directed based on the dependencies of each logical process in the business processing stage, including:

[0028] If at least two logical processes in the business processing stage have the same associated logical process, then the corresponding sub-level operator is obtained based on the associated logical process, and the sub-level operator is used as the pre-operator of the operator corresponding to at least two logical processes, and is respectively connected to the operator corresponding to at least two logical processes in a directed manner.

[0029] In this context, the associated logical process is adjacent to at least two logical processes and precedes at least two logical processes in terms of execution order.

[0030] In one optional embodiment of this application, the method further includes:

[0031] If any operator carries cross-layer scheduling information, then after any operator is scheduled, one or more operators of other layer nodes indicated by the cross-layer scheduling information are scheduled.

[0032] In one optional embodiment of this application, the method further includes:

[0033] When a business request for a target business is received, the resource object corresponding to the target business is obtained. The resource object is the external resource required by the data object in the target business when it is processed by a thread or coroutine.

[0034] Based on resource objects, a corresponding copy of the resource object is created for each local thread and each coroutine. When a new thread or coroutine is added locally, a corresponding copy of the resource object is created for the new thread or coroutine.

[0035] Secondly, embodiments of this application provide a graph scheduling device, including:

[0036] The business analysis module is used to divide the target business into multiple business processing stages, obtain the execution order of each business processing stage, and obtain at least one logical process contained in each business processing stage and the dependencies between each logical process. The execution order of each business processing stage indicates the serial relationship between each business processing stage, and the dependencies between each logical process indicate the connection relationship between each logical process in the business processing stage and the execution order of the connected logical processes.

[0037] The DAG acquisition module is used to take each business processing stage as a layer node, and connect each layer node in a directed manner based on the execution order of each business processing stage. It takes each logical process in each business processing stage as an operator in the corresponding layer node, and connects each operator in the corresponding layer node in a directed manner based on the dependency relationship of each logical process in the business processing stage, so as to obtain the directed acyclic graph (DAG) corresponding to the target business.

[0038] The graph scheduling module is used to schedule the nodes of each layer in the DAG according to the execution order of each processing stage when a business request for the target business is received, and to schedule the operators in the layer nodes according to the dependencies between the logical processes in each layer node, until all operators in the DAG have been scheduled.

[0039] In one optional embodiment of this application, the graph scheduling module is specifically used for:

[0040] Based on dependencies, determine the executable operators in the current time layer node;

[0041] Based on the runtime context of the target business, the executable operators in the current time layer node are scheduled. The runtime context contains information about the data objects in the target business.

[0042] In an optional embodiment of this application, the graph scheduling module is further configured to:

[0043] Based on dependencies, the preceding operators corresponding to each operator in the layer nodes are determined. The preceding operator of each operator is the operator connected to the operator and executed before the operator. Operators whose preceding operators have been scheduled at the current time are determined as executable operators.

[0044] In an optional embodiment of this application, the graph scheduling module is further configured to:

[0045] From the runtime context data, obtain information about the target data objects to be processed by each executable operator in sequence;

[0046] Based on the information of the target data object of each executable operator, the update information of the target data object of the executable operator is obtained in parallel.

[0047] The update information of the target data objects of each executable node is sequentially merged into the runtime context.

[0048] In one optional embodiment of this application, the operator includes a first type of operator and a second type of operator. The first type of operator is used to process multiple data objects in the target service, and the second type of operator is used to process one data object in the target service.

[0049] The graph scheduling module is further used for:

[0050] If the executable operator is a first type operator, then the multiple target data objects of the executable operator are divided into multiple parts, and the corresponding target data objects are processed in parallel based on the information of each part of the target data objects to obtain the update information of the target data objects of the executable operator.

[0051] If the executable operator is a second type operator, then the target data object is processed based on the information of the target data object of the executable operator to obtain the updated information of the target data object of the executable operator.

[0052] In an optional embodiment of this application, the graph scheduling module is further configured to:

[0053] If the logic process corresponding to the executable operator is local logic, then the first number of threads are used to process the corresponding target data objects in parallel based on the information of each target data object;

[0054] If the logical process corresponding to the executable operator is remote logic, then the second number of coroutines are used to process the corresponding target data objects in parallel based on the information of each target data object;

[0055] The first quantity is not less than the second quantity.

[0056] In one optional embodiment of this application, the DAG acquisition module is specifically used for:

[0057] If at least two logical processes in the business processing stage have the same associated logical process, then the corresponding sub-level operator is obtained based on the associated logical process, and the sub-level operator is used as the pre-operator of the operator corresponding to at least two logical processes, and is respectively connected to the operator corresponding to at least two logical processes in a directed manner.

[0058] In this context, the associated logical process is adjacent to at least two logical processes and precedes at least two logical processes in terms of execution order.

[0059] In one optional embodiment of this application, the device may further include a cross-layer scheduling module for:

[0060] If any operator carries cross-layer scheduling information, then after any operator is scheduled, one or more operators of other layer nodes indicated by the cross-layer scheduling information are scheduled.

[0061] In one optional embodiment of this application, the device may further include a resource object acquisition module, used for:

[0062] When a business request for a target business is received, the resource object corresponding to the target business is obtained. The resource object is the external resource required by the data object in the target business when it is processed by a thread or coroutine.

[0063] Based on resource objects, a corresponding copy of the resource object is created for each local thread and each coroutine. When a new thread or coroutine is added locally, a corresponding copy of the resource object is created for the new thread or coroutine.

[0064] Thirdly, embodiments of this application provide an electronic device, including a memory and a processor;

[0065] The memory contains computer programs;

[0066] A processor for executing computer programs to implement the methods provided in the first aspect embodiment or any alternative embodiment of the first aspect.

[0067] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method provided in the first aspect embodiment or any optional embodiment of the first aspect.

[0068] Fifthly, embodiments of this application provide a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method provided in the first aspect embodiment or any optional embodiment of the first aspect.

[0069] The beneficial effects of the technical solutions provided in this application are:

[0070] For the target business, by decomposing its processing stages and logical processes within each stage, the various business processing stages and their logical processes are abstracted. Simultaneously, the execution order of each business processing stage and the dependencies between its logical processes are obtained. Then, each business processing stage is treated as a layer node of a Directed Acyclic Graph (DAG) and connected in the order of execution. The logical processes within each business processing stage are treated as corresponding operators and connected in the order of dependencies, thus obtaining the DAG corresponding to the target business. When a business request for the target business is received, the DAG is scheduled according to the execution order of the processing stages, and the operators within each layer node are scheduled according to the dependencies between their logical processes. This process continues until all operators in the DAG have been scheduled, completing the processing of the target business. This approach abstracts the business processing stages of the target business as layer nodes and the logical processes within each stage as operators during DAG construction. Because layer nodes and operators have stronger expressive power, the resulting DAG is more readable, thereby improving the convenience of graph scheduling. Attached Figure Description

[0071] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.

[0072] Figure 1 A flowchart illustrating a graph scheduling method provided in an embodiment of this application;

[0073] Figure 2 This is a schematic diagram illustrating the process of constructing a DAG corresponding to a target service in one example of an embodiment of this application;

[0074] Figure 3 This is a schematic diagram illustrating the construction of sub-layer nodes in one example of an embodiment of this application;

[0075] Figure 4 This is a schematic diagram of cross-layer scheduling in one example of an embodiment of this application;

[0076] Figure 5 This is a schematic diagram of the three stages of operator scheduling in an example of an embodiment of this application;

[0077] Figure 6 This is a schematic diagram of different types of operators in the second scheduling stage, as an example of an embodiment of this application;

[0078] Figure 7 This is a schematic diagram illustrating the creation of a resource object copy in one example of an embodiment of this application;

[0079] Figure 8 This is a schematic diagram of the graph scheduling process for the "Search" service in one example of an embodiment of this application.

[0080] Figure 9 A structural block diagram of a graph scheduling device provided in an embodiment of this application;

[0081] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0082] The embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions of the embodiments of this application.

[0083] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this application mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” can be implemented as “A,” or as “B,” or as “A and B.”

[0084] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0085] First, let's introduce and explain several terms used in this application:

[0086] DAG: A directed graph is a graph in which it is impossible to return to a vertex from any vertex by traversing several edges.

[0087] Operator: An abstraction of a series of computational logics is called an operator, which is the basic unit of scheduling.

[0088] Batch processing mode: In search scenarios, a single retrieval request typically involves multiple documents. The batch processing mode operator performs calculations based on multiple documents (hereinafter referred to as item_list).

[0089] Single-item processing mode: The operator in single-item processing mode performs calculations based on only one document (hereinafter referred to as item) at a time.

[0090] Data contention: One or more threads perform write operations on a specific data segment A, while at the same time, one or more other threads perform read and write operations on data segment A.

[0091] Coroutine: A lightweight thread that automatically saves its execution context and switches to other executable coroutines within the same coroutine when an I / O (input / output) event occurs. Its characteristic is that the CPU (Central Processing Unit) process within a single thread is serial, but it can initiate multiple I / O events simultaneously and automatically resume the execution of subsequent logic when the I / O event is ready (the coroutines mentioned in the embodiments of this application do not undergo cross-thread scheduling).

[0092] The technical solutions of this application and their effects are described below through several exemplary embodiments. It should be noted that the following embodiments can be referenced, borrowed from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.

[0093] Figure 1 This is a flowchart illustrating a graph scheduling method provided in an embodiment of this application, as shown below. Figure 1 As shown, the method may include:

[0094] Step S101: Divide the target business into multiple business processing stages, obtain the execution order of each business processing stage, and obtain at least one logical process contained in each business processing stage and the dependency relationship between each logical process; the execution order of each business processing stage indicates the serial relationship between each business processing stage, and the dependency relationship between each logical process indicates the connection relationship between each logical process in the business processing stage and the execution order of the connected logical processes.

[0095] The target service can be the service to be processed. The processing result corresponding to the target service can be obtained through the graph scheduling method of this application. For example, the target service can be the "search" service provided by a certain service provider.

[0096] Furthermore, the target service can be divided into multiple major logical processes, i.e., multiple business processing stages, according to the service provider's processing flow. For example, the target service may include several business processing stages such as preprocessing, feature calculation, and result reporting. In the embodiments of this application, the multiple business processing stages are sequential, meaning that during the processing of the target service, each business processing stage is processed in a predetermined order, which is the execution order of the business processing stages.

[0097] Similarly, each business processing stage of the target business can further include multiple smaller logical processes. For example, the preprocessing stage can further include smaller logical processes such as retrieval information preprocessing, document information preprocessing, and experimental information acquisition. These multiple logical processes can be sequential or parallel. Specifically, the dependencies between each logical process can be determined. Through these dependencies, it can be determined whether the logical processes are interconnected and the execution order between two interconnected logical processes. It should be noted that for two interconnected logical processes, during the processing of the corresponding business processing stage, the logical process that comes first is processed first, followed by the logical process that comes later. This processing order is the execution order of the two connected logical processes.

[0098] For example, a target business process includes three business processing stages: preprocessing, feature calculation, and result reporting. The execution order of these three business processing stages is: preprocessing → feature calculation → result reporting. The preprocessing business processing stage includes three logical processes: retrieval information preprocessing, document information preprocessing, and experimental information acquisition. In these three logical processes, retrieval information preprocessing and document information preprocessing are respectively connected to experimental information acquisition, and the execution order of these three logical processes is: experimental information acquisition is performed after retrieval information preprocessing and document information preprocessing are completed.

[0099] Specifically, for a target business, the business processing stages are divided according to the service provider's target business processing flow. Specifically, multiple intermediate data points in the target business processing process can be identified, and the logical process of acquiring each intermediate data point can be traced back. Each logical process is then designated as a corresponding business processing stage. Furthermore, the acquisition order of each intermediate data point is determined, and this acquisition order is used as the execution order of each business processing stage. In other words, if intermediate data corresponding to one business processing stage serves as input data for another business processing stage, then that business processing stage and the other business processing stage are adjacent in execution order, and the first business processing stage precedes the second.

[0100] Then, for each business processing stage, the logical processes contained therein are obtained according to the processing flow of the business processing stage, and the dependencies between the logical processes are also obtained. Specifically, the complete logical process of the business processing stage can be abstracted, and then the complete logical process can be broken down into multiple smaller logical processes, and the dependencies between the logical processes can be obtained, thereby obtaining the logical processes in the business processing stage.

[0101] Step S102: Each business processing stage is taken as a layer node, and each layer node is connected in a directed manner based on the execution order of each business processing stage. Each logical process in each business processing stage is taken as an operator in the corresponding layer node, and each operator in the corresponding layer node is connected in a directed manner based on the dependency relationship of each logical process in the business processing stage, so as to obtain the directed acyclic graph (DAG) corresponding to the target business.

[0102] Specifically, such as Figure 2 As shown, after obtaining the business processing stages, execution order, logical processes, and execution order of each logical process within the target business from the above steps, a Directed Acyclic Graph (DAG) corresponding to the target business is constructed based on this information. First, each business processing stage is treated as a layer node of the DAG, and these layers are connected in a directed manner based on their execution order, thus establishing the overall framework of the DAG. Then, the logical processes within each business processing stage are treated as operators within that stage, and these operators are connected in a directed manner based on the dependencies between them, thus completing the filling of each layer node in the overall DAG framework.

[0103] Understandably, a directed connection between layer nodes refers to connecting two layer nodes, indicating a route from one layer node to another. This means that during graph scheduling, the layer node at the starting point of the directed connection is scheduled first, followed by the layer node at the ending point. Similarly, a directed connection between operators refers to connecting two operators, indicating a route from one operator to another. This means that during graph scheduling, the operator at the starting point of the directed connection is scheduled first, followed by the operator at the ending point. Since an operator is the smallest unit in the graph scheduling process, during graph scheduling, for two layer nodes with a directed connection, the operators in the layer node at the starting point of the directed connection are scheduled first, followed by the operators in the layer node at the ending point. Furthermore, the scheduling of operators in each layer node is also based on the indications of each directed connection.

[0104] It should be noted that when constructing the DAG of the target business, it can also be obtained by transforming an existing graph of the target business. The existing graph of the target business can be a graph constructed in the existing way. By decomposing the logical process based on the existing graph of the target business, it is also possible to obtain each business processing stage in the target business, the execution order of each business processing stage, the logical process contained in each business processing stage, and the execution order of each logical process. Then, based on the above information, the existing graph of the target business can be converted into the DAG in the embodiments of this application.

[0105] Step S103: When a business request for the target business is received, the nodes of each layer in the DAG are scheduled according to the execution order of each processing stage, and the operators in the layer nodes are scheduled according to the dependency relationship between the logical processes in each layer node, until all operators in the DAG are scheduled.

[0106] Among them, the business request for the target business is the request to execute the target business.

[0107] Specifically, upon receiving a business request for a target service, the corresponding business data is obtained from the request. This business data is provided by the request initiator; for example, in a "search" service, this data may include search terms. Then, in response to the business request, the DAG is scheduled based on this business data. Specifically, as described above, during scheduling, operators in each layer node are scheduled according to the execution order between layer nodes and the dependencies between logical processes within each layer node. Since the operator is the smallest unit in the scheduling process, during graph scheduling, for two layer nodes with a directed connection, the operator in the layer node at the starting point of the directed connection is scheduled first, followed by the operator in the layer node at the ending point of the directed connection. Furthermore, operator scheduling in each layer node is based on the indications of each directed connection. In other words, in this embodiment, operator scheduling is completed layer by layer; that is, operators in the preceding layer node are scheduled first, followed by operators in the next layer node, and so on, until all operators in the DAG are scheduled, thus obtaining the result of the target service processing.

[0108] It should be noted that operator scheduling refers to the logical process of executing operators.

[0109] The solution provided in this application, for a target business, abstracts each business processing stage and its logical process by decomposing its processing stages and the logical processes within those stages. Simultaneously, it obtains the execution order of each business processing stage and the dependencies between the logical processes within each stage. Then, each business processing stage is treated as a layer node of a Directed Acyclic Graph (DAG) and connected in a directed manner according to its execution order. The logical processes within each business processing stage are treated as corresponding operators and connected in a directed manner according to their dependencies, thus obtaining the DAG corresponding to the target business. When a business request for the target business is received, the solution responds to the request by scheduling each layer node in the DAG according to the execution order of each processing stage, and by scheduling each operator within each layer node according to the dependencies between the logical processes within each layer node. This process continues until all operators in the DAG have been scheduled, completing the processing of the target business. This solution abstracts the business processing stages of the target business as layer nodes and the logical processes within each business processing stage as operators during the DAG construction process. Because layer nodes and operators have stronger expressive power, the resulting DAG is more readable, thereby improving the convenience of graph scheduling.

[0110] In one optional embodiment of this application, the operators in the corresponding layer nodes are directed based on the dependencies of each logical process in the business processing stage, including:

[0111] If at least two logical processes in the business processing stage have the same associated logical process, then the corresponding sub-level operator is obtained based on the associated logical process, and the sub-level operator is used as the pre-operator of the operator corresponding to at least two logical processes, and is respectively connected to the operator corresponding to at least two logical processes in a directed manner.

[0112] In this context, the associated logical process is adjacent to at least two logical processes and precedes at least two logical processes in terms of execution order.

[0113] Specifically, each layer node can contain one or more sub-layer nodes. This allows for the analysis of dependencies between logical processes within the layer node. If two or more logical relationships within a layer node share the same associated logical processes, corresponding sub-layer nodes can be constructed based on these shared nodes. Directed connections are then established between the sub-layer nodes and operators within the layer node. Specifically, the sub-layer nodes constructed in this way serve as the pre-operators of the operators corresponding to the two or more logical processes, and are respectively connected to the operators corresponding to at least two logical processes. Constructing sub-layer operators simplifies dependencies within the layer node. The associated logical process can include one or more logical processes; that is, the operator corresponding to the associated logical process can be understood as the operator of a single logical process, or it can be obtained by merging operators corresponding to multiple logical processes. It is understood that the sub-layer node implements the functionality of one or more corresponding operators.

[0114] For example, logical process 1 and logical process 2 in a certain layer node correspond to the same associated logical process. Logical process 1 can be simplified to calculating c / (a+b), and logical process 2 can be simplified to calculating d×(a+b). The associated logical process can include three logical processes: the logical process to calculate a, the logical process to calculate b, and the logical process to calculate a+b. Before constructing the child layer node, the relationship between operator 1 corresponding to logical process 1, operator 2 corresponding to logical process 2, and operators 3, 4, and 5 corresponding to the associated logical process is as follows: Figure 3 As shown in the left figure. According to the method provided in the embodiments of this application, corresponding sub-layer nodes are constructed based on association logic, and the dependencies in these layer nodes are adjusted to obtain the adjusted relationships between the aforementioned nodes as follows: Figure 3 As shown in the diagram on the right, this example demonstrates that introducing sub-level nodes simplifies dependencies by eliminating the need for two calculations of operators 3, 4, and 5, thus accelerating graph scheduling. Furthermore, introducing sub-level nodes enables dynamic graphs; if a sub-level node calculates (a+b) to be 0, operator 1 can be deleted from that node; if (a+b) is not 0, operator 1 is retained.

[0115] It should be noted that the logical process in the above example has been simplified. In practical applications, the logical process can be more complex, but sub-layer nodes can still be constructed using the method of this application. Furthermore, besides constructing sub-layer nodes based on associated nodes, operators corresponding to one or more other logical processes can also be constructed as sub-layer nodes as needed. For example, multiple interconnected identical logical processes contained in different layers of nodes can be constructed as corresponding sub-layer nodes.

[0116] In one optional embodiment of this application, the method may further include:

[0117] If any operator carries cross-layer scheduling information, then after any operator is scheduled, one or more operators of other layer nodes indicated by the cross-layer scheduling information are scheduled.

[0118] Specifically, as described in the foregoing embodiments, the execution order of each layer node in this application embodiment is serial, meaning that operators in each layer node are scheduled sequentially, and only after the operators of the upper-level layer node are scheduled will the operators of the lower-level layer node be scheduled. However, this application embodiment can also provide cross-layer scheduling capability, scheduling the operators of the lower-level layer node before the operators of the upper-level layer node are scheduled. Of course, the number of layers crossed can be set according to requirements. Specifically, corresponding cross-layer scheduling information can be added to a certain operator of a certain layer node. This cross-layer scheduling information indicates the identifier of the operator of another layer node to which the execution should proceed after the execution of this operator. Then, when the execution of this operator of that layer node is reached, the scheduling information is obtained, and the operators of other layer nodes to which the execution should proceed are identified. After the execution of this operator is completed, the operators of other layer nodes are scheduled.

[0119] It should be noted that while jumping to schedule operators of other layer nodes, if the operators within the current layer node have not yet been scheduled, the scheduling of operators of the current layer node will continue, that is, operators of other layer nodes will be scheduled together with operators of the current layer node. The scheduling process of these other layer nodes generally requires the output data of the operator carrying cross-layer scheduling information.

[0120] For example, such as Figure 4 As shown, for operator 1 in layer node 1, the function of operator 1 is to output multiple specific processing results. It carries cross-layer scheduling information, which indicates that the operator in other layer nodes is operator 2 in layer node 3. The function of operator 2 in layer node 3 is to filter specific processing results. Therefore, through the cross-layer scheduling mechanism in this embodiment, after the specific processing result is obtained by executing operator 1 in layer node 1, operator 2 in layer node 3 is executed across layers to filter the specific processing result. Obviously, without this cross-layer scheduling mechanism, after obtaining a specific processing result, it is necessary to wait for all operators in layer nodes 1 and 2 to be scheduled before operator 2 can be scheduled to filter the specific processing result. However, based on this cross-layer scheduling mechanism, filtering can start immediately after obtaining a specific processing result. While ensuring the layer node scheduling logic, it saves the waiting time of operator 2 in layer node 3 and improves the efficiency of graph scheduling.

[0121] In one optional embodiment of this application, scheduling operators in each layer node according to the dependencies between logical processes in each layer node includes:

[0122] Based on dependencies, determine the executable operators in the current time layer node;

[0123] Based on the runtime context of the target business, the executable operators in the current time layer node are scheduled. The runtime context contains information about the data objects in the target business.

[0124] The target business's runtime context records information about all data objects. Different operators require different data objects when they are scheduled, so these data objects need to be obtained from the runtime context.

[0125] Specifically, graph scheduling is actually the scheduling of operators in the graph, which continues until all operators in the DAG have been scheduled. At the current moment, for the layer node currently being scheduled, the executable operators are first determined based on the dependencies between logical processes, i.e., the dependencies between operators. Then, for each executable operator, the corresponding data object is retrieved from the runtime context, and the executable operator is used to process these data objects, thereby completing the scheduling of that operator.

[0126] In one optional embodiment of this application, determining the executable operators in the current time-stack layer node based on dependencies includes:

[0127] Based on dependencies, the preceding operators corresponding to each operator in the layer nodes are determined. The preceding operator of each operator is the operator connected to the operator and executed before the operator. Operators whose preceding operators have been scheduled at the current time are determined as executable operators.

[0128] In this context, the preceding operator of an operator is the operator connected to it and executed before it. It should be noted that an operator may not have a preceding operator, meaning it is one of the first operators scheduled in the node of its layer. An operator may also have one or more preceding operators.

[0129] Specifically, at the current moment, first determine the predecessor operators of each operator in the layer node, then determine which operators have all their predecessor operators already scheduled (or which operators have no predecessor operators), and then determine these operators as executable operators. These executable operators are the ones to be scheduled at the moment.

[0130] For example, if at the current time t1, in the determined layer nodes, operators 1 and 2 have no preceding operators, while other operators have preceding operators that have not been called, then operators 1 and 2 are determined as executable operators at the current time t1. If at the current time t2, in the determined layer nodes, the preceding operators of operator 3 include operators 1 and 2, and both operators 1 and 2 have been called, then operator 3 is determined as an executable operator at the current time t2.

[0131] In one optional embodiment of this application, scheduling the executable operators in the current time-space node based on the runtime context of the target service includes:

[0132] From the runtime context data, obtain information about the target data objects to be processed by each executable operator in sequence;

[0133] Based on the information of the target data object of each executable operator, the update information of the target data object of the executable operator is obtained in parallel.

[0134] The update information of the target data objects of each executable node is sequentially merged into the runtime context.

[0135] Specifically, at the current moment, when scheduling all executable operators, the scheduling process for each executable operator in this embodiment is divided into three stages: a first scheduling stage, a second scheduling stage, and a third scheduling stage. The first scheduling stage, also known as the Before stage, involves each executable operator reading the data object to be processed from the runtime context. The second scheduling stage, also known as the Run stage, involves each executable operator processing the data object to obtain corresponding update information. The third scheduling stage, also known as the After stage, involves each executable operator merging the update information obtained in the Run stage into the runtime context. After completing the three scheduling stages for all executable operators at the current moment, the scheduling for the current moment is complete, and the determination and scheduling of executable operators for the next moment continues.

[0136] In the Before and After phases of the three scheduling phases mentioned above, threads executing different executable operators may simultaneously read or write to the same field in the runtime context, leading to data races. To avoid data races (i.e., ensure thread-safe processing), the executable operators are executed serially in the Before and After phases. However, in the Run phase of the three scheduling phases, the aforementioned data race problem does not exist, and to improve concurrency, the executable operators can be executed in parallel.

[0137] Specifically, such as Figure 5As shown, when scheduling all executable operators at the current moment, in the first scheduling phase, each executable operator is executed serially. Each executable operator reads the required data objects from the running context in a predetermined order and stores them into its own member variables, preparing data for the Run phase. This predetermined order can be a pre-set order or a random order; this embodiment does not limit this. In the second scheduling phase, different executable operators can be executed in parallel. Specifically, each executable operator can be placed in a thread pool for execution, thereby obtaining the updated data corresponding to each executable operator. In the third scheduling phase, each executable operator is executed serially. Each executable operator writes the corresponding updated data into the corresponding field of the running context in a predetermined order. This predetermined order can be a pre-set order or a random order, and the preset order in the third scheduling phase can be the same as or different from the preset order in the first scheduling phase; this embodiment does not limit this either. It should be noted that in the third scheduling phase, in addition to writing the updated data corresponding to the operator into the running context, the data object corresponding to the operator and the logical process corresponding to the operator are also written into the running context.

[0138] In one optional embodiment of this application, the operator includes a first type of operator and a second type of operator. The first type of operator is used to process multiple data objects in the target service, and the second type of operator is used to process one data object in the target service.

[0139] Based on the information of the target data object of each executable operator, obtain the update information of the target data object of the executable operator, including:

[0140] If the executable operator is a first type operator, then the multiple target data objects of the executable operator are divided into multiple parts, and the corresponding target data objects are processed in parallel based on the information of each part of the target data objects to obtain the update information of the target data objects of the executable operator.

[0141] If the executable operator is a second type operator, then the target data object is processed based on the information of the target data object of the executable operator to obtain the updated information of the target data object of the executable operator.

[0142] The first type of operator, also known as a batch operation, processes multiple data objects. The second type of operator, also known as a single operation, processes a single data object. Specifically, a batch operator obtains a batch context from the runtime context during scheduling and then generates a batch of data objects based on that context, resulting in multiple data objects. A single operation, on the other hand, obtains a single context from the runtime context and generates a single data object based on that context. For example, a "search" function might include a batch operator that processes all searched documents (item_list), requiring it to obtain a global context (corresponding to the batch context) from the runtime context to generate data objects for all documents. It could also include a single operation that processes a specific searched document (item), requiring it to obtain a document context (corresponding to the single context) from the runtime context. In other words, a batch operator processes multiple documents, while a single operation processes a single document.

[0143] Specifically, for each operator, in the second scheduling phase, i.e., the Run phase, if the operator is a batch operator and it needs to process multiple data objects, then multiple threads can be used to execute the batch operator concurrently. Specifically, these multiple data objects are divided into multiple parts, and then multiple threads are used to process these multiple parts of data objects concurrently, where the concurrency of each thread can be pre-specified. For example, if a batch operator needs to process 100 documents, and the pre-specified concurrency is 10, then 10 threads can be used to process the 100 documents corresponding to this operator, meaning each thread has a concurrency of 10 documents. If the operator is a singleton operator and it needs to process only one data object, then one thread can be used to process the data object of this operator. For example, if a singleton operator needs to process one document, then one thread from the thread pool can be called to process that one document of the singleton operator.

[0144] In this embodiment of the application, by distinguishing between batch context and single context, the concurrency of batch operator processing can be further improved, thereby improving the efficiency of graph scheduling.

[0145] It should be noted that after obtaining the update information corresponding to the operator in the second scheduling phase, the update information is first merged into the corresponding global context or single-component context, and then the target service's runtime context is updated using the merged global context or single-component context. To avoid data race issues, in the first and third scheduling phases, the global context, single-component context, and generated data objects of each executable operator are in a "read-write" state. However, in the second scheduling phase, the global context and single-component context of each executable operator are in a "read-only" state, while the data objects are in a "read-write" state.

[0146] In one optional embodiment of this application, the corresponding target data objects are processed in parallel based on the information of each target data object, including:

[0147] If the logic process corresponding to the executable operator is local logic, then the first number of threads are used to process the corresponding target data objects in parallel based on the information of each target data object;

[0148] If the logical process corresponding to the executable operator is remote logic, then the second number of coroutines are used to process the corresponding target data objects in parallel based on the information of each target data object;

[0149] The first quantity is not less than the second quantity.

[0150] Among them, the logical process corresponding to an executable operator is local logic, meaning that the data required for its calculation is obtained locally; this type of operator is also called a CPU operator. The logical process corresponding to an executable operator is remote logic, meaning that the data required for its calculation is not obtained locally but needs to be obtained remotely from other devices. Therefore, this calculation process involves waiting for remote data acquisition; this type of operator is also called an I / O operator. It should be noted that the first type of operator can be either a CPU operator or an I / O operator, while the second type of operator is a CPU operator.

[0151] Specifically, for I / O operators, in the second scheduling phase, i.e., the Run phase, if it is a CPU operator, it can be placed in the thread pool and executed by the corresponding thread. If it is an I / O operator, to improve time-sharing multiplexing on a single core, it can be placed in the coroutine pool and executed by the corresponding coroutine. While executing a current I / O operator, if the coroutine enters a waiting process for remote data, it can further execute subsequent operators. After the remote data is obtained, it can jump back to execute the current I / O operator. For example... Figure 6As shown, during operator scheduling, the type of operator is first determined. If it is a second type operator, it is determined to be a CPU operator and is placed in the thread pool for execution. If it is a first type operator, it is necessary to further determine whether it is a CPU operator or an I / O operator. If it is determined to be a CPU operator, it is placed in the thread pool for execution. If it is determined to be an I / O operator, it is placed in the coroutine pool for execution.

[0152] In one optional embodiment of this application, the method may further include:

[0153] When a business request for a target business is received, the resource object corresponding to the target business is obtained. The resource object is the external resource required by the data object in the target business when it is processed by a thread or coroutine.

[0154] Based on resource objects, a corresponding copy of the resource object is created for each local thread and each coroutine. When a new thread or coroutine is added locally, a corresponding copy of the resource object is created for the new thread or coroutine.

[0155] Among them, the resource object is a specific object required in the business process. It can be understood that the resource object is needed when all threads execute operators, such as a preset dictionary.

[0156] Specifically, such as Figure 7 As shown, the system first counts all local threads (including coroutines), then creates a corresponding resource object copy for each thread and places it in a pre-defined resource object queue for later retrieval. Since new threads (including new coroutines) may be added during business execution beyond the total number of local threads, the pre-defined resource object queue may become insufficient. Therefore, additional resource object copies need to be created for the new threads. After the thread executing the operator completes its execution, it puts the corresponding resource object copy back into the pre-defined resource object queue for subsequent use by other threads. This method ensures the correct retrieval of resource objects.

[0157] The following example further illustrates the graph scheduling method in this application. Assume the target service is the "Search" service, as follows: Figure 8 As shown, the graph scheduling process for this service may include the following steps:

[0158] (1) Perform logical analysis on the "Search" business, determine the business processing stage and the execution order of each business processing stage, and perform logical analysis on each business processing stage to determine the logical process contained in each business processing stage and the dependency relationship of each logical stage.

[0159] (2) Based on each business processing stage, the execution order of each business processing stage, the logical process in each business processing stage, and the dependency relationship of each logical processing process, the corresponding DAG is constructed. At the same time, the search business of "Search" can be further analyzed, the corresponding sub-layer stage can be constructed in each layer node, and cross-layer scheduling logic can be set in each layer node to determine the final DAG;

[0160] (3) The response process for the business request of the "Search" service is encapsulated into a session, and then the session is completed in response to the business request. Specifically, this includes scheduling nodes at each layer according to the execution order of nodes in the DAG, and scheduling operators according to the dependencies of operators in each layer node, until all operators are scheduled. It should be noted that during the operator scheduling process, a global context and a singleton context are introduced through data management, which are used for batch operators to process multiple documents and singleton operators to process a single document, respectively. In addition, a corresponding resource object copy is built for each thread through resource management.

[0161] Figure 9 A structural block diagram of a graph scheduling device provided in this application embodiment is shown below. Figure 9 As shown, the device 900 may include: a business analysis module 901, a DAG acquisition module 902, and a graph scheduling module 903, wherein:

[0162] The business analysis module 901 is used to divide the target business into multiple business processing stages, obtain the execution order of each business processing stage, and obtain at least one logical process contained in each business processing stage and the dependencies between each logical process; the execution order of each business processing stage indicates the serial relationship between each business processing stage, and the dependencies between each logical process indicate the connection relationship between each logical process in the business processing stage and the execution order of the connected logical processes.

[0163] The DAG acquisition module 902 is used to take each business processing stage as a layer node, and connect each layer node in a directed manner based on the execution order of each business processing stage. It takes each logical process in each business processing stage as an operator in the corresponding layer node, and connects each operator in the corresponding layer node in a directed manner based on the dependency relationship of each logical process in the business processing stage, so as to obtain the directed acyclic graph (DAG) corresponding to the target business.

[0164] The graph scheduling module 903 is used to schedule the nodes of each layer in the DAG according to the execution order of each processing stage when a service request for the target service is received, and to schedule the operators in the layer nodes according to the dependencies between the logical processes in each layer node, until all operators in the DAG have been scheduled.

[0165] The solution provided in this application, for a target business, abstracts each business processing stage and its logical process by decomposing its processing stages and the logical processes within those stages. Simultaneously, it obtains the execution order of each business processing stage and the dependencies between the logical processes within each stage. Then, each business processing stage is treated as a layer node of a Directed Acyclic Graph (DAG) and connected in a directed manner according to its execution order. The logical processes within each business processing stage are treated as corresponding operators and connected in a directed manner according to their dependencies, thus obtaining the DAG corresponding to the target business. When a business request for the target business is received, the solution responds to the request by scheduling each layer node in the DAG according to the execution order of each processing stage, and by scheduling each operator within each layer node according to the dependencies between the logical processes within each layer node. This process continues until all operators in the DAG have been scheduled, completing the processing of the target business. This solution abstracts the business processing stages of the target business as layer nodes and the logical processes within each business processing stage as operators during the DAG construction process. Because layer nodes and operators have stronger expressive power, the resulting DAG is more readable, thereby improving the convenience of graph scheduling.

[0166] In one optional embodiment of this application, the graph scheduling module is specifically used for:

[0167] Based on dependencies, determine the executable operators in the current time layer node;

[0168] Based on the runtime context of the target business, the executable operators in the current time layer node are scheduled. The runtime context contains information about the data objects in the target business.

[0169] In an optional embodiment of this application, the graph scheduling module is further configured to:

[0170] Based on dependencies, the preceding operators corresponding to each operator in the layer nodes are determined. The preceding operator of each operator is the operator connected to the operator and executed before the operator. Operators whose preceding operators have been scheduled at the current time are determined as executable operators.

[0171] In an optional embodiment of this application, the graph scheduling module is further configured to:

[0172] From the runtime context data, obtain information about the target data objects to be processed by each executable operator in sequence;

[0173] Based on the information of the target data object of each executable operator, the update information of the target data object of the executable operator is obtained in parallel.

[0174] The update information of the target data objects of each executable node is sequentially merged into the runtime context.

[0175] In one optional embodiment of this application, the operator includes a first type of operator and a second type of operator. The first type of operator is used to process multiple data objects in the target service, and the second type of operator is used to process one data object in the target service.

[0176] The graph scheduling module is further used for:

[0177] If the executable operator is a first type operator, then the multiple target data objects of the executable operator are divided into multiple parts, and the corresponding target data objects are processed in parallel based on the information of each part of the target data objects to obtain the update information of the target data objects of the executable operator.

[0178] If the executable operator is a second type operator, then the target data object is processed based on the information of the target data object of the executable operator to obtain the updated information of the target data object of the executable operator.

[0179] In an optional embodiment of this application, the graph scheduling module is further configured to:

[0180] If the logic process corresponding to the executable operator is local logic, then the first number of threads are used to process the corresponding target data objects in parallel based on the information of each target data object;

[0181] If the logical process corresponding to the executable operator is remote logic, then the second number of coroutines are used to process the corresponding target data objects in parallel based on the information of each target data object;

[0182] The first quantity is not less than the second quantity.

[0183] In one optional embodiment of this application, the DAG acquisition module is specifically used for:

[0184] If at least two logical processes in the business processing stage have the same associated logical process, then the corresponding sub-level operator is obtained based on the associated logical process, and the sub-level operator is used as the pre-operator of the operator corresponding to at least two logical processes, and is respectively connected to the operator corresponding to at least two logical processes in a directed manner.

[0185] In this context, the associated logical process is adjacent to at least two logical processes and precedes at least two logical processes in terms of execution order.

[0186] In one optional embodiment of this application, the device may further include a cross-layer scheduling module for:

[0187] If any operator carries cross-layer scheduling information, then after any operator is scheduled, one or more operators of other layer nodes indicated by the cross-layer scheduling information are scheduled.

[0188] In one optional embodiment of this application, the device may further include a resource object acquisition module, used for:

[0189] When a business request for a target business is received, the resource object corresponding to the target business is obtained. The resource object is the external resource required by the data object in the target business when it is processed by a thread or coroutine.

[0190] Based on resource objects, a corresponding copy of the resource object is created for each local thread and each coroutine. When a new thread or coroutine is added locally, a corresponding copy of the resource object is created for the new thread or coroutine.

[0191] The apparatus in this application embodiment can execute the method provided in this application embodiment, and the implementation principle is similar. The actions performed by each module in the apparatus of each embodiment of this application correspond to the steps in the method of each embodiment of this application. For detailed functional descriptions of each module of the apparatus, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here.

[0192] The following is for reference. Figure 10 It illustrates an electronic device suitable for implementing embodiments of this application (e.g., performing...). Figure 1 The diagram illustrates the structure of the terminal device or server 1000 of the method shown. The electronic devices in this application embodiment may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (e.g., vehicle navigation terminals), wearable devices, and fixed terminals such as digital TVs and desktop computers. Figure 10 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0193] The electronic device includes a memory and a processor. The memory stores a program for executing the methods described in the various method embodiments above. The processor is configured to execute the program stored in the memory. The processor may be referred to as processing device 1001 as described below. The memory may include at least one of read-only memory (ROM) 1002, random access memory (RAM) 1003, and storage device 1008 as described below, as specifically shown below:

[0194] like Figure 10As shown, the electronic device 1000 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. The RAM 1003 also stores various programs and data required for the operation of the electronic device 1000. The processing unit 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0195] Typically, the following devices can be connected to the I / O interface 1005: input devices 1006 including, for example, a touchscreen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 1007 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1008 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows electronic device 1000 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 10 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have instead.

[0196] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 1009, or installed from storage device 1008, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of embodiments of this application.

[0197] It should be noted that the computer-readable storage medium described above in this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0198] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0199] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0200] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to:

[0201] The target business is divided into multiple business processing stages. The execution order of each business processing stage is obtained, along with at least one logical process contained in each business processing stage and the dependencies between these logical processes. The execution order of each business processing stage indicates the serial relationship between them, while the dependencies between logical processes indicate the connection relationship between these logical processes and their execution order. Each business processing stage is treated as a layer node, and the layer nodes are connected in a directed manner based on their execution order. Each logical process in each business processing stage is treated as an operator in the corresponding layer node, and the operators in the corresponding layer node are connected in a directed manner based on the dependencies between these logical processes. This yields a Directed Acyclic Graph (DAG) corresponding to the target business. When a business request for the target business is received, the layer nodes in the DAG are scheduled according to the execution order of each processing stage, and the operators in the layer nodes are scheduled according to the dependencies between the logical processes in each layer node, until all operators in the DAG have been scheduled.

[0202] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include, but are not limited to, object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0203] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0204] The modules or units described in the embodiments of this application can be implemented in software or hardware. The names of modules or units do not necessarily limit the specific unit; for example, a first constraint acquisition module can also be described as a "module for acquiring the first constraint".

[0205] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0206] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0207] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the following actions:

[0208] The target business is divided into multiple business processing stages. The execution order of each business processing stage is obtained, along with at least one logical process contained in each business processing stage and the dependencies between these logical processes. The execution order of each business processing stage indicates the serial relationship between them, while the dependencies between logical processes indicate the connection relationship between these logical processes and their execution order. Each business processing stage is treated as a layer node, and the layer nodes are connected in a directed manner based on their execution order. Each logical process in each business processing stage is treated as an operator in the corresponding layer node, and the operators in the corresponding layer node are connected in a directed manner based on the dependencies between these logical processes. This yields a Directed Acyclic Graph (DAG) corresponding to the target business. When a business request for the target business is received, the layer nodes in the DAG are scheduled according to the execution order of each processing stage, and the operators in the layer nodes are scheduled according to the dependencies between the logical processes in each layer node, until all operators in the DAG have been scheduled.

[0209] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0210] The above description is only a partial embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A graph scheduling method, characterized in that, include: The target business is divided into multiple business processing stages. The execution order of each business processing stage is obtained, and at least one logical process contained in each business processing stage and the dependencies between each logical process are obtained. The execution order of each business processing stage indicates the serial relationship between each business processing stage, and the dependencies between each logical process indicate the connection relationship between each logical process in the business processing stage and the execution order of the connected logical processes. Each business processing stage is treated as a layer node, and each layer node is connected in a directed manner based on the execution order of each business processing stage. Each logical process in each business processing stage is treated as an operator in the corresponding layer node, and each operator in the corresponding layer node is connected in a directed manner based on the dependency relationship of each logical process in the business processing stage, so as to obtain the directed acyclic graph (DAG) corresponding to the target business. When a service request for the target service is received, the nodes of each layer in the DAG are scheduled according to the execution order of each processing stage, and the operators in each layer node are scheduled according to the dependency relationship between each logical process in each layer node, until all operators in the DAG have been scheduled. The operators in the layer nodes corresponding to the directed connections based on the dependencies of each logical process in the business processing stage include: If at least two logical processes in the business processing stage have the same associated logical process, then the corresponding sub-layer operator is obtained based on the associated logical process, and the sub-layer operator is used as the pre-operator of the operator corresponding to the at least two logical processes. It is then connected to the operator corresponding to the at least two logical processes in a directed manner, so that the sub-layer operator is scheduled to be executed only once during the execution of the business processing stage. In that, the associated logical process is adjacent to and precedes the at least two logical processes in terms of execution order; The method of scheduling operators in each layer node according to the dependencies between logical processes in each layer node includes: The sub-layer operator is executed to obtain the calculation result of the associated logical process. Based on the calculation result, at least one logical process corresponding to the associated logical process is deleted or retained in the layer node where the sub-layer operator is located.

2. The method according to claim 1, characterized in that, Schedule the operators in each layer node according to the dependencies between the logical processes in each layer node, including: Based on the aforementioned dependencies, determine the executable operators in the layer nodes at the current time; Based on the runtime context of the target service, the executable operators in the layer node at the current time are scheduled, and the runtime context contains information about the data objects in the target service.

3. The method according to claim 2, characterized in that, The step of determining the executable operators in the layer node at the current time based on the dependency relationship includes: Based on the dependency relationship, the preceding operators corresponding to each operator in the layer node are determined. The preceding operator of each operator is the operator connected to the operator and whose execution order is before the operator. The operators in each operator whose preceding operators have been scheduled at the current time are determined as executable operators.

4. The method according to claim 2, characterized in that, The step of scheduling the executable operators in the layer node at the current moment based on the runtime context of the target service includes: From the runtime context data, information about the target data object to be processed by each executable operator is obtained sequentially; Based on the information of the target data object of each executable operator, the update information of the target data object of the executable operator is obtained in parallel. The update information of the target data objects of each executable node is sequentially merged into the runtime context.

5. The method according to claim 4, characterized in that, The operator includes a first type of operator and a second type of operator. The first type of operator is used to process multiple data objects in the target service, and the second type of operator is used to process one data object in the target service. The step of obtaining the update information of the target data objects of each executable operator in parallel based on the information of the target data objects of each executable operator includes: If the executable operator is a first type operator, then the multiple target data objects of the executable operator are divided into multiple parts, and the corresponding target data objects are processed in parallel based on the information of each part of the target data objects to obtain the update information of the target data objects of the executable operator. If the executable operator is a second type operator, then the target data object is processed based on the information of the target data object of the executable operator to obtain the update information of the target data object of the executable operator.

6. The method according to claim 5, characterized in that, The parallel processing of the target data objects based on the information of each target data object includes: If the logical process corresponding to the executable operator is local logic, then the first number of threads are used to process the corresponding target data objects in parallel based on the information of each target data object; If the logical process corresponding to the executable operator is remote logic, then the second number of coroutines are used to process the corresponding target data objects in parallel based on the information of each target data object; Wherein, the first quantity is not less than the second quantity.

7. The method according to claim 1, characterized in that, The method further includes: If any operator carries cross-layer scheduling information, then after any operator is scheduled, one or more operators of other layer nodes indicated by the cross-layer scheduling information are scheduled.

8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: Upon receiving a business request for the target business, obtain the resource object corresponding to the target business. The resource object is the external resource required when the data object in the target business is processed by a thread or coroutine. Based on the resource object, a corresponding resource object copy is created for each local thread and each coroutine, and when a new thread or coroutine is added locally, a corresponding resource object copy is created for the new thread or coroutine.

9. A graph scheduling device, characterized in that, include: The business analysis module is used to divide the target business into multiple business processing stages, obtain the execution order of each business processing stage, and obtain at least one logical process contained in each business processing stage and the dependencies between each logical process; the execution order of each business processing stage indicates the serial relationship between each business processing stage, and the dependencies between each logical process indicate the connection relationship between each logical process in the business processing stage and the execution order of the connected logical processes. The DAG acquisition module is used to take each business processing stage as a layer node, and connect each layer node in a directed manner based on the execution order of each business processing stage. It takes each logical process in each business processing stage as an operator in the corresponding layer node, and connects each operator in the corresponding layer node in a directed manner based on the dependency relationship of each logical process in the business processing stage, so as to obtain the directed acyclic graph (DAG) corresponding to the target business. The graph scheduling module is used to schedule each layer node in the DAG according to the execution order of each processing stage when a service request for the target service is received, and to schedule each operator in the layer node according to the dependency relationship between each logical process in each layer node, until all operators in the DAG have been scheduled. The DAG acquisition module, based on the dependencies between logical processes in the business processing stage, makes directed connections to the operators in the corresponding layer nodes, including: If at least two logical processes in the business processing stage have the same associated logical process, then the corresponding sub-layer operator is obtained based on the associated logical process, and the sub-layer operator is used as the pre-operator of the operator corresponding to the at least two logical processes. It is then connected to the operator corresponding to the at least two logical processes in a directed manner, so that the sub-layer operator is scheduled to be executed only once during the execution of the business processing stage. In that, the associated logical process is adjacent to and precedes the at least two logical processes in terms of execution order; The graph scheduling module schedules the operators in each layer node according to the dependencies between the logical processes in each layer node, including: The sub-layer operator is executed to obtain the calculation result of the associated logical process. Based on the calculation result, at least one logical process corresponding to the associated logical process is deleted or retained in the layer node where the sub-layer operator is located.

10. An electronic device, characterized in that, Including memory and processor; The memory stores computer programs; The processor is configured to execute the computer program to implement the method of any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of any one of claims 1 to 8.

12. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Node combination scheduling method and device, equipment and storage medium

    CN111061551A

  • Service request processing method and device, electronic equipment and storage medium

    CN114860301A