CN104407923A - Cluster task balancing method and device based on single node triggering - Google Patents
Cluster task balancing method and device based on single node triggering Download PDFInfo
- Publication number
- CN104407923A CN104407923A CN201410601792.8A CN201410601792A CN104407923A CN 104407923 A CN104407923 A CN 104407923A CN 201410601792 A CN201410601792 A CN 201410601792A CN 104407923 A CN104407923 A CN 104407923A
- Authority
- CN
- China
- Prior art keywords
- task
- processed
- node
- cluster
- server node
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 55
- 230000001960 triggered effect Effects 0.000 abstract description 4
- 230000000737 periodic effect Effects 0.000 description 17
- 230000008569 process Effects 0.000 description 13
- 238000010586 diagram Methods 0.000 description 10
- 230000006870 function Effects 0.000 description 9
- 230000004044 response Effects 0.000 description 6
- 239000000463 material Substances 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000010453 quartz Substances 0.000 description 1
- VYPSYNLAJGMNEJ-UHFFFAOYSA-N silicon dioxide Inorganic materials O=[Si]=O VYPSYNLAJGMNEJ-UHFFFAOYSA-N 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Landscapes
- Mobile Radio Communication Systems (AREA)
Abstract
The invention provides a cluster task balancing method based on single node triggering and a cluster task balancing device based on the single node triggering. The cluster task balancing method based on the single node triggering comprises the steps of regularly or periodically selecting available server nodes in a cluster; sending a triggering request to the available server nodes, wherein the triggering request carries the name of a to-be-handled task, so that the available server nodes are triggered to execute the to-be-handled task. By applying the method and the device, the task dispatch in the cluster can be realized based on single nodes; task loads can be dispersed relatively uniformly in the cluster, so that the cluster server resource can be utilized better.
Description
Technical Field
The invention relates to the technical field of internet, in particular to a cluster task balancing method and device based on single-node triggering.
Background
In the prior art, in order to avoid the overload of a single server, the tasks need to be balanced in a cluster. In a feasible technical scheme, under the condition that only a single node runs a timed task, the single node generally runs the timed task by running a crontab or using Quartz in a Java application, but the scheme can only execute the task on the single node, and even if a plurality of nodes are available, only one server can work, and the task cannot be uniformly put on all machines in a cluster to be executed.
Another possible technical solution is to deliver a message in a cluster through message middleware and randomly select a receiver to process a task, and this technical solution needs message middleware and requires the message middleware to support random delivery to realize task distribution in the cluster. In addition, the technical scheme performs inter-cluster task triggering through a message mechanism, so that the time precision is not high and delay is easy to occur.
Disclosure of Invention
The present invention has been made to solve at least one of the technical problems of the related art to some extent.
Therefore, the first purpose of the present invention is to provide a cluster task balancing method based on single-node triggering. The method realizes task scheduling in the cluster based on the single node, and can relatively uniformly disperse task load in the cluster, thereby better utilizing cluster server resources.
The second objective of the present invention is to provide a cluster task balancing method based on single-node triggering, in which after receiving a triggering request of a triggering node, a task to be processed is executed, so that task scheduling in a cluster can be realized based on a single node, task loads can be relatively uniformly dispersed in the cluster, and thus cluster server resources can be better utilized.
The third purpose of the invention is to provide a cluster task balancing device based on single-node triggering.
The fourth purpose of the present invention is to provide a cluster task balancing device based on single-node triggering.
In order to implement the foregoing embodiments, a cluster task balancing method based on single-node triggering according to an embodiment of the first aspect of the present invention includes: periodically or periodically selecting available server nodes in the cluster; and sending a trigger request to the available server node, wherein the trigger request carries the name of the task to be processed so as to trigger the available server node to execute the task to be processed.
According to the cluster task balancing method based on single-node triggering, the available server nodes are selected regularly or periodically, the triggering requests are sent to the available server nodes, the names of the tasks to be processed are carried in the triggering requests, the available server nodes are triggered to execute the tasks to be processed, therefore task scheduling in a cluster can be achieved based on the single nodes, task loads can be dispersed in the cluster relatively uniformly, and therefore cluster server resources can be better utilized.
In order to implement the foregoing embodiments, a cluster task balancing method based on single-node triggering according to an embodiment of the second aspect of the present invention includes: receiving a trigger request sent by a trigger node at regular time or periodically, wherein the trigger request carries the name of a task to be processed; and executing the task to be processed after determining to execute the task to be processed according to the name of the task to be processed.
According to the cluster task balancing method based on single-node triggering, after the triggering request of the triggering node is received, the task to be processed is executed, so that task scheduling in the cluster can be achieved based on the single node, task loads can be dispersed in the cluster relatively uniformly, and therefore cluster server resources can be utilized better.
In order to implement the foregoing embodiments, a cluster task balancing apparatus based on single-node triggering according to an embodiment of the third aspect of the present invention includes: the selection module is used for selecting available server nodes in the cluster at regular time or periodically; and the sending module is used for sending a triggering request to the available server node selected by the selecting module, wherein the triggering request carries the name of the task to be processed so as to trigger the available server node to execute the task to be processed.
In the cluster task balancing device based on single-node triggering of the embodiment of the invention, the selection module selects the available server nodes at regular time or periodically, the sending module sends the triggering request to the available server nodes, and the triggering request carries the name of the task to be processed so as to trigger the available server nodes to execute the task to be processed, so that the task scheduling in the cluster can be realized based on the single nodes, the task load can be relatively uniformly dispersed in the cluster, and the cluster server resources can be better utilized.
In order to implement the foregoing embodiments, a cluster task balancing apparatus based on single-node triggering according to a fourth aspect of the present invention includes: the receiving module is used for receiving a trigger request sent by a trigger node at regular time or periodically, wherein the trigger request carries the name of a task to be processed; the determining module is used for determining whether to execute the task to be processed according to the name of the task to be processed received by the receiving module; and the execution module is used for executing the task to be processed after the determination module determines to execute the task to be processed.
In the cluster task balancing device based on single-node triggering of the embodiment of the invention, the receiving module receives the triggering request of the triggering node, and the executing module executes the task to be processed after the determining module determines to execute the task to be processed, so that the task scheduling in the cluster can be realized based on the single node, the task load can be relatively uniformly dispersed in the cluster, and the cluster server resource can be better utilized.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a flowchart of an embodiment of a cluster task balancing method based on single-node triggering according to the present invention;
FIG. 2 is a flowchart of another embodiment of a cluster task balancing method based on single-node triggering according to the present invention;
FIG. 3 is a schematic deployment diagram of a cluster task balancing method based on single-node triggering according to still another embodiment of the present invention;
FIG. 4 is a flowchart of a cluster task balancing method based on single-node triggering according to another embodiment of the present invention;
FIG. 5 is a flowchart of a cluster task balancing method based on single-node triggering according to another embodiment of the present invention;
FIG. 6 is a schematic deployment diagram of a cluster task balancing method based on single-node triggering according to still another embodiment of the present invention;
FIG. 7 is a schematic structural diagram of an embodiment of a cluster task balancing device based on single-node triggering according to the present invention;
FIG. 8 is a schematic structural diagram of another embodiment of a cluster task balancing device based on single-node triggering according to the present invention;
fig. 9 is a schematic structural diagram of a cluster task balancing device based on single-node triggering according to still another embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention. On the contrary, the embodiments of the invention include all changes, modifications and equivalents coming within the spirit and terms of the claims appended hereto.
Fig. 1 is a flowchart of an embodiment of a cluster task balancing method based on single-node triggering according to the present invention, and as shown in fig. 1, the cluster task balancing method based on single-node triggering may include:
in step 101, an available server node is selected periodically or periodically.
Specifically, the selection of the available server node may be: selecting an available server node from a statically configured server node directory; alternatively, the available server nodes are obtained from a service locator or a server configuration center.
In particular implementations, a timed or periodic task may be configured on a node in the cluster, for example: the timing or periodic execution of the tasks may be configured by linux's crontab command. It is the responsibility of this timed or periodic task to randomly select an available server node in the cluster, for example, an available server node may be randomly selected from a statically configured directory of server nodes, or an available server node may be randomly retrieved from a service locator or server configuration center and then triggered to a specific task processing logic.
And 102, sending a trigger request to the available server node, wherein the trigger request carries the name of the task to be processed, so as to trigger the available server node to execute the task to be processed.
In specific implementation, triggering is simply to initiate a REST request by using a CURL command. By providing a task processing framework, a unified HTTP REST interface is provided in the task processing framework and is responsible for receiving a Hypertext Transfer Protocol (HTTP) request, printing a service log, processing parameters and performing task asynchronous execution, and services only need to realize a specific processing interface and are specially responsible for service logic.
In the embodiment, the available server node is selected at regular time or periodically, and a trigger request is sent to the available server node, where the trigger request carries a name of a task to be processed to trigger the available server node to execute the task to be processed, so that task scheduling in a cluster can be realized based on a single node, task load can be relatively uniformly dispersed in the cluster, and cluster server resources can be better utilized.
Fig. 2 is a flowchart of another embodiment of a cluster task balancing method based on single-node triggering according to the present invention, and as shown in fig. 2, the method may include:
step 201, triggering the node to select the available server node periodically or periodically.
Specifically, the selection of the available server node may be: selecting an available server node from a statically configured server node directory; alternatively, the available server nodes are obtained from a service locator or a server configuration center.
The trigger node is a node in the cluster, and a timing or periodic task is configured on the trigger node, for example: the timing or periodic execution of the tasks may be configured by linux's crontab command. It is the responsibility of this timed or periodic task to have the trigger node randomly select an available server node in the cluster, for example: the trigger node may randomly select an available server node from a statically configured server node directory, or the trigger node may randomly acquire an available server node from a service locator or a server configuration center and then trigger specific task processing logic.
Step 202, the trigger node sends a trigger request to the available server node, where the trigger request carries a name of a task to be processed.
Step 203, the available server node determines whether to execute the task to be processed according to the name of the task to be processed.
Specifically, the available server node may determine, according to a name of the task to be processed, whether the task to be processed is executed by itself, and if so, execute the task to be processed; and if the available server node determines that the task to be processed is not executed by the available server node according to the name of the task to be processed, the available server node does not execute the task to be processed.
When the available server node executes the task to be processed, if the available server node determines that the task to be processed has already been executed and executes the task to be processed again to obtain the same result as the result obtained before, the available server node may simplify the execution process of the task to be processed, for example: only the tasks to be processed can be preprocessed, and specific business processes are not executed.
At step 204, the available server node sends a trigger response to the trigger node.
Specifically, if the available server node determines to execute the task to be processed, the trigger response carries an instruction that the available server node determines to execute the task to be processed; and if the available server node determines not to execute the task to be processed, the trigger response carries an indication that the available server node determines not to execute the task to be processed.
When the available server node determines to execute the task to be processed, step 205 is executed; and when the available server node determines not to execute the task to be processed, the process is ended.
Step 205, the above-mentioned task to be processed can be executed asynchronously with the server node.
In the above embodiment, the trigger node selects the available server node at regular time or periodically, and sends the trigger request to the available server node, where the trigger request carries the name of the task to be processed, and after receiving the trigger request of the trigger node, the available server node executes the task to be processed, so that task scheduling in a cluster can be implemented based on a single node, and task loads can be relatively uniformly dispersed in the cluster, thereby better utilizing cluster server resources.
Fig. 3 is a schematic deployment diagram of a cluster task balancing method based on single-node triggering according to still another embodiment of the present invention, and in fig. 3, APP-1-1 is a triggering node.
As shown in fig. 3, the method may include:
step 301, configuring a timing or periodic task on APP-1-1.
For example: the timing or periodic execution of the tasks may be configured by linux's crontab command.
And step 302, the APP-1-1 selects an available server node in the cluster according to the scheduling of the timing or periodic task.
Specifically, APP-1-1 may randomly select an available server node from a statically configured server node directory, or APP-1-1 may randomly acquire an available server node from a service locator or a server configuration center and then trigger specific task processing logic.
In FIG. 3, APP-1-X is the available server node selected by APP-1-1.
Step 303, the APP-1-1 sends a trigger request to the APP-1-X, where the trigger request carries the name of the task to be processed, so as to trigger the APP-1-X to execute the task to be processed.
The embodiment can realize task scheduling in the cluster based on the single node, and can relatively uniformly disperse task load in the cluster, so that cluster server resources can be better utilized.
Fig. 4 is a flowchart of a cluster task balancing method based on single-node triggering according to still another embodiment of the present invention, as shown in fig. 4, the method may include:
step 401, receiving a trigger request sent periodically or at regular time by a trigger node, where the trigger request carries a name of a task to be processed.
Step 402, after determining to execute the task to be processed according to the name of the task to be processed, executing the task to be processed.
Specifically, the available server node may determine, according to a name of the task to be processed, whether the task to be processed is executed by itself, and if so, execute the task to be processed; and if the available server node determines that the task to be processed is not executed by the available server node according to the name of the task to be processed, the available server node does not execute the task to be processed.
In this embodiment, the task to be processed may be executed as follows: splitting the task to be processed into at least two subtasks to be processed, and selecting at least one server node for executing the at least two subtasks to be processed; and then respectively sending the at least two to-be-processed subtasks to at least one server node, and respectively executing the at least two to-be-processed subtasks by the at least one server node.
That is to say, in this embodiment, after determining to execute the task to be processed, the available server node may execute the task to be processed by itself, so that the task execution is distributed to the server nodes in the cluster, but when a large task is encountered, only this is done or the pressure cannot be effectively distributed, so that the available server node may also split the task to be processed into at least two sub-tasks to be processed, then at least one server node that executes the at least two sub-tasks to be processed is selected, and the at least two sub-tasks to be processed are executed by the at least one server node, respectively. Specifically, an available server node for executing at least two pending subtasks may be randomly selected, and then the at least two pending subtasks are handed over to the randomly selected at least one available server node for executing the task.
Wherein, the at least one server node that selects to execute the at least two pending subtasks may be: selecting at least one server node for executing at least two to-be-processed subtasks from a statically configured server node directory; or, at least one server node executing the at least two pending subtasks is acquired from a service locator or a server configuration center.
In addition, in this embodiment, the receiving of the trigger request periodically sent by the trigger node may be: receiving a trigger request sent by a trigger node according to a first period; the task to be processed may be executed as follows: executing the task to be processed according to a second period; wherein the first period is a multiple of the second period.
That is, the present embodiment implements a function that is continuously executed after a single trigger, for example, when the first period is 60 seconds and the second period is 10 seconds, the trigger node sends a trigger request every 60 seconds, but the execution requirement is 10 seconds, and the available server node executes itself every 10 seconds 60 seconds before the next trigger request, thereby implementing a high-precision trigger.
In the above embodiment, after receiving the trigger request of the trigger node, the available server node executes the task to be processed, so that task scheduling in the cluster can be realized based on a single node, and task loads can be relatively uniformly dispersed in the cluster, so that cluster server resources can be better utilized, and the available server node can also split the task to be processed into at least two subtasks to be processed, so that load balancing is more effectively realized in the cluster, and in addition, a function of continuous execution after single trigger is realized, so that high trigger precision can be realized.
Fig. 5 is a flowchart of a cluster task balancing method based on single-node triggering according to still another embodiment of the present invention, as shown in fig. 5, the method may include:
step 501, triggering the node to select an available server node periodically or periodically.
Specifically, the selection of the available server node may be: selecting an available server node from a statically configured server node directory; alternatively, the available server nodes are obtained from a service locator or a server configuration center.
The trigger node is a node in the cluster, and a timing or periodic task is configured on the trigger node, for example: the timing or periodic execution of the tasks may be configured by linux's crontab command. It is the responsibility of this timed or periodic task to have the trigger node randomly select an available server node in the cluster, for example: the trigger node may randomly select an available server node from a statically configured server node directory, or the trigger node may randomly acquire an available server node from a service locator or a server configuration center and then trigger specific task processing logic.
Step 502, the trigger node sends a trigger request to the available server node, where the trigger request carries a name of a task to be processed.
Step 503, the available server node determines whether to execute the task to be processed according to the name of the task to be processed.
Specifically, the available server node may determine, according to a name of the task to be processed, whether the task to be processed is executed by itself, and if so, execute the task to be processed; and if the available server node determines that the task to be processed is not executed by the available server node according to the name of the task to be processed, the available server node does not execute the task to be processed.
When the available server node executes the task to be processed, if the available server node determines that the task to be processed has already been executed and executes the task to be processed again to obtain the same result as the result obtained before, the available server node may simplify the execution process of the task to be processed, for example: only the tasks to be processed can be preprocessed, and specific business processes are not executed.
The available server node sends a trigger response to the trigger node, step 504.
Specifically, if the available server node determines to execute the task to be processed, the trigger response carries an instruction that the available server node determines to execute the task to be processed; and if the available server node determines not to execute the task to be processed, the trigger response carries an indication that the available server node determines not to execute the task to be processed.
When the available server node determines to execute the task to be processed, step 205 is executed; and when the available server node determines not to execute the task to be processed, the process is ended.
Step 505, the available server node splits the task to be processed into at least two subtasks to be processed, and selects at least one server node to execute the at least two subtasks to be processed.
Wherein, the at least one server node that selects to execute the at least two pending subtasks may be: selecting at least one server node for executing at least two to-be-processed subtasks from a statically configured server node directory; or, at least one server node executing the at least two pending subtasks is acquired from a service locator or a server configuration center.
Step 506, the available server node sends at least two pending subtasks to at least one server node, respectively.
In this embodiment, the split at least two to-be-processed subtasks may be sent to the same server node for execution, or may be sent to different server nodes for execution respectively; or grouping at least two to-be-processed subtasks, sending the subtasks belonging to the same group to the same server node for execution, and sending the subtasks belonging to different groups to different server nodes.
In step 507, at least one server node respectively executes the at least two to-be-processed subtasks asynchronously.
In the above embodiment, after receiving the trigger request of the trigger node, the available server node executes the task to be processed, so that task scheduling in the cluster can be realized based on a single node, and task loads can be relatively uniformly dispersed in the cluster, so that cluster server resources can be better utilized, and the available server node can also split the task to be processed into at least two subtasks to be processed, thereby more effectively realizing load balancing in the cluster.
Fig. 6 is a schematic deployment diagram of a cluster task balancing method based on single-node triggering according to still another embodiment of the present invention, and in fig. 6, APP-1-1 is a triggering node.
As shown in fig. 6, the method may include:
step 601, configuring a timing or periodic task on APP-1-1.
For example: the timing or periodic execution of the tasks may be configured by linux's crontab command.
Step 602, APP-1-1 selects available server nodes in the cluster according to scheduling of timing or periodic tasks.
Specifically, APP-1-1 may randomly select an available server node from a statically configured server node directory, or APP-1-1 may randomly acquire an available server node from a service locator or a server configuration center and then trigger specific task processing logic.
In FIG. 6, APP-1-X is the available server node selected by APP-1-1.
Step 603, the APP-1-1 sends a trigger request to the APP-1-X, where the trigger request carries the name of the task to be processed, so as to trigger the APP-1-X to execute the task to be processed.
Step 604, after determining to execute the task to be processed, APP-1-X splits the task to be processed into at least two sub-tasks to be processed.
Specifically, APP-1-X determines that the task to be processed is executed by itself according to the name of the task to be processed, and then executes the task to be processed.
Step 605, APP-1-X selects at least one server node executing the at least two pending subtasks.
Step 606, APP-1-X sends at least two to-be-processed subtasks to at least one server node, and the at least one server node executes the at least two to-be-processed subtasks, respectively.
In FIG. 6, APP-1-N, …, APP-1-M is at least one server node selected for APP-1-X.
The embodiment can realize task scheduling in the cluster based on the single node, and can relatively uniformly disperse task load in the cluster, so that cluster server resources can be better utilized, and the APP-1-X can also split the task to be processed into at least two sub-tasks to be processed, so that load balancing can be more effectively realized in the cluster.
Fig. 7 is a schematic structural diagram of an embodiment of a cluster task balancing device based on single-node triggering according to the present invention, where the cluster task balancing device based on single-node triggering in this embodiment may implement the process of the embodiment shown in fig. 1 of the present invention, and as shown in fig. 7, the device may include: a selection module 71 and a sending module 72;
the selection module 71 is configured to select available server nodes in the cluster periodically or periodically;
in this embodiment, the selecting module 71 is specifically configured to select an available server node from a statically configured server node directory; alternatively, the available server nodes are obtained from a service locator or a server configuration center.
In particular implementations, the selection module 71 may configure the timing or periodic execution of the tasks by means of the crontab command of linux. It is the responsibility of this timed or periodic task to randomly select an available server node in the cluster, for example, an available server node may be randomly selected from a statically configured directory of server nodes, or an available server node may be randomly retrieved from a service locator or server configuration center and then triggered to a specific task processing logic.
A sending module 72, configured to send a trigger request to the available server node selected by the selecting module 71, where the trigger request carries a name of a task to be processed, so as to trigger the available server node to execute the task to be processed.
In a specific implementation, the sending module 72 only needs to simply initiate a REST request by using a CURL command.
The cluster task balancing device based on single-node triggering in this embodiment may be a triggering node, or may be a part of the triggering node, which is not limited in this embodiment; the trigger node may be a server in the cluster.
In the cluster task balancing device based on single-node triggering, the selection module 71 selects available server nodes at regular time or periodically, and the sending module 72 sends triggering requests to the available server nodes, where the triggering requests carry names of tasks to be processed to trigger the available server nodes to execute the tasks to be processed, so that task scheduling in a cluster can be realized based on single nodes, task loads can be relatively uniformly dispersed in the cluster, and cluster server resources can be better utilized.
Fig. 8 is a schematic structural diagram of another embodiment of the cluster task balancing device based on single-node triggering according to the present invention, where the cluster task balancing device based on single-node triggering in this embodiment may implement the process of the embodiment shown in fig. 4 of the present invention, and as shown in fig. 8, the device may include: a receiving module 81, a determining module 82 and an executing module 83;
the receiving module 81 is configured to receive a trigger request sent by a trigger node periodically or periodically, where the trigger request carries a name of a task to be processed.
A determining module 82, configured to determine whether to execute the task to be processed according to the name of the task to be processed received by the receiving module 81; specifically, the determining module 82 may determine, according to the name of the task to be processed, whether the task to be processed is executed by the cluster task balancing device based on single-node triggering, and if so, the determining module 82 determines to execute the task to be processed; if the determining module 82 determines that the task to be processed is not executed by the cluster task balancing device based on single-node triggering according to the name of the task to be processed, the determining module 82 determines not to execute the task to be processed.
And an executing module 83, configured to execute the task to be processed after the determining module 82 determines to execute the task to be processed. Specifically, when the execution module 83 executes the task to be processed, if it is determined that the task to be processed has already been executed and the result obtained by executing the task to be processed again is the same as the result obtained before, the execution module 83 may simplify the execution process of the task to be processed, for example: only the tasks to be processed can be preprocessed, and specific business processes are not executed.
In this embodiment, the receiving module 81 is specifically configured to receive a trigger request sent by a trigger node according to a first period; an execution module 83, specifically configured to execute the task to be processed according to a second cycle; wherein the first period is a multiple of the second period.
That is to say, the cluster task balancing device based on single-node triggering in this embodiment implements the function that is continuously executed after a single triggering, for example, when the first period is 60 seconds, and the second period is 10 seconds, the triggering node sends the triggering request once every 60 seconds, that is, the receiving module 81 receives the triggering request once every 60 seconds, but the execution requirement is once every 10 seconds, and then the executing module 83 executes itself once every 10 seconds in 60 seconds before the next triggering request comes, thereby implementing triggering with high precision.
The cluster task balancing device based on single-node triggering in this embodiment may be an available server node or may be a part of an available server node, which is not limited in this embodiment. The available server node may be a server in the cluster.
In the cluster task balancing device based on single-node triggering, after the receiving module 81 receives the triggering request of the triggering node, the executing module 83 executes the task to be processed, so that task scheduling in the cluster can be realized based on the single node, task load can be relatively uniformly dispersed in the cluster, cluster server resources can be better utilized, and a function of continuous execution after single triggering is realized, so that high-precision triggering can be realized.
Fig. 9 is a schematic structural diagram of a cluster task balancing apparatus based on single-node triggering according to still another embodiment of the present invention, and compared with the cluster task balancing apparatus based on single-node triggering shown in fig. 8, the difference is that the executing module 83 may include: a splitting sub-module 831, a selecting sub-module 832 and a sending sub-module 833;
the splitting submodule 831 is configured to split the to-be-processed task into at least two to-be-processed subtasks;
a selection submodule 832 for selecting at least one server node that executes at least two pending subtasks split by the splitting submodule 831;
the sending sub-module 833 is configured to send at least two to-be-processed sub-tasks split by the splitting sub-module 831 to at least one server node selected by the selecting sub-module 832, and the at least one server node executes the at least two to-be-processed sub-tasks.
That is to say, in this embodiment, after the determining module 82 determines to execute the to-be-processed task, the executing module 83 may execute the to-be-processed task by itself, so that the task is distributed to the server nodes in the cluster, but when a large task is encountered, only this is done or the pressure cannot be effectively distributed, so that the splitting sub-module 831 in the executing module 83 may also split the to-be-processed task into at least two to-be-processed sub-tasks, and then the selecting sub-module 832 selects at least one server node that executes the at least two to-be-processed sub-tasks, so that the at least one server node executes the at least two to-be-processed sub-tasks respectively. Specifically, an available server node for executing at least two pending subtasks may be randomly selected, and then the at least two pending subtasks are handed over to the randomly selected at least one available server node for executing the task.
Specifically, the selecting submodule 832 may select at least one server node that executes the at least two pending subtasks from a statically configured server node directory; or, at least one server node executing the at least two pending subtasks is acquired from a service locator or a server configuration center.
The cluster task balancing device based on single-node triggering can realize task scheduling in a cluster based on single nodes, can relatively uniformly disperse task loads in the cluster, can better utilize cluster server resources, can also divide a task to be processed into at least two subtasks to be processed by an available server node, can effectively realize load balancing in the cluster, and can realize the function of continuous execution after single triggering, thereby realizing high-precision triggering.
It should be noted that the terms "first," "second," and the like in the description of the present invention are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. In addition, in the description of the present invention, "a plurality" means two or more unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic Gate circuit for implementing a logic function on a data signal, an asic having an appropriate combinational logic Gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), and the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.
Claims (12)
1. A cluster task balancing method based on single-node triggering is characterized by comprising the following steps:
periodically or periodically selecting available server nodes in the cluster;
and sending a trigger request to the available server node, wherein the trigger request carries the name of the task to be processed so as to trigger the available server node to execute the task to be processed.
2. The method of claim 1, wherein selecting available server nodes in a cluster comprises:
selecting an available server node from a statically configured server node directory; or,
the available server nodes are obtained from a service locator or a server configuration center.
3. A cluster task balancing method based on single-node triggering is characterized by comprising the following steps:
receiving a trigger request sent by a trigger node at regular time or periodically, wherein the trigger request carries the name of a task to be processed;
and executing the task to be processed after determining to execute the task to be processed according to the name of the task to be processed.
4. The method of claim 3, wherein the performing the pending task comprises:
splitting the task to be processed into at least two subtasks to be processed, and selecting at least one server node for executing the at least two subtasks to be processed;
and respectively sending the at least two to-be-processed subtasks to the at least one server node, and respectively executing the at least two to-be-processed subtasks by the at least one server node.
5. The method of claim 4, wherein selecting at least one server node to execute the at least two pending subtasks comprises:
selecting at least one server node for executing the at least two to-be-processed subtasks from a statically configured server node directory; or,
obtaining at least one server node executing the at least two pending subtasks from a service locator or a server configuration center.
6. The method according to any of claims 3-5, wherein the receiving the trigger request periodically sent by the trigger node comprises: receiving a trigger request sent by a trigger node according to a first period;
the executing the task to be processed comprises: executing the task to be processed according to a second period;
wherein the first period is a multiple of the second period.
7. A cluster task balancing device based on single-node triggering is characterized by comprising:
the selection module is used for selecting available server nodes in the cluster at regular time or periodically;
and the sending module is used for sending a triggering request to the available server node selected by the selecting module, wherein the triggering request carries the name of the task to be processed so as to trigger the available server node to execute the task to be processed.
8. The apparatus of claim 7,
the selection module is specifically configured to select an available server node from a statically configured server node directory; alternatively, the available server nodes are obtained from a service locator or a server configuration center.
9. A cluster task balancing device based on single-node triggering is characterized by comprising:
the receiving module is used for receiving a trigger request sent by a trigger node at regular time or periodically, wherein the trigger request carries the name of a task to be processed;
the determining module is used for determining whether to execute the task to be processed according to the name of the task to be processed received by the receiving module;
and the execution module is used for executing the task to be processed after the determination module determines to execute the task to be processed.
10. The apparatus of claim 9, wherein the execution module comprises:
the splitting sub-module is used for splitting the task to be processed into at least two sub-tasks to be processed;
the selection submodule is used for selecting at least one server node for executing at least two to-be-processed subtasks split by the splitting submodule;
and the sending submodule is used for respectively sending the at least two to-be-processed subtasks split by the splitting submodule to the at least one server node selected by the selecting submodule, and the at least one server node respectively executes the at least two to-be-processed subtasks.
11. The apparatus of claim 10,
the selection submodule is specifically configured to select at least one server node that executes the at least two to-be-processed subtasks from a statically configured server node directory; or, at least one server node executing the at least two pending subtasks is acquired from a service locator or a server configuration center.
12. The apparatus according to any one of claims 9 to 11,
the receiving module is specifically configured to receive a trigger request sent by a trigger node according to a first period;
the execution module is specifically configured to execute the task to be processed according to a second cycle;
wherein the first period is a multiple of the second period.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410601792.8A CN104407923A (en) | 2014-10-31 | 2014-10-31 | Cluster task balancing method and device based on single node triggering |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410601792.8A CN104407923A (en) | 2014-10-31 | 2014-10-31 | Cluster task balancing method and device based on single node triggering |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104407923A true CN104407923A (en) | 2015-03-11 |
Family
ID=52645556
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410601792.8A Pending CN104407923A (en) | 2014-10-31 | 2014-10-31 | Cluster task balancing method and device based on single node triggering |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104407923A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107301178A (en) * | 2016-04-14 | 2017-10-27 | 阿里巴巴集团控股有限公司 | Data query processing method, apparatus and system |
CN110166306A (en) * | 2019-06-14 | 2019-08-23 | 上海富欣智能交通控制有限公司 | Data communications method and system |
CN113238839A (en) * | 2021-04-26 | 2021-08-10 | 深圳微品致远信息科技有限公司 | Cloud computing based data management method and device |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060136600A1 (en) * | 2004-11-30 | 2006-06-22 | International Business Machines Corporation | A Method, System and Computer Program for Addressing a Web Service |
CN101753461A (en) * | 2010-01-14 | 2010-06-23 | 中国建设银行股份有限公司 | Method for realizing load balance, load balanced server and group system |
CN102096602A (en) * | 2009-12-15 | 2011-06-15 | 中国移动通信集团公司 | Task scheduling method, and system and equipment thereof |
US20110231888A1 (en) * | 1998-08-21 | 2011-09-22 | Corporate Media Partners D/B/A Americast | System and method for a master scheduler |
CN102541640A (en) * | 2011-12-28 | 2012-07-04 | 厦门市美亚柏科信息股份有限公司 | Cluster GPU (graphic processing unit) resource scheduling system and method |
CN102681881A (en) * | 2011-03-07 | 2012-09-19 | 中国银联股份有限公司 | Cross-computer scheduling method and system thereof |
CN103793272A (en) * | 2013-12-27 | 2014-05-14 | 北京天融信软件有限公司 | Periodical task scheduling method and periodical task scheduling system |
-
2014
- 2014-10-31 CN CN201410601792.8A patent/CN104407923A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110231888A1 (en) * | 1998-08-21 | 2011-09-22 | Corporate Media Partners D/B/A Americast | System and method for a master scheduler |
US20060136600A1 (en) * | 2004-11-30 | 2006-06-22 | International Business Machines Corporation | A Method, System and Computer Program for Addressing a Web Service |
CN102096602A (en) * | 2009-12-15 | 2011-06-15 | 中国移动通信集团公司 | Task scheduling method, and system and equipment thereof |
CN101753461A (en) * | 2010-01-14 | 2010-06-23 | 中国建设银行股份有限公司 | Method for realizing load balance, load balanced server and group system |
CN102681881A (en) * | 2011-03-07 | 2012-09-19 | 中国银联股份有限公司 | Cross-computer scheduling method and system thereof |
CN102541640A (en) * | 2011-12-28 | 2012-07-04 | 厦门市美亚柏科信息股份有限公司 | Cluster GPU (graphic processing unit) resource scheduling system and method |
CN103793272A (en) * | 2013-12-27 | 2014-05-14 | 北京天融信软件有限公司 | Periodical task scheduling method and periodical task scheduling system |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107301178A (en) * | 2016-04-14 | 2017-10-27 | 阿里巴巴集团控股有限公司 | Data query processing method, apparatus and system |
CN107301178B (en) * | 2016-04-14 | 2021-07-02 | 创新先进技术有限公司 | Data query processing method, device and system |
CN110166306A (en) * | 2019-06-14 | 2019-08-23 | 上海富欣智能交通控制有限公司 | Data communications method and system |
CN113238839A (en) * | 2021-04-26 | 2021-08-10 | 深圳微品致远信息科技有限公司 | Cloud computing based data management method and device |
CN113238839B (en) * | 2021-04-26 | 2022-04-12 | 深圳微品致远信息科技有限公司 | Cloud computing based data management method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3637733B1 (en) | Load balancing engine, client, distributed computing system, and load balancing method | |
US20200225984A1 (en) | Computing node job assignment for distribution of scheduling operations | |
US10862760B2 (en) | Network functions virtualization | |
CN106330769B (en) | Service processing method and server | |
US20240333787A1 (en) | System and method for fast application auto-scaling | |
US20170331867A1 (en) | Method, device and system for pushing file | |
WO2020168356A3 (en) | Systems and methods for cloud migration readiness | |
KR102499219B1 (en) | Interoperable cloud-based media processing using dynamic network interfaces | |
CN107438101B (en) | Service expansion method and device for single application | |
CN111510469A (en) | Message processing method and device | |
CN104407923A (en) | Cluster task balancing method and device based on single node triggering | |
US10437647B2 (en) | Cluster configuration with zero touch provisioning | |
CN107370808B (en) | Method for performing distributed processing on big data task | |
WO2019144809A1 (en) | Service update method and device, system | |
CN107025134B (en) | Database service system and method compatible with multiple databases | |
US20230123350A1 (en) | Containerized workload management in container computing environment | |
CN109032779B (en) | Task processing method and device, computer equipment and readable storage medium | |
CN106790354B (en) | Communication method and device for preventing data congestion | |
WO2012174838A1 (en) | Method and system of parallel transmitting network element messages | |
CN108833532B (en) | Service processing method, device and system based on Internet of things | |
CN106598758A (en) | Centralized forwarding and calling method and system | |
CN111294250B (en) | Pressure testing method, device and system | |
CN111935029B (en) | Gateway load balancing method and device, storage medium and electronic equipment | |
CN116232884A (en) | Proxy instance management method, device, electronic equipment and storage medium | |
CN111371635B (en) | Network node monitoring method, device and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20150311 |