CN117785488B - Query scheduling method, device, equipment and computer readable storage medium - Google Patents

Query scheduling method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN117785488B
CN117785488B CN202410211538.0A CN202410211538A CN117785488B CN 117785488 B CN117785488 B CN 117785488B CN 202410211538 A CN202410211538 A CN 202410211538A CN 117785488 B CN117785488 B CN 117785488B
Authority
CN
China
Prior art keywords
query
decision
scheduling
model
query instruction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410211538.0A
Other languages
Chinese (zh)
Other versions
CN117785488A (en
Inventor
王龙
王祯
杨钊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Matrix Origin Shenzhen Information Technology Co ltd
Original Assignee
Matrix Origin Shenzhen Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matrix Origin Shenzhen Information Technology Co ltd filed Critical Matrix Origin Shenzhen Information Technology Co ltd
Priority to CN202410211538.0A priority Critical patent/CN117785488B/en
Publication of CN117785488A publication Critical patent/CN117785488A/en
Application granted granted Critical
Publication of CN117785488B publication Critical patent/CN117785488B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a query scheduling method, a query scheduling device, query scheduling equipment and a computer readable storage medium, and belongs to the technical field of database management. Receiving a preset number of client instructions, and outputting query instructions in the client instructions as a query instruction sequence; based on the data of the query instruction sequence, obtaining the optimal scheduling decision with the smallest sum of the transmission delay and the execution delay of all query instructions under the current system configuration, wherein the optimal scheduling decision comprises a decision for distributing computing nodes and a decision for distributing computing resources; according to the optimal scheduling decision, scheduling the query instructions in the query instruction sequence to a preset number of computing nodes respectively, and determining the computing resources of each query instruction scheduled by any computing node. And scheduling the received query instructions to different computing nodes by acquiring an optimal scheduling decision, determining computing resources allocated to each query instruction by the computing nodes, avoiding overload of the computing nodes, and ensuring the performance of the computing nodes.

Description

Query scheduling method, device, equipment and computer readable storage medium
Technical Field
The present application relates to the field of database management technologies, and in particular, to a query scheduling method, apparatus, device, and computer readable storage medium.
Background
With the development of the big data age, the database management system generally adopts horizontal expansion to expand the capacity and throughput of the database, but the horizontal expansion also brings about the problems of resource and node allocation.
In the prior art, most database manufacturers migrate session connection on a server with an oversized load to a server with a smaller load through a polling method on the basis of horizontal capacity expansion of a database, so that the pressure of the whole database management system is relieved.
However, the load is relieved by the polling method, the overload of the server cannot be avoided, and when the session is migrated by the polling method, the situation that the server is temporarily unavailable easily occurs, so that the performance of the server is reduced, and the user experience is poor.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present application and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The application mainly aims to provide a query scheduling method, a query scheduling device, query scheduling equipment and a computer readable storage medium, and aims to prevent overload of computing nodes and ensure performance of the computing nodes by scheduling queries to different computing nodes.
In order to achieve the above object, the present application provides a query scheduling method, including:
receiving a client instruction and outputting a query instruction in the client instruction as a query instruction sequence;
Based on the query instruction sequence, obtaining an optimal scheduling decision with the smallest sum of transmission delay and execution delay of all query instructions under the current system configuration, wherein the optimal scheduling decision comprises a decision for distributing computing nodes and a decision for distributing computing resources;
according to the decision of the distributed computing nodes, scheduling the query instructions in the query instruction sequence to a preset number of computing nodes respectively;
and determining the computing resources of each query instruction scheduled by any computing node according to the decision of distributing the computing resources.
Optionally, the query scheduling method is applied to a query scheduling model, and the query scheduling model is used for outputting the optimal scheduling decision; before the step of obtaining the minimum optimal scheduling decision in the sum of the transmission delay and the execution delay of all the query instructions under the current system configuration based on the query instruction sequence, the method further comprises the following steps:
and constructing the query scheduling model, wherein the optimization target of the query scheduling model is that the sum of the transmission delay and the execution delay of all the query instructions in the query instruction sequence is minimum.
Optionally, the data of the query instruction sequence includes estimated metadata processing amounts of each query instruction in the query instruction sequence, and the current system configuration includes the number of computing nodes, computing resources which can be allocated by each computing node, and a current transmission rate; the query scheduling model comprises an inner layer algorithm model;
the step of constructing the query scheduling model comprises the following steps:
The inner-layer algorithm model is built based on a Markov decision process, and comprises a state space, an action space and a reward function, wherein the state space is built by the estimated metadata processing amount, the number of computing nodes, the computing resources which can be distributed by each computing node and the current transmission rate, the action space is built by the decision of a preset number of distributed computing nodes and the decision of a preset number of distributed computing resources, and the reward function is built by the sum of the preset total time delay and the transmission time delay and the execution time delay.
Optionally, the inner layer algorithm model further comprises an encoder and a decoder; the step of obtaining the minimum optimal scheduling decision in the sum of the transmission delay and the execution delay of all the query instructions under the current system configuration based on the query instruction sequence comprises the following steps:
Inputting a current state space and a sequence index of the query instruction into the encoder and the decoder to obtain a current decision, wherein the current decision comprises a first allocation probability and a second allocation probability, the first allocation probability comprises the probability that any query instruction is scheduled to any computing node, and the second allocation probability comprises the probability that any computing node allocates computing resources to any query instruction;
Inputting the current decision and the current state space and sequence index of the next query instruction to the encoder and the decoder to obtain a new current decision;
returning to execute the step of inputting the current state space and the sequence index of the query instruction to the encoder and the decoder until all the current state spaces of the query instructions are completely decoded;
and outputting the optimal scheduling decision.
Optionally, the step of inputting the current state space and the sequence index of the query instruction to the encoder and the decoder to obtain the current decision includes:
After the current state space and the sequence index of the query instruction are coded, a state vector with a preset length of the query instruction is obtained;
Weighting the state vectors based on an attention mechanism and an output time sequence of the encoder to obtain new state vectors of each query instruction;
and decoding the new state vector through the decoder to obtain a current decision.
Optionally, the query scheduling model includes an outer layer training model; the step of constructing the query scheduling model further comprises the following steps:
constructing an outer layer training model, wherein the training target of the outer layer training model is a rule and a mode for learning and extracting different query instructions;
training the outer layer learning model through a preset number of training sets;
based on a preset number of test sets, evaluating the trained outer layer learning model to obtain an evaluation result, wherein the evaluation result comprises generalization capability and learning speed of the outer layer learning model;
When the evaluation result is converged to a first preset convergence degree, obtaining the outer layer training model after training is completed;
outputting network parameters through the outer layer training model, and training the inner layer algorithm model;
and when the output of the inner-layer algorithm model converges to a second preset convergence degree, obtaining the trained inner-layer algorithm model.
Optionally, after the step of determining the computing resource of each query instruction scheduled by any computing node according to the decision of allocating the computing resource, the method further includes:
executing the query instruction through the computing node, and returning an execution result to the outer layer training model;
Constructing a loss function through a reinforcement learning algorithm based on the execution result and the reward function;
and updating the inner algorithm model through the outer training model based on the loss function.
The application also provides a query scheduling device, which comprises:
The receiving module is used for receiving the client instructions and outputting the query instructions in the client instructions as a query instruction sequence;
The decision module is used for obtaining the optimal scheduling decision with the smallest sum of the transmission delay and the execution delay of all the query instructions under the current system configuration based on the query instruction sequence, wherein the optimal scheduling decision comprises a decision for distributing computing nodes and a decision for distributing computing resources;
the node scheduling module is used for scheduling the query instructions in the query instruction sequence to a preset number of computing nodes respectively according to the decision of the distributed computing nodes;
and the resource scheduling module is used for determining the computing resources of each query instruction scheduled by any computing node according to the decision of distributing the computing resources.
The application also provides a query scheduling device, which comprises: memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the query scheduling method as claimed in any one of the preceding claims.
The application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of the query scheduling method as defined in any of the preceding claims.
The application provides a query scheduling method, which comprises the following steps: receiving a client instruction and outputting a query instruction in the client instruction as a query instruction sequence; based on the query instruction sequence, obtaining an optimal scheduling decision with the smallest sum of transmission delay and execution delay of all query instructions under the current system configuration, wherein the optimal scheduling decision comprises a decision for distributing computing nodes and a decision for distributing computing resources; according to the decision of the distributed computing nodes, the query instructions in the query instruction sequence are respectively scheduled to the preset number of computing nodes, and according to the decision of the distributed computing resources, the computing resources of the query instructions scheduled by any computing node are determined.
In the conventional technology, a load balancing mechanism is introduced while the database expands horizontally, the load balancing mechanism counts the load condition of computing nodes through a polling method, session connection on the computing nodes with overlarge load is migrated to the computing nodes with smaller load, so that the pressure of the whole database management system is relieved, but the polling method cannot avoid the overload condition of the computing nodes, so that the performance of the computing nodes cannot be ensured, and the polling method also needs to periodically start a background task to access each computing node in the cluster to achieve the aim of load balancing, so that the working pressure of the cluster is increased, the performance of the computing nodes is reduced, in addition, the condition that the computing nodes are unavailable easily occurs in the session migration process, and the user experience is influenced.
Different from the conventional means, the method and the device acquire the optimal scheduling decisions corresponding to all the query instructions in the query instruction sequence based on the data of the query instruction sequence and the current system configuration, do not need to periodically start additional polling tasks, and reduce the working pressure of the computing node cluster; then, according to the decision of distributing the computing nodes in the optimal scheduling decision, scheduling the query instructions in the query instruction sequence to a preset number of computing nodes respectively, and considering the load balance of each computing node in the cluster when scheduling the query instructions, avoiding the overload condition of the computing nodes from the root, rather than migrating the session on the computing node with overlarge load to the computing node with small load after the overload condition of the computing node occurs; further, according to the decision of allocating computing resources, any query instruction of any computing node is allocated with computing resources, the load after each computing node receives the query instruction is prejudged firstly by acquiring the optimal scheduling decision, the condition that the computing nodes are overlarge in load is radically avoided, the preset number of query instructions are shared to different computing nodes, so that overload of the computing nodes is avoided, the performance of the computing nodes is ensured, the user experience sense is improved, in addition, the overall performance of a computing node cluster can be effectively improved by controlling the computing resources allocated to each query instruction by each computing node, and the reliability and the stability of a database management system applying the query scheduling method provided by the application are improved while the query requirement is met.
Drawings
FIG. 1 is a schematic diagram of a query scheduling device of a hardware operating environment according to an embodiment of the present application;
FIG. 2 is a flow chart of a first embodiment of the present application;
FIG. 3 is a schematic diagram of an optimal scheduling decision according to an embodiment of the present application;
FIG. 4 is a diagram of a query scheduling application of a query scheduling model according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a codec according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a framework of a query scheduling model according to an embodiment of the present application;
fig. 7 is a schematic block diagram of a query scheduling model according to an embodiment of the present application.
The achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
Referring to fig. 1, fig. 1 is a schematic diagram of a query scheduling device structure of a hardware running environment according to an embodiment of the present application.
As shown in fig. 1, the query scheduling device may include: a processor 1001, such as a central processing unit (Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., a wireless FIdelity (WI-FI) interface). The Memory 1005 may be a high-speed random access Memory (Random Access Memory, RAM) Memory or a stable Non-Volatile Memory (NVM), such as a disk Memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
Those skilled in the art will appreciate that the structure shown in fig. 1 does not constitute a limitation of the query scheduling device, and may include more or fewer components than shown, or may combine certain components, or may be a different arrangement of components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a computer program may be included in the memory 1005 as one type of storage medium.
In the query scheduling device shown in fig. 1, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the query scheduling device of the present application may be provided in the query scheduling device, where the query scheduling device calls the computer program stored in the memory 1005 through the processor 1001 and executes the query scheduling method provided by the embodiment of the present application:
receiving a client instruction and outputting a query instruction in the client instruction as a query instruction sequence;
Based on the query instruction sequence, obtaining an optimal scheduling decision with the smallest sum of transmission delay and execution delay of all query instructions under the current system configuration, wherein the optimal scheduling decision comprises a decision for distributing computing nodes and a decision for distributing computing resources;
according to the decision of the distributed computing nodes, scheduling the query instructions in the query instruction sequence to a preset number of computing nodes respectively;
and determining the computing resources of each query instruction scheduled by any computing node according to the decision of distributing the computing resources.
In an embodiment, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
The query scheduling method is applied to a query scheduling model, and the query scheduling model is used for outputting the optimal scheduling decision; before the step of obtaining the minimum optimal scheduling decision in the sum of the transmission delay and the execution delay of all the query instructions under the current system configuration based on the query instruction sequence, the method further comprises the following steps:
and constructing the query scheduling model, wherein the optimization target of the query scheduling model is that the sum of the transmission delay and the execution delay of all the query instructions in the query instruction sequence is minimum.
In an embodiment, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
The data of the query instruction sequence comprises estimated metadata processing amount of each query instruction in the query instruction sequence, and the current system configuration comprises the number of computing nodes, computing resources which can be distributed by each computing node and current transmission rate; the query scheduling model comprises an inner layer algorithm model;
the step of constructing the query scheduling model comprises the following steps:
The inner-layer algorithm model is built based on a Markov decision process, and comprises a state space, an action space and a reward function, wherein the state space is built by the estimated metadata processing amount, the number of computing nodes, the computing resources which can be distributed by each computing node and the current transmission rate, the action space is built by the decision of a preset number of distributed computing nodes and the decision of a preset number of distributed computing resources, and the reward function is built by the sum of the preset total time delay and the transmission time delay and the execution time delay.
In an embodiment, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
the inner layer algorithm model further comprises an encoder and a decoder; the step of obtaining the minimum optimal scheduling decision in the sum of the transmission delay and the execution delay of all the query instructions under the current system configuration based on the query instruction sequence comprises the following steps:
Inputting a current state space and a sequence index of the query instruction into the encoder and the decoder to obtain a current decision, wherein the current decision comprises a first allocation probability and a second allocation probability, the first allocation probability comprises the probability that any query instruction is scheduled to any computing node, and the second allocation probability comprises the probability that any computing node allocates computing resources to any query instruction;
Inputting the current decision and the current state space and sequence index of the next query instruction to the encoder and the decoder to obtain a new current decision;
returning to execute the step of inputting the current state space and the sequence index of the query instruction to the encoder and the decoder until all the current state spaces of the query instructions are completely decoded;
and outputting the optimal scheduling decision.
In an embodiment, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
the step of inputting the current state space and the sequence index of the query instruction to the encoder and the decoder to obtain the current decision comprises the following steps:
After the current state space and the sequence index of the query instruction are coded, a state vector with a preset length of the query instruction is obtained;
Weighting the state vectors based on an attention mechanism and an output time sequence of the encoder to obtain new state vectors of each query instruction;
and decoding the new state vector through the decoder to obtain a current decision.
In an embodiment, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
the query scheduling model comprises an outer layer training model; the step of constructing the query scheduling model further comprises the following steps:
constructing an outer layer training model, wherein the training target of the outer layer training model is a rule and a mode for learning and extracting different query instructions;
training the outer layer learning model through a preset number of training sets;
based on a preset number of test sets, evaluating the trained outer layer learning model to obtain an evaluation result, wherein the evaluation result comprises generalization capability and learning speed of the outer layer learning model;
When the evaluation result is converged to a first preset convergence degree, obtaining the outer layer training model after training is completed;
outputting network parameters through the outer layer training model, and training the inner layer algorithm model;
and when the output of the inner-layer algorithm model converges to a second preset convergence degree, obtaining the trained inner-layer algorithm model.
In an embodiment, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
After the step of determining the computing resource of each query instruction scheduled by any computing node according to the decision of allocating the computing resource, the method further includes:
executing the query instruction through the computing node, and returning an execution result to the outer layer training model;
Constructing a loss function through a reinforcement learning algorithm based on the execution result and the reward function;
and updating the inner algorithm model through the outer training model based on the loss function.
An embodiment of the present application provides a query scheduling method, referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of a query scheduling method of the present application.
In this embodiment, the query scheduling method includes:
step S10: receiving a client instruction and outputting a query instruction in the client instruction as a query instruction sequence;
In this embodiment, the server receives a preset number of client instructions, and outputs query instructions with an instruction type of data query in the received client instructions as a query instruction sequence, where the query instruction sequence is 1 or more query instructions received by the server, and the server is a database management system, and the client is an application program or tool that interacts and manages with a database, for example, the client may be MySQL Workbench (visual database design software) and database management tool software (SQL SERVER MANAGEMENT Studio, SSMS) client instructions are SQL sentences (Structured Query Language ), and the query instruction sequence at least includes one query instruction, where the preset number may be adjusted according to an actual situation, for example, the preset number may be all client instructions currently transmitted to the server, or the server may preset the maximum number of receivable client instructions.
The client instructions comprise other instructions of a data definition language, a data operation language or a data control language besides query instructions of the type of data query;
Optionally, according to the connection information of the client session, transmitting other instructions except the query instruction in the client instructions to a computing node which is connected with the client session.
Step S20: based on the query instruction sequence, obtaining an optimal scheduling decision with the smallest sum of transmission delay and execution delay of all query instructions under the current system configuration, wherein the optimal scheduling decision comprises a decision for distributing computing nodes and a decision for distributing computing resources;
In this embodiment, the data of the query instruction sequence includes, but is not limited to, the number of query instructions in the query instruction sequence Information content of each query instruction/>Estimated metadata throughput per query instructionThe estimated metadata processing amount comprises metadata and relation data required by each query instruction when the query instruction is executed; current system configurations include, but are not limited to, computing the number of nodes/>Computing resources allocable to each computing node, computing resources allocated to any query instruction by any computing node/>Current transmission rate/>Transmission delay/>Weight parameter/>And execution delay/>Weight parameter/>Based on the parameters, obtaining an optimal scheduling decision, wherein the optimal scheduling decision is a scheduling decision with the minimum sum of transmission delay and execution delay of all query instructions when the query instruction sequence is executed, and concretely, the optimal scheduling decision is obtained by referring to the following formula:
wherein the transmission delay is And execution delay/>Reference is made to the formula:
In the method, in the process of the invention, Representing a query instruction; /(I)Is a vector with length of n, n is the number of computing nodes in the server; the computing node allocates no more computing resources than the maximum of the computing node resources to all query instructions dispatched to the computing node.
Step S30: according to the decision of the distributed computing nodes, scheduling the query instructions in the query instruction sequence to a preset number of computing nodes respectively;
In this embodiment, according to the decision of allocating the computing nodes in the optimal scheduling decision, the query instruction sequence is respectively scheduled to the corresponding preset number of computing nodes, where the preset number of computing nodes may be all the computing nodes in the server, or may be the computing nodes in the server whose load does not exceed the preset index. The manner of allocating the query instruction to the computing nodes includes that 1 query instruction is allocated to 1 computing node, or that a plurality of query instructions are allocated to 1 computing node, referring to fig. 3, assuming that the query instruction sequence includes query instructions a/B/C, the computing node cluster of the server side includes computing nodes 1/2/3, at which the processing task of the computing node 2 has reached the upper limit, based on the information amount of each query instruction, the estimated metadata processing amount, and the system configuration of each computing node, the output decision of allocating the computing node is: the query instruction A is scheduled to the computing node 1 for processing, and the query instructions B and C are scheduled to the computing node 3 for processing.
Step S40: and determining the computing resources of each query instruction scheduled by any computing node according to the decision of distributing the computing resources.
In this embodiment, according to the decision of allocating computing resources in the optimal scheduling decision, computing resources are allocated to the query instruction scheduled to the computing node by the computing node in the server, where the computing resources may be hardware resources and/or software resources, and the sources may be local devices or cloud servers. Referring to fig. 3, assuming that the query instruction sequence includes a query instruction a/B/C, the computing node cluster of the server includes computing nodes 1/2/3, the query instruction a is scheduled to be processed by the computing node 1 according to a decision of allocating the computing nodes, and after the query instruction B and the query instruction C are scheduled to be processed by the computing node 3, each computing node allocates computing resources respectively according to the decision of allocating the computing resources to the query instructions of each computing node.
The application provides a query scheduling method, which comprises the following steps: receiving a client instruction and outputting a query instruction in the client instruction as a query instruction sequence; based on the query instruction sequence, obtaining an optimal scheduling decision with the smallest sum of transmission delay and execution delay of all query instructions under the current system configuration, wherein the optimal scheduling decision comprises a decision for distributing computing nodes and a decision for distributing computing resources; according to the decision of the distributed computing nodes, the query instructions in the query instruction sequence are respectively scheduled to the preset number of computing nodes, and according to the decision of the distributed computing resources, the computing resources of the query instructions scheduled by any computing node are determined.
In the conventional technology, a load balancing mechanism is introduced while the database expands horizontally, the load balancing mechanism counts the load condition of computing nodes through a polling method, session connection on the computing nodes with overlarge load is migrated to the computing nodes with smaller load, so that the pressure of the whole database management system is relieved, but the polling method cannot avoid the overload condition of the computing nodes, so that the performance of the computing nodes cannot be ensured, and the polling method also needs to periodically start a background task to access each computing node in the cluster to achieve the aim of load balancing, so that the working pressure of the cluster is increased, the performance of the computing nodes is reduced, in addition, the condition that the computing nodes are unavailable easily occurs in the session migration process, and the user experience is influenced.
Different from the conventional means, the method and the device acquire the optimal scheduling decisions corresponding to all the query instructions in the query instruction sequence based on the data of the query instruction sequence and the current system configuration, do not need to periodically start additional polling tasks, and reduce the working pressure of the computing node cluster; then, according to the decision of distributing the computing nodes in the optimal scheduling decision, scheduling the query instructions in the query instruction sequence to a preset number of computing nodes respectively, and considering the load balance of each computing node in the cluster when scheduling the query instructions, avoiding the overload condition of the computing nodes from the root, rather than migrating the session on the computing node with overlarge load to the computing node with small load after the overload condition of the computing node occurs; further, according to the decision of allocating computing resources, any query instruction of any computing node is allocated with computing resources, the load after each computing node receives the query instruction is prejudged firstly by acquiring the optimal scheduling decision, the condition that the computing nodes are overlarge in load is radically avoided, the preset number of query instructions are shared to different computing nodes, so that overload of the computing nodes is avoided, the performance of the computing nodes is ensured, the user experience sense is improved, in addition, the overall performance of a computing node cluster can be effectively improved by controlling the computing resources allocated to each query instruction by each computing node, and the reliability and the stability of a database management system applying the query scheduling method provided by the application are improved while the query requirement is met.
Preferably, in a second embodiment, based on the above first embodiment, the query scheduling method is applied to a query scheduling model, which is used to output the optimal scheduling decision; before the step of obtaining the minimum optimal scheduling decision in the sum of the transmission delay and the execution delay of all the query instructions under the current system configuration based on the query instruction sequence, the method further comprises the following steps:
and constructing the query scheduling model, wherein the optimization target of the query scheduling model is that the sum of the transmission delay and the execution delay of all the query instructions in the query instruction sequence is minimum.
In an embodiment, the query scheduling method provided by the application is applied to a query scheduling model, and referring to fig. 4, fig. 4 is an application schematic diagram of the query scheduling model, including a scheduling node, a training node, N computing nodes and M storage nodes, where N and M are positive integers; after the server receives the query instruction, the scheduling node is used for scheduling the query instruction to the corresponding computing node, the computing node is used for executing the query instruction scheduled to the computing node, the storage node stores data which are required by the computing node when executing the query instruction and comprise metadata and relational data, after the computing node completes execution, the query result of the query instruction is returned to the scheduling node, the scheduling node returns the result to the client, and the training node can be used for updating and training the query scheduling model according to the execution results of all the computing nodes.
The query scheduling model at least comprises an SQL receiving module, a scheduling decision module and a time delay module;
The SQL receiving module is used for receiving SQL sentences transmitted to the server side by the client side, executing different scheduling decisions according to the type of the SQL sentences, directly sending the SQL sentences to the computing nodes which are kept connected with the client side according to session connection information of the client side if the type of the SQL sentences is a data definition language, a data operation language or a data control language, and scheduling query instructions to the corresponding computing nodes according to the query scheduling method provided by the application if the type of the SQL sentences is a data query.
The scheduling decision module at least comprises one scheduling node, the scheduling decision module is used for executing an optimal scheduling decision on a query instruction with the type of data query, the scheduling decision comprises a decision for distributing computing nodes and a decision for distributing computing resources, the decision for distributing computing nodes represents which computing node to schedule the query instruction to be executed, and the decision for distributing computing resources represents how much computing resources are required to be distributed to a certain query statement scheduled to the computing node by the computing node. In particular, parametersRepresenting decisions to allocate compute nodes,/>Is a vector of length n, n being the number of compute nodes in the cluster,/>Representing a decision to allocate computing resources; exemplary, refer to the following formula,/>Representing decisions to assign query instruction i to compute nodes 1-n,/>Representing Instructions to query/>Assigned to the main computing node,/>Representing Instructions to query/>Assigning to the computing node k for execution; if the value of x in the vector is 1, scheduling the query statement to the (x+1) th computing node:
in addition, parameters The represented action space for the decision to allocate a compute node is discrete, i.e. only one compute node can be selected at a time, while the parameter/>The represented action space for allocating the decisions of the computing resources is continuous, namely the computing resources allocated by the computing nodes to each query are continuous (within a section), so that the action space of the scheduling decisions output by the scheduling decision module related by the application is a mixed action space, and the resource allocation is dynamically adjusted by adopting the mixed action space, so that the flexible selection capability and the optimization capability of the decisions are effectively improved, and the overall performance of a server is improved.
The time delay module is used for calculating the transmission time delay of the scheduling node for transmitting the query instruction to the computing node, and the execution time delay of the query instruction executed on the computing node, and the query instructionThe total delay of (a) is the weighted sum/>, of the transmission delay and the execution delayReference is made to the formula:
the optimization target of the query scheduling model is the same as the optimal scheduling decision, and the optimization target of the query scheduling model is as follows: the sum of the transmission delay and the execution delay of all the inquiry instructions in the inquiry instruction sequence is minimized.
Preferably, in a third embodiment, based on the above second embodiment, the data of the query instruction sequence includes estimated metadata processing amounts of each query instruction in the query instruction sequence, and the current system configuration includes a number of computing nodes, a computing resource assignable by each computing node, and a current transmission rate; the query scheduling model comprises an inner layer algorithm model;
the step of constructing the query scheduling model comprises the following steps:
The inner-layer algorithm model is built based on a Markov decision process, and comprises a state space, an action space and a reward function, wherein the state space is built by the estimated metadata processing amount, the number of computing nodes, the computing resources which can be distributed by each computing node and the current transmission rate, the action space is built by the decision of a preset number of distributed computing nodes and the decision of a preset number of distributed computing resources, and the reward function is built by the sum of the preset total time delay and the transmission time delay and the execution time delay.
In one embodiment, the inner layer algorithm model is a query scheduling decision model of a reinforcement learning algorithm based on a hybrid action space, the process of performing scheduling decisions on a query instruction sequence is modeled as a Markov decision process (Markov Decision Process, MDP), and the state space includes the current transmission rateEstimated metadata throughput for query instruction i/>The number of computing nodes, the computing power/>, including computing node k, in the computing resources that each computing node can allocateThe computing capability at least comprises the computing speed, capacity and parallel processing capability of the computing node; the state space representation is shown as:
the action space includes a decision d to allocate a computing node and a decision to allocate computing resources The preset number can be adjusted according to actual conditions, for example, the number of decisions for distributing the computing nodes is modified by increasing or decreasing the number of the computing nodes, and the number of decisions for distributing the computing resources is adjusted by increasing or decreasing the computing resources; the action space is shown as the formula:
The reward function may be used to update the query scheduling model, for example, by calculating the loss rate from the reward function when updating the inner algorithm model, such that the updated network parameters are back-propagated, the reward function being as shown in:
In the method, in the process of the invention, Representing rewards after executing the query scheduling method provided by the application on the query instruction i,/>Representing a preset total delay,/>For scheduling query instructions directly to the time delays executing on the computing nodes maintaining the session connection; /(I)For inquiry instruction/>I.e. query instruction/>A weighted sum of the transmission delay and the execution delay; by/>Evaluating the performance of the query scheduling method provided by the application, for example, when/>When the positive number or the value is larger than a preset performance threshold, the evaluation result is that the performance is better; when/>When the negative number or the value is smaller than a preset performance threshold, the evaluation result is that the performance is poor, and at the moment, the query scheduling model can be trained through the training node.
Preferably, in a fourth embodiment, based on the above third embodiment, the inner layer algorithm model further includes an encoder and a decoder; the step of obtaining the minimum optimal scheduling decision in the sum of the transmission delay and the execution delay of all the query instructions under the current system configuration based on the query instruction sequence comprises the following steps:
Inputting a current state space and a sequence index of the query instruction into the encoder and the decoder to obtain a current decision, wherein the current decision comprises a first allocation probability and a second allocation probability, the first allocation probability comprises the probability that any query instruction is scheduled to any computing node, and the second allocation probability comprises the probability that any computing node allocates computing resources to any query instruction;
Inputting the current decision and the current state space and sequence index of the next query instruction to the encoder and the decoder to obtain a new current decision;
returning to execute the step of inputting the current state space and the sequence index of the query instruction to the encoder and the decoder until all the current state spaces of the query instructions are completely decoded;
and outputting the optimal scheduling decision.
In an embodiment, in consideration of the relevance between query instructions, in the query scheduling method provided by the application, the inner layer algorithm model further comprises an encoder and a decoder; the codec related to the application is used as a sequence-to-sequence model (Sequence to Sequence, seq2 Seq) constructed based on a cyclic neural network (Recurrent Neural Network, RNN) for capturing the dependency relationship between input and output, and simultaneously, the codec constructed based on the RNN is used for simulating decision, so that the modeling capability of the codec on sequence information is effectively improved.
It can be understood that after the current state space and the sequence index of the query instruction are input to the encoder for encoding, a state vector with a preset length is obtained, and then the state vector with the preset length is input to the decoder for decoding, so as to obtain a current decision, where the current state space, that is, the estimated metadata processing capacity corresponding to the query instruction and the current system configuration, and the sequence index includes that each word or character in the input text or sequence is mapped to its corresponding digital index, and can be used for representing the characteristics of the input data. The preset length can be a set fixed length and can be adjusted according to practical conditions, for example, the output of the encoder is cut off, filled, lifted/dropped or the output length of the encoder is adjusted through an attention mechanism; in addition, the state space corresponding to the query instruction is dynamically changed in real time, and the scheduling decision is acquired based on the state space acquired in real time, so that the timeliness of the query scheduling method is improved.
The method comprises the steps of encoding a current state space corresponding to each query instruction in a query instruction sequence into a state vector with a fixed length through an encoder-decoder structure, decoding the state vector into a current decision through a decoder, wherein the current decision comprises a first allocation probability and a second allocation probability, the first allocation probability comprises the probability that any query instruction is scheduled to any computing node, the second allocation probability comprises the probability that any computing node allocates computing resources to any query instruction, then taking the current decision as a part of the state vector to be decoded next, participating in the input of the state vector to be decoded next, and obtaining an optimal scheduling decision after the state spaces corresponding to all the query instructions are coded and decoded. According to the relevance between the decoded data and the data to be decoded, the data caching in the computing node is utilized, so that the speed of processing the data with the dependency relationship and the data utilization rate are improved, meanwhile, the adaptability of the query scheduling model is enhanced, and the speed of acquiring the scheduling decision for each query instruction is improved.
Preferably, in a fifth embodiment, based on the fourth embodiment, the step of inputting the current state space and the sequence index of the query instruction to the encoder and the decoder to obtain the current decision includes:
After the current state space and the sequence index of the query instruction are coded, a state vector with a preset length of the query instruction is obtained;
Weighting the state vectors based on an attention mechanism and an output time sequence of the encoder to obtain new state vectors of each query instruction;
and decoding the new state vector through the decoder to obtain a current decision.
In an embodiment, after the state space corresponding to the query instruction is encoded by the encoder, the vector output by the encoder is weighted by the attention mechanism, so that vector representations with different lengths can be generated according to the importance of different positions in the input sequence. Referring to fig. 5, P, T, V and pi in fig. 5 are a state space, a sequence index, an action space and an action policy, respectively, after the encoder outputs a current state vector, the current state vector is weighted according to the output time sequence of the encoder based on an attention mechanism, and after a new state vector after the weighting is obtained, the new state vector is input into a decoder for decoding; wherein the output timing indicates the order of the encoder hidden layer output vectors.
The dimension of the state vector in the traditional RNN network is fixed, and the storable information is limited, so that when the queried task is processed, query cache data with a long distance is difficult to acquire, so that an inner layer algorithm cannot ensure a decision effect in decision, and an attention mechanism concentrates limited resources on key information by giving different weights to the output of an encoder hiding layer under different time sequences, and the key information of the prior query data is acquired rapidly, thereby improving the decision efficiency and ensuring the decision effect and the service performance.
Preferably, in a sixth embodiment, based on the fifth embodiment, the query scheduling model includes an outer layer training model; the step of constructing the query scheduling model further comprises the following steps:
constructing an outer layer training model, wherein the training target of the outer layer training model is a rule and a mode for learning and extracting different query instructions;
training the outer layer learning model through a preset number of training sets;
based on a preset number of test sets, evaluating the trained outer layer learning model to obtain an evaluation result, wherein the evaluation result comprises generalization capability and learning speed of the outer layer learning model;
When the evaluation result is converged to a first preset convergence degree, obtaining the outer layer training model after training is completed;
outputting network parameters through the outer layer training model, and training the inner layer algorithm model;
and when the output of the inner-layer algorithm model converges to a second preset convergence degree, obtaining the trained inner-layer algorithm model.
In an embodiment, the outer layer training model is a meta learning model, the rule and mode of different query instructions are learned and extracted through the meta learning model, a large number of training sets are used for training how fast the meta learning model learning is adapted to different tasks and data sets, test evaluation is carried out on the generalization ability and learning speed of the meta learning model, and when the evaluation result converges to a preset convergence degree or the convergence curve tends to be stable, the meta learning model is explained to be trained.
Referring to fig. 6, the trained meta learning model is used to initialize an inner layer algorithm model, specifically, the meta learning model is used to output neural network parameters to the inner layer algorithm model for training, the neural network parameters include weight parameters, the inner layer model returns the parameters to the outer layer model after training for a preset period of time, and then the outer layer model returns the parameters to the inner layer model after updating training until the output of the inner layer algorithm model converges to a preset convergence degree, so as to obtain the trained inner layer algorithm model.
The outer layer training model is constructed into a meta learning model, the meta learning model is utilized to train the inner layer algorithm model, the convergence speed and the algorithm performance of the inner layer algorithm model are accelerated, the adaptability of the inner layer algorithm model is improved, and a system applying the query scheduling method provided by the application can quickly respond to any type of query statement.
Preferably, in a seventh embodiment, based on the sixth embodiment, after the step of determining the computing resource of each query instruction scheduled by any computing node according to the decision of allocating the computing resource, the method further includes:
executing the query instruction through the computing node, and returning an execution result to the outer layer training model;
Constructing a loss function through a reinforcement learning algorithm based on the execution result and the reward function;
and updating the inner algorithm model through the outer training model based on the loss function.
In an embodiment, the query scheduling model further includes an outer layer training model, after the scheduling node distributes the query instruction sequence to each computing node based on the optimal scheduling decision, the computing node executes the query instruction scheduled to the computing node, returns the execution result to the outer layer training model, then constructs a loss function based on the execution result and the reward function through the reinforcement learning algorithm, and updates the inner layer algorithm model based on the loss function through the outer layer training model, specifically, calculates the gradient of the loss function to the network parameters, then updates the network parameters through the gradient descent method, propagates the error from the output layer to the input layer, thereby calculating the contribution of each parameter to the overall loss, and adjusting the value of the parameter according to the direction of the gradient, so as to achieve the purpose of optimizing the query scheduling model.
The reinforcement learning algorithm is a PPO algorithm (Proximal Policy Optimization, a near-end strategy optimization algorithm), the outer training model is a meta learning model, and the training target of the outer training model is a rule and mode for learning and extracting different query instructions.
Inclusion of loss functions in PPO algorithmsDominance function/>Cost loss function/>And policy entropyLoss function/>Reference is made to the formula: /(I)
Wherein,Representing the near-end ratio clipping penalty, used to limit the magnitude of the network update, can be calculated by:
wherein, Is the update amplitude of the policy,/>Representing that the current policy takes action in the state/>Probability of (1) and old policy in state/>Take action/>Ratio of probabilities,/>Is a merit function for measuring the goodness of the current state and motion with respect to the average level, and refers to the following formula:
wherein, Expressed in state/>Take action/>Value of/>Expressed in state/>Average value under/>Is a super parameter for controlling the clipping amplitude.
Cost loss functionReference is made to the formula:
policy entropy Reference is made to the formula:
Wherein the network parameters Gradient updates may be made by a loss function.
Referring to fig. 7, the present application further provides a query scheduling apparatus, including:
The receiving module M1 is used for receiving client instructions and outputting query instructions in the client instructions as a query instruction sequence;
The decision module M2 is used for obtaining the optimal scheduling decision with the smallest sum of the transmission delay and the execution delay of all the query instructions under the current system configuration based on the query instruction sequence, wherein the optimal scheduling decision comprises a decision for distributing computing nodes and a decision for distributing computing resources;
the node scheduling module M3 is used for scheduling the query instructions in the query instruction sequence to a preset number of computing nodes respectively according to the decision of the distributed computing nodes;
and the resource scheduling module M4 is used for determining the computing resources of each query instruction scheduled by any computing node according to the decision of distributing the computing resources.
Optionally, the query scheduling method is applied to a query scheduling model, and the query scheduling model is used for outputting the optimal scheduling decision; the decision module is further configured to:
and constructing the query scheduling model, wherein the optimization target of the query scheduling model is that the sum of the transmission delay and the execution delay of all the query instructions in the query instruction sequence is minimum.
Optionally, the data of the query instruction sequence includes estimated metadata processing amounts of each query instruction in the query instruction sequence, and the current system configuration includes the number of computing nodes, computing resources which can be allocated by each computing node, and a current transmission rate; the query scheduling model comprises an inner layer algorithm model; the decision module is further configured to:
The inner-layer algorithm model is built based on a Markov decision process, and comprises a state space, an action space and a reward function, wherein the state space is built by the estimated metadata processing amount, the number of computing nodes, the computing resources which can be distributed by each computing node and the current transmission rate, the action space is built by the decision of a preset number of distributed computing nodes and the decision of a preset number of distributed computing resources, and the reward function is built by the sum of the preset total time delay and the transmission time delay and the execution time delay.
Optionally, the inner layer algorithm model further comprises an encoder and a decoder; the decision module is further configured to:
Inputting a current state space and a sequence index of the query instruction into the encoder and the decoder to obtain a current decision, wherein the current decision comprises a first allocation probability and a second allocation probability, the first allocation probability comprises the probability that any query instruction is scheduled to any computing node, and the second allocation probability comprises the probability that any computing node allocates computing resources to any query instruction;
Inputting the current decision and the current state space and sequence index of the next query instruction to the encoder and the decoder to obtain a new current decision;
returning to execute the step of inputting the current state space and the sequence index of the query instruction to the encoder and the decoder until all the current state spaces of the query instructions are completely decoded;
and outputting the optimal scheduling decision.
Optionally, the decision module is further configured to:
After the current state space and the sequence index of the query instruction are coded, a state vector with a preset length of the query instruction is obtained;
Weighting the state vectors based on an attention mechanism and an output time sequence of the encoder to obtain new state vectors of each query instruction;
and decoding the new state vector through the decoder to obtain a current decision.
Optionally, the decision module is further configured to:
constructing an outer layer training model, wherein the training target of the outer layer training model is a rule and a mode for learning and extracting different query instructions;
training the outer layer learning model through a preset number of training sets;
based on a preset number of test sets, evaluating the trained outer layer learning model to obtain an evaluation result, wherein the evaluation result comprises generalization capability and learning speed of the outer layer learning model;
When the evaluation result is converged to a first preset convergence degree, obtaining the outer layer training model after training is completed;
outputting network parameters through the outer layer training model, and training the inner layer algorithm model;
and when the output of the inner-layer algorithm model converges to a second preset convergence degree, obtaining the trained inner-layer algorithm model.
Optionally, the resource scheduling module is further configured to:
executing the query instruction through the computing node, and returning an execution result to the outer layer training model;
Constructing a loss function through a reinforcement learning algorithm based on the execution result and the reward function;
and updating the inner algorithm model through the outer training model based on the loss function.
The query scheduling device provided by the application adopts the query scheduling method in the embodiment, and aims to avoid overload of the computing nodes and ensure the performance of the computing nodes by scheduling the query to different computing nodes. Compared with the conventional technology, the query scheduling device provided by the embodiment of the application has the same beneficial effects as the query scheduling method provided by the embodiment, and other technical features in the query scheduling device are the same as the features disclosed by the method of the embodiment, and are not repeated here.
The application also provides a query scheduling device, which comprises: memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the query scheduling method as claimed in any one of the preceding claims.
The application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of the query scheduling method as defined in any of the preceding claims.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the application, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (6)

1. The query scheduling method is characterized by being applied to a query scheduling model, wherein the query scheduling model is used for outputting an optimal scheduling decision, and comprises an inner algorithm model and an outer training model; the inner layer algorithm model further comprises an encoder and a decoder;
the query scheduling method comprises the following steps:
receiving a client instruction and outputting a query instruction in the client instruction as a query instruction sequence;
constructing the query scheduling model, wherein the optimization target of the query scheduling model is the minimum sum of the transmission delay and the execution delay of all the query instructions in the query instruction sequence;
Based on the query instruction sequence, obtaining an optimal scheduling decision with the smallest sum of transmission delay and execution delay of all query instructions under the current system configuration, wherein the optimal scheduling decision comprises a decision for distributing computing nodes and a decision for distributing computing resources;
according to the decision of the distributed computing nodes, scheduling the query instructions in the query instruction sequence to a preset number of computing nodes respectively;
Determining the computing resources of each inquiry instruction scheduled by any computing node according to the decision of distributing the computing resources;
the data of the query instruction sequence comprises estimated metadata processing amounts of all query instructions in the query instruction sequence, and the current system configuration comprises the number of computing nodes, computing resources which can be distributed by all the computing nodes and current transmission rate;
the step of constructing the query scheduling model comprises the following steps:
Establishing the inner-layer algorithm model based on a Markov decision process, wherein the inner-layer algorithm model comprises a state space, an action space and a reward function, the state space is constructed by the estimated metadata processing amount, the number of computing nodes, the computing resources which can be allocated by each computing node and the current transmission rate, the action space is constructed by the decision of a preset number of allocation computing nodes and the decision of a preset number of allocation computing resources, and the reward function is constructed by the preset total time delay and the sum of the transmission time delay and the execution time delay;
The step of obtaining the minimum optimal scheduling decision in the sum of the transmission delay and the execution delay of all the query instructions under the current system configuration based on the query instruction sequence comprises the following steps:
Inputting a current state space and a sequence index of the query instruction into the encoder and the decoder to obtain a current decision, wherein the current decision comprises a first allocation probability and a second allocation probability, the first allocation probability comprises the probability that any query instruction is scheduled to any computing node, and the second allocation probability comprises the probability that any computing node allocates computing resources to any query instruction;
Inputting the current decision and the current state space and sequence index of the next query instruction to the encoder and the decoder to obtain a new current decision;
returning to execute the step of inputting the current state space and the sequence index of the query instruction to the encoder and the decoder until all the current state spaces of the query instructions are completely decoded;
Outputting an optimal scheduling decision;
the step of constructing the query scheduling model further comprises the following steps:
constructing an outer layer training model, wherein the training target of the outer layer training model is a rule and a mode for learning and extracting different query instructions;
training the outer layer training model through a preset number of training sets;
Based on a preset number of test sets, evaluating the trained outer layer training model to obtain an evaluation result, wherein the evaluation result comprises generalization capability and learning speed of the outer layer training model;
When the evaluation result is converged to a first preset convergence degree, obtaining the outer layer training model after training is completed;
outputting network parameters through the outer layer training model, and training the inner layer algorithm model;
and when the output of the inner-layer algorithm model converges to a second preset convergence degree, obtaining the trained inner-layer algorithm model.
2. The query scheduling method of claim 1, wherein said step of inputting a current state space and a sequence index of said query instruction to said encoder and said decoder to obtain a current decision comprises:
After the current state space and the sequence index of the query instruction are coded, a state vector with a preset length of the query instruction is obtained;
Weighting the state vectors based on an attention mechanism and an output time sequence of the encoder to obtain new state vectors of each query instruction;
and decoding the new state vector through the decoder to obtain a current decision.
3. The query scheduling method of claim 1, wherein after the step of determining the computing resources of each query instruction to which any computing node is scheduled based on the decision to allocate computing resources, further comprising:
executing the query instruction through the computing node, and returning an execution result to the outer layer training model;
Constructing a loss function through a reinforcement learning algorithm based on the execution result and the reward function;
and updating the inner algorithm model through the outer training model based on the loss function.
4. The query scheduling device is characterized by being applied to a query scheduling model, wherein the query scheduling model is used for outputting an optimal scheduling decision, and comprises an inner algorithm model and an outer training model; the inner layer algorithm model further comprises an encoder and a decoder; the query scheduling device comprises:
The receiving module is used for receiving the client instructions and outputting the query instructions in the client instructions as a query instruction sequence;
The decision module is used for obtaining the optimal scheduling decision with the smallest sum of the transmission delay and the execution delay of all the query instructions under the current system configuration based on the query instruction sequence, wherein the optimal scheduling decision comprises a decision for distributing computing nodes and a decision for distributing computing resources;
the node scheduling module is used for scheduling the query instructions in the query instruction sequence to a preset number of computing nodes respectively according to the decision of the distributed computing nodes;
the resource scheduling module is used for determining the computing resources of each query instruction scheduled by any computing node according to the decision of distributing the computing resources;
the decision module is further configured to:
constructing the query scheduling model, wherein the optimization target of the query scheduling model is the minimum sum of the transmission delay and the execution delay of all the query instructions in the query instruction sequence;
the data of the query instruction sequence comprises estimated metadata processing amounts of all query instructions in the query instruction sequence, and the current system configuration comprises the number of computing nodes, computing resources which can be distributed by all the computing nodes and current transmission rate;
the decision module is further configured to:
Establishing the inner-layer algorithm model based on a Markov decision process, wherein the inner-layer algorithm model comprises a state space, an action space and a reward function, the state space is constructed by the estimated metadata processing amount, the number of computing nodes, the computing resources which can be allocated by each computing node and the current transmission rate, the action space is constructed by the decision of a preset number of allocation computing nodes and the decision of a preset number of allocation computing resources, and the reward function is constructed by the preset total time delay and the sum of the transmission time delay and the execution time delay;
the decision module is further configured to:
Inputting a current state space and a sequence index of the query instruction into the encoder and the decoder to obtain a current decision, wherein the current decision comprises a first allocation probability and a second allocation probability, the first allocation probability comprises the probability that any query instruction is scheduled to any computing node, and the second allocation probability comprises the probability that any computing node allocates computing resources to any query instruction;
Inputting the current decision and the current state space and sequence index of the next query instruction to the encoder and the decoder to obtain a new current decision;
returning to execute the step of inputting the current state space and the sequence index of the query instruction to the encoder and the decoder until all the current state spaces of the query instructions are completely decoded;
Outputting an optimal scheduling decision;
the decision module is further configured to:
constructing an outer layer training model, wherein the training target of the outer layer training model is a rule and a mode for learning and extracting different query instructions;
training the outer layer training model through a preset number of training sets;
Based on a preset number of test sets, evaluating the trained outer layer training model to obtain an evaluation result, wherein the evaluation result comprises generalization capability and learning speed of the outer layer training model;
When the evaluation result is converged to a first preset convergence degree, obtaining the outer layer training model after training is completed;
outputting network parameters through the outer layer training model, and training the inner layer algorithm model;
and when the output of the inner-layer algorithm model converges to a second preset convergence degree, obtaining the trained inner-layer algorithm model.
5. A query scheduling device, the query scheduling device comprising: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the query scheduling method of any one of claims 1 to 3.
6. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the query scheduling method of any of claims 1 to 3.
CN202410211538.0A 2024-02-27 2024-02-27 Query scheduling method, device, equipment and computer readable storage medium Active CN117785488B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410211538.0A CN117785488B (en) 2024-02-27 2024-02-27 Query scheduling method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410211538.0A CN117785488B (en) 2024-02-27 2024-02-27 Query scheduling method, device, equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN117785488A CN117785488A (en) 2024-03-29
CN117785488B true CN117785488B (en) 2024-04-26

Family

ID=90391318

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410211538.0A Active CN117785488B (en) 2024-02-27 2024-02-27 Query scheduling method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN117785488B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113032120A (en) * 2021-03-26 2021-06-25 重庆大学 Industrial field big data task coordination degree method based on edge calculation
CN114448806A (en) * 2020-10-16 2022-05-06 广州海格通信集团股份有限公司 Resource scheduling method and device of software defined network
CN115878910A (en) * 2022-11-18 2023-03-31 深圳依时货拉拉科技有限公司 Line query method, device and storage medium
CN117014389A (en) * 2023-08-07 2023-11-07 中国电信股份有限公司技术创新中心 Computing network resource allocation method and system, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103092683B (en) * 2011-11-07 2017-12-26 Sap欧洲公司 For data analysis based on didactic scheduling
CN106528280B (en) * 2015-09-15 2019-10-29 阿里巴巴集团控股有限公司 A kind of method for allocating tasks and system
CN110431806B (en) * 2017-04-19 2021-02-05 华为技术有限公司 System and method for local scheduling of low-delay nodes in distributed resource management

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114448806A (en) * 2020-10-16 2022-05-06 广州海格通信集团股份有限公司 Resource scheduling method and device of software defined network
CN113032120A (en) * 2021-03-26 2021-06-25 重庆大学 Industrial field big data task coordination degree method based on edge calculation
CN115878910A (en) * 2022-11-18 2023-03-31 深圳依时货拉拉科技有限公司 Line query method, device and storage medium
CN117014389A (en) * 2023-08-07 2023-11-07 中国电信股份有限公司技术创新中心 Computing network resource allocation method and system, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
高性能计算机资源管理系统改进设计与实现;顾文静 等;《计算技术与自动化》;20171231;第36卷(第4期);全文 *

Also Published As

Publication number Publication date
CN117785488A (en) 2024-03-29

Similar Documents

Publication Publication Date Title
US20220391771A1 (en) Method, apparatus, and computer device and storage medium for distributed training of machine learning model
CN113950066B (en) Single server part calculation unloading method, system and equipment under mobile edge environment
CN111459628A (en) Spark platform task scheduling method based on improved quantum ant colony algorithm
CN113141317B (en) Streaming media server load balancing method, system, computer equipment and terminal
CN111124689A (en) Dynamic allocation method for container resources in cluster
CN111611062B (en) Cloud-edge collaborative hierarchical computing method and cloud-edge collaborative hierarchical computing system
CN113037877B (en) Optimization method for time-space data and resource scheduling under cloud edge architecture
CN112988345A (en) Dependency task unloading method and device based on mobile edge calculation
CN109656713B (en) Container scheduling method based on edge computing framework
CN113822456A (en) Service combination optimization deployment method based on deep reinforcement learning in cloud and mist mixed environment
CN112084035B (en) Task scheduling method and system based on ant colony algorithm
CN113364859A (en) MEC-oriented joint computing resource allocation and unloading decision optimization scheme in Internet of vehicles
CN114328291A (en) Industrial Internet edge service cache decision method and system
CN115454612A (en) Cloud platform task scheduling method based on dimension learning strategy and wolf optimization
CN107566535B (en) Self-adaptive load balancing method based on concurrent access timing sequence rule of Web map service
CN111176784A (en) Virtual machine integration method based on extreme learning machine and ant colony system
CN110743164B (en) Dynamic resource partitioning method for reducing response delay in cloud game
CN117785488B (en) Query scheduling method, device, equipment and computer readable storage medium
CN113342504A (en) Intelligent manufacturing edge calculation task scheduling method and system based on cache
CN112312299A (en) Service unloading method, device and system
CN113543160A (en) 5G slice resource allocation method and device, computing equipment and computer storage medium
CN113672372B (en) Multi-edge collaborative load balancing task scheduling method based on reinforcement learning
CN115562833A (en) Workflow optimization scheduling method based on improved goblet sea squirt algorithm
CN115499876A (en) Computing unloading strategy based on DQN algorithm under MSDE scene
CN115801896A (en) Calculation network node distribution method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant