A system and method for distributed task processing based on library container

By using a library container-based distributed task processing system, and leveraging the automated management of the central server component and the Work component, combined with the Consul registry, the high hardware requirements and high technical barriers of existing technologies are solved, achieving low-cost and high-efficiency distributed task processing.

CN112631738BActive Publication Date: 2024-09-10JIANGSU XINSHU TECH CO LTD
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202110105055.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-26
Publication Date
2024-09-10
Estimated Expiration
2041-01-26

AI Technical Summary

Technical Problem

Existing technologies for big data distributed task processing suffer from high hardware and software requirements, high technical barriers, high maintenance costs, difficulty in changing development models, and high cloud service fees, making it difficult to simply build a parallel distributed task platform in the existing cluster environment.

Method used

It adopts a distributed task processing system based on library containers, including a central server component, a Work component, and a Consul registry module. It achieves automated management and communication by monitoring library files, electing a master node, and utilizing the Consul registry to ensure high availability and high consistency, avoid duplicate registration, and support Docker commands and library package management.

Benefits of technology

It reduces operation and maintenance costs, simplifies operation processes, lowers the technical threshold, and enables distributed task processing without changes to the existing development model, supporting scenarios with parallel computing and high performance requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112631738B
    Figure CN112631738B
Patent Text Reader

Abstract

The present invention discloses a system and method for distributed task processing based on library container, including at least one central server component, at least one Work component and at least one Consul registration center module, wherein the central server component is used to monitor the library files uploaded or specified by the customer, and register the central server component address port to the Consul registration center module, and if multiple central server components are started, they will first be registered to the registration center in sequence. The beneficial effects of the present invention are: the library package upload and release provided by the present invention are easy to manage, automatically maintain the start and stop of the work component and the container, and do not need to manually check whether it is normal and have problems, automatically manage the processing of tasks in the container, and reduce the operation and maintenance costs; the present invention provides services in a simple and transparent way to users without changing the existing development model, and the customer does not change the original development package library, and can simply upload and specify, which is easy to operate and reduces the technical threshold.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a distributed task processing system, in particular to a distributed task processing system and method based on a library container, belonging to the technical field of big data distributed multi-task processing applications. Background Art

[0002] With the continuous advancement of information technology, the processing of distributed multi-tasks of big data is becoming more and more common; however, the parallel processing and distribution framework based on clusters and single servers either requires more and more resources, hardware and software, or is difficult to deploy and implement. Its technical threshold is getting higher and higher, and its maintenance and operation costs are also getting higher and higher.

[0003] How to achieve distributed processing and parallel task deployment in the existing development environment without the need for complex hardware and software is now everyone's unanimous expectation.

[0004] In the existing environment, the cluster deployment of kubernets (also known as k8s) and the hadoop parallel operating system, which have high hardware requirements, are particularly complex; however, the technical threshold is too high, requiring a lot of manpower and learning costs, and the maintenance cost is also increasing.

[0005] There are also open source distributed task platforms based on xxljob and powerjob, but they cannot directly upload library packages for use. Customers are required to modify the code according to the requirements of the platform, change the original code and development methods, causing difficulties in learning and deployment; the development model needs to be changed, and the cost is too high.

[0006] Of course, there is also serverless on the cloud. Although this is convenient and easy to use, it is quite expensive. How to implement a method to simply build a parallel distributed task platform in the existing cluster environment is a very urgent requirement. Summary of the invention

[0007] The purpose of the present invention is to solve the above-mentioned problem and to provide a system and method for distributed task processing based on library container.

[0008] The object of the present invention can be achieved by the following technical solutions: A system for distributed task processing based on library containers, comprising at least one central server component, at least one Work component and at least one Consul registration center module;

[0009] The central server component is used to monitor the library files uploaded or specified by the customer, and register the central server component address port to the consul registration center module. If multiple central server components are started, they will first be registered to the registration center in sequence; then the registration center adopts an election algorithm to elect the master node to publish services externally, and the central server component and the work component communicate and provide library package log services externally;

[0010] The Work component is a daemon process for each workstation that actually executes tasks. It is responsible for executing specific tasks, communicating with the central server component, and executing commands of the central server component. The Work component is also used as an agent on each distributed server.

[0011] Similarly, after the work component is started, it first registers its own resources (CPU, memory, available hard disk space, etc.) and address ports to the consul registration center, and checks the status of the registered work machine to prevent duplicate registration (generate a unique identification code based on the machine hardware information); at the same time, it queries the registration center for master service component information, reports information to it and obeys instructions and commands; each execution needs to report to consul in real time. When receiving the re-election master service component information sent by consul, it needs to wait and query the new master service component, and be responsible for and report communication with the new service component;

[0012] After the working component on each machine is started, the first thing to do is to query the master service component information of the other party's service, request the public key of the service component, add the public key to the authorized service file in the .ssh directory of the local machine, and remove the old, outdated or elected auxiliary backup service components; the purpose of this step is to ensure that the service component has absolute password-free login and control rights to the work component (relying on Linux's public and private key ssh login mechanism). After completing these steps, it can be guaranteed that the service component can directly control the working component as the root user. In special circumstances, if an error occurs in the working work component or the instruction cannot be executed, the service component can directly log in to the work machine without a password and directly control the work machine; ensure the absolute command and stability of the system, and when necessary, even replace the work component to perform login and startup operations.

[0013] The Consul registration center module is used to receive registration information of the central server component and the Work component. Since the consul component is open source and shared, its registration discovery center guarantees the CA in the CAP principle (the core theory of CAP is that a distributed system cannot simultaneously meet the three conditions of CAP, the three requirements of availability and partition tolerance; Note: C, Consistency (strong consistency), A, Availability (availability), P, Partitiontolerance (partition tolerance), the CA of the consul registration center can meet high availability and high consistency, sacrificing some partition tolerance; for non-giant networks (such as clusters of more than 1,000 machines), it is completely sufficient.

[0014] Preferably, the commands executed by the Work component to execute the central server component are docker commands, upload and download commands, execution start and stop commands, obtain jar library package commands, report monitoring commands and health status feedback commands, etc., so that the central service component can send specific task library packages to specific work components.

[0015] Preferably, the work component and the central service component are both written in Java, and the core implements http protocol communication, self-registration of the work component, and system internal call commands of the work component.

[0016] Preferably, the health information and process task information are registered and written into the consul registration center component through the work component for display and statistics of the service component.

[0017] Preferably, the central server component includes a library package management component (log component), and the library package management component is used to provide a library package log service to the outside.

[0018] A distributed task processing method of a distributed task processing system based on library container implementation, the working method of the system specifically comprises the following steps:

[0019] Step 1: The central server component monitors the library files uploaded or specified by the customer, publishes the library files to the Docker container of the corresponding server, and then starts, stops, and operates the container; register the address port of the central server component to the Consul registration center. If multiple central server components are started, they are first registered to the Consul registration center in sequence, and then the Consul registration center adopts an election algorithm to elect the master node to publish services to the outside world. At the same time, the library package management component collects real-time logs and displays them to users. After the service component is started, it registers with the Consul registration center. After successful registration, the task work component on each specific work server is started. The service component then calls the library package management component to provide the library package management interface and interface to the outside world. At this point, the deployment is complete, waiting for the customer to upload or specify the specific library file to start and perform service operations;

[0020] Step 2: Start the work component. First, register the work component resources and address ports to the consul registry component. At the same time, check the status of the registered work machine to prevent duplicate registration (generate a unique identification code based on the machine hardware information); at the same time, query the master service component information from the consul registry component, report information to it and follow instructions; each execution is reported according to the real-time situation of consul. When receiving the re-election of the master service component information sent by the consul registry component, it is necessary to wait and query the new master service component, and be responsible for and report communication to the new central server component;

[0021] Step 3: After the master service component and the worker component have bidirectional communication, they execute commands and interact according to the protocol (first receive the master service component's public key and receive absolute control of the service component during the interaction);

[0022] Step 4: When the consul component re-elects a new central server component as the master, all components refresh the new service component address, re-interact and remove the old service component information, and receive the new master command.

[0023] Compared with the prior art, the present invention has the following beneficial effects:

[0024] (1) The library package upload and release provided by the present invention are easy to manage, and the start and stop of the working components and containers are automatically maintained. There is no need for manual inspection to check whether they are normal or have problems. The processing of tasks in the container is automatically managed, and the operation and maintenance costs are reduced.

[0025] (2) The present invention provides services in a simple and transparent way to users without changing the existing development model. Customers do not need to change the original development package library and can simply upload and specify. The operation is convenient and the technical threshold is low. The present invention can be widely used in complex and high-performance occasions such as parallel computing, parallel tasks, multi-machine deployment and operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to facilitate understanding by those skilled in the art, the present invention is further described below with reference to the accompanying drawings.

[0027] Figure 1 The present invention is a block diagram of the overall workflow of a system and method for distributed task processing based on a library container. DETAILED DESCRIPTION

[0028] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] See also Figure 1 As shown, a distributed task processing system based on library container implementation, at least one central server component, at least one Work component and at least one Consul registration center module;

[0030] The central server component is used to monitor the library files uploaded or specified by the customer, and register the central server component address port to the consul registration center module. If multiple central server components are started, they will first be registered to the registration center in sequence; then the registration center adopts an election algorithm to elect the master node to publish services externally, and the central server component and the work component communicate and provide library package log services externally;

[0031] The Work component is a daemon process for each workstation that actually executes tasks. It is responsible for executing specific tasks, communicating with the central server component, and executing commands of the central server component. The Work component is also used as an agent on each distributed server.

[0032] Similarly, after the work component is started, it first registers its own resources (CPU, memory, available hard disk space, etc.) and address ports to the consul registration center, and checks the status of the registered work machine to prevent duplicate registration (generate a unique identification code based on the machine hardware information); at the same time, it queries the registration center for master service component information, reports information to it and obeys instructions and commands; each execution needs to report to consul in real time. When receiving the re-election master service component information sent by consul, it needs to wait and query the new master service component, and be responsible for and report communication with the new service component;

[0033] After the working component on each machine is started, the first thing to do is to query the master service component information of the other party's service, request the public key of the service component, add the public key to the authorized service file in the .ssh directory of the local machine, and remove the old, outdated or elected auxiliary backup service components; the purpose of this step is to ensure that the service component has absolute password-free login and control rights to the work component (relying on Linux's public and private key ssh login mechanism). After completing these steps, it can be guaranteed that the service component can directly control the working component as the root user. In special circumstances, if an error occurs in the working work component or the instruction cannot be executed, the service component can directly log in to the work machine without a password and directly control the work machine; ensure the absolute command and stability of the system, and when necessary, even replace the work component to perform login and startup operations.

[0034] The Consul registration center module is used to receive registration information of the central server component and the Work component. Since the consul component is open source and shared, its registration discovery center guarantees the CA in the CAP principle (the core theory of CAP is that a distributed system cannot simultaneously meet the three conditions of CAP, the three requirements of availability and partition tolerance; Note: C, Consistency (strong consistency), A, Availability (availability), P, Partitiontolerance (partition tolerance), the CA of the consul registration center can meet high availability and high consistency, sacrificing some partition tolerance; for non-giant networks (such as clusters of more than 1,000 machines), it is completely sufficient.

[0035] Preferably, the commands executed by the Work component to execute the central server component are docker commands, upload and download commands, execution start and stop commands, obtain jar library package commands, report monitoring commands and health status feedback commands, etc., so that the central service component can send specific task library packages to specific work components.

[0036] Preferably, the work component and the central service component are both written in Java, and the core implements http protocol communication, self-registration of the work component, and system internal call commands of the work component.

[0037] Preferably, the health information and process task information are registered and written into the consul registration center component through the work component for display and statistics of the service component.

[0038] Preferably, the central server component includes a library package management component (log component), and the library package management component is used to provide a library package log service to the outside.

[0039] Preferably, the working method of the system specifically comprises the following steps:

[0040] Step 1: The central server component monitors the library files uploaded or specified by the customer, publishes the library files to the Docker container of the corresponding server, and then starts, stops, and operates the container; register the address port of the central server component to the Consul registration center. If multiple central server components are started, they are first registered to the Consul registration center in sequence, and then the Consul registration center adopts an election algorithm to elect the master node to publish services to the outside world. At the same time, the library package management component collects real-time logs and displays them to users. After the service component is started, it registers with the Consul registration center. After successful registration, the task work component on each specific work server is started. The service component then calls the library package management component to provide the library package management interface and interface to the outside world. At this point, the deployment is complete, waiting for the customer to upload or specify the start of a specific library file to perform service operations; Required equipment or devices or components: Docker container tool, Linux standard server, Consul registration center, library package management component, service monitoring component, task work component.

[0041] Step 2: Start the work component. First, register the work component resources and address ports to the consul registry component. At the same time, check the status of the registered work machine to prevent duplicate registration (generate a unique identification code based on the machine hardware information); at the same time, query the master service component information from the consul registry component, report information to it and follow instructions; each execution is reported according to the real-time situation of consul. When receiving the re-election of the master service component information sent by the consul registry component, it is necessary to wait and query the new master service component, and be responsible for and report communication to the new central server component;

[0042] Step 3: After the master service component and the worker component have bidirectional communication, they execute commands and interact according to the protocol (first receive the master service component's public key and receive absolute control of the service component during the interaction);

[0043] Step 4: When the consul component re-elects a new central server component as the master, all components refresh the new service component address, re-interact and remove the old service component information, and receive the new master command.

[0044] The service monitoring component is deployed on a central server or a backend with load balancing, and can maintain high availability in a load balancing redundant mode or in a master-slave mode.

[0045] After the service component is started, it registers with the registration center. After successful registration, it starts the task work component on each specific work server;

[0046] The service component then calls the library package management component to provide the library package management interface and interface to the outside world.

[0047] At this point, the deployment is complete, waiting for the customer to upload or specify the specific library file to start the service operation.

[0048] The entire method uses three self-developed components: service component, library package log management component, and work component.

[0049] The devices needed are linux system, docker system, and consul system.

[0050] The core of the present invention is the communication and feedback mechanism between the service component and the work component; both the service component and the work component are automatically registered in the consul registration center so that both parties can automatically discover each other.

[0051] The communication mechanism is bidirectional, and the communication types are divided into:

[0052] 1Execute command

[0053] Start, stop, restart, hot deploy;

[0054] 2. Receive files

[0055] Library package file stream and version information;

[0056] 3Report Status

[0057] Health status, task status, and the last n logs in real time;

[0058] 4. Container Management

[0059] Container start and stop, container build, and container status report;

[0060] 5 Log Return

[0061] Log stream collection;

[0062] Communication Protocol:

[0063] http json format

[0064] Server sends message

[0065] {"communication type":"",

[0066] "communication content": "",

[0067] }

[0068] The server receives the client message

[0069] {"communication type":"",

[0070] "communication content": "",

[0071] "Status Code": ""

[0072] }

[0073] The specific working process of the system of the present invention is as follows:

[0074] S1, Server component - sends information to consul to register itself;

[0075] S2, Server component - request consul to elect a master (i.e. leader), following the CAP principle;

[0076] S3, Consul--Broadcast to tell all work components the new master (new leader);

[0077] S4, Work component - sends information to consul to query whether it is repeated - if there is no duplication, send the formal registration information;

[0078] S5, Consul component - informs the master information or master change information - and also informs the registration result;

[0079] S6. Work component - directly communicates with the master after obtaining the master information - receives and communicates with the master.

[0080] The system of the present invention supports modification and viewing of tasks, logs, and status running in the work component; the modification includes configuration and modification of resource parameters, starting, stopping, and pausing tasks, and also includes graceful stop operations of tasks (the so-called graceful stop means that after receiving a command, the task does not stop immediately, but stops after completing the work at hand, avoiding the unfriendly nature of unexpected service interruption for customers);

[0081] Dynamic log viewing supports real-time log viewing and scrolling operations; the scheduling and execution between work components and service components are decoupled, which improves the stability of the overall system; in addition, based on the registration and discovery mechanism, the dynamic nature of work components and machines joining the cluster can be guaranteed. Since work components and processes can be stopped gracefully, the number of work components can be increased or reduced at any time, ensuring the dynamic scalability of the system.

[0082] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to only specific implementation methods. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.

Claims

1. A distributed task processing system based on a library container, characterized in that: Includes at least one central server component, at least one Work component and at least one Consul registration center module; The central server component is used to monitor the library files uploaded or specified by the customer, and register the central server component address port to the consul registration center module. The central server component communicates with the work component and provides library package log services to the outside world. The Work component is a daemon process for each workstation that actually executes tasks. It is responsible for executing specific tasks, communicating with the central server component, and executing commands of the central server component. The Work component is also used as an agent on each distributed server. The Consul registration center module is used to receive registration information of the central server component and the Work component; The commands of the Work component execution center server component are docker commands, upload and download commands, execution start and stop commands, jar library package acquisition commands, report monitoring commands and health status feedback commands; The work component and the central server component are both written in Java, and the core implements http protocol communication, self-registration of the work component, and system internal call commands of the work component; The health information and process task information are registered and written into the consul registration center component through the work component; The central server component includes a library package management component, and the library package management component is used to provide a library package log service externally.

2. The distributed task processing method of a system for distributed task processing based on a library container according to claim 1, characterized in that: The method specifically comprises the following steps: Step 1: The central server component monitors the library files uploaded or specified by the customer, publishes the library files to the Docker container of the corresponding server, and registers the central server component address port to the Consul registration center. If multiple central server components are started, they are first registered to the Consul registration center in sequence, and then the Consul registration center adopts an election algorithm to elect the master node to publish services externally; Step 2: Start the work component. First, register the work component resources and address ports to the consul registry component. At the same time, check the status of the registered work machine. At the same time, query the consul registry component for the master service component information, report information to it and follow instructions. Each execution is reported according to the real-time situation of consul. When receiving the re-election of the master service component information sent by the consul registry component, it is necessary to wait and query the new master service component, and be responsible for and report communication to the new central server component. Step 3: After the master service component and the worker component have bidirectional communication, they execute commands and interact according to the protocol; Step 4: When the consul component re-elects a new central server component as the master, all components refresh the new service component address, re-interact and remove the old service component information, and receive the new master command.

Citation Information

Patent Citations

  • Networking system for user health services, and realization method

    CN104184800A

  • Distributed task scheduling method and device based on event triggering

    CN106980543A

  • Task scheduling system for environmental sanitation platform

    CN107844368A

  • Low-coupling automatic operation and maintenance system and method

    CN108494582A

  • Data transmission method, communication component, device and system

    CN109117282A