Transaction scheduling optimization method based on graph embedding

By constructing a heterogeneous graph and utilizing graph embedding and deep reinforcement learning to optimize transaction scheduling, the problem of obtaining the global optimal solution in existing methods is solved, a globally optimal transaction scheduling strategy is realized, and the transaction execution efficiency of multi-core CPUs is improved.

CN117216071BActive Publication Date: 2025-10-28BEIJING INST OF REMOTE SENSING EQUIP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311086604.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-28
Publication Date
2025-10-28
Estimated Expiration
2043-08-28

AI Technical Summary

Technical Problem

Existing transaction scheduling methods struggle to find the globally optimal solution for large volumes of complex and ever-changing transaction execution sequences, and heuristic algorithms are prone to getting trapped in local optima.

Method used

Heterogeneous graphs are constructed based on graph embedding methods. Transaction features are learned using graph embedding models and mapped to a low-dimensional feature space. Iterative training is then performed using Markov decision processes and deep reinforcement learning to optimize transaction scheduling strategies.

Benefits of technology

Find the globally optimal transaction scheduling strategy in a vast search space, avoid local optima, and improve transaction execution efficiency and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117216071B_ABST
    Figure CN117216071B_ABST
Patent Text Reader

Abstract

This invention discloses a transaction scheduling optimization method based on graph embedding. Relating to the technical field of database transaction scheduling, this graph embedding-based transaction scheduling optimization method includes: constructing a heterogeneous graph based on collected transaction information, where the heterogeneous graph has transactions as vertices and relationships between transactions as edges; using a graph embedding model to learn the heterogeneous graph, mapping the transaction features in the heterogeneous graph to a low-dimensional feature space, obtaining the graph embedding representation result corresponding to the transaction information, wherein the graph embedding representation result includes the embedding representation of each vertex in the heterogeneous graph after multi-layer iterative learning of vertex features, connected edge features, and the types of edges between vertices; establishing a Markov decision process model, and using deep reinforcement learning to iteratively train the graph embedding representation result until a preset number of iterations is reached to obtain the output transaction scheduling allocation strategy. This invention solves the technical problem that existing transaction scheduling methods cannot obtain globally optimal scheduling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of database transaction scheduling, and more specifically, to a transaction scheduling optimization method based on graph embedding. Background Technology

[0002] Transaction scheduling is a crucial issue in database systems, involving the effective management and scheduling of the execution order of multiple concurrent transactions to ensure that database consistency, isolation, durability, and atomicity are satisfied. Multi-core CPUs have multiple processing cores, each capable of independently executing instructions, allowing multiple transactions to run simultaneously, thus achieving parallel processing and improving transaction execution efficiency and performance. On the other hand, when multiple transactions run concurrently, they may compete for shared resources, leading to contention and conflicts, thereby impacting transaction execution efficiency. Therefore, rationally allocating transactions to different cores to maximize the parallel performance of multi-core CPUs has become a critical issue that urgently needs to be addressed.

[0003] In recent years, with the rise of multi-core computing, multi-core transaction scheduling and allocation strategies have been proposed. This method forms a complete transaction dependency graph based on collected transaction information, represented by a directed acyclic graph; then, a heuristic algorithm is used to determine the priority of transactions, forming a transaction queue from high to low priority; finally, the optimal allocation scheme for system resources is found based on transaction information and inter-transaction relationships.

[0004] However, the above methods have the following problems: First, the allocation strategies for transaction scheduling using the heuristic algorithms mentioned above are mostly manually designed rules and strategies, which are difficult to handle large workloads and complex and ever-changing transaction execution orders. Second, since heuristic algorithms make decisions based on predefined rules, their search space is limited by the scope of manually defined rules, which can easily lead to the algorithm getting stuck in local optima and missing the global optimum.

[0005] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0006] This invention provides a transaction scheduling optimization method based on graph embedding, which at least solves the technical problem that existing transaction scheduling methods cannot obtain the globally optimal schedule.

[0007] According to one aspect of the present invention, a transaction scheduling optimization method based on graph embedding is provided, comprising: constructing a heterogeneous graph based on collected transaction information, wherein the transaction information includes all transactions to be scheduled and transaction parameters, and the heterogeneous graph has transactions as vertices and relationships between transactions as edges; learning the heterogeneous graph using a graph embedding model to map the transaction features in the heterogeneous graph to a low-dimensional feature space to obtain graph embedding representation results corresponding to the transaction information, wherein the graph embedding representation results include embedding representations of vertex features, connected edge features, and types of edges between vertices in the heterogeneous graph after multi-layer iterative learning; establishing a Markov decision process model and using deep reinforcement learning to iteratively train the graph embedding representation results until a preset number of iterations is reached to obtain an output transaction scheduling allocation strategy.

[0008] Preferably, constructing a heterogeneous graph based on the collected transaction information includes: performing one-hot encoding on the transaction information and constructing an embedded representation set of transactions using the concatenation result of the transaction information encoding; representing the relationships between transactions in tuple form and constructing a transaction relationship set using the relationship tuples; using all features in the embedded representation set as vertex input features and using the features in the above transaction relationship set as edge input features to construct a heterogeneous graph.

[0009] Preferably, the relationships between transactions are represented in the form of tuples, and a set of transaction relationships is constructed using relation tuples, including: obtaining the relationship types of the aforementioned edges, and encoding and storing the aforementioned relationship types, wherein the aforementioned relationship types include sequential execution, data sharing, and data conflict.

[0010] Preferably, a graph embedding model is used to learn the heterogeneous graph to map the transaction features in the heterogeneous graph to a low-dimensional feature space, thereby obtaining the graph embedding representation result corresponding to the transaction information. This includes: inputting the vertex features, edge features, and types of edges between vertices of the heterogeneous graph into the graph embedding model to fit and learn the vertex features, edge features, and types of edges to obtain the embedding features of the corresponding vertices; using the embedding features as input for the next layer of iterative learning, and sequentially passing through a preset layer of iterative learning to obtain the embedding representation of each vertex in the top-level iteration; and collecting the embedding representations of all vertices to obtain the graph embedding representation result corresponding to the transaction information, wherein the graph embedding representation result is matched with the vertices and edges of the heterogeneous graph, and each embedding vector in the graph embedding representation result corresponds one-to-one with a vertex of the heterogeneous graph.

[0011] Preferably, the fitting learning of the above vertex features, edge features, and edge types to obtain the embedding features of the corresponding vertex includes: fitting learning based on the embedding features, edge features, vertex features of adjacent vertices including edge types, and weight matrix of the previous layer to obtain the embedding features of the corresponding vertex in the current layer.

[0012] Preferably, the embedding features of the corresponding vertex in the current layer are obtained by fitting and learning based on the embedding features, edge features, vertex features of adjacent vertices including edge types, and weight matrix of the previous layer. This includes: normalizing and summing the embedding features, edge features, and vertex features of adjacent vertices including edge types using the weight matrix, and concatenating the feature vectors; and processing the feature vectors using a nonlinear activation function to obtain the embedding representation of the corresponding vertex in the current layer.

[0013] Preferably, establishing a Markov decision process model includes: using the above graph embedding representation results as input to the state space; using the set of all scheduling sequences as the action space; constructing a reward function using transaction completion time, CPU utilization, and data transmission cost; and determining a discount factor.

[0014] Preferably, deep reinforcement learning is used to iteratively train the graph embedding representation results, including: using the state of the state space, the order of transaction execution in the action space, and each reward factor of the reward function as input to the policy network and value network in each working network; using the output of the policy network to indicate the probability of determining the order of transaction execution based on the state in the action space, and using the value network to output the value evaluation value in the current state; after each working network performs a preset number of training steps, it feeds the gradient into the global network and receives the updated gradient parameters issued by the global network, thus realizing one iteration of training.

[0015] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, wherein the computer program is configured to execute the above-described graph embedding-based transaction scheduling optimization method at runtime.

[0016] According to another aspect of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described graph embedding-based transaction scheduling optimization method through the computer program.

[0017] In this embodiment of the invention, a heterogeneous graph is constructed based on collected transaction information. The heterogeneous graph uses transactions as vertices and the relationships between transactions as edges. A graph embedding model is used to learn the heterogeneous graph, mapping the transaction features in the heterogeneous graph to a low-dimensional feature space, thus obtaining the graph embedding representation result corresponding to the transaction information. The graph embedding representation result includes the embedding representation of each vertex in the heterogeneous graph after multi-layer iterative learning of vertex features, connected edge features, and the types of edges between vertices. A Markov decision process model is established, and deep reinforcement learning is used to iteratively train the graph embedding representation result until a preset number of iterations is reached to obtain the output transaction scheduling and allocation strategy. By constructing a graph through transaction information and using graph embedding methods to mine deep features of transactions and dependencies between transactions, and by using deep reinforcement learning to determine the optimal transaction scheduling and allocation strategy, the goal of finding the globally optimal strategy in a huge search space is achieved, avoiding getting trapped in local optima. This achieves the technical effect of a globally optimal scheduling strategy and solves the technical problem that existing transaction scheduling cannot obtain a globally optimal schedule. Attached Figure Description

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

[0019] Figure 1 This is a schematic diagram of an application environment for an optional graph embedding-based transaction scheduling optimization method according to an embodiment of the present invention;

[0020] Figure 2 This is a flowchart illustrating an optional graph-embedded transaction scheduling optimization method according to an embodiment of the present invention.

[0021] Figure 3 This is a flowchart illustrating an optional graph-embedded transaction scheduling optimization method according to an embodiment of the present invention.

[0022] Figure 4 This is a flowchart illustrating an optional graph-embedded transaction scheduling optimization method according to an embodiment of the present invention.

[0023] Figure 5 This is a schematic diagram of an optional graph embedding-based transaction scheduling optimization device according to an embodiment of the present invention;

[0024] Figure 6 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. Detailed Implementation

[0025] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0026] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0027] According to one aspect of the present invention, a transaction scheduling optimization method based on graph embedding is provided, which is widely used in application scenarios of transaction scheduling strategy determination and optimization.

[0028] As an optional implementation method, such as Figure 1 As shown, the above-mentioned transaction scheduling optimization method based on graph embedding includes:

[0029] S102, construct a heterogeneous graph based on the collected transaction information, where the transaction information includes all transactions to be scheduled and transaction parameters, and the heterogeneous graph has transactions as vertices and the relationships between transactions as edges;

[0030] S104. A graph embedding model is used to learn heterogeneous graphs so as to map the transaction features in the heterogeneous graphs to a low-dimensional feature space and obtain the graph embedding representation results corresponding to the transaction information. The graph embedding representation results include the embedding representation of each vertex in the heterogeneous graph through multi-layer iterative learning of vertex features, connected edge features, and the types of edges between vertices.

[0031] S106. Establish a Markov decision process model and use deep reinforcement learning to iteratively train the graph embedding representation results until a preset number of iterations is reached to obtain the output transaction scheduling and allocation strategy.

[0032] A heterogeneous graph is constructed based on the collected transaction information, with transactions as vertices and dependencies between transactions as edges. A graph embedding model is used to learn the graph data representing transaction information and map the graph data into a low-dimensional feature space. Finally, a Markov decision process model is established, and a deep reinforcement learning method is used to iteratively train the transaction scheduling and allocation strategy to obtain the optimal strategy.

[0033] A heterogeneous graph approach is employed to explicitly represent the complex dependencies between transactions. A graph embedding model is then used to learn a large amount of transaction information features from the heterogeneous graph, mapping them into low-dimensional feature vectors for easier subsequent computation. Reinforcement learning methods introduce neural networks as function approximators, enabling the agent to directly extract effective information from the original input and learn complex state-action mappings. This allows for finding more effective strategies within a vast search space, avoiding getting trapped in local optima.

[0034] In this embodiment, a graph is constructed using transaction information, and a graph embedding method is used to mine deep features of transactions and dependencies between transactions. The optimal transaction scheduling and allocation strategy is determined through deep reinforcement learning. This achieves the goal of finding the globally optimal strategy in a huge search space and avoiding getting trapped in local optima, thereby realizing the technical effect of a globally optimal scheduling strategy and solving the technical problem that existing transaction scheduling cannot obtain globally optimal scheduling.

[0035] As an optional implementation, a heterogeneous graph is constructed based on the collected transaction information, including:

[0036] S102-2, perform one-hot encoding on the transaction information, and use the concatenation result of the transaction information encoding to construct the embedded representation set of the transaction;

[0037] S102-4 represents the relationships between transactions in the form of tuples and uses relation tuples to construct a set of transaction relationships;

[0038] S102-6 uses all features in the embedded representation set as vertex input features and features in the transaction relationship set as edge input features to construct a heterogeneous graph.

[0039] As an optional implementation, the relationships between transactions are represented in the form of tuples, and a set of transaction relationships is constructed using relation tuples, including: obtaining the relationship types of edges, and encoding and storing the relationship types, wherein the relationship types include sequential execution, data sharing, and data conflict.

[0040] As an optional implementation, a graph embedding model is used to learn heterogeneous graphs to map transaction features in the heterogeneous graphs to a low-dimensional feature space, obtaining graph embedding representation results corresponding to the transaction information, including:

[0041] S104-2, input the vertex features, edge features, and edge types between vertices of the heterogeneous graph into the graph embedding model, and learn the vertex features, edge features, and edge types to obtain the embedding features of the corresponding vertices.

[0042] S104-4, the embedded features are used as the input for the next layer of iterative learning, and the learning is passed through the preset layers in sequence to obtain the embedded representation of each vertex in the top layer iteration.

[0043] S104-6, the graph embedding representation result corresponding to the transaction information is obtained by collecting the embedding representation of all vertices. The graph embedding representation result is matched with the vertices and edges of the heterogeneous graph, and each embedding vector in the graph embedding representation result corresponds one-to-one with the vertex of the heterogeneous graph.

[0044] As an optional implementation, fitting and learning vertex features, edge features, and edge types to obtain the embedding features of the corresponding vertex includes: fitting and learning based on the embedding features, edge features, vertex features of adjacent vertices including edge types, and weight matrix of the previous layer to obtain the embedding features of the corresponding vertex in the current layer.

[0045] As an optional implementation, the embedding features of the corresponding vertex in the current layer are obtained by fitting and learning based on the embedding features, edge features, vertex features of adjacent vertices including edge types, and weight matrix of the previous layer. This includes: normalizing and summing the embedding features, edge features, and vertex features of adjacent vertices including edge types using the weight matrix, and concatenating the feature vectors; and processing the feature vectors using a non-linear activation function to obtain the embedding representation of the corresponding vertex in the current layer.

[0046] As an optional implementation method, a Markov decision process model is established, including:

[0047] S106-22, use the graph embedding representation result as the state space input;

[0048] S106-24, the set of all scheduling sequences is taken as the action space;

[0049] S106-26, construct a reward function using transaction completion time, CPU utilization and data transfer cost;

[0050] S106-28, Determine the discount factor.

[0051] As an optional implementation, deep reinforcement learning is used to iteratively train the graph embedding representation results, including:

[0052] S106-42, the states in the state space, the order of transaction execution in the action space, and the various reward factors of the reward function are used as inputs to the policy network and value network in each working network;

[0053] S106-44, the policy network outputs the probability of determining the execution order of transactions based on the state in the action space, and the value network outputs the value assessment value in the current state.

[0054] S106-46: After each working network performs a preset number of training steps, it passes the gradient to the global network and receives the updated gradient parameters from the global network, thus completing one iteration of training.

[0055] The specific implementation process of the above-mentioned graph embedding-based transaction scheduling optimization method is not limited to the following.

[0056] Step 1: Construct a graph based on the collected transaction information.

[0057] The specific process is not limited to, for example Figure 2 As shown, all transaction information data is collected, including the entire payload, i.e., the collection of all transactions. , transactions , affairs computational workload , affairs The workload of transferring data in memory , affairs Transmission memory latency , affairs Maximum delay tolerance time , affairs To another transaction Data volume transmitted , and Conflict time for accessing the same data , and Data access time The computing power of each computing node on the server Average transmission bandwidth of the server .

[0058] Calculate the transaction based on the above transaction information data. computational cost That is, to calculate the completion of the transaction. The time spent on the workload is expressed by the following formula:

[0059] (1)

[0060] transactions Memory access cost , which is the time required from when the CPU issues a memory read or write instruction to when the data is received, is expressed by the following formula: (2)

[0061] transactions and affairs Inter-transmission data transfer cost It can be expressed by the following formula: (3)

[0062] transactions and affairs Simultaneous access to conflicting data incurs waiting costs. It can be expressed by the following formula:

[0063] (4)

[0064] When multiple tasks require the same data, the time required decreases, thereby incurring sharing costs. It can be expressed by the following formula: (5)

[0065] For transactions Table names, column names, row names, predicates, and symbols are all encoded using one-hot encoding. and The three-bit encoding is used. For example, AND is encoded as 001, OR as 010; the id column of the person table is encoded as 001, the name column as 010; the symbol ">" is encoded as 011, the symbol "<" as 010; the encoding of numbers is their corresponding binary encoding, and characters use an eight-bit one-hot encoding, for example, "John" is encoded as 11110011. Transactions... The various parts of the code are concatenated, and the transaction is... Encoding and splicing results Stored in a collection , , is the set of embedded representations of all transactions. For a transaction... and There may be dependencies between them, and dependencies are used to... This indicates that the transaction and affairs Dependencies are represented in tuple form, here written as Store it in a collection middle, It is a set of dependencies that exist between transactions.

[0066] Hypothetical heterogeneous graph , It is a picture The set of all vertices in the set is also the embedded representation of all transactions, where the vertices... Features include , , , , will the vertex All features are used as vertex input features ;

[0067] It is a picture The set of all edges in a given context is also the set of relationships between transactions; edges Features include , , , , , , will the side The feature values ​​are used as edge input features ; It is a picture The set of types of relationships between edges. This includes sequential execution, data sharing, and data conflicts, encoded using 00, 01, and 10 respectively. The encoded results of all transactions and inter-transaction dependencies are stored, and vertex features are defined as follows: (Vertex features: Transaction computation workload) The computational cost of transactions Transaction memory transfer data workload Memory access cost of transactions Edge characteristics: the amount of data transferred between transactions Inter-transaction data transfer cost The time when transactions jointly access data Conflict time when multiple transactions access the same data Multiple transactions accessing conflicting data simultaneously incur waiting costs. The reduced sharing cost when multiple tasks require the same data. , and store.

[0068] Step 2: Use a graph embedding model to learn heterogeneous graphs.

[0069] The specific process is not limited to, for example Figure 3 As shown, the heterogeneous graph constructed based on step one This method improves graph neural network models to learn and embed graph data of transaction information in a low-dimensional way, capturing the relationships and structures between transactions. It transforms the originally complex graph data of transaction information into an efficient vector representation, thereby preserving the important features of each transaction, i.e., graph vertex, in a low-dimensional space, providing better input features for subsequent tasks.

[0070] For heterogeneous graphs one of the vertices and vertex Adjacent nodes In the initial training phase of the improved graph neural network model, input vertex features Sum of edge features and vertices and Types of edges between Using neural networks, , and Fitting learning vertices New features, to obtain vertices deep features and the vertex deep features As input for the next layer of the learning process, the final top layer is obtained after multiple iterations. Embedded output results , , Representative Heterogeneous Diagram The output is the final embedded representation of all vertices. The number of vertices and edges remains unchanged; only the features are learned multiple times to form a (multi-dimensional) vector.

[0071] In the improved graph neural network model, considering heterogeneous graphs, we simultaneously incorporate edge features for joint updating, calculating the computation within the heterogeneous graph. Update a vertex , The forward propagation update is expressed by the following formula: (6)

[0072] in, It is The vertex of the layer Embedded representation, It is the vertex In the Layer embedding representation, It is the vertex At the initial layer input, , and vertex eigenvalues ​​of connected edges It is all with vertices A set of vertices with relational dependencies. Indicate their relationship, , It is a set of dependency types. , represents a vertex With vertex Adjacent and dependent, , and It is a learnable weight matrix. It is a non-linear activation function. These are hyperparameters used for normalization.

[0073] While normalizing and summing the feature vectors of adjacent vertices, a weight matrix is ​​used to learn the features of edges between vertices and the different edge types. After learning the weight matrix and concatenating the feature vectors, a non-linear activation function is used to process the feature vectors, resulting in the transaction information representation after graph embedding learning. This serves as the input for the deep reinforcement learning method in step three.

[0074] Step 3: Use deep reinforcement learning to train the graph embedding representation of transaction information and obtain the optimal allocation strategy for transaction scheduling.

[0075] Specifically, not limited to, such as Figure 4 As shown, given all transactions, the goal is to autonomously decide the optimal transaction scheduling strategy in a multi-core CPU using reinforcement learning, maximizing the utilization of multi-core CPU resources while completing all transactions. Therefore, the transaction scheduling decision problem in a multi-core CPU can be modeled as a Markov decision process, defined as a quadruple representation. ;

[0076] The state space represents the set of all possible states that the agent can observe during the decision-making process. Since the graph embedding model learns the encoding of transactions and the dependencies between transactions, the result of graph embedding contains all the feature information of transactions, all dependencies between transactions, and relationship features. Therefore, the transaction information representation result after graph embedding learning is used. As input to the state space, i.e. Therefore, the state space is defined. , in It is the state of a transaction information graph after an action has been performed, that is, the embedded representation set of the remaining vertices after some vertices have been selected and removed;

[0077] The action space represents the set of all possible actions an agent can choose in each state. Since the goal is to optimize the best strategy for multi-core CPU transaction scheduling, the action space is defined as the set of all possible scheduling orders. Each action is represented as one or more sequences, representing the optimal processing order of vertices. Therefore, the action space is defined as follows: , , Each action in the action space is represented as , ;

[0078] The reward function is used to evaluate the agent's performance after performing an action and to provide the agent with immediate feedback. The reward function consists of three parts: the completion time of the transaction, and the time required for the transaction to complete. A positive reward is given if the scheduling order allows all transactions to complete faster, and a negative reward is given if the delay is longer; CPU utilization If the scheduling order results in higher CPU utilization and more efficient use of computing resources, then a positive reward is given for the number of concurrent operations at the same time; data transfer cost If the scheduling order leads to a reduction in data transmission costs, such as reducing the number of data transfers between multiple cores or the distance of data dependencies, a positive reward is given. Reducing the number of data transfers between different cores can reduce communication overhead and improve data access efficiency. If the related data is too far apart, the latency required for access will increase, affecting system performance. Therefore, related transactions are executed on cores that are closer together, thereby reducing the distance of data dependencies and improving the efficiency of data access.

[0079] This represents a discount factor, allowing the agent to consider future rewards when making decisions.

[0080] An asynchronous advantage actor-commentator algorithm is used to determine the optimal transaction scheduling strategy in a multi-core CPU. A global network and several worker networks are established, and the maximum number of iterations is input. Steps Each working network employs an actor-commentator algorithm based on a dominance function, and each working network consists of a policy network and a value network.

[0081] The policy network is used to decide the execution order of transactions in each state, which is represented by an array of vertices in the graph. The architecture of the policy network includes an input layer, an intermediate layer, and an output layer. The input layer is a fully connected layer, and the input values ​​of the input layer include the transaction state. The selected transaction execution sequence The completion time of the sequential execution of transactions. , CPU utilization and data transmission costs ;

[0082] And select the order of transaction execution. Post-transaction information status The input consists of environmental observations obtained through the interaction between the agent and the environment; the intermediate layer is a fully connected layer; and the output layer is a softmax activation function layer, with the output being the policy. This refers to the probability of choosing the execution order of transactions in the action space, which is also the probability of choosing the vertex order array.

[0083] Value networks are used to generate decision value functions that select the execution order of a particular transaction. The network layer structure includes an input layer, intermediate layers, and an output layer, where the input layer is a fully connected layer. The input values ​​of the input layer include the state of the transaction information. The selected transaction execution sequence The completion time of the sequential execution of transactions. , CPU utilization and data transmission costs ; and select the order of transaction execution. Post-transaction information status The above input consists of environmental observations obtained through the interaction between the agent and the environment; the intermediate layer is a fully connected layer; and the output layer is a linear layer, with the output value being the current state. Evaluation value of the lower value function .

[0084] The parameters of the policy network are updated according to the following formula: (7)

[0085] in, Indicates the policy network parameters, This indicates taking the partial derivative with respect to the network parameters. Indicates the state Next action strategy, Indicates the state Next action The advantage function.

[0086] The advantage function is approximated by the following formula: (8)

[0087] in, This indicates an immediate reward, obtained from feedback by the decision evaluation module. This is a hyperparameter, with a range of values. , Indicates the current state Value functions, Indicates the state at the next moment. The value function is generated by the output of the value network.

[0088] The value network parameters are updated according to the following formula: (9)

[0089] in, This represents the parameters of the value network.

[0090] The decision evaluation indicators are defined from three perspectives: the completion time of the transaction sequence, CPU utilization, and data transfer cost.

[0091] The calculation method for decision evaluation indicators, i.e., the immediate reward obtained from performing an action, is expressed by the following formula: (10)

[0092] in, , , is a hyperparameter, , , .

[0093] Number of steps completed per working network After training, the gradient is fed into the global network to update its parameters. The working network then retrieves the updated parameters from the global network, and this process is repeated. If the preset maximum number of iterations has not been reached... If the preset maximum number of iterations is reached, then the deep reinforcement learning training process continues; Then the training ends and the optimal transaction scheduling allocation strategy is output.

[0094] In this embodiment, transactions and transaction dependencies are transformed into a graph data structure, which clearly represents the complex dependencies between transactions, including sequential dependencies, parallel dependencies, and conditional dependencies. This comprehensively reflects the correlation between transactions, facilitating the analysis and mining of deep relationships between transaction features and dependencies in the load. A graph embedding algorithm is used to process transaction features and dependencies, and a neural network is used as a means to learn the similarity and dependencies between nodes from the feature representation of high-dimensional transaction information, forming a vector representation of low-dimensional effective transaction information nodes. Information on edge types and edge features is added during the transmission and aggregation of node information, increasing the embedded representation results of node learning. In the modeling of the Markov decision process, the graph embedding of transaction information is used as the state space, the vertex arrangement order in the transaction information graph is constructed as the action space, and the load execution time, CPU utilization, and data transmission cost are used as reward functions. Based on deep reinforcement learning model training, the optimal transaction execution strategy is found.

[0095] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.

[0096] According to another aspect of the present invention, a graph embedding-based transaction scheduling optimization apparatus for implementing the above-described graph embedding-based transaction scheduling optimization method is also provided. For example... Figure 5 As shown, the device includes:

[0097] Graph construction unit 502 is used to construct a heterogeneous graph based on the collected transaction information, wherein the transaction information includes all transactions to be scheduled and transaction parameters, and the heterogeneous graph has transactions as vertices and the relationships between transactions as edges;

[0098] Graph learning unit 504 is used to learn heterogeneous graphs using a graph embedding model to map the transaction features in the heterogeneous graph to a low-dimensional feature space and obtain the graph embedding representation result corresponding to the transaction information. The graph embedding representation result includes the embedding representation of each vertex in the heterogeneous graph through multi-layer iterative learning of vertex features, connected edge features, and the types of edges between vertices.

[0099] Decision unit 506 is used to establish a Markov decision process model and use deep reinforcement learning to iteratively train the graph embedding representation results until a preset number of iterations is reached to obtain the output transaction scheduling and allocation strategy.

[0100] Optionally, the above-mentioned graph construction unit 502 includes: performing one-hot encoding on transaction information and constructing an embedded representation set of transactions using the splicing result of the transaction information encoding; representing the relationship between transactions in the form of tuples and constructing a transaction relationship set using the relationship tuples; using all features in the embedded representation set as vertex input features and using the features in the transaction relationship set as edge input features to construct a heterogeneous graph.

[0101] Optionally, the above-mentioned graph construction unit 502 represents the relationship between transactions in the form of tuples, and constructs a set of transaction relationships using relation tuples, including: obtaining the relationship types of edges, and encoding and storing the relationship types, wherein the relationship types include sequential execution, data sharing, and data conflict.

[0102] Optionally, the graph learning unit 504 above uses a graph embedding model to learn heterogeneous graphs, so as to map the transaction features in the heterogeneous graphs to a low-dimensional feature space and obtain the graph embedding representation results corresponding to the transaction information. This includes: inputting the vertex features, edge features, and the types of edges between vertices of the heterogeneous graph into the graph embedding model to fit and learn the vertex features, edge features, and edge types to obtain the embedding features of the corresponding vertices; using the embedding features as the input for the next layer of iterative learning, and sequentially passing through a preset layer of iterative learning to obtain the embedding representation of each vertex in the top layer iteration; and collecting the embedding representations of all vertices to obtain the graph embedding representation results corresponding to the transaction information. The graph embedding representation results are matched with the vertices and edges of the heterogeneous graph, and each embedding vector in the graph embedding representation results corresponds one-to-one with the vertex of the heterogeneous graph.

[0103] Optionally, the graph learning unit 504 above fits and learns vertex features, edge features, and edge types to obtain the embedding features of the corresponding vertex, including: fitting and learning based on the embedding features, edge features, vertex features of adjacent vertices including edge types, and weight matrix of the previous layer to obtain the embedding features of the corresponding vertex in the current layer.

[0104] Optionally, the graph learning unit 504 above performs fitting learning based on the embedding features, edge features, vertex features of adjacent vertices including edge types, and weight matrix of the previous layer to obtain the embedding features of the corresponding vertex in the current layer, including: normalizing and summing the embedding features, edge features, and vertex features of adjacent vertices including edge types using the weight matrix, and concatenating the feature vectors; and processing the feature vectors using a nonlinear activation function to obtain the embedding representation of the corresponding vertex in the current layer.

[0105] Optionally, the decision-making unit 506 establishes a Markov decision process model, including: using the graph embedding representation result as the state space input; using the set of all scheduling sequences as the action space; constructing a reward function using transaction completion time, CPU utilization, and data transmission cost; and determining a discount factor.

[0106] Optionally, the decision unit 506 employs deep reinforcement learning to iteratively train the graph embedding representation results, including: using the state in the state space, the order of transaction execution in the action space, and each reward factor of the reward function as input to the policy network and value network in each working network; using the output of the policy network to indicate the probability of determining the order of transaction execution based on the state in the action space, and using the value network to output the value evaluation value in the current state; after each working network performs a preset number of training steps, it feeds the gradient into the global network and receives the updated gradient parameters issued by the global network, thus realizing one iteration of training.

[0107] In this embodiment, a heterogeneous graph is constructed based on collected transaction information. The heterogeneous graph uses transactions as vertices and the relationships between transactions as edges. A graph embedding model is used to learn the heterogeneous graph, mapping the transaction features in the heterogeneous graph to a low-dimensional feature space, thus obtaining the graph embedding representation result corresponding to the transaction information. The graph embedding representation result includes the embedding representation of each vertex in the heterogeneous graph after multi-layer iterative learning of vertex features, connected edge features, and the types of edges between vertices. A Markov decision process model is established, and deep reinforcement learning is used to iteratively train the graph embedding representation result until a preset number of iterations is reached to obtain the output transaction scheduling and allocation strategy. By constructing a graph through transaction information and using graph embedding methods to mine deep features of transactions and dependencies between transactions, and by using deep reinforcement learning to determine the optimal transaction scheduling and allocation strategy, the goal of finding the globally optimal strategy in a huge search space is achieved, avoiding getting trapped in local optima. This achieves the technical effect of a globally optimal scheduling strategy and solves the technical problem that existing transaction scheduling cannot obtain a globally optimal schedule.

[0108] According to another aspect of the present invention, an electronic device for implementing the above-described graph embedding-based transaction scheduling optimization method is also provided. This electronic device may be... Figure 1 The terminal device or server shown. This embodiment uses this electronic device as an example for illustration. Figure 6 As shown, the electronic device includes a memory 602 and a processor 604. The memory 602 stores a computer program, and the processor 604 is configured to execute the steps in any of the above method embodiments via the computer program.

[0109] Optionally, in this embodiment, the aforementioned electronic device may be located in at least one of a plurality of network devices in a computer network.

[0110] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:

[0111] S1. Construct a heterogeneous graph based on the collected transaction information, where the transaction information includes all transactions to be scheduled and transaction parameters. The heterogeneous graph has transactions as vertices and the relationships between transactions as edges.

[0112] S2, a graph embedding model is used to learn heterogeneous graphs to map the transaction features in the heterogeneous graphs to a low-dimensional feature space, and obtain the graph embedding representation results corresponding to the transaction information. The graph embedding representation results include the embedding representation of each vertex in the heterogeneous graph through multi-layer iterative learning of vertex features, connected edge features, and the types of edges between vertices.

[0113] S3. Establish a Markov decision process model and use deep reinforcement learning to iteratively train the graph embedding representation results until a preset number of iterations is reached to obtain the output transaction scheduling and allocation strategy.

[0114] Alternatively, as those skilled in the art will understand, Figure 6 The structure shown is for illustrative purposes only; the electronic device can be any terminal device. Figure 6 This does not limit the structure of the aforementioned electronic devices. For example, the electronic device may also include components that are more... Figure 6 The more or fewer components shown (such as network interfaces, etc.), or having the same Figure 6 The different configurations shown.

[0115] The memory 602 can be used to store software programs and modules, such as the program instructions / modules corresponding to the monitoring method and device for intelligent devices in this embodiment of the invention. The processor 604 executes various functional applications and data processing by running the software programs and modules stored in the memory 602, thereby realizing the above-mentioned transaction scheduling optimization method based on graph embedding. The memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 602 may further include memory remotely located relative to the processor 604, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, enterprise intranets, local area networks, mobile communication networks, and combinations thereof. Specifically, the memory 602 may be used, but is not limited to, to store transaction information, heterogeneous graphs, graph embedding representation results, transaction scheduling allocation measurements, and other information. As an example, such as Figure 6 As shown, the memory 602 may include, but is not limited to, the graph construction unit 502, the graph learning unit 504, and the decision unit 506 in the graph embedding-based transaction scheduling optimization device. Furthermore, it may include, but is not limited to, other module units in the graph embedding-based transaction scheduling optimization device, which will not be elaborated further in this example.

[0116] Optionally, the transmission device 606 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 606 includes a Network Interface Controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In another example, the transmission device 606 is a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0117] In addition, the aforementioned electronic device also includes: a display 608 for displaying the heterogeneous diagram and transaction scheduling allocation measurement; and a connection bus 610 for connecting the various module components in the aforementioned electronic device.

[0118] In other embodiments, the aforementioned terminal device or server can be a node in a distributed system, wherein the distributed system can be a blockchain system, which is a distributed system formed by connecting multiple nodes through network communication. The nodes can form a peer-to-peer (P2P) network, and any form of computing device, such as a server, terminal, or other electronic device, can become a node in the blockchain system by joining this peer-to-peer network.

[0119] According to one aspect of this application, a computer program product or computer program is provided, comprising 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 methods provided in the various alternative implementations of the graph embedding-based transaction scheduling optimization described above. The computer program is configured to execute the steps in any of the above method embodiments at runtime.

[0120] Optionally, in this embodiment, the computer-readable storage medium described above may be configured to store a computer program for performing the following steps:

[0121] S1. Construct a heterogeneous graph based on the collected transaction information, where the transaction information includes all transactions to be scheduled and transaction parameters. The heterogeneous graph has transactions as vertices and the relationships between transactions as edges.

[0122] S2, a graph embedding model is used to learn heterogeneous graphs to map the transaction features in the heterogeneous graphs to a low-dimensional feature space, and obtain the graph embedding representation results corresponding to the transaction information. The graph embedding representation results include the embedding representation of each vertex in the heterogeneous graph through multi-layer iterative learning of vertex features, connected edge features, and the types of edges between vertices.

[0123] S3. Establish a Markov decision process model and use deep reinforcement learning to iteratively train the graph embedding representation results until a preset number of iterations is reached to obtain the output transaction scheduling and allocation strategy.

[0124] Optionally, in this embodiment, those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

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

[0126] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0127] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0128] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.

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

[0130] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0131] The above description is only a preferred 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 transaction scheduling optimization method based on graph embedding, characterized in that, include: A heterogeneous graph is constructed based on the collected transaction information, wherein the transaction information includes all transactions to be scheduled and transaction parameters, and the heterogeneous graph has transactions as vertices and the relationships between transactions as edges; A graph embedding model is used to learn heterogeneous graphs to map the transaction features in the heterogeneous graphs to a low-dimensional feature space, thereby obtaining graph embedding representation results corresponding to the transaction information. The graph embedding representation results include the embedding representation of each vertex in the heterogeneous graph through multi-layer iterative learning of vertex features, connected edge features, and the types of edges between vertices. A Markov decision process model is established, and deep reinforcement learning is used to iteratively train the graph embedding representation results until a preset number of iterations is reached to obtain the output transaction scheduling and allocation strategy. This includes: using the graph embedding representation results as input to the state space; using the set of all scheduling orders as the action space; constructing a reward function using transaction completion time, CPU utilization, and data transmission cost; determining a discount factor; using the state of the state space, the transaction execution order of the action space, and each reward factor of the reward function as input to the policy network and value network in each working network; using the policy network to output the probability of determining the transaction execution order based on the state in the action space, and using the value network to output the value evaluation value in the current state; after each working network performs a preset number of training steps, it feeds the gradient into the global network and receives the updated gradient parameters from the global network, thus achieving one iteration of training.

2. The method according to claim 1, characterized in that, A heterogeneous graph is constructed based on the collected transaction information, including: The transaction information is one-hot encoded, and the embedded representation set of the transaction is constructed using the concatenation result of the transaction information encoding. Relationships between transactions are represented in tuple form, and a set of transaction relationships is constructed using relation tuples; All features in the embedded representation set are used as vertex input features, and features in the transaction relationship set are used as edge input features to construct a heterogeneous graph.

3. The method according to claim 2, characterized in that, Relationships between transactions are represented as tuples, and a set of transaction relations is constructed using relation tuples, including: Obtain the relationship types of the edges, and encode and store the relationship types, wherein the relationship types include sequential execution, data sharing, and data conflict.

4. The method according to claim 1, characterized in that, A graph embedding model is used to learn heterogeneous graphs, mapping the transaction features in the heterogeneous graphs to a low-dimensional feature space to obtain graph embedding representation results corresponding to the transaction information, including: The vertex features, edge features, and types of edges between vertices of the heterogeneous graph are input into the graph embedding model to fit and learn the vertex features, edge features, and types of edges to obtain the embedding features of the corresponding vertices. The embedded features are used as input for the next layer of iterative learning, and the learning is passed through a preset layer of iterative learning to obtain the embedded representation of each vertex in the top layer iteration. The graph embedding representation result corresponding to the transaction information is obtained by collecting the embedding representations of all vertices, wherein the graph embedding representation result is matched with the vertices and edges of the heterogeneous graph, and each embedding vector in the graph embedding representation result corresponds one-to-one with the vertex of the heterogeneous graph.

5. The method according to claim 4, characterized in that, The embedding features of the corresponding vertices are obtained by fitting and learning the vertex features, edge features, and edge types, including: By fitting and learning based on the embedding features, edge features, and vertex features of adjacent vertices including edge types from the previous layer, as well as the weight matrix, the embedding features of the corresponding vertex in the current layer are obtained.

6. The method according to claim 5, characterized in that, Based on the embedding features, edge features, and vertex features of adjacent vertices including edge types from the previous layer, a fitting learning process is performed to obtain the embedding features of the corresponding vertex in the current layer, including: The embedding features, edge features, and vertex features of adjacent vertices including edge types in the previous layer are normalized and summed using a weight matrix, and then the feature vectors are concatenated. The feature vectors are processed using a nonlinear activation function to obtain the embedding representation of the corresponding vertex in the current layer.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method according to any one of claims 1 to 6.

8. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 6 through the computer program.

Citation Information

Patent Citations

  • Task scheduling method based on graph neural network

    CN112486641A

  • Block chain performance optimization method based on multi-agent deep reinforcement learning

    CN115935442A