Task distribution method and system based on multiple manages and multiple workers
By adopting the collaborative working mechanism of multiple managers and multiple workers in the task management system, dynamic scheduling algorithms and automation expansion, the problem of unbalanced tasks and insufficient failure processing in the task management system is solved, and efficient load balancing and system stability are achieved promote.
Patent Information
- Application Number
- CN202411041710.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-11-15
AI Technical Summary
The existing task management system has problems such as task imbalance, insufficient node failure processing and lack of a global perspective in handling scale tasks, poor stability and reliability in handling scale tasks, resulting in low system efficiency, poor stability and reliability.
Using a task distribution method based on multi-manager and multi-worker, the task load balancing, failed node processing and globalization are achieved through dynamic task scheduling algorithm, load monitoring and prediction, real-time failure detection, manager collaborative work, automated expansion and operation and maintenance mechanism. Load balancing.
It realizes efficient load balancing, quickly identify and deal with failed nodes, improves system stability and reliability, and optimizes task execution efficiency and resource utilization.
Smart Images

Figure CN118963951A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a task distribution method, in particular to a task distribution method in which multiple managers group and schedule multiple worker nodes, and belongs to the technical field of task management. Background Art
[0002] Task management system: refers to a software system used to effectively manage and allocate tasks, usually involving the scheduling, distribution, monitoring and execution of tasks.
[0003] Scheduler: It is the core component in the task management system, responsible for deciding which node or processing unit to assign tasks to, and sorting and prioritizing tasks when necessary.
[0004] Worker node: refers to the computing node that performs tasks in a distributed system, usually composed of computers or servers. Load balancing: refers to the distribution of tasks and loads among multiple nodes to ensure maximum utilization of system resources and avoid overloading of certain nodes.
[0005] Node failure processing: refers to the processing mechanism when some nodes or servers in the system cannot work normally due to failure or other reasons, usually including automatic failure detection, reallocation of tasks to other available nodes, etc.
[0006] In the existing computing environment, the design and implementation of task management systems face many challenges. Task schedulers also have some limitations in handling large-scale tasks, multi-node distribution, and failure handling, as follows:
[0007] Unbalanced tasks: Since task management systems usually adopt static task allocation strategies and fail to take into account node load, performance fluctuations, and differences between tasks, task management systems often have difficulty handling the imbalance of task allocation between nodes, which can easily lead to some nodes being overloaded while other nodes are idle, affecting the overall efficiency of the system.
[0008] Inadequate node failure handling: Since the task management system lacks a real-time failed node detection mechanism, it is unable to identify failed nodes in a timely manner. When a node fails, the system fails to automatically reallocate tasks to other available nodes, resulting in task interruption or loss, affecting the stability and reliability of the system.
[0009] Lack of global perspective: Since each scheduler runs independently, there is a lack of effective information sharing and global scheduling strategies, and a lack of effective coordination mechanisms, which makes the system unable to achieve global load balancing and task allocation.
[0010] To this end, a task distribution method and system based on multi-manager and multi-worker is proposed. Summary of the invention
[0011] In view of this, the present invention provides a task distribution method and system based on multiple managers and multiple workers to solve or alleviate the technical problems existing in the prior art, and at least provide a beneficial choice.
[0012] The technical solution of the embodiment of the present invention is implemented as follows: a task distribution method based on multiple managers and multiple workers, comprising the following steps:
[0013] S1. Develop dynamic task allocation strategies - add task scheduling algorithms, load monitoring and prediction based on the task management system;
[0014] S2. Develop dynamic task allocation strategies - add task scheduling algorithms, load monitoring and prediction based on the task management system;
[0015] S3. Use multi-manager collaborative work - call multiple managers in the task management system, group the managers and share information, and establish a manager collaborative work mechanism;
[0016] S4. Add automation extension;
[0017] S5. Add automated operation and maintenance;
[0018] S6. Get task request;
[0019] S7, collaboratively call multiple managers and multiple worker nodes to complete task distribution and execution.
[0020] Further preferably, in S1, the task scheduling algorithm is a weighted load balancing algorithm or a load balancing algorithm based on response time;
[0021] Among them, the task scheduling algorithm combines the task characteristics to dynamically adjust the task allocation weights;
[0022] Among them, task characteristics include task type, priority and execution time.
[0023] Further preferably, in S1, load monitoring is used to monitor node load in real time, collect node load information regularly, and make task allocation decisions based on real-time data;
[0024] The prediction uses load prediction models, time series analysis models, or machine learning regression models to predict the future load of the node.
[0025] Further preferably, in S2, the real-time failure detection adopts a heartbeat detection mechanism or a timeout mechanism to periodically send signals to the nodes, and determine the failed nodes according to whether the nodes respond.
[0026] Further preferably, in S2, the task reallocation strategy includes task state backup and dynamic task transfer;
[0027] Among them, task status backup is used to persist task status information to ensure that tasks can be restored and reallocated in case of failure;
[0028] Among them, dynamic task transfer is used to dynamically migrate tasks on failed nodes to other available nodes to maintain continuous execution of tasks.
[0029] Further preferably, in S3, manager grouping and information sharing are used to group multiple managers, establish information interaction channels between groups, and share real-time information between managers;
[0030] Among them, manager grouping and information sharing adopt global scheduling algorithm or distributed scheduling algorithm to make task allocation decisions based on inter-group information and load conditions.
[0031] Further preferably, in said S3, the manager collaborative working mechanism includes group leader election and collaborative decision-making process;
[0032] Among them, group leader election is to select a leader in each manager group for intra-group scheduling and coordination of inter-group communication;
[0033] Among them, the collaborative decision-making process is to establish a collaborative decision-making process between managers to ensure the overall load balancing and task scheduling of the system.
[0034] Further preferably, in S4, the automated expansion includes elastic node management, automatic deployment and configuration;
[0035] Among them, elastic node management is to introduce an automated node expansion mechanism to automatically increase or decrease nodes according to load conditions;
[0036] Among them, automatic deployment and configuration is used to automatically deploy new nodes and configure them as part of the working nodes;
[0037] In the S5, automated operation and maintenance includes health monitoring and fault handling, automated logging, and performance tuning;
[0038] Among them, health monitoring and fault handling are to monitor the health of the task management system and identify and automatically handle node failures;
[0039] Among them, automated logging and performance tuning is to use automated tools to perform system log analysis and performance tuning;
[0040] Among them, the automation tool is the ELK Stack tool, the Grafana tool, or the Splunk tool.
[0041] A task distribution system based on multiple managers and multiple workers, characterized in that: the system includes a processor and a register coupled to the processor, wherein program instructions are stored in the register, and when the program instructions are executed by the processor, the processor executes the task distribution method based on multiple managers and multiple workers described in any one of claims 1-8.
[0042] The embodiment of the present invention has the following advantages due to the adoption of the above technical solution:
[0043] Efficient load balancing: The present invention uses dynamic scheduling algorithms and load monitoring to achieve task load balancing between nodes, maximize system resource utilization, avoid the load imbalance problem in traditional systems, and ensure that each node is in a moderate load state;
[0044] Failed node processing and fault tolerance: The present invention establishes a timely failure detection mechanism to quickly identify failed nodes, thereby reducing the risk of system interruption. Tasks on failed nodes can be automatically and timely reallocated to other available nodes, ensuring the continuous execution of tasks.
[0045] Multi-manager collaborative work: The present invention ensures global load balancing and more efficient task allocation through manager grouping and collaborative work mechanism. Information sharing between managers strengthens the collaborative ability of the system, so that the system can better cope with dynamically changing workloads.
[0046] Elastic expansion and automation: The elastic node management and automated deployment of the present invention ensure that the system can automatically expand or shrink according to changes in workload, and the automated health monitoring, fault handling and log analysis reduce manual intervention and improve the stability and reliability of the system;
[0047] Optimize system performance and resource utilization: Through the optimization of task allocation and failed node processing, the present invention improves the efficiency of system task execution, reduces task waiting time, optimizes system resource utilization, and avoids excessive node load and resource waste.
[0048] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present invention will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 It is a flow chart of the steps of the present invention. DETAILED DESCRIPTION
[0051] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the spirit or scope of the present invention. Therefore, the drawings and descriptions are considered to be exemplary and non-restrictive in nature.
[0052] It should be noted that the terms "first", "second", "symmetrical", "array", etc. are only used to distinguish between description and position description purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the definition of "first", "symmetrical", etc. can explicitly or implicitly include one or more of these features; similarly, when the number of certain features is not limited in the form of words such as "two" or "three", it should be noted that this feature also explicitly or implicitly includes one or more feature quantities.
[0053] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0054] Embodiment 1
[0055] like Figure 1 As shown, an embodiment of the present invention provides a task distribution method based on multiple managers and multiple workers, including the following steps:
[0056] S1. Develop dynamic task allocation strategies - add task scheduling algorithms, load monitoring and prediction based on the task management system;
[0057] S2. Establish a failed node processing mechanism - add real-time failure detection and task reallocation strategy to the task management system;
[0058] S3. Use multi-manager collaborative work - call multiple managers in the task management system, group the managers and share information, and establish a manager collaborative work mechanism;
[0059] S4. Add automation extension;
[0060] S5. Add automated operation and maintenance;
[0061] S6. Get task request;
[0062] S7, collaboratively call multiple managers and multiple worker nodes to complete task distribution and execution.
[0063] In one embodiment, in S1, the task scheduling algorithm is a weighted load balancing algorithm;
[0064] Among them, the task scheduling algorithm combines the task characteristics to dynamically adjust the task allocation weights;
[0065] Among them, task characteristics include task type, priority, and execution time;
[0066] By considering the different characteristics of tasks, the load imbalance problem in traditional systems is avoided and each node is ensured to be in a moderate load state.
[0067] By adopting dynamic scheduling algorithms and load monitoring, task load balancing between nodes is achieved to maximize system resource utilization;
[0068] A weighted load balancing algorithm is a method of distributing network or application traffic to multiple servers or resources in a distributed system, which takes into account the performance and capabilities of each server and their relative importance in the system. By assigning different weights to each server, this algorithm can optimize resource usage and response time according to a predetermined strategy;
[0069] The weighted load balancing algorithm distributes traffic based on the following factors:
[0070] Server capacity: The ability of a server to handle requests, usually measured in terms of concurrent connections or requests per second.
[0071] Server Status: The health and current load of the server to ensure that requests are sent to the fastest responding server.
[0072] Network latency: The round-trip time for a packet of data to travel from client to server.
[0073] User Needs: Assign priorities based on the specific needs of the user or application.
[0074] Server response time: The average time it takes for the server to process a request.
[0075] In one embodiment, in S1, load monitoring is used to monitor node load in real time, collect node load information regularly, and make task allocation decisions based on real-time data;
[0076] The prediction adopts the load prediction model to predict the future load of the node;
[0077] Load forecasting model: Load forecasting models are mainly used to predict the load conditions of infrastructure such as power systems and communication networks. Such models need to consider historical load data, weather conditions, holidays and other factors to predict future load demand. Load forecasting models can help operators allocate resources reasonably and ensure the efficient operation of infrastructure. When building load forecasting models, time series analysis, machine learning and other methods are often used.
[0078] In one embodiment, in S2, the real-time failure detection uses a heartbeat detection mechanism to periodically send signals to nodes and determine failed nodes based on whether the nodes respond.
[0079] In S2, the task reallocation strategy includes task state backup and dynamic task transfer;
[0080] Among them, task status backup is used to persist task status information to ensure that tasks can be restored and reallocated in case of failure;
[0081] Among them, dynamic task transfer is used to dynamically migrate tasks on failed nodes to other available nodes to maintain task continuity;
[0082] By establishing a timely failure detection mechanism, failed nodes can be quickly identified, reducing the risk of system interruption. Tasks on failed nodes can be automatically reallocated to other available nodes in a timely manner, ensuring the continuous execution of tasks.
[0083] Heartbeat detection mechanism: The heartbeat detection mechanism is a mechanism used to monitor whether the system or network connection is normal. In network communication, two communicating entities (such as server and client) will periodically send heartbeat messages, which are special control messages, to indicate that they are still online and can communicate normally. Heartbeat messages usually contain some basic information, such as the sender's status, timestamp, etc.
[0084] By monitoring the reception of heartbeat messages, the receiver can determine whether the sender is still active. If the sender does not send a heartbeat message within a specified time, the receiver can assume that the sender has failed or disconnected, and can take appropriate measures, such as retrying the connection, notifying the monitoring system, or performing a failover.
[0085] In one embodiment, in S3, manager grouping and information sharing are used to group multiple managers and establish information interaction channels between groups to share real-time information between managers;
[0086] Among them, manager grouping and information sharing adopt a global scheduling algorithm to make task allocation decisions based on inter-group information and load conditions.
[0087] In S3, the manager collaborative working mechanism includes group leader election and collaborative decision-making process;
[0088] Among them, group leader election is to select a leader in each manager group for intra-group scheduling and coordination of inter-group communication;
[0089] Among them, the collaborative decision-making process is to establish a collaborative decision-making process between managers to ensure the overall load balancing and task scheduling of the system;
[0090] Global load balancing and more efficient task allocation are ensured through manager grouping and collaborative working mechanism. Information sharing between managers strengthens the system's collaborative ability, allowing the system to better cope with dynamically changing workloads.
[0091] Global Scheduling Algorithm: A global scheduling algorithm is an algorithm that comprehensively manages and schedules all available resources in a centralized scheduling system. This scheduling algorithm has a single scheduling entity that is responsible for evaluating the priority of all tasks, the demand for computing resources, and the allocation. The goal of the global scheduling algorithm is to optimize the performance of the entire system, such as maximizing resource utilization, minimizing the time to complete tasks, etc.
[0092] The typical application of global scheduling algorithms is in cloud computing environments, such as the task scheduler in Google's MapReduce framework. It is responsible for reasonably allocating tasks to each node in the cluster and monitoring the execution of tasks to ensure the efficient completion of the entire job.
[0093] In one embodiment, in S4, automated expansion includes elastic node management, automatic deployment, and configuration;
[0094] Among them, elastic node management is to introduce an automated node expansion mechanism to automatically increase or decrease nodes according to load conditions;
[0095] Among them, automatic deployment and configuration is used to automatically deploy new nodes and configure them as part of the working nodes;
[0096] Through elastic node management and automated deployment, the system can automatically expand or shrink according to changes in workload. Automated health monitoring, fault handling, and log analysis reduce manual intervention and improve system stability and reliability.
[0097] In S5, automated O&M includes health monitoring and fault handling, automated logging, and performance tuning;
[0098] Among them, health monitoring and fault handling are to monitor the health of the task management system and identify and automatically handle node failures;
[0099] Among them, automated logging and performance tuning is to use automated tools to perform system log analysis and performance tuning;
[0100] Among them, the automated tool is the Splunk tool;
[0101] By optimizing task allocation and handling failed nodes, the system can execute tasks more efficiently, reduce task waiting time, optimize system resource utilization, and avoid excessive node load and resource waste.
[0102] Splunk: Splunk is an open source data analysis platform that is mainly used to search, analyze and visualize machine data. Splunk can process a variety of structured and unstructured data and provide real-time event correlation and analysis;
[0103] Features of Splunk include:
[0104] Powerful search function to quickly find and analyze log data;
[0105] Rich visualization tools that support the creation of a variety of charts and dashboards;
[0106] Support customized reports and data export;
[0107] Provide cloud service and on-premises deployment options;
[0108] Splunk is suitable for scenarios that require in-depth analysis, reporting, and monitoring of log data, such as IT operations monitoring, security incident detection and response, and business intelligence analysis.
[0109] Embodiment 2
[0110] The embodiment of the present invention also provides a task distribution method based on multiple managers and multiple workers, comprising the following steps:
[0111] S1. Develop dynamic task allocation strategy - add task scheduling algorithm, load monitoring and prediction on the basis of task management system;
[0112] S2. Establish a failed node processing mechanism - add real-time failure detection and task reallocation strategy to the task management system;
[0113] S3. Use multi-manager collaborative work - call multiple managers in the task management system, group the managers and share information, and establish a manager collaborative work mechanism;
[0114] S4. Add automation extension;
[0115] S5. Add automated operation and maintenance;
[0116] S6. Obtain task request;
[0117] S7, collaboratively call multiple managers and multiple worker nodes to complete task distribution and execution.
[0118] In one embodiment, in S1, the task scheduling algorithm is a load balancing algorithm based on response time;
[0119] Among them, the task scheduling algorithm combines the task characteristics to dynamically adjust the task allocation weights;
[0120] Among them, task characteristics include task type, priority, and execution time;
[0121] By considering the different characteristics of tasks, the load imbalance problem in traditional systems is avoided and each node is ensured to be in a moderate load state.
[0122] By adopting dynamic scheduling algorithms and load monitoring, task load balancing between nodes is achieved to maximize system resource utilization;
[0123] A response time-based load balancing algorithm is an algorithm that distributes client requests based on the server's response time. The purpose of this algorithm is to ensure that client requests can be processed as quickly as possible, thereby improving user experience. A response time-based load balancing algorithm can effectively improve the overall performance of the system because it ensures that requests are processed by servers that process them quickly. This algorithm is particularly suitable for applications that are sensitive to response time.
[0124] In one embodiment, in S1, load monitoring is used to monitor node load in real time, collect node load information regularly, and make task allocation decisions based on real-time data;
[0125] The prediction uses a time series analysis model to predict the future load of the node;
[0126] Time series analysis model: A time series analysis model is a model that makes predictions based on historical time data. It predicts future values by analyzing the trend, seasonality, and periodicity of time series data. Time series analysis models are widely used in financial markets, weather forecasts, sales forecasts, and other fields. When building a time series analysis model, commonly used methods include autoregressive models (AR), moving average models (MA), autoregressive moving average models (ARMA), and seasonal models (such as ARIMA).
[0127] In one embodiment, in S2, the real-time failure detection uses a timeout mechanism to periodically send signals to nodes and determine the failed nodes based on whether the nodes respond.
[0128] In S2, the task reallocation strategy includes task state backup and dynamic task transfer;
[0129] Among them, task status backup is used to persist task status information to ensure that tasks can be restored and reallocated in case of failure;
[0130] Among them, dynamic task transfer is used to dynamically migrate tasks on failed nodes to other available nodes to maintain task continuity;
[0131] By establishing a timely failure detection mechanism, failed nodes can be quickly identified, reducing the risk of system interruption. Tasks on failed nodes can be automatically reallocated to other available nodes in a timely manner, ensuring the continuous execution of tasks.
[0132] Timeout mechanism: The timeout mechanism is a time limit mechanism used to control the maximum execution time of an operation or task. In system monitoring and network communication, the timeout mechanism can be used to ensure that an operation is completed within a certain time. If this time is exceeded, the operation is considered to have failed or timed out.
[0133] For example, in a network request, the client sets a timeout for each request. If the server does not respond within the timeout, the client considers the request failed and can cancel the request or retry. In a distributed system, the timeout mechanism is also used to control the execution time of distributed operations, such as the timeout of distributed locks and the timeout of distributed transactions.
[0134] In one embodiment, in S3, manager grouping and information sharing are used to group multiple managers and establish information interaction channels between groups to share real-time information between managers;
[0135] Among them, manager grouping and information sharing adopt a distributed scheduling algorithm to make task allocation decisions based on inter-group information and load conditions.
[0136] In S3, the manager collaborative working mechanism includes group leader election and collaborative decision-making process;
[0137] Among them, group leader election is to select a leader in each manager group for intra-group scheduling and coordination of inter-group communication;
[0138] Among them, the collaborative decision-making process is to establish a collaborative decision-making process between managers to ensure the overall load balancing and task scheduling of the system;
[0139] Global load balancing and more efficient task allocation are ensured through manager grouping and collaborative working mechanism. Information sharing between managers strengthens the system's collaborative ability, allowing the system to better cope with dynamically changing workloads.
[0140] Distributed Scheduling Algorithms: Distributed scheduling algorithms are scheduling algorithms that execute tasks on multiple nodes without a central scheduling entity. Each node may have its own local scheduler, which is responsible for scheduling tasks on this node. Distributed scheduling algorithms usually need to consider communication and coordination between nodes, as well as how to balance loads and optimize task allocation between nodes.
[0141] The goal of a distributed scheduling algorithm is to optimize the load balance between nodes, reduce communication overhead, and improve the fault tolerance of the system. This algorithm is widely used in distributed databases, distributed file systems, distributed computing tasks, and other fields. Examples of distributed scheduling algorithms include data partitioning algorithms in distributed databases, task division and scheduling in MapReduce, and data replica placement strategies in distributed file systems.
[0142] In one embodiment, in S4, automated expansion includes elastic node management, automatic deployment, and configuration;
[0143] Among them, elastic node management is to introduce an automated node expansion mechanism to automatically increase or decrease nodes according to load conditions;
[0144] Among them, automatic deployment and configuration is used to automatically deploy new nodes and configure them as part of the working nodes;
[0145] Through elastic node management and automated deployment, the system can automatically expand or shrink according to changes in workload. Automated health monitoring, fault handling, and log analysis reduce manual intervention and improve system stability and reliability.
[0146] In S5, automated O&M includes health monitoring and fault handling, automated logging, and performance tuning;
[0147] Among them, health monitoring and fault handling are to monitor the health of the task management system and identify and automatically handle node failures;
[0148] Among them, automated logging and performance tuning is to use automated tools to perform system log analysis and performance tuning;
[0149] Among them, the automation tool is the ELK Stack tool;
[0150] By optimizing task allocation and handling failed nodes, the system can execute tasks more efficiently, reduce task waiting time, optimize system resource utilization, and avoid excessive node load and resource waste.
[0151] ELK Stack: ELK Stack is a log processing and analysis platform composed of three open source tools: Elasticsearch, Logstash, and Kibana. This combination is usually used for real-time analysis and visualization of large-scale log data;
[0152] Elasticsearch is a highly scalable open source search and analytics engine for storing, searching, and analyzing large amounts of data.
[0153] Logstash is an open source data processing pipeline that can be used to collect, transmit, transform and store data;
[0154] Kibana is an open source data visualization and analysis tool used to work with Elasticsearch to create dashboards and visualize log data;
[0155] ELK Stack is particularly suitable for scenarios that require fast search and analysis of log data, such as large-scale distributed systems, cloud infrastructure, and microservice architecture.
[0156] Embodiment 3
[0157] The embodiment of the present invention also provides a task distribution method based on multiple managers and multiple workers, comprising the following steps:
[0158] S1. Develop dynamic task allocation strategy - add task scheduling algorithm, load monitoring and prediction on the basis of task management system;
[0159] S2. Establish a failed node processing mechanism - add real-time failure detection and task reallocation strategy to the task management system;
[0160] S3. Use multi-manager collaborative work - call multiple managers in the task management system, group the managers and share information, and establish a manager collaborative work mechanism;
[0161] S4. Add automation extension;
[0162] S5. Add automated operation and maintenance;
[0163] S6. Obtain task request;
[0164] S7, collaboratively call multiple managers and multiple worker nodes to complete task distribution and execution.
[0165] In one embodiment, in S1, the task scheduling algorithm is a weighted load balancing algorithm;
[0166] Among them, the task scheduling algorithm combines the task characteristics to dynamically adjust the task allocation weights;
[0167] Among them, task characteristics include task type, priority, and execution time;
[0168] By considering the different characteristics of tasks, the load imbalance problem in traditional systems is avoided and each node is ensured to be in a moderate load state.
[0169] By adopting dynamic scheduling algorithms and load monitoring, task load balancing between nodes is achieved to maximize system resource utilization;
[0170] A weighted load balancing algorithm is a method of distributing network or application traffic to multiple servers or resources in a distributed system, which takes into account the performance and capabilities of each server and their relative importance in the system. By assigning different weights to each server, this algorithm can optimize resource usage and response time according to a predetermined strategy;
[0171] The weighted load balancing algorithm distributes traffic based on the following factors:
[0172] Server capacity: The ability of a server to handle requests, usually measured in terms of concurrent connections or requests per second.
[0173] Server Status: The health and current load of the server to ensure that requests are sent to the fastest responding server.
[0174] Network latency: The round-trip time for a packet of data to travel from client to server.
[0175] User Needs: Assign priorities based on the specific needs of the user or application.
[0176] Server response time: The average time it takes for the server to process a request.
[0177] In one embodiment, in S1, load monitoring is used to monitor node load in real time, collect node load information regularly, and make task allocation decisions based on real-time data;
[0178] The prediction uses a machine learning regression model to predict the future load of the node;
[0179] Machine learning regression model: A machine learning regression model is a method that uses machine learning algorithms to establish a relationship between input features and output targets for prediction. This type of model can handle nonlinear and high-dimensional data, so it is widely used in many fields. For example, in the fields of house price prediction, stock price prediction, text classification, etc., machine learning regression models can be used for prediction. Commonly used machine learning regression models include linear regression, support vector machine regression (SVR), decision tree regression, random forest regression, etc.
[0180] In one embodiment, in S2, the real-time failure detection uses a heartbeat detection mechanism to periodically send signals to nodes and determine failed nodes based on whether the nodes respond.
[0181] In S2, the task reallocation strategy includes task state backup and dynamic task transfer;
[0182] Among them, task status backup is used to persist task status information to ensure that tasks can be restored and reallocated in case of failure;
[0183] Among them, dynamic task transfer is used to dynamically migrate tasks on failed nodes to other available nodes to maintain task continuity;
[0184] By establishing a timely failure detection mechanism, failed nodes can be quickly identified, reducing the risk of system interruption. Tasks on failed nodes can be automatically reallocated to other available nodes in a timely manner, ensuring the continuous execution of tasks.
[0185] Heartbeat detection mechanism: The heartbeat detection mechanism is a mechanism used to monitor whether the system or network connection is normal. In network communication, two communicating entities (such as server and client) will periodically send heartbeat messages, which are special control messages, to indicate that they are still online and can communicate normally. Heartbeat messages usually contain some basic information, such as the sender's status, timestamp, etc.
[0186] By monitoring the reception of heartbeat messages, the receiver can determine whether the sender is still active. If the sender does not send a heartbeat message within a specified time, the receiver can assume that the sender has failed or disconnected, and can take appropriate measures, such as retrying the connection, notifying the monitoring system, or performing a failover.
[0187] In one embodiment, in S3, manager grouping and information sharing are used to group multiple managers and establish information interaction channels between groups to share real-time information between managers;
[0188] Among them, manager grouping and information sharing adopt a global scheduling algorithm to make task allocation decisions based on inter-group information and load conditions.
[0189] In S3, the manager collaborative working mechanism includes group leader election and collaborative decision-making process;
[0190] Among them, group leader election is to select a leader in each manager group for intra-group scheduling and coordination of inter-group communication;
[0191] Among them, the collaborative decision-making process is to establish a collaborative decision-making process between managers to ensure the overall load balancing and task scheduling of the system;
[0192] Global load balancing and more efficient task allocation are ensured through manager grouping and collaborative working mechanism. Information sharing between managers strengthens the system's collaborative ability, allowing the system to better cope with dynamically changing workloads.
[0193] Global Scheduling Algorithm: A global scheduling algorithm is an algorithm that comprehensively manages and schedules all available resources in a centralized scheduling system. This scheduling algorithm has a single scheduling entity that is responsible for evaluating the priority of all tasks, the demand for computing resources, and the allocation. The goal of the global scheduling algorithm is to optimize the performance of the entire system, such as maximizing resource utilization, minimizing the time to complete tasks, etc.
[0194] The typical application of global scheduling algorithms is in cloud computing environments, such as the task scheduler in Google's MapReduce framework. It is responsible for reasonably allocating tasks to each node in the cluster and monitoring the execution of tasks to ensure the efficient completion of the entire job.
[0195] In one embodiment, in S4, automated expansion includes elastic node management, automatic deployment, and configuration;
[0196] Among them, elastic node management is to introduce an automated node expansion mechanism to automatically increase or decrease nodes according to load conditions;
[0197] Among them, automatic deployment and configuration is used to automatically deploy new nodes and configure them as part of the working nodes;
[0198] Through elastic node management and automated deployment, the system can automatically expand or shrink according to changes in workload. Automated health monitoring, fault handling, and log analysis reduce manual intervention and improve system stability and reliability.
[0199] In S5, automated O&M includes health monitoring and fault handling, automated logging, and performance tuning;
[0200] Among them, health monitoring and fault handling are to monitor the health of the task management system and identify and automatically handle node failures;
[0201] Among them, automated logging and performance tuning is to use automated tools to perform system log analysis and performance tuning;
[0202] Among them, the automation tool is Grafana tool;
[0203] By optimizing task allocation and handling failed nodes, the system can execute tasks more efficiently, reduce task waiting time, optimize system resource utilization, and avoid excessive node load and resource waste.
[0204] Grafana: Grafana is an open source data visualization and analysis tool that is mainly used to monitor and analyze metrics, logs, and trace data. Grafana supports a variety of data sources, including Prometheus, InfluxDB, Elasticsearch, KairosDB, OpenTSDB, MongoDB, Cassandra, Redis, Graphite, etc.
[0205] Features of Grafana include:
[0206] Flexible dashboard design to create a variety of charts and data visualizations;
[0207] A powerful plugin ecosystem that provides rich functionality and customization options;
[0208] Alert notifications can be integrated to issue alerts when data exceeds thresholds;
[0209] Grafana is suitable for scenarios that require monitoring and visualization of time series data, such as system performance monitoring, network monitoring, application performance management, etc.
[0210] Embodiment 4
[0211] An embodiment of the present invention also provides a task distribution system based on multiple managers and multiple workers. The system includes a processor and a register coupled to the processor. The register stores program instructions. When the program instructions are executed by the processor, the processor executes the task distribution method based on multiple managers and multiple workers according to any one of claims 1 to 8.
[0212] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of various changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A task distribution method based on multiple managers and multiple workers, characterized in that: The following steps are involved: S1. Develop dynamic task allocation strategy - add task scheduling algorithm, load monitoring and prediction on the basis of task management system; S2. Establish a failed node processing mechanism - add real-time failure detection and task reallocation strategy to the task management system; S3. Use multi-manager collaborative work - call multiple managers in the task management system, group the managers and share information, and establish a manager collaborative work mechanism; S4. Add automation extension; S5. Add automated operation and maintenance; S6. Get task request; S7, collaboratively call multiple managers and multiple worker nodes to complete task distribution and execution.
2. The task distribution method based on multiple managers and multiple workers according to claim 1, characterized in that: In S1, the task scheduling algorithm is a weighted load balancing algorithm or a load balancing algorithm based on response time; Among them, the task scheduling algorithm combines the task characteristics to dynamically adjust the task allocation weights; Among them, task characteristics include task type, priority and execution time.
3. The task distribution method based on multiple managers and multiple workers according to claim 2 is characterized in that: In S1, load monitoring is used to monitor node load in real time, collect node load information regularly, and make task allocation decisions based on real-time data; The prediction uses load forecasting models, time series analysis models, or machine learning regression models to predict the future load of the node.
4. The task distribution method based on multiple managers and multiple workers according to claim 1, characterized in that: In S2, the real-time failure detection uses a heartbeat detection mechanism or a timeout mechanism to periodically send signals to nodes, and determine the failed nodes based on whether the nodes respond.
5. The task distribution method based on multiple managers and multiple workers according to claim 4 is characterized in that: In S2, the task reallocation strategy includes task state backup and dynamic task transfer; Among them, task status backup is used to persist task status information to ensure that tasks can be restored and reallocated in case of failure; Among them, dynamic task transfer is used to dynamically migrate tasks on failed nodes to other available nodes to maintain continuous execution of tasks.
6. The task distribution method based on multiple managers and multiple workers according to claim 1, characterized in that: In S3, manager grouping and information sharing are used to group multiple managers, establish information interaction channels between groups, and share real-time information between managers; Among them, manager grouping and information sharing adopt global scheduling algorithm or distributed scheduling algorithm to make task allocation decisions based on inter-group information and load conditions.
7. The task distribution method based on multiple managers and multiple workers according to claim 6 is characterized in that: In S3, the manager collaborative working mechanism includes group leader election and collaborative decision-making process; Among them, group leader election is to select a leader in each manager group for intra-group scheduling and coordination of inter-group communication; Among them, the collaborative decision-making process is to establish a collaborative decision-making process between managers to ensure the overall load balancing and task scheduling of the system.
8. The task distribution method based on multiple managers and multiple workers according to claim 1, characterized in that: In S4, automated expansion includes elastic node management, automatic deployment and configuration; Among them, elastic node management is to introduce an automated node expansion mechanism to automatically increase or decrease nodes according to load conditions; Among them, automatic deployment and configuration is used to automatically deploy new nodes and configure them as part of the working nodes; In the S5, automated operation and maintenance includes health monitoring and fault handling, automated logging, and performance tuning; Among them, health monitoring and fault handling are to monitor the health of the task management system and identify and automatically handle node failures; Among them, automated logging and performance tuning is to use automated tools to perform system log analysis and performance tuning; The automation tool is an ELK Stack tool, a Grafana tool, or a Splunk tool.
9. A task distribution system based on multiple managers and multiple workers, characterized by: The system includes a processor and a register coupled to the processor, wherein the register stores program instructions, and when the program instructions are executed by the processor, the processor executes the task distribution method based on multiple managers and multiple workers as described in any one of claims 1-8.
