WO2020211358A1 - Database scheduling method and apparatus, and computer device and storage medium - Google Patents

Database scheduling method and apparatus, and computer device and storage medium Download PDF

Info

Publication number
WO2020211358A1
WO2020211358A1 PCT/CN2019/118039 CN2019118039W WO2020211358A1 WO 2020211358 A1 WO2020211358 A1 WO 2020211358A1 CN 2019118039 W CN2019118039 W CN 2019118039W WO 2020211358 A1 WO2020211358 A1 WO 2020211358A1
Authority
WO
WIPO (PCT)
Prior art keywords
executed
path
steps
priority
time required
Prior art date
Application number
PCT/CN2019/118039
Other languages
French (fr)
Chinese (zh)
Inventor
李家捷
Original Assignee
平安普惠企业管理有限公司
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 平安普惠企业管理有限公司 filed Critical 平安普惠企业管理有限公司
Publication of WO2020211358A1 publication Critical patent/WO2020211358A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Definitions

  • This application relates to the field of scheduling and application of database platforms, and in particular to a database scheduling method, device, computer equipment, and storage medium.
  • Database scheduling is to perform a series of operations in order. At present, the inventor found that in database scheduling, priority settings are often only performed for scheduling jobs, and there is no optimization method for scheduling jobs themselves, and the overall scheduling time is longer.
  • this application proposes a database scheduling method, device, computer equipment, and storage medium, which can optimize the scheduling timeliness of jobs in the database scheduling process.
  • this application proposes a database scheduling method, the method includes: calculating a plurality of paths included in a triggered operation series; wherein, the operation series includes a plurality of steps to be executed; The to-be-executed steps required by the path calculate the time required to execute each path; database scheduling is performed, and the to-be-executed steps of the path with the longest time required are preferentially executed in the database scheduling process.
  • the present application also provides a database scheduling device, which includes: a path calculation module adapted to calculate multiple paths included in a triggered operation series; wherein the operation series includes a plurality of steps to be executed;
  • the time calculation module is adapted to calculate the time required to execute each path according to the to-be-executed steps required for each path;
  • the scheduling module is adapted to perform database scheduling, and in the database scheduling process, the execution of the longest time required The steps to be executed on the path.
  • the present application also provides a computer device, including a memory, a processor, and computer-readable instructions stored in the memory and capable of running on the processor.
  • the processor executes the computer-readable instructions when the computer-readable instructions are executed.
  • the present application also provides a non-volatile computer-readable storage medium having computer-readable instructions stored thereon, and the computer-readable instructions implement the foregoing database scheduling method when executed by a processor.
  • the computer can calculate the key steps of the critical path in the database scheduling process and give it higher Priority allows computer resources to be used first on the key steps of the critical path, thereby optimizing the overall scheduling timeliness and reducing the overall delay of the computer scheduling process.
  • FIG. 1 is a diagram of an optional application environment of the database scheduling method of each embodiment of the present application
  • Figure 2 is a topological diagram of a set of operation series in the database of each embodiment of the present application.
  • FIG. 3 is a schematic flowchart of the database scheduling method according to the first embodiment of the present application.
  • FIG. 4 is a schematic flow chart of determining key steps in the database scheduling method of the first embodiment of the present application.
  • FIG. 5 is a schematic flowchart of another critical step in the database scheduling method of the first embodiment of the present application.
  • FIG. 6 is a schematic diagram of the process of judging the critical path in the database scheduling method of the first embodiment of the present application.
  • FIG. 7 is a schematic diagram of program modules of the database scheduling device according to the second embodiment of the present application.
  • FIG. 8 is a schematic diagram of the hardware structure of the computer device according to the third embodiment of the present application.
  • FIG. 1 is a schematic diagram of an optional application environment for database scheduling.
  • the business system 20 communicates with the database 10 in a wired or wireless manner.
  • the user can interact with the business system 20 to make the business system 20 perform all operations.
  • the business system 20 may be in the form of hardware with computing capabilities such as computers, mobile phones, tablet computers, and servers.
  • the database 10 can be a private resource for users to use alone.
  • the database 10 is a shared resource that can be used by multiple users.
  • the database 10 can provide multiple resources including access data.
  • the user can also customize a series of operations including multiple operations.
  • This series of operations includes multiple steps to be performed.
  • the steps to be performed include trigger conditions that trigger one or more other steps to be performed, that is, these steps to be performed There is a dependency relationship in the steps, and the execution of some steps depends on other steps being executed first. Once the series of operations including these steps to be executed are triggered to be executed, the steps to be executed will be executed in order, which is equivalent to that one operation can Multiple operations were performed.
  • the database needs to store the customer's order information, and the database needs to update the inventory quantity of the product. .
  • the database call includes 7 steps S1, S2, S3, S4, S5, S6, S7, where step S1 includes trigger conditions for triggering steps S2 and S3.
  • S2 includes the trigger conditions for triggering step S4,
  • step S3 includes the trigger conditions for triggering steps S4 and S6,
  • step S4 includes the trigger conditions for triggering step S5, and both steps S5 and S6 include the trigger conditions for triggering step S7.
  • FIG. 3 is a flowchart of an embodiment of a database scheduling method of the present application.
  • the method includes the following steps S301-S303:
  • Step S301 Calculate multiple paths included in the triggered operation series.
  • the path is an orderly execution chain formed by a series of multiple steps to be executed in the series of operations.
  • each step to be executed may include conditions that trigger the execution of multiple steps.
  • step S1 includes conditions for triggering the execution of steps S2 and S3. After step S1 is executed, this trigger condition is triggered, and then steps S2 and S3 are executed. Steps S2 and S3 both include the trigger conditions that trigger the execution of step S4. Therefore, there are two execution paths from steps S1-S4, which are steps S1-S2-S4 and steps S1-S3-S4, because steps S2 and S3 The required time is not used, so the paths S1-S2-S4 and paths S1-S3-S4 take different time.
  • the method for calculating the multiple paths included in the triggered operation series specifically includes steps S301a-S301b:
  • Step S301a Form the topological relationship between all the steps to be executed according to all the trigger conditions; specifically, determine in turn whether each step to be executed contains a trigger condition, if the step to be executed contains a trigger condition, The trigger condition obtains the sequence number of each to-be-executed step that depends on the to-be-executed step, and establishes the topological relationship between the to-be-executed step and the triggered to-be-executed step.
  • Step S301b generating all the orderly execution chains composed of the steps to be executed according to the topological relationship, and these orderly execution chains are the paths.
  • Step S302 Calculate the time required to execute each path according to the to-be-executed steps required for each path.
  • the time required to load each step to be executed can be manually entered in the database, but preferably, the following step is included before this step is executed: separately loading all the steps to be executed included in the operation series , Record the loading time required to load each step to be executed.
  • the individual loading process of the steps to be executed is a trial execution of the steps to be executed, that is, each step to be executed is individually loaded into the CPU cache of the business system 20, and the computing resources required to execute each step to be executed separately can be known according to the loading time. It can provide a basis for optimizing the use of computing resources during the subsequent execution of the entire series of operations. In this way, before calculating the total time of each path, the time required for each step to be executed can be known by preloading and entered into the database 10. During the implementation of this step, each path included Add the loading time of all the steps to be executed to get the time required to execute each path.
  • step S303 database scheduling is performed, and the steps to be executed of the path with the longest time required are preferentially executed in the database scheduling process.
  • each different path is automatically based on trigger conditions.
  • a certain key step of the path that takes a long time to be executed may take a long time, but it is executed later. At this time, computer resources are already occupied by other steps, resulting in a long overall time.
  • the steps to be executed in the path that takes the longest time to be executed first can be embodied as: if a previous step to be executed contains the trigger conditions of the other two steps to be executed, the previous step to be executed runs After completion, the next step will give priority to the steps to be executed on the path that takes a longer time.
  • the steps to be executed of the path with the longest time required to be executed first can also be embodied as: each step of the path with the longest time in the database scheduling process is assigned higher The priority of each step on this path will be executed first, and the steps of the path with less time will be executed after the path with the longest time is executed, so as to ensure that the computer resources are given priority to execute these time On the critical path, thereby reducing the overall delay.
  • steps S1, S3, S6, and S7 in the longest path L3 are assigned a higher priority.
  • steps S1, S3, S6, and S7 are executed first to ensure the priority use of computer resources In the critical steps of the critical path, the overall delay of the database scheduling process can be reduced.
  • the priority in addition to the priority optimization for the steps to be executed on the path with the longest running time, for other paths, the priority can be set according to the length of the running time, that is, the path with the longer running time is required
  • the steps to be executed are assigned a higher priority, and the steps to be executed with a shorter running time are assigned a lower priority.
  • the order of the running time of the three paths is T3> T2>T1, based on this, in addition to assigning higher priority to the steps to be executed on the L3 path, the steps to be executed on the L2 path are assigned the next level of priority, and the steps to be executed on the L1 path have the lowest priority.
  • Step S1, S3, S6, S7 included, and then steps S4, S5, S7 included in the L2 path (where steps S1, S3 overlap with the L3 path), and finally steps S2, S4, S5, and S5 included in the L1 path are executed.
  • S7 (where step S1 coincides with the path L2 and L3).
  • the second type is to exercise priority only between multiple to-be-executed steps that rely on the same to-be-executed step.
  • step S3 includes the triggering conditions of step S4 and step S6, due to the time required to load path L3 It is longer than the time required for the loading of path L2, so the priority of step S6 is higher than the priority of step S4, and step S6 is executed first.
  • the running time of one or more of all the paths included is not the longest, but among them
  • the included steps to be executed are more critical.
  • the key steps to be executed in these paths are ignored, and computing resources are preferentially allocated to the path with the longest running time.
  • individual weights are preset for specific steps to be executed in several paths.
  • Step S401 sequentially determining whether each path includes a step to be executed with a separate weight
  • step S402 among the multiple to-be-executed steps that rely on the same to-be-executed step, priority is given to sequentially execute the weighted to-be-executed steps according to their weights, or to assign and The weight corresponds to the priority.
  • step S4 in path L2 and step S6 in path L3 have separate weights, set the weight of step S4 in path L2 to 0.7, and step S6 in path L3 The weight of is 0.3.
  • step S3 includes the triggering conditions of step S4 and step S6, when step S3 is executed, since the weight of step S4 is higher than that of step S6, step S4 is executed first. The execution of other steps to be executed is still carried out according to the priority assigned according to the time required for path execution.
  • the priority corresponding to the weight is assigned to each step to be executed in the path where the step to be executed with a higher weight is located, so that the entire path where the key step to be executed is located is executed first.
  • the weight of step S4 in L2 is greater than the weight of step S6 in path L3
  • all the steps to be executed in path L2 are assigned the highest priority
  • the time required to execute path L3 is greater than the time required to execute path L1
  • the priority of path L3 is higher than that of path L1.
  • the calculated critical path can be made more scientific and reasonable.
  • the running time of one or more of all the paths included is not the longest, but among them
  • the included steps to be executed are more critical.
  • the key steps to be executed in these paths are ignored, and computing resources are preferentially allocated to the path with the longest running time.
  • you can The database 10 presets special priorities for specific steps to be executed in several paths.
  • steps S501-S502 are executed first in the database scheduling process. Steps to be executed for the long path:
  • Step S501 sequentially determine whether each path includes a step to be executed with a special priority
  • Step S502 is to preferentially execute a to-be-executed step with a special priority among multiple to-be-executed steps that rely on the same to-be-executed step, or assign each to-be-executed step in the path where the to-be-executed step with a special priority is located priority.
  • step S502 can ensure that when relying on the same previous step to be executed, the next step to be executed with a special priority is executed first, or the entire critical path with key steps is executed first.
  • step S3 includes the trigger conditions of step S4 and step S6,
  • step S4 is executed first, and the execution of other steps to be executed is still executed according to the priority allocated according to the time required for path execution; in the latter case, in the database
  • step S4 in path L2 since step S4 in path L2 has a special priority, each step to be executed in path L2 is assigned the highest priority.
  • path L1 and path L3 the time required to execute path L3 is longer than the execution time.
  • the path L1 takes time, so the priority of the path L3 is higher than the priority of the path L1.
  • the critical path can be assigned a preset priority. As shown in Figure 6, priority is given to the database scheduling process. Perform the following steps S601-S602, and then prioritize the execution of the pending steps of the path that takes the longest time:
  • Step S601 Determine whether each path has priority in turn
  • step S602 each step to be executed on the path with priority is executed first.
  • the steps with priority are executed in sequence according to the priority level.
  • steps S1, S2, S4, S5, and S7 of path L1 will be executed first in the database scheduling process, and the remaining path L2 In path L3, since the time required to execute path L3 is greater than the time required to execute path L2, the priority of path L3 is higher than that of path L2.
  • step S3 of path L3 is executed.
  • S6, S7 and finally execute steps S4, S5, S7 of path L2. If path L1 has the preset highest priority and path L2 has the preset second highest priority, then in the database scheduling process, the execution order of the three paths is: L1, L2, L3.
  • FIG. 7 shows a schematic diagram of program modules of a database scheduling apparatus 700 according to a second embodiment of the present application.
  • the database scheduling device 700 may include or be divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors to complete this Apply, and implement the above database scheduling method.
  • the program module referred to in the embodiments of the present application refers to a series of computer-readable instruction segments that can complete specific functions, and is more suitable for describing the execution process of the database scheduling method in the storage medium than the program itself. The following description will specifically introduce the functions of each program module in this embodiment:
  • the path calculation module 701 is adapted to calculate multiple paths included in the triggered operation series.
  • the path is an orderly execution chain formed by a series of multiple steps to be executed in the series of operations.
  • each step to be executed may include conditions that trigger the execution of multiple steps.
  • step S1 includes the conditions that trigger the execution of steps S2 and S3. After step S1 is executed, this trigger condition is triggered, and then steps S2 and S3 are executed. Steps S2 and S3 both include the trigger conditions that trigger the execution of step S4. Therefore, there are two execution paths from steps S1-S4, which are steps S1-S2-S4 and steps S1-S3-S4, because steps S2 and S3 The required time is not used, so the paths S1-S2-S4 and paths S1-S3-S4 take different time.
  • the method for the path calculation module 701 to calculate the multiple paths included in the triggered operation series specifically includes steps S301a-S301b:
  • step S301a the path calculation module 701 forms the topological relationship between all the steps to be executed according to all the trigger conditions; specifically, it sequentially determines whether each step to be executed includes a trigger condition, and if the step to be executed includes The trigger condition is to obtain the sequence number of each to-be-executed step dependent on the to-be-executed step according to the triggering condition, and establish the topological relationship between the to-be-executed step and the triggered to-be-executed step.
  • step S301b the path calculation module 701 generates all the orderly execution chains composed of the steps to be executed according to the topological relationship, and these orderly execution chains are the paths.
  • the time calculation module 702 is adapted to calculate the time required to execute each path according to the to-be-executed steps required for each path.
  • the time required to load each step to be executed may be manually entered in the database, but preferably, the following step is included before the execution of this step: the time calculation module 702 performs all the steps to be executed included in the operation series
  • the steps are loaded individually, and the loading time required to load each step to be executed is recorded.
  • the separate loading process of the time calculation module 702 for the steps to be executed is a trial execution of the steps to be executed, that is, the time calculation module 702 individually loads each step to be executed into the CPU cache of the business system 20, and can know that each step is executed separately according to the loading time.
  • the computing resources required for each step to be executed can provide a basis for optimizing the use of computing resources during the subsequent execution of the entire series of operations.
  • the time calculation module 702 can know the time required for each step to be executed separately by preloading and enter it into the database 10, and respectively record all the paths contained in each path. The loading time of the steps to be executed is added to obtain the time required to execute each path.
  • the scheduling module 703 performs database scheduling, and in the database scheduling process, the to-be-executed steps of the path with the longest time required are preferentially executed.
  • each different path is automatically based on trigger conditions.
  • a certain key step of the path that takes a long time to be executed may take a long time, but it is executed later. At this time, computer resources are already occupied by other steps, resulting in a long overall time.
  • the steps to be executed in the path that takes the longest time to be executed first can be embodied as: if a previous step to be executed contains the trigger conditions of the other two steps to be executed, the previous step to be executed runs After completion, the next step will give priority to the steps to be executed on the path that takes a longer time.
  • the steps to be executed of the path with the longest time required to be executed first can also be embodied as: each step of the path with the longest time in the database scheduling process is assigned higher The priority of each step on this path will be executed first, and the steps of the path with less time will be executed after the path with the longest time is executed, so as to ensure that the computer resources are given priority to execute these time On the critical path, thereby reducing the overall delay.
  • the scheduling module 703 assigns higher priority to steps S1, S3, S6, and S7 in the longest path L3.
  • steps S1, S3, S6, and S7 are executed first to ensure that the computer The resources are prioritized in the key steps of the critical path, which can reduce the overall delay of the database scheduling process.
  • the priority in addition to the priority optimization of the scheduling module 703 for the steps to be executed on the path with the longest running time, for other paths, the priority can be set according to the length of the running time, that is, the required running time is longer.
  • the steps to be executed in the long path are assigned a higher priority, and the steps to be executed with a shorter running time are assigned a lower priority.
  • the order of the running time of the three paths For T3>T2>T1 in addition to assigning a higher priority to the steps to be executed on the L3 path, the steps to be executed on the L2 path are assigned the next level of priority, and the steps to be executed on the L1 path have priority The lowest level.
  • Step S1, S3, S6, S7 included, and then steps S4, S5, S7 included in the L2 path (where steps S1, S3 overlap with the L3 path), and finally steps S2, S4, S5, and S5 included in the L1 path are executed.
  • S7 (where step S1 coincides with the path L2 and L3).
  • the second type is to exercise priority only between multiple to-be-executed steps that rely on the same to-be-executed step.
  • step S3 includes the triggering conditions of step S4 and step S6, due to the time required to load path L3 It is longer than the time required for the loading of path L2, so the priority of step S6 is higher than the priority of step S4, and step S6 is executed first.
  • the scheduling module 703 ignores the key steps to be executed in these paths, and preferentially allocates computing resources to the path with the longest running time, in order to avoid the above situation.
  • individual weights can be preset for specific to-be-executed steps in several paths, so in the above step S303, referring to FIG. 4, the scheduling module 703 preferentially executes the following steps S401-S402 during the database scheduling process. Then give priority to the steps to be executed on the path that takes the longest time:
  • Step S401 The scheduling module 703 sequentially determines whether each path includes a step to be executed with a separate weight
  • Step S402 the scheduling module 703, among the multiple to-be-executed steps that depend on the same step-to-be-executed, preferentially executes the weighted to-be-executed steps according to the weights, or each path in which the weighted to-be-executed steps are located.
  • the steps are assigned a priority corresponding to the weight.
  • step S4 in path L2 and step S6 in path L3 have separate weights, set the weight of step S4 in path L2 to 0.7, and step S6 in path L3 The weight of is 0.3.
  • step S3 since step S3 includes the triggering conditions of step S4 and step S6, when step S3 is executed, since the weight of step S4 is higher than that of step S6, step S4 is executed first. The execution of other steps to be executed is still carried out according to the priority assigned according to the time required for path execution.
  • the priority corresponding to the weight is assigned to each step to be executed in the path where the step to be executed with a higher weight is located, so that the entire path where the key step to be executed is located is executed first.
  • the weight of step S4 in L2 is greater than the weight of step S6 in path L3
  • all the steps to be executed in path L2 are assigned the highest priority
  • the time required to execute path L3 is greater than the time required to execute path L1
  • the priority of path L3 is higher than that of path L1.
  • the calculated critical path can be made more scientific and reasonable.
  • the scheduling module 703 ignores the key steps to be executed in these paths, and preferentially allocates computing resources to the path with the longest running time, in order to avoid the above situation.
  • special priorities may be preset for specific steps to be executed in several paths.
  • the scheduling module 703 preferentially executes the following steps S501-S502 during the database scheduling process. Then give priority to the steps to be executed on the path that takes the longest time:
  • Step S501 The scheduling module 703 sequentially determines whether each path includes a step to be executed with a special priority
  • step S502 the scheduling module 703 preferentially executes the to-be-executed steps with a special priority among multiple to-be-executed steps that rely on the same to-be-executed step, or for each of the paths where the to-be-executed steps with special priority are located. Prioritize execution steps.
  • step S502 can ensure that when relying on the same previous step to be executed, the next step to be executed with a special priority is executed first, or the entire critical path with key steps is executed first.
  • step S3 includes the trigger conditions of step S4 and step S6,
  • step S4 is executed first, and the execution of other steps to be executed is still executed according to the priority allocated according to the time required for path execution; in the latter case, in the database
  • step S4 in path L2 since step S4 in path L2 has a special priority, each step to be executed in path L2 is assigned the highest priority.
  • path L1 and path L3 the time required to execute path L3 is longer than the execution time.
  • the path L1 takes time, so the priority of the path L3 is higher than the priority of the path L1.
  • the critical path can be assigned a preset priority. As shown in Figure 6, priority is given to the database scheduling process. Perform the following steps S601-S602, and then prioritize the execution of the pending steps of the path that takes the longest time:
  • Step S601 the scheduling module 703 sequentially determines whether each path has a priority
  • step S602 if yes, the scheduling module 703 preferentially executes each to-be-executed step on the path with priority.
  • the steps with priority are executed in sequence according to the priority level.
  • the scheduling module 703 will give priority to executing steps S1, S2, S4, S5, and S7 of path L1 in the database scheduling process, and the rest In path L2 and path L3, since the time required to execute path L3 is greater than the time required to execute path L2, the priority of path L3 is higher than that of path L2.
  • path L3 is executed again Steps S3, S6, S7 of path L2, and finally steps S4, S5, S7 of path L2 are executed. If the path L1 has the preset highest priority, and the path L2 has the preset second highest priority, the scheduling module 703 performs the order of the three paths in the database scheduling process: L1, L2, L3.
  • the computer device 800 is a device that can automatically perform numerical calculation and/or information processing according to pre-set or stored instructions.
  • the computer equipment 800 at least includes, but is not limited to, a memory 801, a processor 802, a network interface 803, and a database scheduling device 804 that can communicate with each other through a system bus. among them:
  • the memory 801 includes at least one type of non-volatile computer-readable storage medium.
  • the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), Random access memory (RAM), static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk Wait.
  • the memory 801 may be an internal storage unit of the computer device 800, such as a hard disk or memory of the computer device 800.
  • the memory 801 may also be an external storage device of the computer device 800, for example, a plug-in hard disk, a smart media card (SMC), and a secure digital (Secure Digital, SD card, Flash Card, etc.
  • the memory 801 may also include both an internal storage unit of the computer device 800 and an external storage device thereof.
  • the memory 801 is generally used to store the operating system and various application software installed in the computer device 800, such as the program code of the database scheduling device 804.
  • the memory 801 can also be used to temporarily store various types of data that have been output or will be output.
  • the processor 802 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips.
  • the processor 802 is generally used to control the overall operation of the computer device 800.
  • the processor 802 is used to run the program code or process data stored in the memory 801, for example, to run the database scheduling device 804, to implement the database scheduling method in the first embodiment.
  • the network interface 803 may include a wireless network interface or a wired network interface, and the network interface 803 is usually used to establish a communication connection between the computer device 800 and other electronic devices.
  • the network interface 803 is used to connect the computer device 800 with an external terminal through a network, and establish a data transmission channel and a communication connection between the computer device 800 and the external terminal.
  • the network may be Intranet, Internet, Global System of Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G Network, Bluetooth (Bluetooth), Wi-Fi and other wireless or wired networks.
  • FIG. 8 only shows a computer device 800 with components 801-804, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
  • the database scheduling device 804 stored in the memory 801 may also be divided into one or more program modules.
  • the one or more program modules are stored in the memory 801 and are composed of one or more program modules. Are executed by two processors (the processor 802 in this embodiment) to complete the database scheduling method of this application.
  • This embodiment also provides a non-volatile computer-readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory ( SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, server, App application mall, etc., on which storage There are computer-readable instructions, and the corresponding functions are realized when the program is executed by the processor.
  • the non-volatile computer-readable storage medium of this embodiment is used to store the database scheduling device 700 or 804, and when executed by a processor, the database scheduling method of this application is implemented.
  • the method of the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is better. ⁇
  • the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, The optical disc) includes several instructions to enable a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the method described in each embodiment of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A database scheduling method and apparatus, and a computer device and a storage medium. The method comprises: calculating a plurality of paths contained in a triggered operation series (S301); calculating time required for executing each path according to a step to be executed required by each path (S302); and finally, performing database scheduling, and preferentially executing said step of the path that takes the longest time in a database scheduling process (S303). By introducing a key path method into a database scheduling design, a computer can obtain the key steps of the key path in the database scheduling process by means of calculation and give a higher priority to the key steps, so that computer resources can be preferentially used in the key steps of the key path, thereby implementing the optimization of the overall scheduling timeliness, and reducing the overall delay of the computer scheduling process.

Description

数据库调度方法、装置、计算机设备及存储介质Database scheduling method, device, computer equipment and storage medium
本申请要求于2019年4月15日提交中国专利局,专利名称为“数据库调度方法、装置、计算机设备及存储介质”,申请号为201910300315.0的发明专利的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires the priority of the Chinese patent application submitted to the Chinese Patent Office on April 15, 2019. The patent name is "Database scheduling method, device, computer equipment and storage medium", and the application number is 201910300315.0. Incorporated in this application by reference.
技术领域Technical field
本申请涉及数据库平台的调度运用领域,特别是涉及一种数据库调度方法、装置、计算机设备及存储介质。This application relates to the field of scheduling and application of database platforms, and in particular to a database scheduling method, device, computer equipment, and storage medium.
背景技术Background technique
数据库调度就是按照顺序执行一系列操作,目前,发明人发现在数据库的调度中,往往只针对调度作业进行优先级设置,缺少针对调度作业本身的优化方法,整体调度时效较长。Database scheduling is to perform a series of operations in order. At present, the inventor found that in database scheduling, priority settings are often only performed for scheduling jobs, and there is no optimization method for scheduling jobs themselves, and the overall scheduling time is longer.
发明内容Summary of the invention
有鉴于此,本申请提出一种数据库调度方法、装置、计算机设备及存储介质,能够在数据库调度过程中优化作业的调度时效。In view of this, this application proposes a database scheduling method, device, computer equipment, and storage medium, which can optimize the scheduling timeliness of jobs in the database scheduling process.
首先,为实现上述目的,本申请提出一种数据库调度方法,所述方法包括:计算被触发的操作系列所包含的多条路径;其中,所述操作系列包含多个待执行步骤;根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间;进行数据库调度,在数据库调度过程中优先执行所需时间最长的路径的待执行步骤。First of all, in order to achieve the above object, this application proposes a database scheduling method, the method includes: calculating a plurality of paths included in a triggered operation series; wherein, the operation series includes a plurality of steps to be executed; The to-be-executed steps required by the path calculate the time required to execute each path; database scheduling is performed, and the to-be-executed steps of the path with the longest time required are preferentially executed in the database scheduling process.
为实现上述目的,本申请还提供一种数据库调度装置,其包括:路径计算模块,适于计算被触发的操作系列所包含的多条路径;其中,所述操作系列包含多个待执行步骤;时间计算模块,适于根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间;调度模块,适于进行数据库调度,在数据库调度过程中优先执行所需时间最长的路径的待执行步骤。To achieve the above objective, the present application also provides a database scheduling device, which includes: a path calculation module adapted to calculate multiple paths included in a triggered operation series; wherein the operation series includes a plurality of steps to be executed; The time calculation module is adapted to calculate the time required to execute each path according to the to-be-executed steps required for each path; the scheduling module is adapted to perform database scheduling, and in the database scheduling process, the execution of the longest time required The steps to be executed on the path.
为实现上述目的,本申请还提供一种计算机设备,包括存储器、处理器以及存储在存储器上并可在处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现上述数据库调度方法。In order to achieve the foregoing objective, the present application also provides a computer device, including a memory, a processor, and computer-readable instructions stored in the memory and capable of running on the processor. The processor executes the computer-readable instructions when the computer-readable instructions are executed. The above database scheduling method.
为实现上述目的,本申请还提供一种非易失性计算机可读存储介质,其上存储有计算 机可读指令,所述计算机可读指令被处理器执行时实现上述数据库调度方法。To achieve the foregoing objective, the present application also provides a non-volatile computer-readable storage medium having computer-readable instructions stored thereon, and the computer-readable instructions implement the foregoing database scheduling method when executed by a processor.
本申请所提出的数据库调度方法、装置、计算机设备及存储介质,通过在数据库调度设计中引入关键路径法,计算机能够通过计算得出数据库调度过程中关键路径的关键步骤,并给其较高的优先级,使得计算机资源可以优先使用在关键路径的关键步骤上,从而可实现对整体调度时效的优化,减少计算机调度过程的整体延时。In the database scheduling method, device, computer equipment, and storage medium proposed in this application, by introducing the critical path method into the database scheduling design, the computer can calculate the key steps of the critical path in the database scheduling process and give it higher Priority allows computer resources to be used first on the key steps of the critical path, thereby optimizing the overall scheduling timeliness and reducing the overall delay of the computer scheduling process.
附图说明Description of the drawings
图1是本申请各实施例之数据库调度方法的一可选的应用环境图;FIG. 1 is a diagram of an optional application environment of the database scheduling method of each embodiment of the present application;
图2是本申请各实施例之数据库内的一组操作系列的拓扑关系图;Figure 2 is a topological diagram of a set of operation series in the database of each embodiment of the present application;
图3是本申请第一实施例之数据库调度方法的流程示意图;3 is a schematic flowchart of the database scheduling method according to the first embodiment of the present application;
图4是本申请第一实施例之数据库调度方法中判断关键步骤的流程示意图;FIG. 4 is a schematic flow chart of determining key steps in the database scheduling method of the first embodiment of the present application;
图5是本申请第一实施例之数据库调度方法中另一种判断关键步骤的流程示意图;FIG. 5 is a schematic flowchart of another critical step in the database scheduling method of the first embodiment of the present application;
图6是本申请第一施例之数据库调度方法中判断关键路径的流程示意图;FIG. 6 is a schematic diagram of the process of judging the critical path in the database scheduling method of the first embodiment of the present application;
图7是本申请第二实施例之数据库调度装置的程序模块示意图;FIG. 7 is a schematic diagram of program modules of the database scheduling device according to the second embodiment of the present application;
图8是本申请第三实施例之计算机设备的硬件结构示意图。FIG. 8 is a schematic diagram of the hardware structure of the computer device according to the third embodiment of the present application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics, and advantages of the purpose of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
具体实施方式detailed description
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions, and advantages of this application clearer, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the application, and not used to limit the application. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。It should be noted that the descriptions related to "first", "second", etc. in this application are only for descriptive purposes, and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. . Therefore, the features defined with "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on what can be achieved by a person of ordinary skill in the art. When the combination of technical solutions is contradictory or cannot be achieved, it should be considered that such a combination of technical solutions does not exist. , Not within the scope of protection required by this application.
参阅图1所示,是进行数据库调度的一种可选的应用环境示意图,业务系统20通过有线或无线的方式与数据库10进行通信,用户可通过与业务系统20的交互使得业务系统20执行所需的数据库调度任务。业务系统20的形式可以是计算机、手机、平板电脑、服务器 等具有运算能力的硬件。Refer to Figure 1, which is a schematic diagram of an optional application environment for database scheduling. The business system 20 communicates with the database 10 in a wired or wireless manner. The user can interact with the business system 20 to make the business system 20 perform all operations. Required database scheduling tasks. The business system 20 may be in the form of hardware with computing capabilities such as computers, mobile phones, tablet computers, and servers.
在下列各实施例中,数据库10可以是供用户单独使用的私有资源,当然更多情况下数据库10是一个共享资源,可以供多个用户使用,数据库10可以提供包括存取数据在内的多个操作,用户还可以自定义包括多个操作的操作系列,这种操作系列包括多个待执行步骤,所述待执行步骤包括触发一个或多个其他待执行步骤的触发条件,即这些待执行的步骤中存在依赖关系,某些步骤的执行依赖其他步骤先被执行,包括这些待执行步骤的操作系列一旦被触发执行,所述待执行步骤会按顺序被执行,从而相当于,一次操作可以有多个操作被执行。In the following embodiments, the database 10 can be a private resource for users to use alone. Of course, in more cases, the database 10 is a shared resource that can be used by multiple users. The database 10 can provide multiple resources including access data. The user can also customize a series of operations including multiple operations. This series of operations includes multiple steps to be performed. The steps to be performed include trigger conditions that trigger one or more other steps to be performed, that is, these steps to be performed There is a dependency relationship in the steps, and the execution of some steps depends on other steps being executed first. Once the series of operations including these steps to be executed are triggered to be executed, the steps to be executed will be executed in order, which is equivalent to that one operation can Multiple operations were performed.
例如,当用户在网上购物时,在付款这个操作步骤被成功执行后,可能有多个后续涉及数据库的调度步骤被执行,数据库需要存入客户的订单信息,同时数据库还需要更新商品的库存数量。For example, when a user is shopping online, after the payment operation step is successfully executed, multiple subsequent scheduling steps involving the database may be executed. The database needs to store the customer's order information, and the database needs to update the inventory quantity of the product. .
请参阅图2所示,在本申请各实施例中,数据库调用包括S1、S2、S3、S4、S5、S6、S7这7个步骤,其中步骤S1包括触发步骤S2、S3的触发条件,步骤S2包括触发步骤S4的触发条件,步骤S3包括触发步骤S4、S6的触发条件,步骤S4包括触发步骤S5的触发条件,步骤S5与步骤S6均包含触发步骤S7的触发条件。Please refer to Figure 2. In each embodiment of the present application, the database call includes 7 steps S1, S2, S3, S4, S5, S6, S7, where step S1 includes trigger conditions for triggering steps S2 and S3. S2 includes the trigger conditions for triggering step S4, step S3 includes the trigger conditions for triggering steps S4 and S6, step S4 includes the trigger conditions for triggering step S5, and both steps S5 and S6 include the trigger conditions for triggering step S7.
第一实施例First embodiment
参阅图3所示,是本申请的一种数据库调度方法的实施例的流程图,该方法包括如下步骤S301-S303:Refer to Figure 3, which is a flowchart of an embodiment of a database scheduling method of the present application. The method includes the following steps S301-S303:
步骤S301,计算被触发的操作系列所包含的多条路径。Step S301: Calculate multiple paths included in the triggered operation series.
其中,所述的路径是由操作系列中的多个待执行步骤串联形成的有序执行链条,具体到本实施例的数据库10中,由于每个待执行步骤可能包括触发多个步骤执行的条件,从而在数据库调度时可能存在多条路径,每条路径所需用时也不同。Wherein, the path is an orderly execution chain formed by a series of multiple steps to be executed in the series of operations. Specifically in the database 10 of this embodiment, each step to be executed may include conditions that trigger the execution of multiple steps. , So there may be multiple paths in database scheduling, and each path requires different time.
例如,在步骤S1中包括触发步骤S2和S3执行的条件,在步骤S1被执行后,这个触发条件就被触发,然后步骤S2和S3被执行。而步骤S2和S3都包括触发步骤S4执行的触发条件,因此从步骤S1-S4就存在两条执行路径,分别是步骤S1-S2-S4和步骤S1-S3-S4,由于步骤S2和步骤S3所需用时不用,因此路径S1-S2-S4和路径S1-S3-S4的用时也不同。For example, step S1 includes conditions for triggering the execution of steps S2 and S3. After step S1 is executed, this trigger condition is triggered, and then steps S2 and S3 are executed. Steps S2 and S3 both include the trigger conditions that trigger the execution of step S4. Therefore, there are two execution paths from steps S1-S4, which are steps S1-S2-S4 and steps S1-S3-S4, because steps S2 and S3 The required time is not used, so the paths S1-S2-S4 and paths S1-S3-S4 take different time.
本步骤中,计算被触发的操作系列所包含的多条路径的方法具体包括步骤S301a-S301b:In this step, the method for calculating the multiple paths included in the triggered operation series specifically includes steps S301a-S301b:
步骤S301a,根据所有的所述触发条件形成所有的所述待执行步骤之间的拓扑关系;具体地,依次判断每个待执行步骤中是否包含触发条件,若待执行步骤中包含触发条件,根据触发条件获取依赖该待执行步骤的每个待执行步骤的序号,并建立该待执行步骤与被触发的待执行步骤之间的拓扑关系。Step S301a: Form the topological relationship between all the steps to be executed according to all the trigger conditions; specifically, determine in turn whether each step to be executed contains a trigger condition, if the step to be executed contains a trigger condition, The trigger condition obtains the sequence number of each to-be-executed step that depends on the to-be-executed step, and establishes the topological relationship between the to-be-executed step and the triggered to-be-executed step.
步骤S301b,根据所述拓扑关系生成由待执行步骤组成的所有有序执行链条,这些有序执行链条即为路径。Step S301b, generating all the orderly execution chains composed of the steps to be executed according to the topological relationship, and these orderly execution chains are the paths.
步骤S302,根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间。Step S302: Calculate the time required to execute each path according to the to-be-executed steps required for each path.
不同路径所需的步骤并不相同,某些路径可能并不需要特定的步骤,例如在用户网上购物时,如果用户付款失败,则只需要保存用户付款信息至数据库,而不需要在数据库中更新商品的库存数量。The steps required for different paths are not the same. Some paths may not require specific steps. For example, when a user makes an online purchase, if the user fails to make a payment, he only needs to save the user's payment information to the database instead of updating it in the database. The inventory quantity of the product.
参阅图3所示,在本实施例中,在数据库调度过程中,包括以下路径。Referring to FIG. 3, in this embodiment, during the database scheduling process, the following paths are included.
L1:S1-S2-S4-S5-S7;L1: S1-S2-S4-S5-S7;
L2:S1-S3-S4-S5-S7;L2: S1-S3-S4-S5-S7;
L3:S1-S3-S6-S7;L3: S1-S3-S6-S7;
例如,在本实施例中,步骤S1至步骤S7中每个步骤加载所需时长分别为t1至t7,并且加载各步骤所需的时间具体如下:t1=1秒、t2=1秒、t3=2秒、t4=2秒、t5=1秒、t6=5秒、t7=1秒。则,以上路径L1、L2和L3各自的总用时T1、T2、T3分别为:For example, in this embodiment, the time required to load each step in step S1 to step S7 is t1 to t7, and the time required to load each step is specifically as follows: t1=1 second, t2=1 second, t3= 2 seconds, t4=2 seconds, t5=1 second, t6=5 seconds, t7=1 second. Then, the total time T1, T2, and T3 of the above paths L1, L2, and L3 are respectively:
T1=t1+t2+t4+t5+t7=1+1+2+1+1=6秒;T1=t1+t2+t4+t5+t7=1+1+2+1+1=6 seconds;
T2=t1+t3+t4+t5+t7=1+2+2+1+1=7秒;T2=t1+t3+t4+t5+t7=1+2+2+1+1=7 seconds;
T3=t1+t3+t6+t7=1+2+5+1=8秒。T3=t1+t3+t6+t7=1+2+5+1=8 seconds.
本步骤中,加载各待执行步骤所需的时长可以是人工已经录入在数据库中,但是较为优选地,在本步骤执行之前还包括如下步骤:对操作系列所包含的所有待执行步骤进行单独加载,记录加载每个所述待执行步骤所需的加载时间。此处对待执行步骤的单独加载过程是对待执行步骤的试执行,即将每个待执行步骤单独加载至业务系统20的CPU缓存,根据加载时间可以获知单独执行每个待执行步骤需要的计算资源,可为后续执行整个操作系列过程中对计算资源的使用优化提供依据。如此,在计算各路径各自的总用时之前,通过预加载的方式可以知道每个待执行步骤单独所需的时间并录入数据库10,在本步骤实施过程中,分别将每条所述路径所包含的所有待执行步骤的加载时间相加得到执行各路径所需的时间。In this step, the time required to load each step to be executed can be manually entered in the database, but preferably, the following step is included before this step is executed: separately loading all the steps to be executed included in the operation series , Record the loading time required to load each step to be executed. Here, the individual loading process of the steps to be executed is a trial execution of the steps to be executed, that is, each step to be executed is individually loaded into the CPU cache of the business system 20, and the computing resources required to execute each step to be executed separately can be known according to the loading time. It can provide a basis for optimizing the use of computing resources during the subsequent execution of the entire series of operations. In this way, before calculating the total time of each path, the time required for each step to be executed can be known by preloading and entered into the database 10. During the implementation of this step, each path included Add the loading time of all the steps to be executed to get the time required to execute each path.
步骤S303,进行数据库调度,在数据库调度过程中优先执行所需时间最长的路径的待执行步骤。In step S303, database scheduling is performed, and the steps to be executed of the path with the longest time required are preferentially executed in the database scheduling process.
由于在数据库调度过程中,包括多个待执行步骤的操作系列要么不被执行,要么全部被执行,在现有技术中,由于缺少优化和优先级分配,每个不同的路径是根据触发条件自动被执行的,那些用时较长的路径的某个关键步骤可能用时较长,但是在后被执行,此时计算机资源已经被其他步骤占用,导致整体用时较长。In the database scheduling process, the series of operations including multiple steps to be executed are either not executed or all executed. In the prior art, due to lack of optimization and priority allocation, each different path is automatically based on trigger conditions. A certain key step of the path that takes a long time to be executed may take a long time, but it is executed later. At this time, computer resources are already occupied by other steps, resulting in a long overall time.
上述在数据库调度过程中优先执行所需时间最长的路径的待执行步骤可以体现为:若 一个在前待执行步骤包含另外两个在后待执行步骤的触发条件,则在前待执行步骤运行完后,下一步优先运行所需时间较长的路径的待执行步骤。In the database scheduling process, the steps to be executed in the path that takes the longest time to be executed first can be embodied as: if a previous step to be executed contains the trigger conditions of the other two steps to be executed, the previous step to be executed runs After completion, the next step will give priority to the steps to be executed on the path that takes a longer time.
在另外一种实施例中,在数据库调度过程中优先执行所需时间最长的路径的待执行步骤也可以体现为:对数据库调度过程中用时最长的那条路径的每个步骤分配较高的优先级,这条路径上的每个步骤会被优先执行,用时较少的路径的步骤则在用时最长的路径被执行后再执行,从而保证计算机的资源被优先用于执行这些用时长的关键路径上,从而整体缩短延时。In another embodiment, in the database scheduling process, the steps to be executed of the path with the longest time required to be executed first can also be embodied as: each step of the path with the longest time in the database scheduling process is assigned higher The priority of each step on this path will be executed first, and the steps of the path with less time will be executed after the path with the longest time is executed, so as to ensure that the computer resources are given priority to execute these time On the critical path, thereby reducing the overall delay.
例如,在本实施例中,若没有优化,执行数据库调度过程中,在路径L2和L3中,步骤S4和步骤S6被同时执行,用时会大于2+5=7秒,整体延时会大于13秒。For example, in this embodiment, if there is no optimization, in the process of executing database scheduling, in paths L2 and L3, steps S4 and S6 are executed at the same time, the time will be greater than 2+5=7 seconds, and the overall delay will be greater than 13 second.
优化后,对用时最长的路径L3中的步骤S1、S3、S6、S7分配较高的优先级,在数据库调度中,步骤S1、S3、S6、S7被优先执行,从而保证计算机资源优先使用在关键路径的关键步骤上,从而可以减少数据库调度过程的整体延时。After optimization, steps S1, S3, S6, and S7 in the longest path L3 are assigned a higher priority. In database scheduling, steps S1, S3, S6, and S7 are executed first to ensure the priority use of computer resources In the critical steps of the critical path, the overall delay of the database scheduling process can be reduced.
在进一步的实施例中,除了针对运行时间最长路径的待执行步骤进行的优先级优化,对于其他路径,可以根据运行时间的长短设置优先级的高低,即給所需运行时间较长的路径的待执行步骤分配较高的优先级,为运行时间较短的待执行步骤分配较低的优先级,以上述L1、L2、L3三条路径为例,三条路径的运行时间的长短顺序为T3>T2>T1,可据此除了为L3路径上的待执行步骤分配较高优先级外,为L2路径上的待执行步骤分配次一级的优先级,L1路径上待执行步骤的优先级最低。此处优先级可有两种体现形式:第一种,优先级高的路径上每一个待执行步骤的优先级都较高,以上述L1、L2、L3三条路径为例,优先执行L3路径所包含的步骤S1、S3、S6、S7,再执行L2路径所包含的步骤S4、S5、S7(其中步骤S1、S3与L3路径重合),最后执行L1路径所包含的步骤S2、S4、S5、S7(其中步骤S1与L2、L3路径重合)。第二种,仅在依赖同一待执行步骤的多个待执行步骤之间行使优先权,如路径L2与L3中,步骤S3包含步骤S4与步骤S6的触发条件,由于路径L3的加载所需时长大于路径L2的加载所需时长,因此步骤S6的优先级高于步骤S4的优先级,此处优先执行步骤S6。In a further embodiment, in addition to the priority optimization for the steps to be executed on the path with the longest running time, for other paths, the priority can be set according to the length of the running time, that is, the path with the longer running time is required The steps to be executed are assigned a higher priority, and the steps to be executed with a shorter running time are assigned a lower priority. Taking the above three paths L1, L2, and L3 as an example, the order of the running time of the three paths is T3> T2>T1, based on this, in addition to assigning higher priority to the steps to be executed on the L3 path, the steps to be executed on the L2 path are assigned the next level of priority, and the steps to be executed on the L1 path have the lowest priority. There are two forms of priority here: First, the priority of each step to be executed on the path with higher priority is higher. Taking the above three paths of L1, L2, and L3 as examples, the priority of L3 path is executed. Steps S1, S3, S6, S7 included, and then steps S4, S5, S7 included in the L2 path (where steps S1, S3 overlap with the L3 path), and finally steps S2, S4, S5, and S5 included in the L1 path are executed. S7 (where step S1 coincides with the path L2 and L3). The second type is to exercise priority only between multiple to-be-executed steps that rely on the same to-be-executed step. For example, in paths L2 and L3, step S3 includes the triggering conditions of step S4 and step S6, due to the time required to load path L3 It is longer than the time required for the loading of path L2, so the priority of step S6 is higher than the priority of step S4, and step S6 is executed first.
在另一实施例中,在包含多个待执行步骤的操作系列中,有可能存在下述情形:其包含的所有路径中的某一项或几项路径的运行用时不是最长的,但其中包含的待执行步骤较为关键,按照第一实施例的调度方式,会忽略这些路径中的关键待执行步骤,而将计算资源优先分配给运行用时最长的路径,为了避免上述情况发生,可以在数据库10中对若干路径中的特定待执行步骤预设单独的权重,如此在上述步骤S303中,参阅图4所示,数据库调度过程中优先执行下列步骤S401-S402,再优先执行所需时间最长的路径的待执行步骤:In another embodiment, in an operation series that includes multiple steps to be executed, there may be the following situation: the running time of one or more of all the paths included is not the longest, but among them The included steps to be executed are more critical. According to the scheduling method of the first embodiment, the key steps to be executed in these paths are ignored, and computing resources are preferentially allocated to the path with the longest running time. In order to avoid the above situation, you can In the database 10, individual weights are preset for specific steps to be executed in several paths. Thus, in the above step S303, referring to FIG. 4, the following steps S401-S402 are executed first in the database scheduling process, and the time required to execute the first step is the longest. Steps to be executed for the long path:
步骤S401,依次判断每条所述路径中是否包含具有单独的权重的待执行步骤;Step S401, sequentially determining whether each path includes a step to be executed with a separate weight;
步骤S402,是则在依赖同一待执行步骤的多个待执行步骤中优先按权重依次执行具有权重的待执行步骤,或者为具有权重的待执行步骤所在的路径中的每一个待执行步骤分配与权重相应的优先级。In step S402, among the multiple to-be-executed steps that rely on the same to-be-executed step, priority is given to sequentially execute the weighted to-be-executed steps according to their weights, or to assign and The weight corresponds to the priority.
本步骤中,第一种情形下,在数据库调度过程中,若多个在后待执行步骤依赖同一在先待执行步骤执行,则按照权重大小,优先执行权重较高的在后待执行步骤,再执行权重较低的在后待执行步骤。以上述L1、L2、L3三条路径为例,若路径L2中的步骤S4与路径L3中的步骤S6均具有单独的权重,设路径L2中的步骤S4的权重为0.7,路径L3中的步骤S6的权重为0.3,则在数据库调度过程中,由于步骤S3包含步骤S4与步骤S6的触发条件,当执行完步骤S3时,由于步骤S4的权重高于步骤S6的权重,因此优先执行步骤S4,其他待执行步骤的执行仍按照根据路径执行所需的时长分配的优先权执行。In this step, in the first case, in the database scheduling process, if multiple subsequent steps to be executed rely on the same prior step to be executed, then according to the weight, the higher weight of the subsequent step to be executed will be executed first. Then execute the next step with lower weight. Taking the above three paths L1, L2, and L3 as an example, if step S4 in path L2 and step S6 in path L3 have separate weights, set the weight of step S4 in path L2 to 0.7, and step S6 in path L3 The weight of is 0.3. In the database scheduling process, since step S3 includes the triggering conditions of step S4 and step S6, when step S3 is executed, since the weight of step S4 is higher than that of step S6, step S4 is executed first. The execution of other steps to be executed is still carried out according to the priority assigned according to the time required for path execution.
后一种情形下,为权重较高的待执行步骤所在的路径中的每一条待执行步骤分配与权重对应的优先权,可使得关键待执行步骤所在的整条路径都被优先执行。以上述L1、L2、L3三条路径为例,由于L2中的步骤S4的权重大于路径L3中的步骤S6的权重,因此,为路径L2中所有待执行步骤分配最高优先级,而在路径L1与路径L3中,由于执行路径L3所需时长大于执行路径L1所需时长,因此路径L3的优先级高于路径L1的优先级。In the latter case, the priority corresponding to the weight is assigned to each step to be executed in the path where the step to be executed with a higher weight is located, so that the entire path where the key step to be executed is located is executed first. Taking the above three paths L1, L2, and L3 as an example, since the weight of step S4 in L2 is greater than the weight of step S6 in path L3, all the steps to be executed in path L2 are assigned the highest priority, and in path L1 and In path L3, since the time required to execute path L3 is greater than the time required to execute path L1, the priority of path L3 is higher than that of path L1.
通过对关键路径的关键步骤设置单独的权重,可使得算出的关键路径更科学合理。By setting individual weights for the critical steps of the critical path, the calculated critical path can be made more scientific and reasonable.
在另一实施例中,在包含多个待执行步骤的操作系列中,有可能存在下述情形:其包含的所有路径中的某一项或几项路径的运行用时不是最长的,但其中包含的待执行步骤较为关键,按照第一实施例的调度方式,会忽略这些路径中的关键待执行步骤,而将计算资源优先分配给运行用时最长的路径,为了避免上述情况发生,可以在数据库10中对若干路径中的特定待执行步骤预设特殊优先级,如此在上述步骤S303中,参阅图5所示,数据库调度过程中优先执行下列步骤S501-S502,再优先执行所需时间最长的路径的待执行步骤:In another embodiment, in an operation series that includes multiple steps to be executed, there may be the following situation: the running time of one or more of all the paths included is not the longest, but among them The included steps to be executed are more critical. According to the scheduling method of the first embodiment, the key steps to be executed in these paths are ignored, and computing resources are preferentially allocated to the path with the longest running time. In order to avoid the above situation, you can The database 10 presets special priorities for specific steps to be executed in several paths. In the above step S303, referring to FIG. 5, the following steps S501-S502 are executed first in the database scheduling process. Steps to be executed for the long path:
步骤S501,依次判断每条所述路径中是否包含具有特殊优先级的待执行步骤;Step S501: sequentially determine whether each path includes a step to be executed with a special priority;
步骤S502,是则在依赖同一待执行步骤的多个待执行步骤中优先执行具有特殊优先级的待执行步骤,或者为具有特殊优先级的待执行步骤所在的路径中的每一个待执行步骤分配优先级。Step S502 is to preferentially execute a to-be-executed step with a special priority among multiple to-be-executed steps that rely on the same to-be-executed step, or assign each to-be-executed step in the path where the to-be-executed step with a special priority is located priority.
上述步骤S502可保证在依赖同一在先待执行步骤时,具有特殊优先级的在后待执行步骤被优先执行,或者使得具有关键步骤的整个关键路径被优先执行。以上述L1、L2、L3三条路径为例,若对步骤L2中的步骤S4设置特殊优先级,前一种情形下,在数据库调度过程中,由于步骤S3包含步骤S4与步骤S6的触发条件,当执行完步骤S3时,由于步骤S4具 有特殊优先级,因此优先执行步骤S4,其他待执行步骤的执行仍按照根据路径执行所需的时长分配的优先权执行;后一种情形下,在数据库调度过程中,由于路径L2中的步骤S4具有特殊优先级,因此为路径L2中的每一个待执行步骤分配最高优先级,而在路径L1与路径L3中,由于执行路径L3所需时长大于执行路径L1所需时长,因此路径L3的优先级高于路径L1的优先级。The above step S502 can ensure that when relying on the same previous step to be executed, the next step to be executed with a special priority is executed first, or the entire critical path with key steps is executed first. Taking the above three paths L1, L2, and L3 as an example, if a special priority is set for step S4 in step L2, in the former case, in the database scheduling process, since step S3 includes the trigger conditions of step S4 and step S6, When step S3 is executed, because step S4 has a special priority, step S4 is executed first, and the execution of other steps to be executed is still executed according to the priority allocated according to the time required for path execution; in the latter case, in the database In the scheduling process, since step S4 in path L2 has a special priority, each step to be executed in path L2 is assigned the highest priority. In path L1 and path L3, the time required to execute path L3 is longer than the execution time. The path L1 takes time, so the priority of the path L3 is higher than the priority of the path L1.
在另一实施例中,在包含多个待执行步骤的操作系列中,有可能存在下述情形:其包含的所有路径中的某一项或几项路径较为关键,按照第一实施例的调度方式,会忽略这些关键路径,而将计算资源优先分配给运行用时最长的路径,为了避免上述情况发生,可为关键路径分配预设的优先级,参阅图6所示,数据库调度过程中优先执行下列步骤S601-S602,再优先执行所需时间最长的路径的待执行步骤:In another embodiment, in an operation series that includes multiple steps to be executed, there may be a situation where one or more of all the paths included are more critical, and according to the scheduling of the first embodiment In this way, these critical paths are ignored, and computing resources are assigned to the path with the longest running time. In order to avoid the above situation, the critical path can be assigned a preset priority. As shown in Figure 6, priority is given to the database scheduling process. Perform the following steps S601-S602, and then prioritize the execution of the pending steps of the path that takes the longest time:
步骤S601,依次判断每条路径是否具有优先级;Step S601: Determine whether each path has priority in turn;
步骤S602,是则优先执行具有优先级的路径上的每个待执行步骤。In step S602, each step to be executed on the path with priority is executed first.
若多个路径具有优先级,则按照优先级的等级依次执行具有优先级的步骤。If multiple paths have priority, the steps with priority are executed in sequence according to the priority level.
仍以上述L1、L2、L3三条路径为例,若路径L1具有预设的优先级,则在数据库调度过程中优先执行路径L1的步骤S1、S2、S4、S5、S7,剩下的路径L2与路径L3中,由于执行路径L3所需时长大于执行路径L2所需时长,因此路径L3的优先级高于路径L2的优先级,在执行完路径L1的步骤后,再执行路径L3的步骤S3、S6、S7,最后执行路径L2的步骤S4、S5、S7。若路径L1具有预设的最高优先级,路径L2具有预设的次高优先级,则在数据库调度过程中,三条路径的执行顺序为:L1、L2、L3。Still taking the above three paths L1, L2, and L3 as an example, if path L1 has a preset priority, steps S1, S2, S4, S5, and S7 of path L1 will be executed first in the database scheduling process, and the remaining path L2 In path L3, since the time required to execute path L3 is greater than the time required to execute path L2, the priority of path L3 is higher than that of path L2. After the steps of path L1 are executed, step S3 of path L3 is executed. , S6, S7, and finally execute steps S4, S5, S7 of path L2. If path L1 has the preset highest priority and path L2 has the preset second highest priority, then in the database scheduling process, the execution order of the three paths is: L1, L2, L3.
第二实施例Second embodiment
请参阅图7,示出了本申请第二实施例之数据库调度装置700的程序模块示意图。在本实施例中,数据库调度装置700可以包括或被分割成一个或多个程序模块,一个或者多个程序模块被存储于存储介质中,并由一个或多个处理器所执行,以完成本申请,并可实现上述数据库调度方法。本申请实施例所称的程序模块是指能够完成特定功能的一系列计算机可读指令指令段,比程序本身更适合于描述数据库调度方法在存储介质中的执行过程。以下描述将具体介绍本实施例各程序模块的功能:Please refer to FIG. 7, which shows a schematic diagram of program modules of a database scheduling apparatus 700 according to a second embodiment of the present application. In this embodiment, the database scheduling device 700 may include or be divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors to complete this Apply, and implement the above database scheduling method. The program module referred to in the embodiments of the present application refers to a series of computer-readable instruction segments that can complete specific functions, and is more suitable for describing the execution process of the database scheduling method in the storage medium than the program itself. The following description will specifically introduce the functions of each program module in this embodiment:
路径计算模块701,适于计算被触发的操作系列所包含的多条路径。The path calculation module 701 is adapted to calculate multiple paths included in the triggered operation series.
其中,所述的路径是由操作系列中的多个待执行步骤串联形成的有序执行链条,具体到本实施例的数据库10中,由于每个待执行步骤可能包括触发多个步骤执行的条件,从而在数据库调度时可能存在多条路径,每条路径所需用时也不同。Wherein, the path is an orderly execution chain formed by a series of multiple steps to be executed in the series of operations. Specifically in the database 10 of this embodiment, each step to be executed may include conditions that trigger the execution of multiple steps. , So there may be multiple paths in database scheduling, and each path requires different time.
例如,在步骤S1中包括触发步骤S2和S3执行的条件,在步骤S1被执行后,这个触 发条件就被触发,然后步骤S2和S3被执行。而步骤S2和S3都包括触发步骤S4执行的触发条件,因此从步骤S1-S4就存在两条执行路径,分别是步骤S1-S2-S4和步骤S1-S3-S4,由于步骤S2和步骤S3所需用时不用,因此路径S1-S2-S4和路径S1-S3-S4的用时也不同。For example, step S1 includes the conditions that trigger the execution of steps S2 and S3. After step S1 is executed, this trigger condition is triggered, and then steps S2 and S3 are executed. Steps S2 and S3 both include the trigger conditions that trigger the execution of step S4. Therefore, there are two execution paths from steps S1-S4, which are steps S1-S2-S4 and steps S1-S3-S4, because steps S2 and S3 The required time is not used, so the paths S1-S2-S4 and paths S1-S3-S4 take different time.
此处,路径计算模块701计算被触发的操作系列所包含的多条路径的方法具体包括步骤S301a-S301b:Here, the method for the path calculation module 701 to calculate the multiple paths included in the triggered operation series specifically includes steps S301a-S301b:
步骤S301a,路径计算模块701根据所有的所述触发条件形成所有的所述待执行步骤之间的拓扑关系;具体地,依次判断每个待执行步骤中是否包含触发条件,若待执行步骤中包含触发条件,根据触发条件获取依赖该待执行步骤的每个待执行步骤的序号,并建立该待执行步骤与被触发的待执行步骤之间的拓扑关系。In step S301a, the path calculation module 701 forms the topological relationship between all the steps to be executed according to all the trigger conditions; specifically, it sequentially determines whether each step to be executed includes a trigger condition, and if the step to be executed includes The trigger condition is to obtain the sequence number of each to-be-executed step dependent on the to-be-executed step according to the triggering condition, and establish the topological relationship between the to-be-executed step and the triggered to-be-executed step.
步骤S301b,路径计算模块701根据所述拓扑关系生成由待执行步骤组成的所有有序执行链条,这些有序执行链条即为路径。In step S301b, the path calculation module 701 generates all the orderly execution chains composed of the steps to be executed according to the topological relationship, and these orderly execution chains are the paths.
时间计算模块702,适于根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间。The time calculation module 702 is adapted to calculate the time required to execute each path according to the to-be-executed steps required for each path.
不同路径所需的步骤并不相同,某些路径可能并不需要特定的步骤,例如在用户网上购物时,如果用户付款失败,则只需要保存用户付款信息至数据库,而不需要在数据库中更新商品的库存数量。The steps required for different paths are not the same. Some paths may not require specific steps. For example, when a user makes an online purchase, if the user fails to make a payment, he only needs to save the user's payment information to the database instead of updating it in the database. The inventory quantity of the product.
参阅图3所示,在本实施例中,在数据库调度过程中,包括以下路径。Referring to FIG. 3, in this embodiment, during the database scheduling process, the following paths are included.
L1:S1-S2-S4-S5-S7;L1: S1-S2-S4-S5-S7;
L2:S1-S3-S4-S5-S7;L2: S1-S3-S4-S5-S7;
L3:S1-S3-S6-S7;L3: S1-S3-S6-S7;
例如,在本实施例中,步骤S1至步骤S7中每个步骤加载所需时长分别为t1至t7,并且加载各步骤所需的时间具体如下:t1=1秒、t2=1秒、t3=2秒、t4=2秒、t5=1秒、t6=5秒、t7=1秒。则,以上路径L1、L2和L3各自的总用时T1、T2、T3分别为:For example, in this embodiment, the time required to load each step in step S1 to step S7 is t1 to t7, and the time required to load each step is specifically as follows: t1=1 second, t2=1 second, t3= 2 seconds, t4=2 seconds, t5=1 second, t6=5 seconds, t7=1 second. Then, the total time T1, T2, and T3 of the above paths L1, L2, and L3 are respectively:
T1=t1+t2+t4+t5+t7=1+1+2+1+1=6秒;T1=t1+t2+t4+t5+t7=1+1+2+1+1=6 seconds;
T2=t1+t3+t4+t5+t7=1+2+2+1+1=7秒;T2=t1+t3+t4+t5+t7=1+2+2+1+1=7 seconds;
T3=t1+t3+t6+t7=1+2+5+1=8秒。T3=t1+t3+t6+t7=1+2+5+1=8 seconds.
本步骤中,加载各待执行步骤所需的时长可以是人工已经录入在数据库中,但是较为优选地,在本步骤执行之前还包括如下步骤:时间计算模块702对操作系列所包含的所有待执行步骤进行单独加载,记录加载每个所述待执行步骤所需的加载时间。此处时间计算模块702对待执行步骤的单独加载过程是对待执行步骤的试执行,即时间计算模块702将每个待执行步骤单独加载至业务系统20的CPU缓存,根据加载时间可以获知单独执行每个待执行 步骤需要的计算资源,可为后续执行整个操作系列过程中对计算资源的使用优化提供依据。如此,在计算各路径各自的总用时之前,时间计算模块702通过预加载的方式可以知道每个待执行步骤单独所需的时间并录入数据库10,并分别将每条所述路径所包含的所有待执行步骤的加载时间相加得到执行各路径所需的时间。In this step, the time required to load each step to be executed may be manually entered in the database, but preferably, the following step is included before the execution of this step: the time calculation module 702 performs all the steps to be executed included in the operation series The steps are loaded individually, and the loading time required to load each step to be executed is recorded. Here, the separate loading process of the time calculation module 702 for the steps to be executed is a trial execution of the steps to be executed, that is, the time calculation module 702 individually loads each step to be executed into the CPU cache of the business system 20, and can know that each step is executed separately according to the loading time. The computing resources required for each step to be executed can provide a basis for optimizing the use of computing resources during the subsequent execution of the entire series of operations. In this way, before calculating the respective total time of each path, the time calculation module 702 can know the time required for each step to be executed separately by preloading and enter it into the database 10, and respectively record all the paths contained in each path. The loading time of the steps to be executed is added to obtain the time required to execute each path.
调度模块703,进行数据库调度,在数据库调度过程中优先执行所需时间最长的路径的待执行步骤。The scheduling module 703 performs database scheduling, and in the database scheduling process, the to-be-executed steps of the path with the longest time required are preferentially executed.
由于在数据库调度过程中,包括多个待执行步骤的操作系列要么不被执行,要么全部被执行,在现有技术中,由于缺少优化和优先级分配,每个不同的路径是根据触发条件自动被执行的,那些用时较长的路径的某个关键步骤可能用时较长,但是在后被执行,此时计算机资源已经被其他步骤占用,导致整体用时较长。In the database scheduling process, the series of operations including multiple steps to be executed are either not executed or all executed. In the prior art, due to lack of optimization and priority allocation, each different path is automatically based on trigger conditions. A certain key step of the path that takes a long time to be executed may take a long time, but it is executed later. At this time, computer resources are already occupied by other steps, resulting in a long overall time.
上述在数据库调度过程中优先执行所需时间最长的路径的待执行步骤可以体现为:若一个在前待执行步骤包含另外两个在后待执行步骤的触发条件,则在前待执行步骤运行完后,下一步优先运行所需时间较长的路径的待执行步骤。In the database scheduling process, the steps to be executed in the path that takes the longest time to be executed first can be embodied as: if a previous step to be executed contains the trigger conditions of the other two steps to be executed, the previous step to be executed runs After completion, the next step will give priority to the steps to be executed on the path that takes a longer time.
在另外一种实施例中,在数据库调度过程中优先执行所需时间最长的路径的待执行步骤也可以体现为:对数据库调度过程中用时最长的那条路径的每个步骤分配较高的优先级,这条路径上的每个步骤会被优先执行,用时较少的路径的步骤则在用时最长的路径被执行后再执行,从而保证计算机的资源被优先用于执行这些用时长的关键路径上,从而整体缩短延时。In another embodiment, in the database scheduling process, the steps to be executed of the path with the longest time required to be executed first can also be embodied as: each step of the path with the longest time in the database scheduling process is assigned higher The priority of each step on this path will be executed first, and the steps of the path with less time will be executed after the path with the longest time is executed, so as to ensure that the computer resources are given priority to execute these time On the critical path, thereby reducing the overall delay.
例如,在本实施例中,若没有优化,调度模块703执行数据库调度过程中,在路径L2和L3中,步骤S4和步骤S6被同时执行,用时会大于2+5=7秒,整体延时会大于13秒。For example, in this embodiment, if there is no optimization, when the scheduling module 703 executes database scheduling, in paths L2 and L3, steps S4 and S6 are executed simultaneously, and the time required will be greater than 2+5=7 seconds, and the overall delay Will be greater than 13 seconds.
优化后,调度模块703对用时最长的路径L3中的步骤S1、S3、S6、S7分配较高的优先级,在数据库调度中,步骤S1、S3、S6、S7被优先执行,从而保证计算机资源优先使用在关键路径的关键步骤上,从而可以减少数据库调度过程的整体延时。After optimization, the scheduling module 703 assigns higher priority to steps S1, S3, S6, and S7 in the longest path L3. In database scheduling, steps S1, S3, S6, and S7 are executed first to ensure that the computer The resources are prioritized in the key steps of the critical path, which can reduce the overall delay of the database scheduling process.
在进一步的实施例中,调度模块703除了针对运行时间最长路径的待执行步骤进行的优先级优化,对于其他路径,可以根据运行时间的长短设置优先级的高低,即給所需运行时间较长的路径的待执行步骤分配较高的优先级,为运行时间较短的待执行步骤分配较低的优先级,以上述L1、L2、L3三条路径为例,三条路径的运行时间的长短顺序为T3>T2>T1,可据此除了为L3路径上的待执行步骤分配较高优先级外,为L2路径上的待执行步骤分配次一级的优先级,L1路径上待执行步骤的优先级最低。此处优先级可有两种体现形式:第一种,优先级高的路径上每一个待执行步骤的优先级都较高,以上述L1、L2、L3三条路径为例,优先执行L3路径所包含的步骤S1、S3、S6、S7,再执行L2路径所包含的步骤S4、S5、 S7(其中步骤S1、S3与L3路径重合),最后执行L1路径所包含的步骤S2、S4、S5、S7(其中步骤S1与L2、L3路径重合)。第二种,仅在依赖同一待执行步骤的多个待执行步骤之间行使优先权,如路径L2与L3中,步骤S3包含步骤S4与步骤S6的触发条件,由于路径L3的加载所需时长大于路径L2的加载所需时长,因此步骤S6的优先级高于步骤S4的优先级,此处优先执行步骤S6。In a further embodiment, in addition to the priority optimization of the scheduling module 703 for the steps to be executed on the path with the longest running time, for other paths, the priority can be set according to the length of the running time, that is, the required running time is longer The steps to be executed in the long path are assigned a higher priority, and the steps to be executed with a shorter running time are assigned a lower priority. Taking the above three paths L1, L2, and L3 as an example, the order of the running time of the three paths For T3>T2>T1, in addition to assigning a higher priority to the steps to be executed on the L3 path, the steps to be executed on the L2 path are assigned the next level of priority, and the steps to be executed on the L1 path have priority The lowest level. There are two forms of priority here: First, the priority of each step to be executed on the path with higher priority is higher. Taking the above three paths of L1, L2, and L3 as examples, the priority of L3 path is executed. Steps S1, S3, S6, S7 included, and then steps S4, S5, S7 included in the L2 path (where steps S1, S3 overlap with the L3 path), and finally steps S2, S4, S5, and S5 included in the L1 path are executed. S7 (where step S1 coincides with the path L2 and L3). The second type is to exercise priority only between multiple to-be-executed steps that rely on the same to-be-executed step. For example, in paths L2 and L3, step S3 includes the triggering conditions of step S4 and step S6, due to the time required to load path L3 It is longer than the time required for the loading of path L2, so the priority of step S6 is higher than the priority of step S4, and step S6 is executed first.
在另一实施例中,在包含多个待执行步骤的操作系列中,有可能存在下述情形:其包含的所有路径中的某一项或几项路径的运行用时不是最长的,但其中包含的待执行步骤较为关键,按照第一实施例的调度方式,调度模块703会忽略这些路径中的关键待执行步骤,而将计算资源优先分配给运行用时最长的路径,为了避免上述情况发生,可以在数据库10中对若干路径中的特定待执行步骤预设单独的权重,如此在上述步骤S303中,参阅图4所示,调度模块703在数据库调度过程中优先执行下列步骤S401-S402,再优先执行所需时间最长的路径的待执行步骤:In another embodiment, in an operation series that includes multiple steps to be executed, there may be the following situation: the running time of one or more of all the paths included is not the longest, but among them The included steps to be executed are more critical. According to the scheduling method of the first embodiment, the scheduling module 703 ignores the key steps to be executed in these paths, and preferentially allocates computing resources to the path with the longest running time, in order to avoid the above situation. In the database 10, individual weights can be preset for specific to-be-executed steps in several paths, so in the above step S303, referring to FIG. 4, the scheduling module 703 preferentially executes the following steps S401-S402 during the database scheduling process. Then give priority to the steps to be executed on the path that takes the longest time:
步骤S401,调度模块703依次判断每条所述路径中是否包含具有单独的权重的待执行步骤;Step S401: The scheduling module 703 sequentially determines whether each path includes a step to be executed with a separate weight;
步骤S402,是则调度模块703在依赖同一待执行步骤的多个待执行步骤中优先按权重依次执行具有权重的待执行步骤,或者为具有权重的待执行步骤所在的路径中的每一个待执行步骤分配与权重相应的优先级。Step S402, the scheduling module 703, among the multiple to-be-executed steps that depend on the same step-to-be-executed, preferentially executes the weighted to-be-executed steps according to the weights, or each path in which the weighted to-be-executed steps are located. The steps are assigned a priority corresponding to the weight.
本步骤中,第一种情形下,调度模块703在数据库调度过程中,若多个在后待执行步骤依赖同一在先待执行步骤执行,则按照权重大小,优先执行权重较高的在后待执行步骤,再执行权重较低的在后待执行步骤。以上述L1、L2、L3三条路径为例,若路径L2中的步骤S4与路径L3中的步骤S6均具有单独的权重,设路径L2中的步骤S4的权重为0.7,路径L3中的步骤S6的权重为0.3,则在数据库调度过程中,由于步骤S3包含步骤S4与步骤S6的触发条件,当执行完步骤S3时,由于步骤S4的权重高于步骤S6的权重,因此优先执行步骤S4,其他待执行步骤的执行仍按照根据路径执行所需的时长分配的优先权执行。In this step, in the first scenario, in the database scheduling process of the scheduling module 703, if multiple subsequent steps to be executed rely on the same prior to be executed step to be executed, according to the weight, the higher priority is given to the later to be executed. Execute the step, and then execute the next step with lower weight. Taking the above three paths L1, L2, and L3 as an example, if step S4 in path L2 and step S6 in path L3 have separate weights, set the weight of step S4 in path L2 to 0.7, and step S6 in path L3 The weight of is 0.3. In the database scheduling process, since step S3 includes the triggering conditions of step S4 and step S6, when step S3 is executed, since the weight of step S4 is higher than that of step S6, step S4 is executed first. The execution of other steps to be executed is still carried out according to the priority assigned according to the time required for path execution.
后一种情形下,为权重较高的待执行步骤所在的路径中的每一条待执行步骤分配与权重对应的优先权,可使得关键待执行步骤所在的整条路径都被优先执行。以上述L1、L2、L3三条路径为例,由于L2中的步骤S4的权重大于路径L3中的步骤S6的权重,因此,为路径L2中所有待执行步骤分配最高优先级,而在路径L1与路径L3中,由于执行路径L3所需时长大于执行路径L1所需时长,因此路径L3的优先级高于路径L1的优先级。In the latter case, the priority corresponding to the weight is assigned to each step to be executed in the path where the step to be executed with a higher weight is located, so that the entire path where the key step to be executed is located is executed first. Taking the above three paths L1, L2, and L3 as an example, since the weight of step S4 in L2 is greater than the weight of step S6 in path L3, all the steps to be executed in path L2 are assigned the highest priority, and in path L1 and In path L3, since the time required to execute path L3 is greater than the time required to execute path L1, the priority of path L3 is higher than that of path L1.
通过对关键路径的关键步骤设置单独的权重,可使得算出的关键路径更科学合理。By setting individual weights for the critical steps of the critical path, the calculated critical path can be made more scientific and reasonable.
在另一实施例中,在包含多个待执行步骤的操作系列中,有可能存在下述情形:其包 含的所有路径中的某一项或几项路径的运行用时不是最长的,但其中包含的待执行步骤较为关键,按照第一实施例的调度方式,调度模块703会忽略这些路径中的关键待执行步骤,而将计算资源优先分配给运行用时最长的路径,为了避免上述情况发生,可以在数据库10中对若干路径中的特定待执行步骤预设特殊优先级,如此在上述步骤S303中,参阅图5所示,调度模块703在数据库调度过程中优先执行下列步骤S501-S502,再优先执行所需时间最长的路径的待执行步骤:In another embodiment, in an operation series that includes multiple steps to be executed, there may be the following situation: the running time of one or more of all the paths included is not the longest, but among them The included steps to be executed are more critical. According to the scheduling method of the first embodiment, the scheduling module 703 ignores the key steps to be executed in these paths, and preferentially allocates computing resources to the path with the longest running time, in order to avoid the above situation. In the database 10, special priorities may be preset for specific steps to be executed in several paths. In the above step S303, referring to FIG. 5, the scheduling module 703 preferentially executes the following steps S501-S502 during the database scheduling process. Then give priority to the steps to be executed on the path that takes the longest time:
步骤S501,调度模块703依次判断每条所述路径中是否包含具有特殊优先级的待执行步骤;Step S501: The scheduling module 703 sequentially determines whether each path includes a step to be executed with a special priority;
步骤S502,是则调度模块703在依赖同一待执行步骤的多个待执行步骤中优先执行具有特殊优先级的待执行步骤,或者为具有特殊优先级的待执行步骤所在的路径中的每一个待执行步骤分配优先级。In step S502, the scheduling module 703 preferentially executes the to-be-executed steps with a special priority among multiple to-be-executed steps that rely on the same to-be-executed step, or for each of the paths where the to-be-executed steps with special priority are located. Prioritize execution steps.
上述步骤S502可保证在依赖同一在先待执行步骤时,具有特殊优先级的在后待执行步骤被优先执行,或者使得具有关键步骤的整个关键路径被优先执行。以上述L1、L2、L3三条路径为例,若对步骤L2中的步骤S4设置特殊优先级,前一种情形下,在数据库调度过程中,由于步骤S3包含步骤S4与步骤S6的触发条件,当执行完步骤S3时,由于步骤S4具有特殊优先级,因此优先执行步骤S4,其他待执行步骤的执行仍按照根据路径执行所需的时长分配的优先权执行;后一种情形下,在数据库调度过程中,由于路径L2中的步骤S4具有特殊优先级,因此为路径L2中的每一个待执行步骤分配最高优先级,而在路径L1与路径L3中,由于执行路径L3所需时长大于执行路径L1所需时长,因此路径L3的优先级高于路径L1的优先级。The above step S502 can ensure that when relying on the same previous step to be executed, the next step to be executed with a special priority is executed first, or the entire critical path with key steps is executed first. Taking the above three paths L1, L2, and L3 as an example, if a special priority is set for step S4 in step L2, in the former case, in the database scheduling process, since step S3 includes the trigger conditions of step S4 and step S6, When step S3 is executed, because step S4 has a special priority, step S4 is executed first, and the execution of other steps to be executed is still executed according to the priority allocated according to the time required for path execution; in the latter case, in the database In the scheduling process, since step S4 in path L2 has a special priority, each step to be executed in path L2 is assigned the highest priority. In path L1 and path L3, the time required to execute path L3 is longer than the execution time. The path L1 takes time, so the priority of the path L3 is higher than the priority of the path L1.
在另一实施例中,在包含多个待执行步骤的操作系列中,有可能存在下述情形:其包含的所有路径中的某一项或几项路径较为关键,按照第一实施例的调度方式,会忽略这些关键路径,而将计算资源优先分配给运行用时最长的路径,为了避免上述情况发生,可为关键路径分配预设的优先级,参阅图6所示,数据库调度过程中优先执行下列步骤S601-S602,再优先执行所需时间最长的路径的待执行步骤:In another embodiment, in an operation series that includes multiple steps to be executed, there may be a situation where one or more of all the paths included are more critical, and according to the scheduling of the first embodiment In this way, these critical paths are ignored, and computing resources are assigned to the path with the longest running time. In order to avoid the above situation, the critical path can be assigned a preset priority. As shown in Figure 6, priority is given to the database scheduling process. Perform the following steps S601-S602, and then prioritize the execution of the pending steps of the path that takes the longest time:
步骤S601,调度模块703依次判断每条路径是否具有优先级;Step S601, the scheduling module 703 sequentially determines whether each path has a priority;
步骤S602,是则调度模块703优先执行具有优先级的路径上的每个待执行步骤。In step S602, if yes, the scheduling module 703 preferentially executes each to-be-executed step on the path with priority.
若多个路径具有优先级,则按照优先级的等级依次执行具有优先级的步骤。If multiple paths have priority, the steps with priority are executed in sequence according to the priority level.
仍以上述L1、L2、L3三条路径为例,若路径L1具有预设的优先级,则调度模块703在数据库调度过程中优先执行路径L1的步骤S1、S2、S4、S5、S7,剩下的路径L2与路径L3中,由于执行路径L3所需时长大于执行路径L2所需时长,因此路径L3的优先级高于路 径L2的优先级,在执行完路径L1的步骤后,再执行路径L3的步骤S3、S6、S7,最后执行路径L2的步骤S4、S5、S7。若路径L1具有预设的最高优先级,路径L2具有预设的次高优先级,则调度模块703在数据库调度过程中,三条路径的执行顺序为:L1、L2、L3。Still taking the above three paths L1, L2, and L3 as an example, if path L1 has a preset priority, the scheduling module 703 will give priority to executing steps S1, S2, S4, S5, and S7 of path L1 in the database scheduling process, and the rest In path L2 and path L3, since the time required to execute path L3 is greater than the time required to execute path L2, the priority of path L3 is higher than that of path L2. After the steps of path L1 are executed, path L3 is executed again Steps S3, S6, S7 of path L2, and finally steps S4, S5, S7 of path L2 are executed. If the path L1 has the preset highest priority, and the path L2 has the preset second highest priority, the scheduling module 703 performs the order of the three paths in the database scheduling process: L1, L2, L3.
第三实施例The third embodiment
参阅图8,是本申请实施例三之计算机设备800的硬件架构示意图。在本实施例中,所述计算机设备800是一种能够按照事先设定或者存储的指令,自动进行数值计算和/或信息处理的设备。如图所示,所述计算机设备800至少包括,但不限于,可通过系统总线相互通信连接存储器801、处理器802、网络接口803、以及数据库调度装置804。其中:Refer to FIG. 8, which is a schematic diagram of the hardware architecture of the computer device 800 according to the third embodiment of the present application. In this embodiment, the computer device 800 is a device that can automatically perform numerical calculation and/or information processing according to pre-set or stored instructions. As shown in the figure, the computer equipment 800 at least includes, but is not limited to, a memory 801, a processor 802, a network interface 803, and a database scheduling device 804 that can communicate with each other through a system bus. among them:
本实施例中,存储器801至少包括一种类型的非易失性计算机可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,存储器801可以是计算机设备800的内部存储单元,例如该计算机设备800的硬盘或内存。在另一些实施例中,存储器801也可以是计算机设备800的外部存储设备,例如该计算机设备800上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,存储器801还可以既包括计算机设备800的内部存储单元也包括其外部存储设备。本实施例中,存储器801通常用于存储安装于计算机设备800的操作系统和各类应用软件,例如数据库调度装置804的程序代码等。此外,存储器801还可以用于暂时地存储已经输出或者将要输出的各类数据。In this embodiment, the memory 801 includes at least one type of non-volatile computer-readable storage medium. The readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), Random access memory (RAM), static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk Wait. In some embodiments, the memory 801 may be an internal storage unit of the computer device 800, such as a hard disk or memory of the computer device 800. In other embodiments, the memory 801 may also be an external storage device of the computer device 800, for example, a plug-in hard disk, a smart media card (SMC), and a secure digital (Secure Digital, SD card, Flash Card, etc. Of course, the memory 801 may also include both an internal storage unit of the computer device 800 and an external storage device thereof. In this embodiment, the memory 801 is generally used to store the operating system and various application software installed in the computer device 800, such as the program code of the database scheduling device 804. In addition, the memory 801 can also be used to temporarily store various types of data that have been output or will be output.
处理器802在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器802通常用于控制计算机设备800的总体操作。本实施例中,处理器802用于运行存储器801中存储的程序代码或者处理数据,例如运行数据库调度装置804,以实现实施例一中的数据库调度方法。In some embodiments, the processor 802 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 802 is generally used to control the overall operation of the computer device 800. In this embodiment, the processor 802 is used to run the program code or process data stored in the memory 801, for example, to run the database scheduling device 804, to implement the database scheduling method in the first embodiment.
所述网络接口803可包括无线网络接口或有线网络接口,该网络接口803通常用于在所述计算机设备800与其他电子装置之间建立通信连接。例如,所述网络接口803用于通过网络将所述计算机设备800与外部终端相连,在所述计算机设备800与外部终端之间的建立数据传输通道和通信连接等。所述网络可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯系统(Global System of Mobile communication,GSM)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、Wi-Fi等无线或有线网络。The network interface 803 may include a wireless network interface or a wired network interface, and the network interface 803 is usually used to establish a communication connection between the computer device 800 and other electronic devices. For example, the network interface 803 is used to connect the computer device 800 with an external terminal through a network, and establish a data transmission channel and a communication connection between the computer device 800 and the external terminal. The network may be Intranet, Internet, Global System of Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G Network, Bluetooth (Bluetooth), Wi-Fi and other wireless or wired networks.
需要指出的是,图8仅示出了具有部件801-804的计算机设备800,但是应理解的是, 并不要求实施所有示出的部件,可以替代的实施更多或者更少的部件。It should be pointed out that FIG. 8 only shows a computer device 800 with components 801-804, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
在本实施例中,存储于存储器801中的所述数据库调度装置804还可以被分割为一个或者多个程序模块,所述一个或者多个程序模块被存储于存储器801中,并由一个或多个处理器(本实施例为处理器802)所执行,以完成本申请数据库调度方法。In this embodiment, the database scheduling device 804 stored in the memory 801 may also be divided into one or more program modules. The one or more program modules are stored in the memory 801 and are composed of one or more program modules. Are executed by two processors (the processor 802 in this embodiment) to complete the database scheduling method of this application.
第四实施例Fourth embodiment
本实施例还提供一种非易失性计算机可读存储介质,如闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘、服务器、App应用商城等等,其上存储有计算机可读指令,程序被处理器执行时实现相应功能。本实施例的非易失性计算机可读存储介质用于存储数据库调度装置700或804,被处理器执行时实现本申请之数据库调度方法。This embodiment also provides a non-volatile computer-readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory ( SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, server, App application mall, etc., on which storage There are computer-readable instructions, and the corresponding functions are realized when the program is executed by the processor. The non-volatile computer-readable storage medium of this embodiment is used to store the database scheduling device 700 or 804, and when executed by a processor, the database scheduling method of this application is implemented.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the foregoing embodiments of the present application are for description only, and do not represent the superiority of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。 Based on this understanding, the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, The optical disc) includes several instructions to enable a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the method described in each embodiment of the present application.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only preferred embodiments of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly used in other related technical fields , The same reason is included in the scope of patent protection of this application.

Claims (20)

  1. 一种数据库调度方法,所述方法包括:A database scheduling method, the method includes:
    计算被触发的操作系列所包含的多条路径;其中,所述操作系列包含多个待执行步骤;Calculate multiple paths included in the triggered operation series; wherein, the operation series includes multiple steps to be executed;
    根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间;Calculate the time required to execute each path according to the steps to be executed required for each path;
    进行数据库调度,在数据库调度过程中优先执行所需时间最长的路径的待执行步骤。Perform database scheduling, and prioritize the execution of the steps to be executed on the path that takes the longest time in the database scheduling process.
  2. 如权利要求1所述的数据库调度方法,有若干所述待执行步骤包含触发条件,所述触发条件可触发至少一项其他待执行步骤,所述计算被触发的操作系列所包含的多条路径包括:The database scheduling method according to claim 1, wherein a number of the steps to be executed include a trigger condition, the trigger condition can trigger at least one other step to be executed, and the calculation of multiple paths included in the triggered operation series include:
    根据所有的所述触发条件形成所有的所述待执行步骤之间的拓扑关系;Forming a topological relationship between all the steps to be executed according to all the trigger conditions;
    根据所述拓扑关系生成由待执行步骤组成的所有有序执行链条形成路径。According to the topological relationship, all the orderly execution chains composed of the steps to be executed form a path.
  3. 如权利要求1所述的数据库调度方法,所述计算被触发的操作系列所包含的多条路径之前还包括:The database scheduling method according to claim 1, wherein before calculating the multiple paths included in the triggered operation series, the method further comprises:
    对操作系列所包含的所有待执行步骤进行单独加载,记录加载每个所述待执行步骤所需的加载时间;All the steps to be executed included in the operation series are individually loaded, and the loading time required to load each step to be executed is recorded;
    所述根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间具体包括:The calculating the time required to execute each path according to the to-be-executed steps required by each path specifically includes:
    分别将每条所述路径所包含的所有待执行步骤的加载时间相加得到执行各路径所需的时间。The loading times of all the steps to be executed included in each path are respectively added to obtain the time required to execute each path.
  4. 如权利要求1所述的数据库调度方法,所述根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间之后还包括:The database scheduling method according to claim 1, after calculating the time required to execute each path according to the steps to be executed required for each path, the method further comprises:
    为所需时间最长的路径的每一项待执行步骤分配优先级。Assign a priority to each step to be executed on the path that takes the longest time.
  5. 如权利要求1所述的数据库调度方法,有若干所述路径中的特定待执行步骤具有预设的单独的权重,所述优先执行所需时间最长的路径的待执行步骤之前还包括:The database scheduling method according to claim 1, wherein the specific to-be-executed steps in the several paths have preset individual weights, and before the to-be-executed steps of the path with the longest time required for priority execution, the method further comprises:
    依次判断每条所述路径中是否包含具有单独的权重的待执行步骤;Sequentially determine whether each of the paths includes steps to be executed with separate weights;
    是则在依赖同一待执行步骤的多个待执行步骤中优先按权重依次执行具有权重的待执行步骤,或者为具有权重的待执行步骤所在的路径中的每一个待执行步骤分配与权重相应的优先级。If yes, among the multiple to-be-executed steps that rely on the same step to be executed, priority is given to execute the weighted steps to be executed in sequence according to the weight, or each step to be executed in the path where the weighted step to be executed is assigned corresponding to the weight priority.
  6. 如权利要求1所述的数据库调度方法,有若干所述路径中的特定待执行步骤具有预设的特殊优先级,所述优先执行所需时间最长的路径的待执行步骤之前还包括:The database scheduling method according to claim 1, wherein the specific to-be-executed steps in several of the paths have preset special priorities, and before the to-be-executed steps of the path with the longest time required for priority execution, the method further comprises:
    依次判断每条所述路径中是否包含具有特殊优先级的待执行步骤;Sequentially determine whether each path includes a step to be executed with a special priority;
    是则在依赖同一待执行步骤的多个待执行步骤中优先执行具有特殊优先级的待执行步 骤,或者为具有特殊优先级的待执行步骤所在的路径中的每一个待执行步骤分配优先级。If yes, among multiple to-be-executed steps that depend on the same to-be-executed step, priority is given to the to-be-executed step with special priority, or priority is assigned to each to-be-executed step in the path where the to-be-executed step with special priority is located.
  7. 如权利要求1所述的数据库调度方法,有若干所述路径具有预设的优先级,所述优先执行所需时间最长的路径的待执行步骤之前还包括:5. The database scheduling method according to claim 1, wherein a number of the paths have preset priorities, and before the step to be executed for the path with the longest time required for priority execution, the method further comprises:
    依次判断每条路径是否具有优先级;Judge whether each path has priority in turn;
    是则优先执行具有优先级的路径上的每个待执行步骤。If yes, each step to be executed on the path with priority is executed first.
  8. 一种数据库调度装置,其包括:A database scheduling device, which includes:
    路径计算模块,适于计算被触发的操作系列所包含的多条路径;其中,所述操作系列包含多个待执行步骤;The path calculation module is suitable for calculating multiple paths included in the triggered operation series; wherein, the operation series includes multiple steps to be executed;
    时间计算模块,适于根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间;The time calculation module is adapted to calculate the time required to execute each path according to the to-be-executed steps required by each path;
    调度模块,适于进行数据库调度,在数据库调度过程中优先执行所需时间最长的路径的待执行步骤。The scheduling module is suitable for database scheduling, and in the database scheduling process, the steps to be executed of the path with the longest time required are preferentially executed.
  9. 一种计算机设备,包括存储器、处理器以及存储在存储器上并可在处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现数据库调度方法包括:A computer device includes a memory, a processor, and computer-readable instructions stored on the memory and capable of running on the processor. The method for implementing database scheduling when the processor executes the computer-readable instructions includes:
    计算被触发的操作系列所包含的多条路径;其中,所述操作系列包含多个待执行步骤;Calculate multiple paths included in the triggered operation series; wherein, the operation series includes multiple steps to be executed;
    根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间;Calculate the time required to execute each path according to the steps to be executed required for each path;
    进行数据库调度,在数据库调度过程中优先执行所需时间最长的路径的待执行步骤。Perform database scheduling, and prioritize the execution of the steps to be executed on the path that takes the longest time in the database scheduling process.
  10. 如权利要求9所述的计算机设备,有若干所述待执行步骤包含触发条件,所述触发条件可触发至少一项其他待执行步骤,所述计算被触发的操作系列所包含的多条路径包括:The computer device according to claim 9, wherein a number of the steps to be executed include a trigger condition, and the trigger condition can trigger at least one other step to be executed, and the multiple paths included in the series of operations triggered by the calculation include :
    根据所有的所述触发条件形成所有的所述待执行步骤之间的拓扑关系;Forming a topological relationship between all the steps to be executed according to all the trigger conditions;
    根据所述拓扑关系生成由待执行步骤组成的所有有序执行链条形成路径。According to the topological relationship, all the orderly execution chains composed of the steps to be executed form a path.
  11. 如权利要求9所述的数据库调度方法,所述计算被触发的操作系列所包含的多条路径之前还包括:9. The database scheduling method according to claim 9, before calculating the multiple paths included in the triggered operation series, the method further comprises:
    对操作系列所包含的所有待执行步骤进行单独加载,记录加载每个所述待执行步骤所需的加载时间;All the steps to be executed included in the operation series are individually loaded, and the loading time required to load each step to be executed is recorded;
    所述根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间具体包括:The calculating the time required to execute each path according to the to-be-executed steps required by each path specifically includes:
    分别将每条所述路径所包含的所有待执行步骤的加载时间相加得到执行各路径所需的时间。The loading times of all the steps to be executed included in each path are respectively added to obtain the time required to execute each path.
  12. 如权利要求9所述的计算机设备,所述根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间之后还包括:9. The computer device according to claim 9, after calculating the time required to execute each path according to the steps to be executed required for each path, further comprising:
    为所需时间最长的路径的每一项待执行步骤分配优先级。Assign a priority to each step to be executed on the path that takes the longest time.
  13. 如权利要求9所述的计算机设备,有若干所述路径中的特定待执行步骤具有预设的单独的权重,所述优先执行所需时间最长的路径的待执行步骤之前还包括:9. The computer device according to claim 9, wherein the specific steps to be executed in the several paths have preset individual weights, and before the steps to be executed of the path with the longest time required for priority execution, the method further comprises:
    依次判断每条所述路径中是否包含具有单独的权重的待执行步骤;Sequentially determine whether each of the paths includes steps to be executed with separate weights;
    是则在依赖同一待执行步骤的多个待执行步骤中优先按权重依次执行具有权重的待执行步骤,或者为具有权重的待执行步骤所在的路径中的每一个待执行步骤分配与权重相应的优先级。If yes, among the multiple to-be-executed steps that rely on the same step to be executed, priority is given to execute the weighted steps to be executed in sequence according to the weight, or each step to be executed in the path where the weighted step to be executed is assigned corresponding to the weight priority.
  14. 如权利要求9所述的计算机设备,有若干所述路径中的特定待执行步骤具有预设的特殊优先级,所述优先执行所需时间最长的路径的待执行步骤之前还包括:9. The computer device according to claim 9, wherein the specific to-be-executed steps in several of the paths have preset special priorities, and before the to-be-executed steps of the path with the longest time required for priority execution, the method further comprises:
    依次判断每条所述路径中是否包含具有特殊优先级的待执行步骤;Sequentially determine whether each path includes a step to be executed with a special priority;
    是则在依赖同一待执行步骤的多个待执行步骤中优先执行具有特殊优先级的待执行步骤,或者为具有特殊优先级的待执行步骤所在的路径中的每一个待执行步骤分配优先级。If yes, among multiple to-be-executed steps that depend on the same to-be-executed step, the to-be-executed step with a special priority is preferentially executed, or a priority is assigned to each to-be-executed step in the path where the to-be-executed step with special priority is located.
  15. 如权利要求9所述的计算机设备,有若干所述路径具有预设的优先级,所述优先执行所需时间最长的路径的待执行步骤之前还包括:9. The computer device according to claim 9, wherein a number of the paths have a preset priority, and before the steps to be executed for the path with the longest time required for priority execution, the method further comprises:
    依次判断每条路径是否具有优先级;Judge whether each path has priority in turn;
    是则优先执行具有优先级的路径上的每个待执行步骤。If yes, each step to be executed on the path with priority is executed first.
  16. 一种非易失性计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现数据库调度方法包括:A non-volatile computer-readable storage medium having computer-readable instructions stored thereon. The method for implementing database scheduling when the computer-readable instructions are executed by a processor includes:
    计算被触发的操作系列所包含的多条路径;其中,所述操作系列包含多个待执行步骤;Calculate multiple paths included in the triggered operation series; wherein, the operation series includes multiple steps to be executed;
    根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间;Calculate the time required to execute each path according to the steps to be executed required for each path;
    进行数据库调度,在数据库调度过程中优先执行所需时间最长的路径的待执行步骤。Perform database scheduling, and prioritize the execution of the steps to be executed on the path that takes the longest time in the database scheduling process.
  17. 如权利要求16所述的计算机可读存储介质,有若干所述待执行步骤包含触发条件,所述触发条件可触发至少一项其他待执行步骤,所述计算被触发的操作系列所包含的多条路径包括:The computer-readable storage medium according to claim 16, wherein a number of the steps to be executed include a trigger condition, and the trigger condition can trigger at least one other step to be executed, and the calculation is triggered by multiple steps included in the sequence of operations. The paths include:
    根据所有的所述触发条件形成所有的所述待执行步骤之间的拓扑关系;Forming a topological relationship between all the steps to be executed according to all the trigger conditions;
    根据所述拓扑关系生成由待执行步骤组成的所有有序执行链条形成路径。According to the topological relationship, all the orderly execution chains composed of the steps to be executed form a path.
  18. 如权利要求16所述的计算机可读存储介质,所述计算被触发的操作系列所包含的多条路径之前还包括:16. The computer-readable storage medium of claim 16, wherein the calculation of the multiple paths included in the triggered operation series further comprises:
    对操作系列所包含的所有待执行步骤进行单独加载,记录加载每个所述待执行步骤所需的加载时间;All the steps to be executed included in the operation series are individually loaded, and the loading time required to load each step to be executed is recorded;
    所述根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间具体包括:The calculating the time required to execute each path according to the to-be-executed steps required by each path specifically includes:
    分别将每条所述路径所包含的所有待执行步骤的加载时间相加得到执行各路径所需的 时间。The loading time of all the steps to be executed included in each path are added to obtain the time required to execute each path.
  19. 如权利要求16所述的计算机可读存储介质,所述根据每条所述路径所需的待执行步骤计算执行每条路径所需的时间之后还包括:15. The computer-readable storage medium according to claim 16, after calculating the time required to execute each path according to the steps to be executed required for each path, further comprising:
    为所需时间最长的路径的每一项待执行步骤分配优先级。Assign a priority to each step to be executed on the path that takes the longest time.
  20. 如权利要求16所述的计算机可读存储介质,有若干所述路径中的特定待执行步骤具有预设的单独的权重,所述优先执行所需时间最长的路径的待执行步骤之前还包括:The computer-readable storage medium according to claim 16, wherein a specific step to be executed in a plurality of the paths has a preset individual weight, and the step to be executed of the path with the longest time required for priority execution further includes :
    依次判断每条所述路径中是否包含具有单独的权重的待执行步骤;Sequentially determine whether each of the paths includes steps to be executed with separate weights;
    是则在依赖同一待执行步骤的多个待执行步骤中优先按权重依次执行具有权重的待执行步骤,或者为具有权重的待执行步骤所在的路径中的每一个待执行步骤分配与权重相应的优先级。If yes, among the multiple to-be-executed steps that rely on the same step to be executed, priority is given to execute the weighted steps to be executed in sequence according to the weight, or each step to be executed in the path where the weighted step to be executed is assigned corresponding to the weight priority.
PCT/CN2019/118039 2019-04-15 2019-11-13 Database scheduling method and apparatus, and computer device and storage medium WO2020211358A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910300315.0A CN110147270A (en) 2019-04-15 2019-04-15 Database dispatching method, device, computer equipment and storage medium
CN201910300315.0 2019-04-15

Publications (1)

Publication Number Publication Date
WO2020211358A1 true WO2020211358A1 (en) 2020-10-22

Family

ID=67589656

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/118039 WO2020211358A1 (en) 2019-04-15 2019-11-13 Database scheduling method and apparatus, and computer device and storage medium

Country Status (2)

Country Link
CN (1) CN110147270A (en)
WO (1) WO2020211358A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110147270A (en) * 2019-04-15 2019-08-20 平安普惠企业管理有限公司 Database dispatching method, device, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007018268A (en) * 2005-07-07 2007-01-25 Sumitomo Heavy Ind Ltd Task scheduling method, task scheduling device, and task scheduling program
CN103336723A (en) * 2013-07-21 2013-10-02 哈尔滨理工大学 Scheduling method for adapting to shortage of processor cores and based on critical paths
CN107301500A (en) * 2017-06-02 2017-10-27 北京工业大学 A kind of workflow schedule method looked forward to the prospect based on critical path task
CN110147270A (en) * 2019-04-15 2019-08-20 平安普惠企业管理有限公司 Database dispatching method, device, computer equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10152349B1 (en) * 2016-09-27 2018-12-11 Juniper Networks, Inc. Kernel scheduling based on precedence constraints and/or artificial intelligence techniques
CN107015856A (en) * 2017-03-30 2017-08-04 青海大学 Task scheduling approach generation method and device under cloud environment in scientific workflow

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007018268A (en) * 2005-07-07 2007-01-25 Sumitomo Heavy Ind Ltd Task scheduling method, task scheduling device, and task scheduling program
CN103336723A (en) * 2013-07-21 2013-10-02 哈尔滨理工大学 Scheduling method for adapting to shortage of processor cores and based on critical paths
CN107301500A (en) * 2017-06-02 2017-10-27 北京工业大学 A kind of workflow schedule method looked forward to the prospect based on critical path task
CN110147270A (en) * 2019-04-15 2019-08-20 平安普惠企业管理有限公司 Database dispatching method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN110147270A (en) 2019-08-20

Similar Documents

Publication Publication Date Title
US20190324819A1 (en) Distributed-system task assignment method and apparatus
US9396028B2 (en) Scheduling workloads and making provision decisions of computer resources in a computing environment
CN109300217B (en) Queuing and calling method, computer storage medium, queuing and calling server and system
US20060206894A1 (en) Method of scheduling jobs using database management system for real-time processing
CN102855216B (en) Improve the performance of multiprocessor computer system
CN110704177B (en) Computing task processing method and device, computer equipment and storage medium
US9304817B2 (en) Method and apparatus for a user-driven priority based job scheduling in a data processing platform
CN109960575B (en) Computing capacity sharing method, system and related equipment
US20100042723A1 (en) Method and system for managing load in a network
CN111338779B (en) Resource allocation method, device, computer equipment and storage medium
WO2021208786A1 (en) Thread management method and apparatus
CN111490963A (en) Data processing method, system, equipment and storage medium based on QUIC protocol stack
CN111885184A (en) Method and device for processing hot spot access keywords in high concurrency scene
CN112988185A (en) Cloud application updating method, device and system, electronic equipment and storage medium
CN116185623A (en) Task allocation method and device, electronic equipment and storage medium
CN113886069A (en) Resource allocation method and device, electronic equipment and storage medium
CN115686805A (en) GPU resource sharing method and device, and GPU resource sharing scheduling method and device
CN114629960B (en) Resource scheduling method, device, system, equipment, medium and program product
WO2015042904A1 (en) Method, apparatus and system for scheduling resource pool in multi-core system
ul Hassan et al. An efficient dynamic decision-based task optimization and scheduling approach for microservice-based cost management in mobile cloud computing applications
WO2020211358A1 (en) Database scheduling method and apparatus, and computer device and storage medium
WO2022142008A1 (en) Data processing method and apparatus, electronic device, and storage medium
CN111709723A (en) RPA business process intelligent processing method, device, computer equipment and storage medium
CN111359205B (en) Operation method and device of cloud game, computer equipment and storage medium
CN116881003A (en) Resource allocation method, device, service equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19924812

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02.02.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19924812

Country of ref document: EP

Kind code of ref document: A1