Task batch processing method and device under cluster architecture deployment
By using a deduplication prevention control table in the cluster architecture, the problem of repeated execution of batch tasks on multiple servers was solved, and the system achieved high availability.
Patent Information
- Application Number
- CN202210277661.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-21
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2042-03-21
AI Technical Summary
In a cluster architecture, existing technologies often encounter issues such as duplicate or non-execution of batch tasks across multiple servers, leading to insufficient system availability.
By setting up an anti-duplicate control table, it can be determined whether a task record exists. If it does not exist, a new task record is generated and inserted into the anti-duplicate control table to avoid repeated execution and ensure that multiple servers can execute batch tasks simultaneously.
It effectively supports multiple servers to execute batch tasks simultaneously, ensuring high system availability and avoiding the problem of task duplication.
Smart Images

Figure CN114637587B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of distributed systems, and particularly relates to a task batch processing method and device under a cluster architecture deployment. BACKGROUND
[0002] In order to ensure high availability of batch services, the current production generally uses a dual hot standby HA deployment architecture, that is, multiple services are deployed with batch applications, but only one of them is started. If a failure occurs, other servers automatically start to execute batch tasks. This method needs to consider what scenarios to start other servers. If the scenarios are not fully considered, it is easy to cause batch programs not to be executed or batch programs to be repeatedly started, resulting in production problems. SUMMARY
[0003] In view of the problems in the prior art, the present application provides a task batch processing method and device under a cluster architecture deployment, which can effectively support multiple servers to execute batch tasks simultaneously and ensure high availability of the system.
[0004] In order to solve at least one of the above problems, the present application provides the following technical solutions:
[0005] In the first aspect, the present application provides a task batch processing method under a cluster architecture deployment, comprising:
[0006] After receiving a batch task starting instruction, it is judged whether there is a task record corresponding to the batch task starting instruction in the anti-duplicate control table, wherein the task record contains task execution time information and task execution server information;
[0007] If not, a task record corresponding to the batch task starting instruction is generated according to the current time information and the current server information and added to the anti-duplicate control table, and the corresponding task is executed according to the batch task starting instruction, otherwise, it is determined that the task is repeated.
[0008] Further, after judging whether there is a task record corresponding to the batch task starting instruction in the anti-duplicate control table, comprising:
[0009] If it is determined that there is a task record corresponding to the batch task starting instruction in the anti-duplicate control table, it is judged whether the task record is executed overtime according to the task execution time information in the task record;
[0010] If executed overtime, the task record is deleted from the anti-duplicate control table, a new task record is generated according to the current time information and the current server information and added to the anti-duplicate control table, and the corresponding task is executed according to the batch task starting instruction, otherwise, it is determined that the task is repeated.
[0011] Further, after executing the corresponding task according to the batch task starting instruction, the method comprises:
[0012] After the task execution is completed, the corresponding task record is deleted from the duplicate control table and the duplicate control table is updated.
[0013] Further, after generating a task record corresponding to the batch task starting instruction and adding the task record to the duplicate control table according to the current time information and the current server information, before executing the corresponding task according to the batch task starting instruction, the method comprises:
[0014] Judging whether the added task record exists in the duplicate control table.
[0015] If the added task record does not exist, it is determined that the task is repeated, and the batch task starting instruction is not responded.
[0016] Further, the task record is composed of a task starting execution time, a task execution server IP address and a random factor.
[0017] In a second aspect, the application provides a task batch processing device under a cluster architecture deployment, comprising:
[0018] A duplicate control judging module is configured to judge whether a task record corresponding to the batch task starting instruction exists in a duplicate control table after receiving the batch task starting instruction, wherein the task record comprises task execution time information and task execution server information.
[0019] A batch execution module is configured to generate a task record corresponding to the batch task starting instruction and add the task record to the duplicate control table according to current time information and current server information if the task record corresponding to the batch task starting instruction does not exist in the duplicate control table, and execute the corresponding task according to the batch task starting instruction, or determine that the task is repeated.
[0020] Further, the duplicate control judging module comprises:
[0021] A timeout judging unit is configured to judge whether the task record is executed overtime according to the task execution time information in the task record if it is determined that the task record corresponding to the batch task starting instruction exists in the duplicate control table.
[0022] A timeout execution unit is configured to delete the task record from the duplicate control table, generate a new task record and add the new task record to the duplicate control table according to current time information and current server information, and execute the corresponding task according to the batch task starting instruction if the task record is executed overtime, or determine that the task is repeated.
[0023] Further, the batch execution module comprises:
[0024] a control table updating unit, configured to delete the corresponding task record from the anti-duplicate control table and update the anti-duplicate control table after the task execution is completed.
[0025] Further, the batch execution module comprises:
[0026] a new record checking unit, configured to determine whether the anti-duplicate control table has the new task record;
[0027] a new record processing unit, configured to determine that the task is duplicated and not respond to the batch task triggering instruction if the anti-duplicate control table does not have the new task record.
[0028] Further, the batch execution module comprises:
[0029] a task record assembling unit, configured to assemble the task record according to the task start execution time, the task execution server IP address and the random factor.
[0030] In a third aspect, the present application provides an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the task batch processing method under the cluster architecture deployment.
[0031] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program, wherein the computer program is executed by a processor to implement the steps of the task batch processing method under the cluster architecture deployment.
[0032] In a fifth aspect, the present application provides a computer program product, comprising a computer program / instruction, wherein the computer program / instruction is executed by a processor to implement the steps of the task batch processing method under the cluster architecture deployment.
[0033] From the above technical solution, the present application provides a task batch processing method and device under the cluster architecture deployment, by setting an anti-duplicate control table, when the batch task is executed, it is first determined whether the anti-duplicate control table has the task record of the current task, if it exists, it is not executed, if it does not exist, a new task record is generated and inserted into the anti-duplicate control table, thereby ensuring that multiple servers can start batch tasks at the same time and will not be executed repeatedly, thereby effectively supporting multiple servers to execute batch tasks at the same time, and guaranteeing the high availability of the system. BRIEF DESCRIPTION OF DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings described below are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0035] Figure 1 One of the flowcharts of the task batch processing method under the cluster architecture deployment in the embodiments of the present application;
[0036] Figure 2 The second flowchart of the task batch processing method under the cluster architecture deployment in the embodiments of the present application;
[0037] Figure 3 The third flowchart of the task batch processing method under the cluster architecture deployment in the embodiments of the present application;
[0038] Figure 4 One of the structural diagrams of the task batch processing device under the cluster architecture deployment in the embodiments of the present application;
[0039] Figure 5 The second structural diagram of the task batch processing device under the cluster architecture deployment in the embodiments of the present application;
[0040] Figure 6 The third structural diagram of the task batch processing device under the cluster architecture deployment in the embodiments of the present application;
[0041] Figure 7 The fourth structural diagram of the task batch processing device under the cluster architecture deployment in the embodiments of the present application;
[0042] Figure 8 The flowchart of the task batch processing method under the cluster architecture deployment in the embodiments of the present application;
[0043] Figure 9 The structural diagram of the electronic device in the embodiments of the present application. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the following will combine the drawings in the embodiments of the present application to make a clear and complete description of the technical solutions in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.
[0045] The acquisition, storage, use, processing and the like of data in the technical solutions of the present application comply with relevant provisions of national laws and regulations.
[0046] In view of the problem that existing dual-HA deployment is prone to repeated execution when processing batch tasks, the present application provides a task batch processing method and device under cluster architecture deployment, by setting a duplicate control table, when a batch task is executed, it is first determined whether a task record of the current task exists in the duplicate control table, if it exists, it is not executed, if it does not exist, a new task record is generated and inserted into the duplicate control table, thereby ensuring that multiple servers can start batch tasks at the same time and will not be repeated, thereby effectively supporting multiple servers to execute batch tasks at the same time, and guaranteeing the high availability of the system.
[0047] In order to effectively support multiple servers to execute batch tasks at the same time, and guarantee the high availability of the system, the present application provides an embodiment of a task batch processing method under cluster architecture deployment, referring to Figure 1 , the task batch processing method under cluster architecture deployment specifically contains the following contents:
[0048] Step S101: After receiving a batch task start instruction, it is determined whether a task record corresponding to the batch task start instruction exists in the duplicate control table, wherein the task record contains task execution time information and task execution server information.
[0049] Optionally, under cluster architecture deployment, when a server receives a batch task start instruction, it can first determine whether a task record corresponding to the batch task start instruction exists in the duplicate control table.
[0050] Optionally, the duplicate control table contains a task record, and the task record corresponds to the batch task start instruction, that is, the task record corresponds to each task.
[0051] Optionally, the task record contains task execution time information and task execution server information, the task execution time information can be the system time when the task starts processing, and the task execution server information can be the physical information of the server executing the task, such as IP address, network field, etc.
[0052] Step S102: If it does not exist, a task record corresponding to the batch task start instruction is generated according to the current time information and the current server information and added to the duplicate control table, and the corresponding task is executed according to the batch task start instruction, otherwise, it is determined that the task is repeated.
[0053] Optionally, if the task record corresponding to the batch task starting instruction does not exist in the anti-duplicate control table, it indicates that the current task to be processed has not been executed by other servers, and the current server can execute the task, which will not cause repeated execution of the task.
[0054] Optionally, before actually executing the task, the current server can generate a task record corresponding to the batch task starting instruction according to current time information and current server information, and add the task record to the anti-duplicate control table. Since the anti-duplicate control table is shared and can be read by all servers, after the current server writes the task record corresponding to the task into the anti-duplicate control table, it indicates that the task will be executed by the current server, and other servers will not execute the task repeatedly.
[0055] Similarly, if the task record corresponding to the batch task starting instruction already exists in the anti-duplicate control table, it indicates that the current task to be processed has been executed by other servers, and the current server will not execute the task, which avoids repeated execution of the task.
[0056] As can be seen from the above description, the task batch processing method under the cluster architecture provided by the embodiments of the present application can set an anti-duplicate control table, when the batch task is executed, first determine whether the task record of the current task exists in the anti-duplicate control table, if it exists, do not execute, if it does not exist, generate a new task record and insert it into the anti-duplicate control table, thereby ensuring that multiple servers can start batch tasks at the same time and will not execute repeatedly, thereby effectively supporting multiple servers to execute batch tasks at the same time, and guaranteeing the high availability of the system.
[0057] In order to be able to process the overdue task in time, in an embodiment of the task batch processing method under the cluster architecture of the present application, referring to Figure 2 After the step S101, the following content can also be specifically included:
[0058] Step S201: If it is determined that the task record corresponding to the batch task starting instruction exists in the anti-duplicate control table, it is determined whether the task record is overdue according to the task execution time information in the task record.
[0059] Step S202: If it is overdue, the task record is deleted from the anti-duplicate control table, a new task record is generated according to the current time information and the current server information, and added to the anti-duplicate control table, and the corresponding task is executed according to the batch task starting instruction, otherwise, it is determined that the task is repeated.
[0060] Optionally, the current server determines that the judgment anti-duplicate control table exists the task record corresponding to the batch task starting instruction, but it does not mean that the task has been executed by other servers. There can be a case that other servers have not actually processed the task due to some reasons after adding the task record. At this time, according to the task execution time information in the task record, the application can determine whether the task record is executed overtime.
[0061] Optionally, after determining the overtime, the application can delete the task record from the anti-duplicate control table, and generate a new task record according to the current time information and the current server information, and add the new task record to the anti-duplicate control table, thereby indicating that the task is replaced by the current server for execution, and thereby executing the corresponding task according to the batch task starting instruction.
[0062] Similarly, if it is determined that the execution is not overtime, it is determined that the task is repeated, and the current server does not process the task.
[0063] In order to avoid repeated execution of the task, in an embodiment of the task batch processing method under the cluster architecture of the application, after the above step S102, the following content can be specifically included:
[0064] After the task is executed, the corresponding task record is deleted from the anti-duplicate control table and the anti-duplicate control table is updated.
[0065] In order to accurately ensure that the task will not be executed repeatedly, in an embodiment of the task batch processing method under the cluster architecture of the application, referring to Figure 3 In the above step S102, the following content can be specifically included:
[0066] Step S301: determining whether the anti-duplicate control table exists the added task record.
[0067] Step S302: if not, it is determined that the task is repeated, and the batch task starting instruction is not responded.
[0068] Optionally, after the current server adds a task record in the anti-duplicate control table, before actually executing the task, the current server can query the added task record in the anti-duplicate control table again. At this time, there can be a case that the current server has not actually processed the task due to some reasons, which causes the task to be executed overtime. As known from the above content, the task executed overtime can be executed by other servers. If so, the other servers will delete the added task record. Therefore, the current server queries whether the added task record still exists before actually executing the task, thereby ensuring that the task will not be executed repeatedly. If it still exists, the task can be executed. If it does not exist, it indicates that the task has been executed by other servers, and the current server does not respond to the batch task starting instruction.
[0069] In order to avoid task repetition, in an embodiment of the task batch processing method under the cluster architecture deployment of the present application, the following content can be specifically included:
[0070] The task record is composed of a task start execution time, a task execution server IP address, and a random factor.
[0071] Optionally, the task record is, for example, a duplicate prevention code 20210616134611201444749107, wherein 20210616134611201 is the task start execution time, 444749 is a 6-bit random factor, and 107 is the last network segment of the current server IP address 22.11.148.107.
[0072] In order to effectively support multiple servers to execute batch tasks at the same time and guarantee the high availability of the system, the present application provides an embodiment of a task batch processing device under the cluster architecture deployment for implementing all or part of the content of the task batch processing method under the cluster architecture deployment, as shown in Figure 4 The task batch processing device under the cluster architecture deployment specifically includes the following content:
[0073] A duplicate prevention judgment module 10 is configured to, after receiving a batch task start instruction, judge whether there is a task record corresponding to the batch task start instruction in a duplicate prevention control table, wherein the task record includes task execution time information and task execution server information.
[0074] A batch execution module 20 is configured to, if there is no task record corresponding to the batch task start instruction in the duplicate prevention control table, generate a task record corresponding to the batch task start instruction according to current time information and current server information, add the task record to the duplicate prevention control table, and execute the corresponding task according to the batch task start instruction, otherwise, determine that the task is repeated.
[0075] As can be seen from the above description, the task batch processing device under the cluster architecture deployment provided by the embodiment of the present application can set a duplicate prevention control table, when a batch task is executed, first judge whether there is a task record of the current task in the duplicate prevention control table, if there is, do not execute, if there is not, generate a new task record and insert it into the duplicate prevention control table, thereby ensuring that multiple servers can start batch tasks at the same time and will not be repeated, thereby effectively supporting multiple servers to execute batch tasks at the same time and guaranteeing the high availability of the system.
[0076] In order to be able to process the overdue tasks in time, in an embodiment of the task batch processing device under the cluster architecture deployment of the present application, as shown in Figure 5The anti-duplicate judgment module 10 comprises:
[0077] The timeout judgment unit 11 is configured to determine whether the task record is executed overtime according to the task execution time information in the task record if it is determined that the task record corresponding to the batch task initiation instruction exists in the judgment anti-duplicate control table.
[0078] The timeout execution unit 12 is configured to delete the task record from the anti-duplicate control table if the execution is overtime, generate a new task record according to the current time information and the current server information and add the new task record to the anti-duplicate control table, and execute the corresponding task according to the batch task initiation instruction, otherwise, determine that the task is repeated.
[0079] In order to avoid task repetition, in an embodiment of the task batch processing device under the cluster architecture deployment of the present application, referring to Figure 6 The batch execution module 20 comprises:
[0080] The control table updating unit 21 is configured to delete the corresponding task record from the anti-duplicate control table and update the anti-duplicate control table after the task execution is completed.
[0081] In order to accurately ensure that the task will not be repeated, in an embodiment of the task batch processing device under the cluster architecture deployment of the present application, referring to Figure 7 The batch execution module 20 comprises:
[0082] The new record checking unit 22 is configured to determine whether the new task record exists in the anti-duplicate control table.
[0083] The new record processed unit 23 is configured to determine that the task is repeated if the new record does not exist, and does not respond to the batch task initiation instruction.
[0084] In order to avoid task repetition, in an embodiment of the task batch processing device under the cluster architecture deployment of the present application, the following contents are further included:
[0085] The task record assembling unit is configured to assemble the task record according to the task start execution time, the task execution server IP address and the random factor.
[0086] In order to further illustrate the present application, the present application further provides a specific application example of a task batch processing method under the cluster architecture deployment by using the task batch processing device under the cluster architecture deployment, referring to Figure 8 The specific application example comprises the following contents:
[0087] 1. When the batch task initiation instruction is executed, the control table is queried to check whether the current task has an existing anti-duplicate record.
[0088] 2. If there is a current task anti-repetition record, determine whether it is timed out, if the record is timed out, delete the anti-repetition record, and insert the anti-repetition record generated by the current server; if it is not timed out, the current server does not get the execution right of the current task, records the log, and the task ends. If there is no anti-repetition record of the current task, insert the anti-repetition record generated by the current server.
[0089] 3. Query the control table again, determine whether the anti-repetition number of the anti-repetition record in the control table is consistent with the anti-repetition number generated by the server.
[0090] 4. If the anti-repetition numbers are consistent, the current server gets the execution right of the current task, and executes the task. If they are not consistent, the current server does not get the execution right of the current task, records the log, and the task ends.
[0091] 5. The task is executed, and the anti-repetition record in the control table is deleted.
[0092] As known from the above, the application supports multiple servers to execute batch tasks at the same time by setting an anti-repetition control table, avoids the problem of HA switching, and guarantees the high availability of services.
[0093] From the hardware level, in order to effectively support multiple servers to execute batch tasks at the same time and guarantee the high availability of the system, the application provides an embodiment of an electronic device for implementing all or part of the contents of the task batch processing method under the cluster architecture deployment, which specifically includes the following contents:
[0094] A processor, a memory, a communications interface, and a bus; wherein the processor, the memory, and the communications interface complete the communication among each other through the bus; the communications interface is used to realize the information transmission between the task batch processing device under the cluster architecture deployment and the core business system, the user terminal, and the related database and other related devices; the logic controller can be a desktop computer, a tablet computer, a mobile terminal, and the like, and the embodiment is not limited thereto. In the embodiment, the logic controller can be implemented with reference to the embodiments of the task batch processing method under the cluster architecture deployment and the embodiments of the task batch processing device under the cluster architecture deployment, the contents of which are incorporated herein, and the repeated parts will not be described herein again.
[0095] It can be understood that the user terminal can include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a personal digital assistant (PDA), a vehicle-mounted device, a smart wearable device, and the like. The smart wearable device can include smart glasses, a smart watch, a smart bracelet, and the like.
[0096] In practical applications, the batch processing method for tasks deployed in a cluster architecture can be partially executed on the electronic device side as described above, or all operations can be completed on the client device. The choice can be made based on the processing power of the client device and the limitations of the user's usage scenario. This application does not impose any limitations on this. If all operations are completed on the client device, the client device may further include a processor.
[0097] The aforementioned client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission. The server may include a server on the task scheduling center side; in other implementation scenarios, it may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, a server cluster consisting of multiple servers, or a distributed server structure.
[0098] Figure 9 This is a schematic block diagram illustrating the system configuration of the electronic device 9600 according to an embodiment of this application. Figure 9 As shown, the electronic device 9600 may include a central processing unit 9100 and a memory 9140; the memory 9140 is coupled to the central processing unit 9100. It is worth noting that... Figure 9 This is an example; other types of structures can also be used to supplement or replace this structure to achieve telecommunications functions or other functions.
[0099] In one embodiment, the task batch processing method functionality under a cluster architecture deployment can be integrated into the central processing unit 9100. The central processing unit 9100 can be configured to perform the following controls:
[0100] Step S101: After receiving the batch task initiation instruction, determine whether there is a task record corresponding to the batch task initiation instruction in the anti-duplicate control table, wherein the task record includes task execution time information and task execution server information.
[0101] Step S102: If it does not exist, generate a task record corresponding to the batch task initiation instruction based on the current time information and the current server information, add it to the anti-duplicate control table, and execute the corresponding task according to the batch task initiation instruction; otherwise, determine that the task is duplicated.
[0102] From the above description, the electronic device provided by the embodiments of the present application can ensure that multiple servers can simultaneously start batch tasks and will not be repeatedly executed by setting the anti-duplicate control table, thereby effectively supporting multiple servers to simultaneously execute batch tasks and guaranteeing the high availability of the system.
[0103] In another embodiment, the task batch processing device under the cluster architecture deployment can be configured separately from the central processor 9100, for example, the task batch processing device under the cluster architecture deployment can be configured as a chip connected with the central processor 9100, and the function of the task batch processing method under the cluster architecture deployment is realized through the control of the central processor.
[0104] As shown in Figure 9 , the electronic device 9600 can also include a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It should be noted that the electronic device 9600 does not necessarily include all the components shown in Figure 9 ; in addition, the electronic device 9600 can also include components not shown in Figure 9 , which can be referred to prior art.
[0105] As shown in Figure 9 , the central processor 9100, also known as a controller or an operation control, can include a microprocessor or other processor device and / or a logic device, which receives input and controls the operation of each component of the electronic device 9600.
[0106] The memory 9140, for example, can be one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The above information related to failure can be stored, and in addition, programs related to the information can be stored. The central processor 9100 can execute the programs stored in the memory 9140 to realize information storage or processing, etc.
[0107] The input unit 9120 provides input to the central processor 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and text. The display can be, for example, an LCD display, but is not limited thereto.
[0108] The memory 9140 can be a solid state memory such as a read only memory (ROM), a random access memory (RAM), a SIM card, or the like. It can also be a memory that retains information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes referred to as an EPROM or the like. The memory 9140 can also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 can include an application / function storage 9142 for storing application programs and function programs or for storing a flow for executing an operation of the electronic device 9600 by the central processing unit 9100.
[0109] The memory 9140 can also include a data storage 9143 for storing data such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. A driver storage 9144 of the memory 9140 can include various drivers of the electronic device for a communication function and / or for performing other functions of the electronic device such as a messaging application, a phonebook application, and the like.
[0110] The communication module 9110 is a transmitter / receiver 9110 that transmits and receives signals via an antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processing unit 9100 to provide input signals and receive output signals, which can be the same as in the case of a conventional mobile communication terminal.
[0111] Based on different communication technologies, a plurality of communication modules 9110 such as a cellular network module, a Bluetooth module, and / or a wireless local area network module, and the like can be provided in the same electronic device. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and receive audio input from the microphone 9132, thereby enabling a conventional telecommunication function. The audio processor 9130 can include any suitable buffer, decoder, amplifier, and the like. In addition, the audio processor 9130 is also coupled to the central processing unit 9100, thereby enabling recording on the local by the microphone 9132 and playing a sound stored on the local by the speaker 9131.
[0112] The embodiment of the present application further provides a computer readable storage medium capable of implementing all steps of the task batch processing method in the cluster architecture deployment of the server or the client as the execution subject in the above embodiment, wherein the computer program is stored on the computer readable storage medium, and the computer program is executed by the processor to implement all steps of the task batch processing method in the cluster architecture deployment of the server or the client as the execution subject in the above embodiment, for example, the processor executes the computer program to implement the following steps:
[0113] Step S101: after receiving the batch task starting instruction, it is judged whether there is a task record corresponding to the batch task starting instruction in the anti-duplication control table, wherein the task record contains task execution time information and task execution server information.
[0114] Step S102: if there is no task record, a new task record corresponding to the batch task starting instruction is generated according to the current time information and the current server information and added to the anti-duplication control table, and the corresponding task is executed according to the batch task starting instruction, otherwise, it is determined that the task is repeated.
[0115] From the above description, the computer readable storage medium provided by the embodiment of the present application can effectively support the simultaneous execution of batch tasks by multiple servers and guarantee the high availability of the system by setting the anti-duplication control table, judging whether there is a task record of the current task in the anti-duplication control table when the batch task is executed, and if there is, not executing, and if there is not, generating a new task record and inserting it into the anti-duplication control table, so as to guarantee that multiple servers can simultaneously start batch tasks and will not be repeatedly executed.
[0116] The embodiment of the present application further provides a computer program product capable of implementing all steps of the task batch processing method in the cluster architecture deployment of the server or the client as the execution subject in the above embodiment, wherein the computer program / instruction is executed by the processor to implement the steps of the task batch processing method in the cluster architecture deployment, for example, the computer program / instruction implements the following steps:
[0117] Step S101: after receiving the batch task starting instruction, it is judged whether there is a task record corresponding to the batch task starting instruction in the anti-duplication control table, wherein the task record contains task execution time information and task execution server information.
[0118] Step S102: if there is no task record, a new task record corresponding to the batch task starting instruction is generated according to the current time information and the current server information and added to the anti-duplication control table, and the corresponding task is executed according to the batch task starting instruction, otherwise, it is determined that the task is repeated.
[0119] From the above description, the computer program product provided by the embodiment of the present application can ensure that multiple servers can simultaneously start batch tasks and will not be repeatedly executed by setting the anti-duplicate control table, and thus can effectively support multiple servers to simultaneously execute batch tasks, and guarantee the high availability of the system.
[0120] Those skilled in the art will understand that the embodiments of the present application can be provided as methods, apparatuses, or computer program products. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0121] The present application is described with reference to flowcharts and / or block diagrams of the methods, apparatuses (devices), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus generate a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in one or more blocks.
[0122] These computer program instructions can also be stored in a computer-readable memory that can direct the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including instruction apparatus, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in one or more blocks.
[0123] These computer program instructions can also be loaded into a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable data processing apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable data processing apparatus provide a process for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 Figure 1 an apparatus that performs the functions specified in one or more blocks.
[0124] The principles and implementation manners of the present application are described in the specific embodiments. The above description of the embodiments is only used to help understand the method of the present application and its core idea. Meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manners and application ranges will be changed. In summary, the content of the specification should not be understood as a limitation of the present application.
Claims
1. A method for processing a batch of tasks under a cluster architecture, characterized in that, The method comprises: After receiving the batch task starting instruction, it is judged whether there is a task record corresponding to the batch task starting instruction in the anti-duplicate control table, wherein the task record contains task execution time information and task execution server information; If not, a task record corresponding to the batch task starting instruction is generated according to current time information and current server information and added to the anti-duplicate control table, and the corresponding task is executed according to the batch task starting instruction, otherwise, it is determined that the task is repeated; After judging whether there is a task record corresponding to the batch task starting instruction in the anti-duplicate control table, if it is determined that there is a task record corresponding to the batch task starting instruction in the anti-duplicate control table, it is judged whether the task record is executed overtime according to the task execution time information in the task record; if executed overtime, the task record is deleted from the anti-duplicate control table, a new task record is generated according to current time information and current server information and added to the anti-duplicate control table, and the corresponding task is executed according to the batch task starting instruction, otherwise, it is determined that the task is repeated.
2. The method of claim 1, wherein, After executing the corresponding task according to the batch task starting instruction, it comprises: After the task execution is completed, the corresponding task record is deleted from the anti-duplicate control table and the anti-duplicate control table is updated.
3. The method of claim 2, wherein, After generating a task record corresponding to the batch task starting instruction according to current time information and current server information and adding the task record to the anti-duplicate control table, before executing the corresponding task according to the batch task starting instruction, it comprises: It is judged whether the added task record exists in the anti-duplicate control table; If not, it is determined that the task is repeated and the batch task starting instruction is no longer responded.
4. The method of claim 1, wherein, The task record is composed of task start execution time, task execution server IP address and random factor.
5. A task batch processing apparatus under a cluster architecture deployment, characterized in that, It comprises: The anti-duplicate judgment module is used for judging whether there is a task record corresponding to the batch task starting instruction in the anti-duplicate control table after receiving the batch task starting instruction, wherein the task record contains task execution time information and task execution server information; The batch execution module is used for generating a task record corresponding to the batch task starting instruction according to current time information and current server information and adding the task record to the anti-duplicate control table if there is no task record corresponding to the batch task starting instruction in the anti-duplicate control table, and executing the corresponding task according to the batch task starting instruction, otherwise, it is determined that the task is repeated; The anti-duplicate judgment module comprises: The overtime judgment unit is used for judging whether the task record is executed overtime according to the task execution time information in the task record if it is determined that there is a task record corresponding to the batch task starting instruction in the anti-duplicate control table; The overtime execution unit is used for deleting the task record from the anti-duplicate control table if executed overtime, generating a new task record according to current time information and current server information and adding the new task record to the anti-duplicate control table, and executing the corresponding task according to the batch task starting instruction, otherwise, it is determined that the task is repeated.
6. The task batch processing apparatus under the cluster architecture deployment according to claim 5, characterized in that, The batch execution module comprises: A control table updating unit is configured to delete the corresponding task record from the anti-duplicate control table and update the anti-duplicate control table after the task execution is completed.
7. The task batch processing apparatus under the cluster architecture deployment according to claim 6, characterized in that, The batch execution module comprises: A new record checking unit is configured to determine whether the anti-duplicate control table contains the newly added task record. A new record processing unit is configured to determine that the task is duplicated if the anti-duplicate control table does not contain the newly added task record, and not to respond to the batch task triggering instruction any more.
8. The task batch processing apparatus under the cluster architecture deployment according to claim 5, characterized in that, Further comprising: A task record assembling unit is configured to assemble a task record according to a task start execution time, a task execution server IP address, and a random factor.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the steps of the task batch processing method under the cluster architecture deployment according to any one of claims 1 to 4.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the task batch processing method under the cluster architecture deployment according to any one of claims 1 to 4.
11. A computer program product comprising computer programs / instructions, characterized in that, The computer program / instruction is executed by the processor to implement the steps of the task batch processing method under the cluster architecture deployment according to any one of claims 1 to 4.
Citation Information
Patent Citations
Method and device for executing batch tasks in cluster environment
CN113515357A