CN110780988A - Task triggering method and device and computer readable storage medium - Google Patents

Task triggering method and device and computer readable storage medium Download PDF

Info

Publication number
CN110780988A
CN110780988A CN201810857046.3A CN201810857046A CN110780988A CN 110780988 A CN110780988 A CN 110780988A CN 201810857046 A CN201810857046 A CN 201810857046A CN 110780988 A CN110780988 A CN 110780988A
Authority
CN
China
Prior art keywords
task
target
server
time point
task execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810857046.3A
Other languages
Chinese (zh)
Other versions
CN110780988B (en
Inventor
贺瑾玮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Xiaoyu Small Loan Co Ltd
Original Assignee
Chongqing Xiaoyu Small Loan Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Xiaoyu Small Loan Co Ltd filed Critical Chongqing Xiaoyu Small Loan Co Ltd
Priority to CN201810857046.3A priority Critical patent/CN110780988B/en
Publication of CN110780988A publication Critical patent/CN110780988A/en
Application granted granted Critical
Publication of CN110780988B publication Critical patent/CN110780988B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • G06F9/5088Techniques for rebalancing the load in a distributed system involving task migration

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention provides a task triggering method, a task triggering device and a storage medium. The task triggering method comprises the following steps: after receiving the trigger request sent by the task scheduling server, the load balancing server responds to the trigger request, selects a target task execution server from the task execution server cluster, and further allocates a target task included in the task trigger request to the target task execution server to instruct the target task execution server to execute the target task. By adopting the embodiment of the invention, the load balancing server distributes the corresponding task execution servers to execute the tasks, so that the same task can be prevented from being executed by a plurality of task execution servers at the same time, and the accuracy of task execution is ensured.

Description

Task triggering method and device and computer readable storage medium
Technical Field
The present invention relates to the field of computers, and in particular, to a task triggering method and apparatus, and a computer-readable storage medium.
Background
With the rapid development of the information age, the requirements of users on the timing task are more and more abundant, for example, when a word is used to edit a text, document contents need to be stored at regular time, and when an intelligent terminal such as a mobile phone is used, data in the terminal needs to be backed up at regular time, and when a shopping platform or a ticket purchasing platform purchases tickets, unprocessed orders are cancelled at regular time, and the like. The above-listed timing tasks are initiated internally by the server cluster and executed by the servers in the server cluster. However, since a plurality of servers exist in the server cluster and all the plurality of servers have the same timed task execution program, when a certain timed task execution time is reached, the plurality of servers may execute the timed task at the same time, so that the same timed task is executed by the plurality of servers at the same time, thereby generating a timed task execution error.
Disclosure of Invention
The embodiment of the invention provides a task triggering method, a task triggering device and a computer readable storage medium, wherein corresponding task execution servers are distributed to execute tasks through a load balancing server, so that the same task can be prevented from being executed by a plurality of task execution servers at the same time, and the task execution accuracy is ensured.
A first aspect of an embodiment of the present invention provides a task triggering method, including:
the load balancing server receives a task triggering request sent by the task scheduling server when a target triggering time point arrives, wherein the task triggering request carries a target task identifier corresponding to the target triggering time point;
the load balancing server responds to the task triggering request and selects a target task execution server from the task execution server cluster;
and the load balancing server distributes the task triggering request to a target task execution server so as to instruct the target task execution server to execute a target task corresponding to the target task identifier.
Optionally, the load balancing server responds to the task trigger request, and selects a target task execution server from the task execution server cluster, including:
the load balancing server acquires the current working state of each task execution server in the task execution server cluster;
and the load balancing server selects a target task execution server from the task execution server cluster according to the current working state of each task execution server.
Optionally, the load balancing server allocates the task triggering request to the target task execution server, including:
the load balancing server determines a target hypertext transfer protocol (HTTP) port related to a target task identifier in a target task execution server according to the target task identifier carried in the task triggering request;
and the load balancing server distributes the task triggering request to the target task execution server through the target HTTP port. A second aspect of the embodiments of the present invention provides another task triggering method, including:
when the target trigger time point arrives, the task scheduling server inquires a target task identifier corresponding to the target trigger time point;
and the task scheduling server sends a task triggering request to the load balancing server, wherein the task triggering request carries a target task identifier, and the task triggering request is used for indicating the load balancing server to select a target task execution server from the task execution server cluster to execute a target task corresponding to the target task identifier.
Optionally, when the target trigger time point arrives, the task scheduling server queries a target task identifier corresponding to the target trigger time point, including:
when the target trigger time point arrives, the task scheduling server inquires the target task identifier corresponding to the target trigger time point from the corresponding relation between at least one group of trigger time points and the task identifier stored in the database.
Optionally, before the task scheduling server sends the task triggering request to the load balancing server, the method further includes:
the task scheduling server judges whether the corresponding relation between the target trigger time point and the target task identifier in the database is currently set to be valid;
and if so, the task scheduling server executes the step of sending the task triggering request to the load balancing server.
Optionally, the method further comprises:
the task scheduling server receives modification operation aiming at a target trigger time point;
and the task scheduling server modifies the target trigger time point according to the modification operation.
A third aspect of the embodiments of the present invention provides a task triggering apparatus, including:
the receiving unit is used for receiving a task triggering request sent by the task scheduling server when a target triggering time point arrives, wherein the task triggering request carries a target task identifier corresponding to the target triggering time point;
the selection unit is used for responding to the task trigger request and selecting a target task execution server from the task execution server cluster;
and the distribution unit is used for distributing the task trigger request to the target task execution server so as to instruct the target task execution server to execute the target task corresponding to the target task identifier.
Optionally, the selecting unit is specifically configured to:
acquiring the current working state of each task execution server in the task execution server cluster;
and selecting a target task execution server from the task execution server cluster according to the current working state of each task execution server.
Optionally, the allocation unit is specifically configured to:
determining a target hypertext transfer protocol (HTTP) port related to a target task identifier in a target task execution server according to the target task identifier carried in the task trigger request;
and distributing the task trigger request to a target task execution server through a target HTTP port.
A fourth aspect of an embodiment of the present invention provides another task triggering apparatus, including:
the query unit is used for querying a target task identifier corresponding to the target trigger time point when the target trigger time point arrives;
and the sending unit is used for sending a task triggering request to the load balancing server, wherein the task triggering request carries a target task identifier, and the task triggering request is used for indicating the load balancing server to select a target task execution server from the task execution server cluster to execute a target task corresponding to the target task identifier.
Optionally, the query unit is specifically configured to:
and inquiring the target task identifier corresponding to the target trigger time point from the corresponding relation between at least one group of trigger time points and the task identifier stored in the database.
Optionally, the task triggering device further includes a determining unit:
the judging unit is used for judging whether the corresponding relation between the target trigger time point and the target task identifier in the database is currently set to be valid or not;
and if so, the sending unit sends a task triggering request to the load balancing server.
Optionally, the task triggering device further includes a receiving unit and a modifying unit:
a receiving unit, configured to receive a modification operation for a target trigger time point;
and the modification unit is used for modifying the target trigger time point according to the modification operation.
A fifth aspect of embodiments of the present invention provides a load balancing server, including a processor, a network interface, and a memory, where the processor, the network interface, and the memory are connected to each other, where the memory is used to store a computer program that supports a terminal to execute the foregoing method, and the computer program includes program instructions, and the processor is configured to call the program instructions to execute the foregoing method according to the first aspect.
A sixth aspect of embodiments of the present invention provides a task scheduling server, including a processor, a network interface, and a memory, where the processor, the network interface, and the memory are connected to each other, where the memory is used to store a computer program that supports a terminal to execute the foregoing method, and the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method of the second aspect.
A seventh aspect of embodiments of the present invention provides a computer-readable storage medium, in which a computer program is stored, the computer program comprising program instructions that, when executed by a processor, cause the processor to perform the method of the first aspect or to perform the method of the second aspect.
In the embodiment of the invention, after receiving the task triggering request sent by the task scheduling server, the load balancing server responds to the task triggering request and selects the target task execution server from the task execution server cluster, and further allocates the task triggering request to the target task execution server to indicate the target task execution server to execute the target task corresponding to the target task identifier.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is an architecture diagram of a task trigger system according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a task triggering method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating another task triggering method according to an embodiment of the present invention;
fig. 4 is a flowchart illustrating a task triggering method according to another embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a task triggering apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of another task trigger device provided in an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a load balancing server according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a task scheduling server according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, an architecture diagram of a task triggering system according to an embodiment of the present invention, as shown in fig. 1, may include a task scheduling server 10, a load balancing server 20, and a target task execution server 30. It is understood that the target task execution server 30 is any one of a task execution server cluster, and the task scheduling server 10, the load balancing server 20, and the target task execution server 30 may be connected in a wired or wireless manner.
In one embodiment, the task scheduling server 10 may be configured to: when the target trigger time point arrives, inquiring a target task identifier corresponding to the target trigger time point; and sending a task triggering request to the load balancing server 20, where the task triggering request carries a target task identifier, and the task triggering request is used to instruct the load balancing server 20 to select a target task execution server from the task execution server cluster to execute a target task corresponding to the target task identifier.
Optionally, when the target trigger time point arrives, the task scheduling server 10 queries a target task identifier corresponding to the target trigger time point, including: and when the target trigger time point arrives, inquiring the target task identifier corresponding to the target trigger time point from the corresponding relation between at least one group of trigger time points and the task identifier stored in the database. It can be understood that a plurality of trigger time points and task identifiers corresponding to the trigger time points may be stored in the database, and the target trigger time point is any one of the trigger time points in the database.
Optionally, before the task scheduling server 10 sends the task trigger request to the load balancing server, the task scheduling server 10 is further configured to: judging whether the corresponding relation between the target trigger time point and the target task identifier in the database is currently set to be valid or not; if yes, the task scheduling server 10 executes a step of sending a task trigger request to the load balancing server. Optionally, if the task scheduling server 10 determines that the correspondence between the target trigger time point and the target task identifier is currently set to be invalid, that is, it indicates that the task execution server is not currently required to execute the target task corresponding to the target task identifier, the task scheduling server 10 may not execute the step of sending the task trigger request to the load balancing server 20, so that the power consumption overhead of the task scheduling server 10 may be saved.
Optionally, the task scheduling server 10 is further configured to: receiving a modification operation aiming at a target trigger time point; and then modifying the target trigger time point according to the modification operation. That is to say, the task scheduling server 10 modifies the corresponding relationship between the original target trigger time point and the target task identifier according to the received modification operation, for example, the corresponding relationship between the original target trigger time point and the target task identifier is as follows: corresponding to the target task identifier 1 at 3 am, if the modification operation indicated by the modification operation received by the task scheduling server 10 is: if the target trigger time point is changed to 4 am, the task scheduling server 10 modifies the target trigger time according to the modification operation, and the corresponding relationship between the target trigger point and the target task identifier is changed to: and 4 points in the morning correspond to the target task identifier 1. Further, when the task scheduling server 10 detects that the time point reaches 4 points, a task trigger request carrying the target task identifier 1 is generated and sent to the load balancing server 20.
In one embodiment, the load balancing server 20 may be configured to: receiving a task triggering request sent by a task scheduling server when a target triggering time point arrives, wherein the task triggering request carries a target task identifier corresponding to the target triggering time point; responding to the task triggering request, and selecting a target task execution server from the task execution server cluster; and distributing the task trigger request to a target task execution server to instruct the target task execution server to execute the target task corresponding to the target task identifier.
In one embodiment, the load balancing server 20 selects a target task execution server from the task execution server cluster in response to the task trigger request, and includes: acquiring the current working state of each task execution server in the task execution server cluster; and selecting a target task execution server from the task execution server cluster according to the current working state of each task execution server. In other words, the basis for the load balancing server 20 to select the target task execution server from the task execution server cluster is the occupation situation of each task scheduling server, and the specific selection manner may be: and determining the task execution server in an idle state or with a low occupancy rate as a target task scheduling server.
In one embodiment, the load balancing server 20 distributes the task trigger request to the target task execution server, including: the load balancing server determines a target hypertext transfer protocol (HTTP) port related to a target task identifier in a target task execution server according to the target task identifier carried in the task triggering request; and the load balancing server distributes the task triggering request to the target task execution server through the target HTTP port. In other words, the target task execution server may include multiple HyperText Transfer Protocol (HTTP) ports, each HTTP port corresponds to one task, the target task execution server exposes the multiple tasks in the form of HTTP ports, after the load balancing server queries the target task execution server, determines a target task corresponding to the target task identifier according to the target task identifier included in the task trigger request, further determines an HTTP port corresponding to the target task, and finally finds the target HTTP port corresponding to the target task from the multiple HTTP ports exposed by the target task execution server, and sends the task trigger request to the target task execution server through the target HTTP port.
In one embodiment, the target task execution server 30 may be operable to: and receiving the task trigger request distributed by the load balancing server 20, and executing the target task corresponding to the target task identifier. It can be understood that the target task execution server includes a plurality of sets of corresponding relationships between HTTP ports and tasks, and exposes the plurality of tasks in the form of HTTP ports, and the receiving of the task trigger request by the target task execution server, which is allocated by the load balancing server 20, may be understood as the target task execution server receiving the task trigger request through the target HTTP port, where the target HTTP is an HTTP port corresponding to the target task.
As a possible implementation manner, when the task triggering system shown in fig. 1 is applied to perform task triggering, the interaction relationship among the task scheduling server 10, the load balancing server 20, and the target task execution server 30 is shown in fig. 2.
To sum up, after receiving the task triggering request sent by the scheduling server, the load balancing server in the embodiment of the present invention selects the target task execution server from the task execution server cluster, and further allocates the target task carried in the task triggering request to the target task execution server to instruct the target task execution server to execute the target task. It can be understood that, in the embodiment of the present invention, the load balancing server allocates the corresponding task execution servers to execute the tasks, so that the same task can be prevented from being executed by a plurality of task execution servers at the same time, and the accuracy of task execution is ensured.
Referring to fig. 3, a flowchart of a task triggering method according to an embodiment of the present invention is shown, where the task triggering method shown in fig. 3 may include the following steps:
301. and the load balancing server receives a task triggering request sent by the task scheduling server when the target triggering time point arrives.
Optionally, the task triggering request may be an HTTP request, that is, the task scheduling server sends the task triggering request to the load balancing server in the form of an HTTP request, where the task triggering request may carry a target task identifier corresponding to a target triggering time point, and the target task identifier may be a Uniform Resource Locator (URL).
302. And the load balancing server responds to the task triggering request and selects a target task execution server from the task execution server cluster.
Optionally, after receiving the task triggering request, the load balancing server responds to the task triggering request to obtain a target task identifier included in the task triggering request, and then selects a target task execution server from the task execution server cluster to execute a target task corresponding to the target task identifier. It is to be understood that the task execution server cluster includes at least one task execution server, the task execution programs integrated in the respective task execution servers may be the same, and the target task execution server may be any one of the task execution servers.
As a feasible implementation manner, the load balancing server may select the target task execution server according to the current occupation status of each task execution server in the task execution server cluster, that is, the current working state of each task execution server. Optionally, the load balancing server responds to the task trigger request, and selects a target task execution server from the task execution server cluster, including: the load balancing server acquires the current working state of each task execution server in the task execution server cluster; and the load balancing server selects a target task execution server from the task execution server cluster according to the current working state of each task execution server. It can be understood that the load balancing server selects the target task execution server according to the current working state of each task execution server, that is, selects the target task execution server according to the current task processing condition of each task execution server.
Assuming that the task execution server cluster includes 5 task execution servers, the current working states of the 5 task execution servers respectively acquired by the load balancing server are as follows: the task execution server 1 is in an idle state, the task execution server 2 has 5 tasks to be executed, the task execution server 3 has 1 task to be executed, the task execution server 4 and the task execution server 5 both have 2 tasks to be executed, and the load balancing server can select the task execution server 1 as a target task execution server according to the current working states of the 5 task execution servers. It can be understood that the load balancing server selects the target task execution server according to the working state of each task execution server in the task execution server cluster, and it is required to ensure that task execution programs integrated in each task execution server in the task execution server cluster are the same.
As another possible implementation manner, the task execution programs integrated in the task execution servers in the task execution server cluster may be different, for example, the task execution server cluster includes 6 task execution servers, 3 task execution servers integrate the task execution program for saving the document at a fixed time, 2 task execution servers integrate the task execution program for canceling the order at a fixed time, and 1 task execution server integrate the task execution program for backing up the data at a fixed time. It can be understood that the task execution server integrated with the task execution program for saving the document at regular time may consider the task category to which the task execution server belongs as the document at regular time; the task type of the task execution server integrated with the task execution program for regularly canceling the order is a regularly canceling order; the task execution server integrated with the task execution program of the timing backup data belongs to the task category of the timing backup data.
Optionally, if the task execution programs integrated in the task execution servers in the task execution server cluster are different, the load balancing server may select the target task execution server according to the task category to which the target task belongs and the current working state of each task execution server in the category.
Optionally, the load balancing server may select the target task execution server according to the task category to which the target task belongs and the current working state of each task execution server in the category, where the task execution server includes: the load balancing server determines a target task corresponding to a target task identifier in the task triggering request and judges the task category to which the target task belongs; acquiring the current working state of each task execution server in the task category; and selecting a target task execution server according to the current working state of each task execution server in the category. Assuming that the task types to which 6 task execution servers included in the task execution server cluster belong are assumed as described above, if the load balancing server determines that the task type to which the target task corresponding to the target task identifier belongs is a timed save document after receiving the task trigger request, the load balancing server selects a target task execution program from the task execution servers belonging to the timed save document task type.
303. And the load balancing server distributes the task triggering request to the target task execution server so as to instruct the target task execution server to execute the target task corresponding to the target task identifier.
Optionally, the allocating, by the load balancing server, the task trigger request to the target task execution server includes: the load balancing server determines a target hypertext transfer protocol (HTTP) port related to a target task identifier in a target task execution server according to the target task identifier carried in the task triggering request; and the load balancing server distributes the task triggering request to the target task execution server through the target HTTP port. It can be understood that a plurality of task execution programs are integrated in the target task execution server, each task execution program can execute one task, and one task corresponds to one HTTP port, so that the target task execution server exposes each task in the form of the HTTP port. When a certain port of the target task execution server receives the task trigger request, the target task execution server executes the task corresponding to the HTTP port. It is also understood that the task, task identification, and HTTP port correspond to each other, and if one of the three is known, the other two can be determined.
In this embodiment, after receiving a task trigger request sent by a task scheduling server, a load balancing server selects a target task execution server from a task execution server cluster, further allocates a target task identifier included in the task trigger request to the target task execution server to instruct the target task execution server to execute a target task corresponding to the target task identifier, and allocates corresponding task execution servers to execute tasks through the load balancing server, so that the same task is prevented from being executed by multiple task execution servers at the same time, and accuracy of task execution is ensured.
Referring to fig. 4, a flowchart of another task triggering method provided in the embodiment of the present invention is shown, where the task triggering method shown in fig. 4 may include:
401. and when the target trigger time point arrives, the task scheduling server inquires a target task identifier corresponding to the target trigger time point.
Optionally, when the task scheduling server detects that the current time is the target trigger time point, the target task identifier corresponding to the target trigger time point may be queried. Wherein, the target trigger time point may be any one of a plurality of trigger time points stored in advance in the task scheduling database.
In one embodiment, the target trigger time point is a scheduled task CRON expression, which refers to executing a scheduled task at a scheduled time. The CRON expression may include minutes, hours, days, months, and weeks. For example, CRON expression 01510? MON-FRI, representing target trigger time points of monday through friday at 10 am: 15; the CRON expression "00/514, 18? ", indicating that the target trigger time point is every 5 minutes during 2 pm to 2:55 pm and 6 pm to 6:55 pm of each day; the CRON expression "01510L? ", indicates that the target trigger time point was 10:15 am on the last day of each month.
As a possible implementation manner, the task scheduling server may query the target task identifier corresponding to the target trigger time point according to a pre-stored correspondence between the trigger time point and the task identifier. Optionally, the querying, by the task scheduling server, a target task identifier corresponding to the target trigger time point includes: and the load balancing server inquires a target task identifier corresponding to the target trigger time point from the corresponding relation between at least one group of trigger time points and the task identifier stored in the database. It can be understood that, a database of the task scheduling server may store a plurality of sets of corresponding relationships between trigger time points and task identifiers in advance, and when it is detected that the current time point is the target trigger time point, the task scheduling server searches the target task identifier corresponding to the target trigger time point from the database, that is, the task identifier corresponding to the task that needs to be executed at the current time point, and it can be understood that each task identifier uniquely corresponds to one task.
The corresponding relationship between the trigger time point and the task identifier stored in the task scheduling server may be: trigger time point 01510? The task identifier corresponding to the MON-FRI is the identifier of the backup data; trigger time point "00/514, 18? "the corresponding task identifier is the identifier of the saved document; trigger time point CRON expression "01510L? And the corresponding task identifier is an identifier for sending attendance data. If the task scheduling server detects that the current time point is 10:15 Monday morning and determines that the time point is a trigger time point stored in the task scheduling server database, the time point can be determined as a target trigger time point, namely the task scheduling server detects that the target trigger time point arrives, the task scheduling server further queries a task identifier corresponding to 10:15 Monday morning from the database as an identifier of backup data, and then determines the identifier of the backup data as a target task identifier.
402. And the task scheduling server sends a task triggering request to the load balancing server.
Optionally, after the target task identifier corresponding to the target trigger time point is queried, the task scheduling server may generate a task trigger request based on the target task identifier, and send the task trigger request to the load balancing server, so that the load balancing server selects the target task execution server to execute the target task corresponding to the target task identifier.
As a possible implementation manner, the target trigger time point stored in the task scheduling server may be modified according to the needs of the user, and the manner for the task scheduling server to modify the target trigger time point may be: the task scheduling server receives modification operation aiming at a target trigger time point; and the task scheduling server modifies the target trigger time point according to the modification operation. It can be understood that the target trigger time point, that is, the execution time of the target task corresponding to the target task identifier is modified. For example, assume that the raw data stored in the task scheduling server database is: the target trigger time point is 10:15 a.m. every Monday, the corresponding target task identifier is the identifier of the backup data, that is, the original data stored in the database is the target task executed 10:15 a.m. every Monday; after receiving the modification operation of the user, the task scheduling server modifies the original data into new data: the target trigger time point is 11:00 a.m. every Monday, and the corresponding target task identifier is the identifier of the backup data. It can be understood that after the target trigger time point is modified, the task scheduling server determines that the target trigger time point arrives when the next time the time point is detected to be 11:00 a.m. every Monday, and then executes the steps of querying the target task identifier corresponding to the target trigger time point, and the like.
In a possible implementation manner, before sending the task trigger request to the load balancing server, the task scheduling server further includes: the task scheduling server judges whether the corresponding relation between the target trigger time point and the target task identifier in the database is valid at present; if yes, executing a step of sending a task triggering request to the load balancing server; if not, the task scheduling service can ignore the task triggering request. Optionally, the correspondence between the multiple groups of trigger time points and the task identifiers stored in the task scheduling database may be set to be valid or invalid according to an operation instruction of a user, where the valid correspondence may refer to executing the task according to the trigger time points, and the invalid correspondence may refer to not executing the task corresponding to the trigger time points. The corresponding relation between the task trigger time point and the task identifier stored in the task scheduling server has two states, one is an effective state, namely a normal execution state, and the other is an invalid state, namely an execution stop state, for example, the corresponding relation between a group of trigger time points and the task identifier is that attendance data is sent to 12:00 am at the last day of each month, if the user does not generate the attendance data in 7 months, the user can set the corresponding relation in the task scheduling server to be invalid by inputting an operation instruction, so that the task scheduling server can not execute the step of sending the task trigger request to the load balancing server when detecting that the corresponding relation is invalid, and the power consumption expense of the task scheduling server is saved.
When the target triggering time point arrives, the task scheduling server inquires a target task identifier corresponding to the target triggering time point, generates a task triggering request based on the target task identifier, and further sends the task triggering request to the load balancing server for instructing the load balancing server to select a target task execution server from the task execution server cluster to execute a target task corresponding to the target task identifier, so that the same task can be prevented from being executed by a plurality of task execution servers at the same time, and the accuracy of task execution is ensured.
Referring to fig. 5, a schematic structural diagram of a task triggering device according to an embodiment of the present invention is shown in fig. 5, where the task triggering device may include: receiving section 501, selecting section 502, and allocating section 503:
a receiving unit 501, configured to receive a task trigger request sent by a task scheduling server when a target trigger time point arrives, where the task trigger request carries a target task identifier corresponding to the target trigger time point;
a selecting unit 502, configured to respond to the task triggering request, and select a target task execution server from the task execution server cluster;
an allocating unit 503, configured to allocate the task trigger request to the target task execution server to instruct the target task execution server to execute the target task corresponding to the target task identifier.
Optionally, the selecting unit 502 is specifically configured to:
acquiring the current working state of each task execution server in the task execution server cluster;
and selecting a target task execution server from the task execution server cluster according to the current working state of each task execution server.
Optionally, the allocation unit is specifically configured to:
determining a target hypertext transfer protocol (HTTP) port related to a target task identifier in a target task execution server according to the target task identifier carried in the task trigger request;
and distributing the task trigger request to a target task execution server through a target HTTP port.
After receiving a task trigger request sent by a task scheduling server, the receiving unit 501 in this embodiment selects a target task execution server from a task execution server cluster in response to the task trigger request, and further the allocating unit 503 allocates the task trigger request to the target task execution server to instruct the target task execution server to execute a target task corresponding to the target task identifier, and allocates a corresponding task execution server to execute the task through a load balancing server, so that the same task is prevented from being executed by multiple task execution servers at the same time, and accuracy of task execution is ensured.
It can be understood that the functions of each functional unit and unit of the task triggering device in this embodiment may be specifically implemented according to the method in the method embodiment shown in fig. 3, and the specific implementation process may refer to the related description of the method embodiment shown in fig. 3, which is not described herein again.
Referring to fig. 6, a schematic structural diagram of another task triggering device provided in an embodiment of the present invention, where the task triggering device shown in fig. 6 may include: querying section 601 and sending section 602:
the query unit 601 is configured to query a target task identifier corresponding to a target trigger time point when the target trigger time point arrives;
a sending unit 602, configured to send a task trigger request to the load balancing server, where the task trigger request carries a target task identifier, and the task trigger request is used to instruct the load balancing server to select a target task execution server from a task execution server cluster to execute a target task corresponding to the target task identifier.
Optionally, the querying unit 601 is specifically configured to:
and inquiring the target task identifier corresponding to the target trigger time point from the corresponding relation between at least one group of trigger time points and the task identifier stored in the database.
Optionally, the task triggering apparatus further includes a determining unit 603:
a judging unit 603, configured to judge whether a correspondence between a target trigger time point and a target task identifier in the database is currently set to be valid;
if yes, the sending unit 602 sends a task trigger request to the load balancing server.
Optionally, the task triggering device further includes a receiving unit 604 and a modifying unit 605:
a receiving unit 604, configured to receive a modification operation for a target trigger time point;
a modifying unit 605, configured to modify the target trigger time point according to the modifying operation.
It can be understood that the functions of each functional unit and unit of the task triggering device in this embodiment may be specifically implemented according to the method in the method embodiment shown in fig. 4, and the specific implementation process may refer to the related description of the method embodiment shown in fig. 4, which is not described herein again.
In the embodiment of the present invention, when the target trigger time point arrives, the query unit 601 queries the target task identifier corresponding to the target trigger time point, and then the sending unit 602 sends the task trigger request to the load balancing server, so as to instruct the load balancing server to select the target task execution server to execute the target task corresponding to the target task identifier, thereby avoiding that the same task is executed by multiple task execution servers at the same time, and ensuring the accuracy of task execution.
Fig. 7 is a schematic block diagram of a load balancing server according to an embodiment of the present invention. The load balancing server in the present embodiment shown in fig. 7 may include: one or more processors 701; one or more network interfaces 702 and memory 703. The processor 701, the network interface 702, and the memory 703 are connected by a bus 704. The memory 703 is used to store computer programs comprising program instructions, and the processor 701 is used to execute the program instructions stored by the memory 703. Wherein, the processor 701 is configured to call a program instruction to execute:
receiving a task triggering request sent by a task scheduling server when a target triggering time point arrives, wherein the task triggering request carries a target task identifier corresponding to the target triggering time point;
responding to the task triggering request, and selecting a target task execution server from the task execution server cluster;
and distributing the task trigger request to a target task execution server to instruct the target task execution server to execute the target task corresponding to the target task identifier.
Optionally, in response to the task trigger request, a target task execution server is selected from the task execution server cluster, and the processor 701 is configured to call a program instruction to specifically execute:
acquiring the current working state of each task execution server in the task execution server cluster;
and selecting a target task execution server from the task execution server cluster according to the current working state of each task execution server.
Optionally, the load balancing server allocates the task triggering request to the target task execution server, and the processor 701 is configured to call a program instruction to specifically execute:
determining a target hypertext transfer protocol (HTTP) port related to a target task identifier in a target task execution server according to the target task identifier carried in the task trigger request;
and distributing the task trigger request to a target task execution server through a target HTTP port.
It should be understood that, in the embodiment of the present invention, the Processor 701 may be a Central Processing Unit (CPU), and the Processor may also be other general processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The network interface 702 is used to receive or transmit data when connecting to a network.
The memory 703 may include both read-only memory and random-access memory, and provides instructions and data to the processor 701. A portion of the memory 703 may also include non-volatile random access memory. For example, the memory 703 may also store information of the device type.
In a specific implementation, the processor 701 described in the embodiment of the present invention may execute the implementation described in the embodiment of the task triggering method provided in fig. 3, and may also execute the implementation of the task triggering apparatus described in fig. 5, which is not described herein again.
Referring to fig. 8, a schematic block diagram of a task scheduling server according to an embodiment of the present invention is shown. The task scheduling server in the embodiment shown in fig. 8 may include: one or more processors 801; one or more network interfaces 802 and a memory 803. The processor 801, the network interface 802, and the memory 803 are connected by a bus 804. The memory 803 is used to store computer programs comprising program instructions, and the processor 801 is used to execute the program instructions stored by the memory 803. Wherein the processor 801 is configured to invoke the program instructions to perform:
when the target trigger time point arrives, inquiring a target task identifier corresponding to the target trigger time point;
and sending a task triggering request to the load balancing server, wherein the task triggering request carries a target task identifier, and the task triggering request is used for indicating the load balancing server to select a target task execution server from the task execution server cluster to execute a target task corresponding to the target task identifier.
Optionally, when the target trigger time point arrives, the target task identifier corresponding to the target trigger time point is queried, and the processor 801 is configured to invoke the program instruction to specifically execute:
and when the target trigger time point arrives, inquiring the target task identifier corresponding to the target trigger time point from the corresponding relation between at least one group of trigger time points and the task identifier stored in the database.
Optionally, before sending the task triggering request to the load balancing server, the processor 801 is configured to invoke the program instructions to further perform:
judging whether the corresponding relation between the target trigger time point and the target task identifier in the database is currently set to be valid or not;
and if so, executing a step of sending a task triggering request to the load balancing server.
Optionally, the processor 801 is configured to invoke the program instructions to further perform:
receiving a modification operation aiming at a target trigger time point;
and modifying the target trigger time point according to the modification operation.
It should be understood that in embodiments of the present invention, the processor 801 may be a central processing unit CPU, and may also be other general purpose processors, digital signal processors DSP, application specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The network interface 802 is used to receive or transmit data when connecting to a network.
The memory 803 may include both read-only memory and random-access memory, and provides instructions and data to the processor 801. A portion of the memory 803 may also include non-volatile random access memory. For example, the memory 803 may also store information of the device type.
In a specific implementation, the processor 801 described in the embodiment of the present invention may execute the implementation described in the embodiment of the task triggering method provided in fig. 4, and may also execute the implementation of the task triggering apparatus described in fig. 6, which is not described herein again.
In an embodiment of the present invention, there is provided a computer-readable storage medium storing a computer program, the computer program comprising program instructions that when executed by a processor implement:
receiving a task triggering request sent by a task scheduling server when a target triggering time point arrives, wherein the task triggering request carries a target task identifier corresponding to the target triggering time point;
responding to the task triggering request, and selecting a target task execution server from the task execution server cluster;
and distributing the task trigger request to a target task execution server to instruct the target task execution server to execute the target task corresponding to the target task identifier.
Optionally, in response to the task trigger request, a target task execution server is selected from the task execution server cluster, and when executed by the processor, the program instructions implement:
acquiring the current working state of each task execution server in the task execution server cluster;
and selecting a target task execution server from the task execution server cluster according to the current working state of each task execution server.
Optionally, the load balancing server allocates the task triggering request to the target task execution server, and the program instruction is specifically implemented when executed by the processor:
determining a target hypertext transfer protocol (HTTP) port related to a target task identifier in a target task execution server according to the target task identifier carried in the task trigger request;
and distributing the task trigger request to a target task execution server through a target HTTP port.
In an embodiment of the present invention, there is provided another computer-readable storage medium storing a computer program, the computer program comprising program instructions that when executed by a processor implement:
when the target trigger time point arrives, inquiring a target task identifier corresponding to the target trigger time point;
and sending a task triggering request to the load balancing server, wherein the task triggering request carries a target task identifier, and the task triggering request is used for indicating the load balancing server to select a target task execution server from the task execution server cluster to execute a target task corresponding to the target task identifier.
Optionally, when the target trigger time point arrives, the target task identifier corresponding to the target trigger time point is queried, and when executed by the processor, the program instruction specifically implements:
and when the target trigger time point arrives, inquiring the target task identifier corresponding to the target trigger time point from the corresponding relation between at least one group of trigger time points and the task identifier stored in the database.
Optionally, before sending the task triggering request to the load balancing server, the program instructions, when executed by the processor, further implement:
judging whether the corresponding relation between the target trigger time point and the target task identifier in the database is currently set to be valid or not;
and if so, executing a step of sending a task triggering request to the load balancing server.
Optionally, the program instructions when executed by the processor further implement:
receiving a modification operation aiming at a target trigger time point;
and modifying the target trigger time point according to the modification operation.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, and the program can be stored in a computer readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
While the invention has been described with reference to a preferred embodiment, it will be understood by those skilled in the art that various changes in form and detail may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A task triggering method, comprising:
a load balancing server receives a task triggering request sent by a task scheduling server when a target triggering time point arrives, wherein the task triggering request carries a target task identifier corresponding to the target triggering time point;
the load balancing server responds to the task triggering request and selects a target task execution server from the task execution server cluster;
and the load balancing server distributes the task triggering request to the target task execution server so as to instruct the target task execution server to execute the target task corresponding to the target task identifier.
2. The method of claim 1, wherein the load balancing server selects a target task execution server from a cluster of task execution servers in response to the task trigger request, comprising:
the load balancing server acquires the current working state of each task execution server in the task execution server cluster;
and the load balancing server selects a target task execution server from the task execution server cluster according to the current working state of each task execution server.
3. The method of claim 1, wherein the load balancing server distributes the task trigger request to the target task execution server, comprising:
the load balancing server determines a target hypertext transfer protocol (HTTP) port related to a target task identifier in the target task execution server according to the target task identifier carried in the task triggering request;
and the load balancing server distributes the task triggering request to the target task execution server through the target HTTP port.
4. A task triggering method, comprising:
when a target trigger time point arrives, a task scheduling server inquires a target task identifier corresponding to the target trigger time point;
and the task scheduling server sends a task triggering request to a load balancing server, wherein the task triggering request carries the target task identifier, and the task triggering request is used for indicating the load balancing server to select a target task execution server from a task execution server cluster to execute a target task corresponding to the target task identifier.
5. The method according to claim 4, wherein when the target trigger time point arrives, the task scheduling server queries a target task identifier corresponding to the target trigger time point, and includes:
when a target trigger time point arrives, the task scheduling server inquires a target task identifier corresponding to the target trigger time point from the corresponding relation between at least one group of trigger time points and task identifiers stored in a database.
6. The method of claim 5, wherein before the task scheduling server sends the task triggering request to the load balancing server, the method further comprises:
the task scheduling server judges whether the corresponding relation between the target trigger time point and the target task identifier in the database is currently set to be valid;
and if so, the task scheduling server executes the step of sending a task triggering request to the load balancing server.
7. The method of claim 4, further comprising:
the task scheduling server receives modification operation aiming at the target trigger time point;
and the task scheduling server modifies the target trigger time point according to the modification operation.
8. A task trigger apparatus, comprising:
the system comprises a receiving unit, a task scheduling server and a processing unit, wherein the receiving unit is used for receiving a task triggering request sent by the task scheduling server when a target triggering time point arrives, and the task triggering request carries a target task identifier corresponding to the target triggering time point;
the selection unit is used for responding to the task trigger request and selecting a target task execution server from the task execution server cluster;
and the allocation unit is used for allocating the task trigger request to the target task execution server so as to instruct the target task execution server to execute the target task corresponding to the target task identifier.
9. A task trigger apparatus, comprising:
the query unit is used for querying a target task identifier corresponding to a target trigger time point when the target trigger time point arrives;
and the sending unit is used for sending a task triggering request to the load balancing server, wherein the task triggering request carries the target task identifier, and the task triggering request is used for indicating the load balancing server to select a target task execution server from a task execution server cluster to execute a target task corresponding to the target task identifier.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to perform the task triggering method according to any one of claims 1-3, or to perform the task triggering method according to any one of claims 4-7.
CN201810857046.3A 2018-07-31 2018-07-31 Task triggering method and device and computer readable storage medium Active CN110780988B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810857046.3A CN110780988B (en) 2018-07-31 2018-07-31 Task triggering method and device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810857046.3A CN110780988B (en) 2018-07-31 2018-07-31 Task triggering method and device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN110780988A true CN110780988A (en) 2020-02-11
CN110780988B CN110780988B (en) 2022-12-13

Family

ID=69382736

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810857046.3A Active CN110780988B (en) 2018-07-31 2018-07-31 Task triggering method and device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN110780988B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116804949A (en) * 2023-07-29 2023-09-26 腾讯科技(深圳)有限公司 Block chain-based data processing method, device, equipment and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103679392A (en) * 2013-12-26 2014-03-26 拉卡拉支付有限公司 Task scheduling processing method and system
CN104765639A (en) * 2015-04-30 2015-07-08 北京奇虎科技有限公司 Timed task scheduling system and method
CN106406993A (en) * 2016-09-06 2017-02-15 努比亚技术有限公司 Timed task management method and system
CN106713396A (en) * 2015-11-17 2017-05-24 阿里巴巴集团控股有限公司 Server scheduling method and system
CN106844018A (en) * 2015-12-07 2017-06-13 阿里巴巴集团控股有限公司 A kind of task processing method, apparatus and system
CN107092521A (en) * 2016-12-30 2017-08-25 北京小度信息科技有限公司 A kind of distributed task dispatching method, apparatus and system
CN108132830A (en) * 2016-12-01 2018-06-08 北京金山云网络技术有限公司 A kind of method for scheduling task, apparatus and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103679392A (en) * 2013-12-26 2014-03-26 拉卡拉支付有限公司 Task scheduling processing method and system
CN104765639A (en) * 2015-04-30 2015-07-08 北京奇虎科技有限公司 Timed task scheduling system and method
CN106713396A (en) * 2015-11-17 2017-05-24 阿里巴巴集团控股有限公司 Server scheduling method and system
CN106844018A (en) * 2015-12-07 2017-06-13 阿里巴巴集团控股有限公司 A kind of task processing method, apparatus and system
CN106406993A (en) * 2016-09-06 2017-02-15 努比亚技术有限公司 Timed task management method and system
CN108132830A (en) * 2016-12-01 2018-06-08 北京金山云网络技术有限公司 A kind of method for scheduling task, apparatus and system
CN107092521A (en) * 2016-12-30 2017-08-25 北京小度信息科技有限公司 A kind of distributed task dispatching method, apparatus and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116804949A (en) * 2023-07-29 2023-09-26 腾讯科技(深圳)有限公司 Block chain-based data processing method, device, equipment and readable storage medium
CN116804949B (en) * 2023-07-29 2023-11-14 腾讯科技(深圳)有限公司 Block chain-based data processing method, device, equipment and readable storage medium

Also Published As

Publication number Publication date
CN110780988B (en) 2022-12-13

Similar Documents

Publication Publication Date Title
CN108132830B (en) Task scheduling method, device and system
US20060206894A1 (en) Method of scheduling jobs using database management system for real-time processing
CN109814994B (en) Method and terminal for dynamically scheduling thread pool
CN110677462B (en) Access processing method, system, device and storage medium for multi-block chain network
CN103810045A (en) Resource allocation method, resource manager, resource server and system
CN108446172B (en) Data calling method and device, computer equipment and storage medium
CN110599148B (en) Cluster data processing method and device, computer cluster and readable storage medium
CN111338770A (en) Task scheduling method, server and computer readable storage medium
CN113886069A (en) Resource allocation method and device, electronic equipment and storage medium
CN112199353A (en) Data processing method and electric power customer service platform
CN112948723A (en) Interface calling method and device and related equipment
CN110780988B (en) Task triggering method and device and computer readable storage medium
CN109586970B (en) Resource allocation method, device and system
CN113515369B (en) Data processing method, system, terminal and storage medium
US7877750B2 (en) Scheduled job execution management
CN103186536A (en) Method and system for scheduling data shearing devices
CN111179008A (en) Information state updating method, device, system and storage medium
CN111913784B (en) Task scheduling method and device, network element and storage medium
CN111488373A (en) Method and system for processing request
CN112035579B (en) Graph management, data storage and data query methods, devices and storage medium
CN104735134B (en) A kind of method and apparatus serviced for providing calculating
CN115098157A (en) Method and device for processing public service data
CN113051063B (en) Task scheduling method and device for distributed tasks and electronic equipment
CN106874336B (en) Data matching method, data query method and device
CN115329005A (en) Multi-cluster cooperation method, system, device and computer readable storage medium

Legal Events

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