A micro-service architecture implementation method for intelligent dispatch of scheduled tasks
By using a task analysis module, a service instance monitoring module, and a task optimization and allocation model based on the Transformer architecture, the problem of low efficiency in scheduled task dispatch and allocation under a microservice architecture is solved. This achieves accurate matching and dynamic optimization between tasks and service instances, thereby improving system performance and resource utilization.
Patent Information
- Application Number
- CN202511113631.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-11
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-08-11
AI Technical Summary
The existing technology has low efficiency in task planning and distribution under the microservice architecture, and fails to comprehensively consider task characteristics, service instance capabilities, and system load status, resulting in resource waste and task execution delays.
A task analysis module is established for precise classification and labeling. Combined with a service instance monitoring module, load information is collected in real time. The capacity of service instances is quantified through a load assessment algorithm. A multi-dimensional feature matching algorithm is used to achieve accurate association between tasks and service instances. A task optimization and allocation model based on the Transformer architecture is introduced, and the dispatch strategy is dynamically adjusted with a feedback optimization mechanism.
It significantly improves the accuracy and efficiency of task allocation, enhances system resource utilization and task execution efficiency, and realizes the transformation from traditional static allocation to intelligent dynamic optimization.
Smart Images

Figure CN120631546B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of plan task dispatching micro-service, and particularly relates to a plan task intelligent dispatching micro-service architecture implementation method. BACKGROUND
[0002] In the micro-service architecture environment, the plan task scheduling system needs to reasonably distribute a large number of tasks to each service instance for execution. The traditional task dispatching method mainly adopts the polling scheduling, random allocation or the strategy based on simple load balancing, which is widely used in cloud computing platforms, distributed systems, big data processing platforms and other application scenarios. However, the traditional task dispatching method has significant defects, and cannot comprehensively consider multi-dimensional factors such as task characteristics, service instance capability, system load state and the like, resulting in that the task allocation decision lacks scientificity and accuracy. In the current increasingly complex environment of micro-service architecture, due to factors such as task type diversification, service instance capability differentiation, system load dynamic change and the like, the traditional static dispatching strategy is difficult to achieve optimal task allocation, and the situation that some service instances are overloaded while other instances are idle often occurs, causing system resource waste and task execution delay. That is to say, there is a technical problem of low efficiency of plan task dispatching and allocation under the micro-service architecture in the prior art. SUMMARY
[0003] Therefore, the application provides a plan task intelligent dispatching micro-service architecture implementation method, which can solve the technical problem of low efficiency of plan task dispatching and allocation under the micro-service architecture in the prior art.
[0004] The application is implemented in the following manner: the application provides a plan task intelligent dispatching micro-service architecture implementation method, which comprises the following steps: establishing a task analysis module to collect plan task data in a system, classifying and marking the task data, classifying the tasks into three categories of instant tasks, timed tasks and batch processing tasks according to execution time, resource demand and priority level, and establishing a task metadata storage structure; constructing a service instance monitoring module to collect four core indexes of CPU usage rate, memory occupancy rate, network bandwidth usage rate and task processing queue length of each micro-service node in real time; designing a load evaluation algorithm to calculate the comprehensive load value of each micro-service node according to the service instance monitoring data; establishing a task matching engine to associate the plan task with a suitable service instance through a multi-dimensional feature matching algorithm; implementing a dispatching decision module to optimize the task allocation scheme by using a task optimization allocation model; constructing a task execution monitoring module to track the execution state of the dispatched task; and designing a feedback optimization mechanism to adjust the dispatching strategy according to the task execution result and the performance change of the service instance.
[0005] The task metadata storage structure contains a task identifier, a task type, a resource demand, a priority value, a dependency relationship, a creation time, and an expected execution time, and is stored in the distributed cache in the form of a key-value pair.
[0006] The service instance monitoring module updates the service instance state information every 30 seconds through a heartbeat mechanism, each micro-service node periodically sends a heartbeat packet containing state information to the registration center, and the registration center updates the node state table after receiving the heartbeat packet. When a node does not send a heartbeat packet for more than 90 seconds, it is marked as unavailable.
[0007] The load evaluation algorithm calculates the CPU usage, memory occupancy, network bandwidth usage, and task processing queue length by weighting them in the proportions of 0.3, 0.25, 0.2, and 0.25, respectively.
[0008] The multi-dimensional feature matching algorithm is based on the similarity calculation of task resource demand and service instance capability, with a similarity threshold set to 0.75 or above for matching. The calculation steps include extracting the resource demand feature vector of the task and the capability feature vector of the service instance, calculating the Euclidean distance between the two feature vectors, and normalizing the distance value to a similarity score between 0 and 1.
[0009] The task optimization allocation model is a sequence-to-sequence model based on the Transformer architecture, which includes an encoder and a decoder. The encoder is responsible for processing the feature information of the task and the service instance, and the decoder is responsible for generating the optimal task allocation sequence.
[0010] The number of features of the task optimization allocation model is dynamically adjusted according to the number of task categories, the number of service instances, and the number of load evaluation dimensions. When the sum of the number of task categories multiplied by 10, the number of service instances multiplied by 8, and the number of load evaluation dimensions multiplied by 5 is less than 100, the number of features is set to 100. When the sum is greater than 500, the number of features is set to 500.
[0011] The training data set establishment step of the task optimization allocation model includes collecting historical task dispatch records containing data in four dimensions: task features, service instance state, allocation results, and execution effect, cleaning and standardizing the data to remove outliers and missing values, and dividing the data into training and validation sets in chronological order.
[0012] The training step of the task optimization allocation model includes using the Adam optimizer to optimize the model parameters, setting the learning rate to 0.001, the batch size to 32, and the training period to 100 epochs, and using the cross-entropy loss function to calculate the difference between the model prediction results and the true labels.
[0013] The feedback optimization mechanism evaluates the dispatch effect by executing three indexes of success rate, average response time and resource utilization, triggers strategy adjustment when the success rate is lower than 90%, calculates a comprehensive evaluation value by using a dispatch effect evaluation function, and adjusts the feature quantity parameter of the task optimization allocation model based on the different ranges of the comprehensive evaluation value by calling corresponding weight adjustment functions.
[0014] The task execution monitoring module records four key state information of task start time, estimated completion time, actual completion time and execution result, and establishes a task execution log database.
[0015] The calculation formula of the dispatch effect evaluation function is execution success rate multiplied by 0.5 plus average response time reciprocal multiplied by 0.3 plus resource utilization multiplied by 0.2, and the comprehensive evaluation value range is 0 to 1.
[0016] The weight adjustment function includes a low-efficiency weight adjustment function for adjusting the feature quantity parameter in the range of 0 to 0.2, a medium-low-efficiency weight adjustment function for adjusting the feature quantity parameter in the range of 0.2 to 0.4, and a medium-efficiency weight adjustment function for adjusting the feature quantity parameter in the range of 0.4 to 0.6.
[0017] The weight adjustment function further includes a medium-high-efficiency weight adjustment function for adjusting the feature quantity parameter in the range of 0.6 to 0.8, and a high-efficiency weight adjustment function for adjusting the feature quantity parameter in the range of 0.8 to 1.0.
[0018] The task category quantity includes three basic categories of instant tasks, timing tasks and batch processing tasks, and other task categories extended according to actual needs, the service instance quantity is the total number of micro-service nodes available for executing tasks in the system, and the load evaluation dimension quantity includes four dimensions of CPU usage, memory occupancy, network bandwidth usage and task processing queue length.
[0019] The feature quantity parameter is a parameter in the task optimization allocation model for representing the input feature dimension, and the parameter value determines the ability of the model to process task and service instance information, and the comprehensive evaluation value is a numerical index reflecting the overall performance of the task dispatch system calculated by the dispatch effect evaluation function.
[0020] The intelligent task dispatching system based on multi-dimensional feature matching and machine learning is established, and the technical problem of low allocation efficiency of the traditional task dispatching method is solved. The task analysis module is used for accurate classification and labeling of planned tasks, the service instance monitoring module is used for real-time collection of system load information, the load evaluation algorithm is used for quantifying the service instance capacity, the multi-dimensional feature matching algorithm is used for accurate association of tasks and service instances, and the accuracy and efficiency of task allocation are effectively improved. The task optimization allocation model based on the Transformer architecture is introduced, the dispatching strategy is continuously optimized through machine learning technology, the system parameters are dynamically adjusted according to the execution effect through the feedback optimization mechanism, the transformation from traditional static allocation to intelligent dynamic optimization is realized, and the system resource utilization and task execution efficiency are significantly improved. In summary, the technical problem of low allocation efficiency of planned task dispatching in the microservice architecture mentioned in the background technology is solved. BRIEF DESCRIPTION OF DRAWINGS
[0021] Figure 1 The flowchart of the method of the present application.
[0022] Figure 2 The neural network structure diagram of the task optimization allocation model involved in the present application. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application.
[0024] As Figure 1 shown is the flowchart of the microservice architecture implementation method of the intelligent dispatching of planned tasks provided by the present application, and the method comprises the following steps:
[0025] S01, a task analysis module is established to collect planned task data in the system, the task data is classified and labeled, the tasks are classified into three categories of instant tasks, scheduled tasks and batch processing tasks according to execution time, resource demand and priority level, and a task metadata storage structure is established;
[0026] S02, a service instance monitoring module is constructed to collect four core indexes of CPU usage, memory occupancy, network bandwidth usage and task processing queue length of each microservice node in real time, and the service instance state information is updated every 30 seconds through a heartbeat mechanism;
[0027] S03, a load evaluation algorithm is designed to calculate the comprehensive load value of each microservice node according to the service instance monitoring data, and the CPU usage, memory occupancy, network bandwidth usage and task processing queue length are weighted calculated according to the weight proportion of 0.3, 0.25, 0.2 and 0.25.
[0028] S04, the task matching engine is established by multi-dimensional feature matching algorithm to associate the planned task with the appropriate service instance, the matching algorithm is based on the similarity calculation of task resource demand and service instance capacity, and the similarity threshold is set to 0.75 or more for matching;
[0029] S05, the dispatch decision module realizes the optimization of task allocation scheme by adopting a task optimization allocation model, the number of parameters of the model is dynamically adjusted according to the number of task categories, the number of service instances, and the number of load evaluation dimensions, so as to ensure the optimality of the allocation scheme;
[0030] S06, the task execution monitoring module is constructed to track the execution state of the dispatched task, record four key state information of task start time, expected completion time, actual completion time and execution result, and establish a task execution log database;
[0031] S07, the feedback optimization mechanism is designed to adjust the dispatch strategy according to the task execution result and the performance change of the service instance, the dispatch effect is evaluated through three indexes of execution success rate, average response time and resource utilization, the strategy is adjusted when the success rate is lower than 90%, the comprehensive evaluation value is calculated by using the dispatch effect evaluation function, and the feature number parameter of the task optimization allocation model is adjusted by using the corresponding weight adjustment function based on the different ranges of the comprehensive evaluation value.
[0032] Among them, the task metadata storage structure contains seven fields of task identifier, task type, resource demand, priority value, dependency relationship, creation time and expected execution time, and is stored in the distributed cache in the form of key-value pair.
[0033] Among them, the implementation steps of the heartbeat mechanism include that each micro-service node sends a heartbeat packet containing state information to the registration center periodically, the registration center updates the node state table after receiving the heartbeat packet, and marks the node as unavailable when the node does not send a heartbeat packet for more than 90 seconds.
[0034] Among them, the calculation steps of the multi-dimensional feature matching algorithm include extracting the resource demand feature vector of the task and the capability feature vector of the service instance, calculating the Euclidean distance of the two feature vectors, normalizing the distance value into a similarity score between 0 and 1, and the closer the similarity score is to 1, the higher the matching degree is.
[0035] The specific structure of the task optimization allocation model is a sequence-to-sequence model based on a Transformer architecture, including an encoder and a decoder. The encoder is responsible for processing the feature information of the task and the service instance, and the decoder is responsible for generating the optimal task allocation sequence. The number of features in the model is determined according to the sum of the number of task categories multiplied by 10, the number of service instances multiplied by 8, and the number of load evaluation dimensions multiplied by 5. When the sum is less than 100, the number of features is set to 100. When the sum is greater than 500, the number of features is set to 500. In other cases, the number of features is equal to the calculated sum.
[0036] The training data set of the task optimization allocation model includes collecting historical task dispatch records containing data in four dimensions of task features, service instance state, allocation results, and execution effect, cleaning and standardizing the data to remove outliers and missing values, dividing the data into a training set and a validation set in chronological order, with the training set accounting for 80% of the total data and the validation set accounting for 20%, generating corresponding labels for each task allocation record to represent the good or bad degree of allocation effect, with the label range from 0 to 1, and 1 representing the optimal allocation.
[0037] The training steps of the task optimization allocation model include using the Adam optimizer to optimize the model parameters, setting the learning rate to 0.001, the batch size to 32, and the training period to 100 epochs. The cross-entropy loss function is used to calculate the difference between the model prediction results and the true labels. After each epoch, the model performance is evaluated using the validation set. When the accuracy on the validation set does not improve for 5 consecutive epochs, the training is stopped early, and the model with the highest accuracy is saved as the final model.
[0038] The dispatch effect evaluation function is used to calculate the comprehensive evaluation value of the task dispatch system. The input includes the execution success rate, average response time, and resource utilization rate recorded in step S06. The output is the comprehensive evaluation value. The calculation formula is the execution success rate multiplied by 0.5 plus the average response time reciprocal multiplied by 0.3 plus the resource utilization rate multiplied by 0.2. The comprehensive evaluation value ranges from 0 to 1.
[0039] The inefficient weight adjustment function is used to adjust the number of features in the range of 0 to 0.2 of the comprehensive evaluation value. The input includes the comprehensive evaluation value output by the dispatch effect evaluation function, the current number of features of the task optimization allocation model, and the number of task categories. The output is the adjusted number of features. The calculation formula is the current number of features multiplied by 1 plus the negative value of the comprehensive evaluation value multiplied by the square root of the number of task categories.
[0040] The medium-low efficiency weight adjustment function is used to adjust the feature quantity parameter when the comprehensive evaluation value is in the range of 0.2 to 0.4, the input includes the comprehensive evaluation value output by the dispatch effect evaluation function, the current feature quantity parameter of the task optimization allocation model, and the service instance quantity, and the output is the adjusted feature quantity parameter. The calculation formula is the current feature quantity parameter multiplied by 1 plus the result of 0.4 minus the comprehensive evaluation value, and then multiplied by the logarithmic value of the service instance quantity.
[0041] The medium efficiency weight adjustment function is used to adjust the feature quantity parameter when the comprehensive evaluation value is in the range of 0.4 to 0.6, the input includes the comprehensive evaluation value output by the dispatch effect evaluation function, the current feature quantity parameter of the task optimization allocation model, and the load evaluation dimension quantity, and the output is the adjusted feature quantity parameter. The calculation formula is the current feature quantity parameter multiplied by 1 plus the result of 0.01 multiplied by the comprehensive evaluation value minus 0.5, and then multiplied by the load evaluation dimension quantity.
[0042] The medium-high efficiency weight adjustment function is used to adjust the feature quantity parameter when the comprehensive evaluation value is in the range of 0.6 to 0.8, the input includes the comprehensive evaluation value output by the dispatch effect evaluation function, the current feature quantity parameter of the task optimization allocation model, the task category quantity, and the service instance quantity, and the output is the adjusted feature quantity parameter. The calculation formula is the current feature quantity parameter multiplied by 1 minus the result of 0.8 minus the comprehensive evaluation value, and then multiplied by the ratio of the task category quantity to the service instance quantity.
[0043] The high efficiency weight adjustment function is used to adjust the feature quantity parameter when the comprehensive evaluation value is in the range of 0.8 to 1.0, the input includes the comprehensive evaluation value output by the dispatch effect evaluation function, the current feature quantity parameter of the task optimization allocation model, the load evaluation dimension quantity, and the average response time, and the output is the adjusted feature quantity parameter. The calculation formula is the current feature quantity parameter multiplied by 1 minus the result of 1.0 minus the comprehensive evaluation value, and then multiplied by the quotient of the load evaluation dimension quantity divided by the average response time.
[0044] The comprehensive evaluation value is a numerical index reflecting the overall performance of the task dispatch system calculated by the dispatch effect evaluation function, with a value range from 0 to 1. The closer the value is to 1, the better the dispatch effect.
[0045] The feature quantity parameter is a parameter in the task optimization allocation model used to represent the input feature dimension. The parameter value determines the model's ability to process task and service instance information. The larger the parameter value, the more dimensional feature information the model can process.
[0046] The task category quantity is the total number of task categories defined in the system, including the three basic categories of instant tasks, timed tasks, and batch processing tasks established in step S01, as well as other task categories expanded according to actual needs.
[0047] Wherein, the number of service instances refers to the total number of microservice nodes available for executing tasks in the system, which dynamically changes with system expansion and node state changes.
[0048] Wherein, the number of load assessment dimensions refers to the number of index dimensions used to calculate the comprehensive load value in step S03, including CPU usage, memory occupancy, network bandwidth usage, and task processing queue length.
[0049] The specific implementation of the above steps is described in detail below.
[0050] The specific implementation of step S01 is to establish a task analysis module. First, collect planned task information from various entry points of the system through a data collection component, including task request queues, timed task schedulers, and batch task submission interfaces. The collected raw data includes task name, submission time, execution requirements, resource estimates, and other basic information. The task classification marking process is based on a decision tree algorithm for automatic classification. The branch nodes of the decision tree are based on execution time urgency, resource demand magnitude, and priority weight to construct judgment conditions. The threshold for execution time urgency is set to 5 minutes as the immediate task determination standard. The resource demand magnitude is set to 2 CPU cores and 4 GB of memory usage as the lightweight task determination threshold. The priority weight is set to 0.8 as the high priority determination threshold. The task metadata storage structure uses a distributed hash table data structure. The task data is stored on multiple cache nodes using a consistent hashing algorithm to ensure data availability and access efficiency. Each storage node uses a key-value pair to store the task identifier, task type, resource demand, priority value, dependency relationship, creation time, and expected execution time.
[0051] The specific implementation of step S02 is to construct a service instance monitoring module, which is designed based on a publish-subscribe mode. Each microservice node acts as a publisher to regularly send state information, and the monitoring center acts as a subscriber to receive and process the information. The monitoring data collection uses system call interfaces to obtain four core indicators: real-time CPU usage, memory occupancy, network bandwidth usage, and task processing queue length. CPU usage is calculated by reading the / proc / stat file, memory occupancy is obtained through the / proc / meminfo file, network bandwidth usage is monitored through the / proc / net / dev file, and task processing queue length is obtained through the API provided by the application layer queue manager. The implementation of the heartbeat mechanism is based on UDP protocol transmission. Each microservice node sends a heartbeat packet containing node identification, timestamp, and state indicators to the registration center every 30 seconds. The registration center maintains a service instance state table and uses a time window sliding algorithm to detect node health status. When a node has not sent a heartbeat packet for more than 90 seconds, it is automatically marked as unavailable and triggers the load redistribution mechanism.
[0052] The specific implementation of step S03 is to design a load evaluation algorithm based on the weighted summation model in the multi-attribute decision theory. The CPU usage, memory occupancy, network bandwidth usage, and task processing queue length are standardized and then weighted according to the weight proportions of 0.3, 0.25, 0.2, and 0.25. The standardization process uses the maximum and minimum normalization method to map the values of each indicator to the interval of 0 to 1, avoiding mutual interference between indicators of different magnitudes. The weight setting is based on system performance bottleneck analysis. The CPU usage weight is the highest to reflect its key influence on task execution capability, the memory occupancy weight is second to reflect the limiting effect of memory resources on task concurrent processing, the network bandwidth usage weight is moderate to consider the impact of data transmission on distributed tasks, and the task processing queue length weight is equal to the memory to reflect the impact of task backlog on system response capability. The comprehensive load value calculation result ranges from 0 to 1, where 0.7 or above indicates a high load state and 0.3 or below indicates a low load state.
[0053] The specific implementation of step S04 is to establish a task matching engine that designs a multi-dimensional feature matching algorithm based on the vector space model theory. The task resource demand feature vector extraction process includes converting the CPU demand, memory demand, network demand, storage demand, execution time, priority and other attributes of the task into a numerical feature vector, with a 6-dimensional vector. The service instance capability feature vector extraction includes CPU available resources, memory available resources, network available bandwidth, storage available space, historical processing speed, current load level and other attributes, which are also converted into a 6-dimensional numerical vector. The similarity calculation uses the Euclidean distance formula to calculate the distance between the two feature vectors, and the distance value is converted into a similarity score between 0 and 1 through an exponential decay function. The conversion function uses a negative exponential function form to ensure that the smaller the distance, the higher the similarity. The matching threshold is set to 0.75. Only tasks and service instances that are paired and considered to be effective matching have a similarity score that exceeds the threshold. The threshold is determined based on historical matching success rate statistical analysis, which can balance matching accuracy and matching coverage.
[0054] The specific implementation of step S05 is to implement a dispatch decision module that uses a sequence-to-sequence model based on the Transformer architecture as the core algorithm for task optimization allocation. The feature quantity parameter dynamic adjustment mechanism of the model is based on the current state of the system for adaptive calculation. The calculation method is the product of the number of task categories multiplied by 10, plus the product of the number of service instances multiplied by 8, plus the product of the number of load evaluation dimensions multiplied by 5. When the total is less than 100, the parameter is set to 100 to ensure the minimum processing capacity of the model. When the total is greater than 500, the parameter is set to 500 to avoid high computational complexity. In other cases, the parameter is equal to the calculation total. The model optimization objective function considers three dimensions of task completion time, resource utilization, and system load balancing, and uses a multi-objective optimization method to solve the Pareto optimal solution set, from which the allocation scheme with the highest comprehensive evaluation is selected.
[0055] The specific implementation of step S06 is to build a task execution monitoring module that uses an event-driven architecture design to realize real-time tracking of task status through a message queue mechanism. Task state tracking is based on a state machine model that defines four basic states of the task: waiting, executing, completing, and failing. State transitions are achieved through an event-triggered mechanism. The recording of four key information of task start time, estimated completion time, actual completion time, and execution result uses a timestamp accurate to the millisecond level to ensure the accuracy of the time data. The task execution log database is designed using a time series database, which supports high-concurrency writing and fast querying. The data storage structure is partitioned by time and indexed by task type, facilitating subsequent statistical analysis and performance optimization. The monitoring data collection frequency is set to one second, and the data retention period is set to 30 days. Data exceeding the retention period is automatically archived to the historical database.
[0056] The specific implementation of step S07 is to design a feedback optimization mechanism based on closed-loop control theory to build an adaptive adjustment system. The statistics of the three core indicators of execution success rate, average response time, and resource utilization rate use a sliding window algorithm, and the window size is set to the execution records of the last 100 tasks to ensure the timeliness and stability of the statistical results. The dispatch effect evaluation function uses a weighted sum model, with the execution success rate weight being 0.5 to reflect the importance of task completion rate, the average response time inverse weight being 0.3 to reflect the influence of system response speed, and the resource utilization rate weight being 0.2 to consider the system resource use efficiency. When the execution success rate is less than 90%, the strategy adjustment mechanism is triggered, and the threshold is determined based on the system service quality requirements. The weight adjustment function calls the corresponding adjustment strategy according to different ranges of the comprehensive evaluation value, the inefficient weight adjustment function processes the evaluation value in the range of 0 to 0.2, the low-efficiency weight adjustment function processes the evaluation value in the range of 0.2 to 0.4, the medium-efficiency weight adjustment function processes the evaluation value in the range of 0.4 to 0.6, the medium-high-efficiency weight adjustment function processes the evaluation value in the range of 0.6 to 0.8, and the high-efficiency weight adjustment function processes the evaluation value in the range of 0.8 to 1.0. Each adjustment function uses a different mathematical model to ensure the accuracy of the adjustment effect.
[0057] It should be noted that the task optimization allocation model is based on the Transformer architecture design, and the overall structure of the model includes four main components: input embedding layer, encoder stack, decoder stack, and output linear layer. The input embedding layer is responsible for converting the task feature vector and service instance feature vector into internal representation of the model, using a combination of linear transformation and position encoding to ensure that the model can understand the semantic information and sequence position relationship of the input data. The encoder stack consists of 6 identical encoder layers, each containing a multi-head self-attention mechanism and a feed-forward neural network sublayer. The multi-head self-attention mechanism uses 8 attention heads, each with a dimension of 64, and the feed-forward neural network has a hidden layer dimension of 2048. The decoder stack also consists of 6 decoder layers, each containing a masked multi-head self-attention, encoder-decoder attention, and feed-forward neural network sublayer. The masked multi-head self-attention ensures the unidirectionality of the decoding process, and the encoder-decoder attention enables information transfer between the encoder and the decoder. The output linear layer converts the output of the decoder into a task allocation probability distribution, using a softmax activation function to ensure the validity of the output probability.
[0058] The training data set establishment process first collects raw data from the historical task dispatch system, and the data collection range includes all task dispatch records in the past 6 months. Each record contains complete information such as task identification, task features, service instance state, allocation results, and execution effect. The data cleaning process uses an outlier detection algorithm to identify and remove abnormal data, and the detection method includes statistical-based The criteria and density-based local anomaly factor algorithm ensure the reliability of data quality. The missing value processing adopts a strategy combining interpolation and deletion. For missing values in key fields, a similar task-based interpolation method is used to complete them. For missing values in secondary fields, the corresponding records are directly deleted. Data standardization processing includes normalization of numerical features and one-hot encoding of categorical features to ensure fairness in model training.
[0059] The data set division adopts a time series division method, which divides the data into a training set and a validation set in chronological order. The training set accounts for 80% of the total data for model parameter learning, and the validation set accounts for 20% for model performance evaluation. The label generation process is based on the comprehensive evaluation of task execution effect. The evaluation indicators include task completion time, resource utilization efficiency, and system load impact. The weighted sum method is used to calculate the comprehensive score, with a score range of 0 to 1, and 1 representing the optimal allocation effect. The data enhancement technique uses the synthetic minority over-sampling technique to balance the data distribution of different label categories, ensuring the fairness and generalization ability of model training.
[0060] It should be noted that the key technical ideas of the present application include a multi-dimensional load evaluation algorithm, an intelligent allocation model based on Transformer, and a self-adaptive feedback optimization mechanism.
[0061] The multi-dimensional load evaluation algorithm integrates CPU usage, memory occupancy, network bandwidth usage, and task processing queue length to build a comprehensive and accurate service instance load evaluation system. Compared with traditional single-index evaluation methods, this algorithm can more comprehensively reflect the real load state of service instances, avoiding evaluation bias caused by single-index fluctuations. Through weighted sum model and standardization processing, the algorithm effectively solves the interference problem between different orders of magnitude indicators, improving the accuracy and comparability of load evaluation.
[0062] The intelligent allocation model based on Transformer adopts an advanced architecture in the deep learning field, which realizes deep correlation analysis between task features and service instance features through self-attention mechanism. Compared with traditional rule-based or simple heuristic allocation algorithms, this model can learn complex task allocation patterns and automatically discover the potential relationship between task demand and service capability. The sequence-to-sequence structure of the model enables it to handle dynamic changes in task queues and service instance states, realizing more flexible and intelligent allocation decisions.
[0063] The adaptive feedback optimization mechanism monitors the task execution effect in real time and dynamically adjusts the allocation strategy, thereby constructing a closed-loop control system. Compared with the traditional static allocation strategy, the mechanism can automatically optimize the allocation parameters according to the changes in the system running state, and continuously improve the system performance. Through the design of the multi-level weight adjustment function, the mechanism can adopt the corresponding optimization strategy according to different system performance levels, ensuring the accuracy and stability of the optimization effect.
[0064] The synergistic effect of the three key technical ideas forms a complete intelligent task dispatching solution. The multi-dimensional load evaluation provides accurate input data for the intelligent allocation model, ensuring the quality of the basic data for allocation decisions; the intelligent allocation model based on the Transformer uses accurate load evaluation results for deep learning and decision optimization, achieving high-quality task allocation; the adaptive feedback optimization mechanism further improves the performance and stability of the entire system through continuous monitoring and adjustment. The three technical ideas support and promote each other, forming a more intelligent, accurate and efficient task dispatching architecture than traditional methods, significantly improving the overall performance and user experience of the microservice system.
[0065] It should be noted that the present application also solves the following three technical problems.
[0066] The first technical problem is that the prior art lacks a precise quantitative evaluation mechanism for task characteristics and service instance capabilities, resulting in a lack of scientific basis for task allocation decisions and affecting allocation efficiency. The present application establishes a task metadata storage structure, stores the task identifier, task type, resource demand, priority value, dependency relationship, creation time, and expected execution time in the distributed cache in the form of key-value pairs, and realizes the structured description and precise quantification of task characteristics. At the same time, the service instance monitoring module collects CPU usage, memory occupancy, network bandwidth usage, and task processing queue length every 30 seconds, and calculates the comprehensive load value by weighting the four core indicators with a weight ratio of 0.3, 0.25, 0.2, and 0.25, thereby realizing dynamic quantitative evaluation of service instance capabilities. The multi-dimensional feature matching algorithm calculates the Euclidean distance between the task resource demand feature vector and the service instance capability feature vector, normalizes the distance value to a similarity score between 0 and 1, and matches when the similarity is greater than 0.75, thereby solving the problem of low allocation efficiency caused by the inability of traditional methods to accurately evaluate the task and service instance adaptation level.
[0067] The second technical problem is that the prior art lacks an intelligent optimization mechanism based on historical data and machine learning, which cannot dynamically adjust the dispatching strategy according to the system running state, resulting in difficulty in continuously improving the allocation efficiency. The present application builds a task optimization allocation model based on the Transformer architecture, which includes an encoder processing task and service instance feature information, and a decoder generating an optimal task allocation sequence. The model feature quantity parameter is dynamically determined according to the sum of the task category number multiplied by 10, the service instance number multiplied by 8, and the load evaluation dimension number multiplied by 5, realizing adaptive adjustment of the model parameter. By collecting historical task dispatch records to establish a training data set, using the Adam optimizer, a learning rate of 0.001, a batch size of 32, and 100 epochs for model training, and using a cross-entropy loss function to optimize the model parameters, the model is stopped training when the validation set accuracy does not improve for 5 consecutive epochs, ensuring the generalization ability of the model. Combined with the feedback optimization mechanism, the execution success rate, average response time, and resource utilization are calculated by the dispatch effect evaluation function to obtain a comprehensive evaluation value. When the success rate is less than 90%, five different range weight adjustment functions are triggered to dynamically adjust the model parameters, realizing an intelligent optimization dispatching strategy based on machine learning, and effectively improving the allocation efficiency.
[0068] The third technical problem is that the prior art lacks a whole life cycle monitoring and feedback adjustment mechanism for task execution process, which cannot continuously optimize system performance according to execution effect, affecting overall allocation efficiency. The present application builds a task execution monitoring module to record four key state information: task start time, estimated completion time, actual completion time, and execution result, establishes a task execution log database to realize whole process tracking, and provides data support for allocation efficiency evaluation and optimization. A dispatch effect evaluation function is designed, which adopts a weighted calculation method of execution success rate multiplied by 0.5, average response time inverse multiplied by 0.3, and resource utilization multiplied by 0.2, to obtain a comprehensive evaluation value in the range of 0 to 1, accurately reflecting the allocation efficiency level of the system. According to different evaluation value ranges, corresponding weight adjustment functions are called, including five levels of adjustment strategies for low efficiency, medium-low efficiency, medium efficiency, medium-high efficiency, and high efficiency, respectively for evaluation value ranges of 0 to 0.2, 0.2 to 0.4, 0.4 to 0.6, 0.6 to 0.8, and 0.8 to 1.0. The feature quantity parameter of the task optimization allocation model is adjusted through different mathematical formulas, realizing a closed-loop feedback optimization mechanism based on execution effect, and solving the problem that traditional methods cannot continuously improve the dispatching strategy according to the actual execution situation, resulting in difficulty in continuously improving the allocation efficiency.
[0069] Specifically, the principles of the present invention are as follows: The present invention can solve the technical problem of inefficient scheduled task dispatching and allocation in a microservice architecture, primarily based on the following technical principles. First, by establishing a task analysis module to extract and classify scheduled tasks using multi-dimensional features, tasks are accurately classified according to key attributes such as execution time, resource requirements, and priority level, providing a structured data foundation for subsequent efficient matching and avoiding the problem of improper allocation caused by traditional methods that ignore task characteristics. Second, a service instance monitoring module is constructed to collect core indicators such as CPU usage, memory utilization, network bandwidth utilization, and task processing queue length of microservice nodes in real time. A load assessment algorithm is used to calculate a comprehensive load value, accurately quantifying the processing capacity of service instances, providing real-time load status information for task allocation decisions, and ensuring that tasks are allocated to the most suitable service instances. Third, a multi-dimensional feature matching algorithm is designed to achieve precise association between tasks and service instances by calculating the Euclidean distance between the task resource requirement feature vector and the service instance capability feature vector. Compared with traditional simple matching methods, this algorithm can more accurately assess the degree of compatibility between tasks and service instances, avoiding resource waste and performance bottlenecks. Finally, a task optimization allocation model based on the Transformer architecture is introduced. Through a sequence-to-sequence deep learning method, it comprehensively considers multi-dimensional information such as task characteristics, service instance status, and historical execution results to generate the optimal task allocation sequence. Combined with the feedback optimization mechanism, the model parameters are dynamically adjusted according to the execution results, achieving continuous optimization of the allocation strategy, thereby significantly improving the overall allocation efficiency.
[0070] A specific embodiment 1 of the present invention is provided below. The specific implementation of each step in this embodiment 1 is described in detail as follows.
[0071] The specific implementation of steps S01-S02 is the same as above and will not be described in detail here.
[0072] The specific implementation of step S03 is to design a load evaluation algorithm. The calculation formula of the comprehensive load value is expressed as follows:
[0073] ;
[0074] Where, For the The comprehensive load value of each microservice node, dimensionless, ranging from 0 to 1; For the The CPU usage of each microservice node, dimensionless, ranging from 0 to 1; For the The memory usage of each microservice node, dimensionless, ranging from 0 to 1; For the The network bandwidth usage of each microservice node is dimensionless and ranges from 0 to 1; For the The length of the task processing queue of each microservice node is normalized, dimensionless, and ranges from 0 to 1; The index number of the microservice node, ranging from 1 to the total number of microservice nodes in the system. The parameter acquisition method is: The current CPU usage percentage is obtained by reading the / proc / stat file. The calculation method is the ratio of the CPU time difference between two consecutive samples to the total time difference. Memory usage is obtained by reading the / proc / meminfo file, calculated as the ratio of used memory to total memory; Obtained by monitoring network interface traffic statistics, calculated as the ratio of the current network transmission rate to the maximum bandwidth; Get the number of tasks currently waiting to be processed through the application layer queue manager API.
[0075] The specific implementation of step S04 is to establish a task matching engine. The similarity calculation formula of the multi-dimensional feature matching algorithm is expressed as follows:
[0076] ;
[0077] Where, For the Task and The similarity score of each service instance, dimensionless; For the The resource requirement feature vector of each task; For the The capability feature vector of a service instance; is the distance attenuation coefficient, ranging from 1.0 to 3.0, dimensionless; Indicates Euclidean distance calculation. The specific calculation formula of Euclidean distance is as follows:
[0078] ;
[0079] Where, For the Task No. feature components, For the service instance characteristic components. The specific representation of the characteristic vector is as follows:
[0080] ;
[0081] ;
[0082] Where, to CPU requirement, memory requirement, network requirement, storage requirement, execution duration, priority of the i-th task, which are all normalized to dimensionless values between 0 and 1; to CPU available resource, memory available resource, network available bandwidth, storage available space, historical processing speed, current load level of the j-th service instance, which are all normalized to dimensionless values between 0 and 1; is the index number of the task, and the value range is 1 to the total number of tasks to be allocated in the system; is the index number of the service instance, and the value range is 1 to the total number of available service instances in the system; is the dimension index of the feature vector, and the value range is 1 to 6. The parameter acquisition method is: to obtained through the resource requirement description when the task is submitted, and normalized by the maximum and minimum value normalization method; obtained through the historical execution time statistics of the task, and the unit is second, and normalized by the maximum and minimum value normalization method; obtained through the task priority configuration, and the original value range is 1 to 10, and normalized to 0 to 1 by linear transformation; to obtained through the service instance resource monitoring system, and normalized by the maximum and minimum value normalization method; obtained through the historical performance statistics of the service instance, and the unit is the number of tasks per second, and normalized by the maximum and minimum value normalization method; obtained through the load evaluation result of step S03, which is already a dimensionless value between 0 and 1.
[0083] The specific implementation of step S05 is to realize the dispatching decision module, and the dynamic adjustment calculation formula of the feature quantity parameter is represented as follows:
[0084] ;
[0085] wherein, ;
[0086] In the formula, is the finally determined feature quantity parameter; is the temporarily calculated feature quantity parameter; is the number of task categories; is the number of service instances; is the number of load evaluation dimensions. The parameter acquisition method is: obtained by counting the total number of task categories defined in the system, and the default value is 3; Obtained by counting the total number of microservice nodes currently available; Obtained by counting the number of dimensions of indicators used in the load evaluation algorithm, with a default value of 4.
[0087] The specific implementation of step S06 is the same as the foregoing, and will not be described in detail here.
[0088] The specific implementation of step S07 is to design a feedback optimization mechanism, and the calculation formula of the effect evaluation function is represented as follows:
[0089] ;
[0090] In the formula, is the comprehensive evaluation value, dimensionless, ranging from 0 to 1; is the execution success rate, dimensionless, ranging from 0 to 1; is the average response time, with a unit of seconds, and a value range of positive real numbers; is the reciprocal of the average response time, with a unit of , which needs to be converted into a dimensionless value between 0 and 1 through standardization processing; is the resource utilization rate, dimensionless, ranging from 0 to 1. The parameter acquisition method is: Obtained by counting the ratio of the number of successful executions of the last 100 tasks to the total number of tasks; Obtained by calculating the arithmetic mean of the response times of the last 100 tasks; Obtained by calculating the average resource usage of all service instances.
[0091] The weight adjustment function is classified and calculated according to the range of the comprehensive evaluation value. The calculation formula of the low-efficiency weight adjustment function is represented as follows:
[0092] ;
[0093] In the formula, is the adjusted feature quantity parameter in the low-efficiency case; is the current feature quantity parameter; is the comprehensive evaluation value, ranging from 0 to 0.2; is the number of task categories.
[0094] The calculation formula of the medium-low-efficiency weight adjustment function is represented as follows:
[0095] ;
[0096] In the formula, is the adjusted feature quantity parameter in the medium-low-efficiency case; is the comprehensive evaluation value, ranging from 0.2 to 0.4; the number of service instances; denotes a natural logarithm function.
[0097] The calculation formula of the medium-efficiency weight adjustment function is as follows:
[0098]
[0099] wherein, is the adjusted feature quantity parameter under the medium-efficiency condition; is a comprehensive evaluation value, ranging from 0.4 to 0.6; is the number of load evaluation dimensions.
[0100] The calculation formula of the medium-high-efficiency weight adjustment function is as follows:
[0101]
[0102] wherein, is the adjusted feature quantity parameter under the medium-high-efficiency condition; is a comprehensive evaluation value, ranging from 0.6 to 0.8; is the number of task categories; is the number of service instances.
[0103] The calculation formula of the high-efficiency weight adjustment function is as follows:
[0104]
[0105] wherein, is the adjusted feature quantity parameter under the high-efficiency condition; is a comprehensive evaluation value, ranging from 0.8 to 1.0; is the number of load evaluation dimensions; is the average response time.
[0106] It is to be noted that the comprehensive load value calculation formula Based on the principle of the weighted summation model of the multi-attribute decision theory, a unified load evaluation standard is formed by standardizing multiple load indicators of different dimensions and combining them according to the weights. The effect of this formula is that it can comprehensively reflect the real load state of the service instance, avoiding the evaluation deviation caused by relying on a single indicator in the traditional method. The weight setting is determined based on the system performance bottleneck analysis, and the CPU usage rate has the highest weight, which reflects its key influence on the execution capability. Through multi-dimensional comprehensive evaluation, the accuracy of task allocation and the system resource utilization efficiency are improved.
[0107] The similarity calculation formula is as follows: Based on the principle of the vector space model theory and the exponential decay function, the Euclidean distance between the task demand feature vector and the service instance capability feature vector is calculated And use the exponential function Convert the distance into a similarity score. The effect of this formula is to accurately quantify the degree of matching between tasks and service instances, and the exponential decay function ensures a non-linear relationship between distance and similarity, which can better distinguish different matching qualities than traditional linear matching methods, improving the accuracy of task allocation and overall system performance.
[0108] Characteristic number parameter dynamic adjustment formula Based on the principle of adaptive adjustment of system complexity, the feature processing capacity of the model is determined by linear combination of the number of task categories, the number of service instances, and the number of load evaluation dimensions with different weights. The effect of this formula is to dynamically adjust the model complexity according to the current state of the system, avoiding the adaptability problem of fixed parameter setting under different system scales, ensuring that the model can handle complex scenarios and avoid excessive calculation, improving the scalability and computational efficiency of the system compared to static parameter setting.
[0109] Dispatch effect evaluation function Based on the theory of comprehensive evaluation of system performance, the overall effect of the dispatch system is evaluated by weighted sum of execution success rate, average response time reciprocal, and resource utilization rate with different weights. The effect of this formula is to comprehensively evaluate the system performance from three dimensions of task completion quality, system response speed, and resource use efficiency, and the weight setting reflects the importance level of different indicators, which can more accurately reflect the comprehensive performance level of the system than single indicator evaluation method, providing a scientific basis for subsequent strategy optimization.
[0110] The weight adjustment function series is based on piecewise function and adaptive control theory, and adopts corresponding adjustment strategies for different system performance levels, and realizes accurate adjustment of parameters through mathematical functions. Low-efficiency weight adjustment function Square root function is used Negative adjustment, medium-low efficiency weight adjustment function Natural logarithm function is used Positive adjustment, medium efficiency weight adjustment function Linear function is used Fine-tuning, medium-high efficiency weight adjustment function Ratio function is used Accurate adjustment, high-efficiency weight adjustment function Inverse ratio function is used Optimization adjustment. The effect of these functions is to optimize according to the current performance state of the system, with large negative adjustment in low-efficiency state to quickly improve performance, and small fine adjustment in high-efficiency state to maintain optimization effect, which can realize more accurate performance control than traditional fixed adjustment method, significantly improving the adaptability and long-term stability of the system.
[0111] To better understand and implement the present application, the following provides an embodiment 2 of a specific application scenario of the present application: a certain technical team is responsible for building a task plan management information platform, which needs to support multiple building installation projects to perform different types of engineering management work at the same time, including construction plan making, material procurement management, quality detection arrangement, safety supervision patrol, completion acceptance process and other types of tasks. The platform serves the engineering project management needs of large building installation enterprises, involving task scheduling in professional fields such as mechanical and electrical installation, steel structure installation, decoration, water supply and drainage installation, heating and air conditioning installation, etc. During the operation of the platform, technical problems such as uneven task allocation, low resource utilization, and large differences in task execution efficiency are faced, and the technical team decides to use the plan task intelligent dispatching micro-service architecture of the present application to solve these problems.
[0112] The initial configuration of the system contains 15 micro-service nodes, which are deployed on different servers, and each node has different hardware configurations and processing capabilities. The technical team first establishes a task analysis module to classify and mark the building installation engineering management tasks in the system. According to the time urgency of task execution, tasks such as emergency safety accident handling, on-site emergency problem coordination, and key equipment fault handling that require response within 5 minutes are classified as immediate tasks, tasks such as regular safety inspection, periodic quality inspection, and stage progress report are classified as timed tasks, and tasks such as large-scale material procurement plan, engineering quantity statistical analysis, and completion data arrangement are classified as batch processing tasks. The task metadata storage structure uses a distributed hash table design, and each task record contains seven core fields: task identifier, task type, resource demand, priority value, dependency relationship, creation time, and expected execution time.
[0113] The service instance monitoring module collects the state information of each micro-service node every 30 seconds through the heartbeat mechanism. The monitoring data at the initial stage of system operation is shown in Table 1:
[0114] Table 1 Initial state monitoring data of micro-service nodes
[0115]
[0116] The load evaluation algorithm calculates the comprehensive load value of each node according to the monitoring data in Table 1, using the formula to calculate. Since the task processing queue length needs to be normalized, the technical team divides the queue length by the maximum queue length observed in the system, which is 18, to standardize it. The calculation results are shown in Table 2:
[0117] Table 2 Calculation results of comprehensive load values of micro-service nodes
[0118]
[0119] The task matching engine builds a multi-dimensional feature matching algorithm to associate the tasks to be allocated with suitable service instances. The typical task types and their resource requirement features in the system are shown in Table 3:
[0120] Table 3 Resource requirement features of typical task types in building installation projects
[0121]
[0122] The technical team uses the similarity calculation formula The matching degree of the task and the service instance is calculated, where the distance attenuation coefficient is set to 2.0. The matching results of the construction planning tasks with various service instances are shown in Table 4:
[0123] Table 4 Matching results of construction planning tasks and service instances
[0124]
[0125] Since the similarity threshold is set to 0.75, none of the matching results shown in Table 4 meets the threshold requirement. The technical team adjusts the distance attenuation coefficient to 1.5, and after recalculating, the similarity score of Node15 reaches 0.78, successfully matching the construction planning task.
[0126] The dispatch decision module adopts a task optimization allocation model based on the Transformer architecture, and the feature quantity parameter is dynamically adjusted according to the current system state. The number of task categories in the system is 3, the number of service instances is 15, the number of load evaluation dimensions is 4, and the calculation result is Since 170 is between 100 and 500, the final feature quantity parameter is set to 170.
[0127] The task execution monitoring module records the execution status of the dispatched tasks, and the statistical data after the system runs for one week is shown in Table 5:
[0128] Table 5 Statistical data of task execution status
[0129]
[0130] According to the data in Table 5, the overall execution success rate of the system is 0.928, the average response time is 6.8 seconds, and the resource utilization rate is 0.73. The dispatch effect evaluation function The comprehensive evaluation value is calculated, where the average response time is inverted It needs to be converted to 0.59 through standardization processing, and finally .
[0131] Since the comprehensive evaluation value 0.787 is in the range of 0.6 to 0.8, the system triggers the medium-high efficiency weight adjustment function for parameter optimization. Using the formula The adjusted feature quantity parameter is calculated as , which is rounded to 170.
[0132] The technical team continuously monitors the system performance, and after three months of optimization operation, the improvement of various indicators is shown in Table 6:
[0133] Table 6 Comparison of system performance before and after optimization
[0134]
[0135] The system also records the allocation effect of different types of tasks, as shown in Table 7:
[0136] Table 7 Statistics of allocation effect of different task types
[0137]
[0138] The load distribution change during system operation is shown in Table 8:
[0139] Table 8 Statistics of system load distribution change
[0140]
[0141] From Table 8, it can be observed that the system load distribution gradually tends to be balanced, the number of high-load nodes decreases from 6 to 2, and the load standard deviation decreases from 0.284 to 0.154, indicating that the task allocation algorithm effectively improves the load balancing situation.
[0142] The system also encountered abnormal situations such as node failure and network fluctuation during actual operation, and the fault handling effect is shown in Table 9:
[0143] Table 9 Statistics of system fault handling effect
[0144]
[0145] The traditional means for solving the core technical problem of the application mainly include static load balancing algorithm, rule-based task allocation strategy and fixed weight resource evaluation method. The traditional static load balancing algorithm usually adopts polling or random allocation mode, which cannot be dynamically adjusted according to the actual load condition, resulting in unbalanced task allocation. The rule-based task allocation strategy relies on the manually preset allocation rules, lacks self-adaptive ability and is difficult to cope with complex and variable task requirements. The fixed weight resource evaluation method uses preset weight coefficients to evaluate the service instance state, which cannot be optimized and adjusted according to the system running condition. The synergistic effect of the technical innovation of the application makes the whole system obtain significant improvement in key indicators such as task execution success rate, response time and resource utilization, and provides a more intelligent and efficient solution for large-scale distributed task management.
[0146] It should be noted that the variables involved in the application are explained in detail as shown in Table 10.
[0147] Table 10 Variable explanation table
[0148]
[0149] The above is only a specific embodiment of the application, but the protection scope of the application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the application, which should be covered within the protection scope of the application.
Claims
1. A microservice architecture implementation method for intelligent dispatching of planned tasks, characterized in that: include: Establish a task analysis module to collect the planned task data in the system, classify and mark the task data, and divide the tasks into three categories: immediate tasks, scheduled tasks, and batch tasks according to execution time, resource requirements, and priority level, and establish a task metadata storage structure; Build a service instance monitoring module to collect four core indicators of each microservice node in real time: CPU usage, memory usage, network bandwidth usage, and task processing queue length. Design a load assessment algorithm to calculate the comprehensive load value of each microservice node based on service instance monitoring data. Establish a task matching engine to associate scheduled tasks with appropriate service instances through a multi-dimensional feature matching algorithm. Implement a dispatch decision module to optimize the task allocation scheme using a task optimization allocation model; construct a task execution monitoring module to track the execution status of dispatched tasks; design a feedback optimization mechanism to adjust the dispatch strategy according to task execution results and service instance performance changes; the feedback optimization mechanism evaluates the dispatch effect through three indicators: execution success rate, average response time, and resource utilization rate. When the success rate is lower than 90%, the strategy adjustment is triggered. The dispatch effect evaluation function is used to calculate the comprehensive evaluation value, and the corresponding weight adjustment function is called based on the different ranges of the comprehensive evaluation value to adjust the feature quantity parameters of the task optimization allocation model; wherein, the weight adjustment function includes an inefficient weight adjustment function for adjusting the feature quantity parameters with a comprehensive evaluation value in the range of 0 to 0.2, a medium-low efficiency weight adjustment function for adjusting the feature quantity parameters with a comprehensive evaluation value in the range of 0.2 to 0.4, and a medium-efficiency weight adjustment function for adjusting the feature quantity parameters with a comprehensive evaluation value in the range of 0.4 to 0.6; the weight adjustment function also includes a medium-high efficiency weight adjustment function for adjusting the feature quantity parameters with a comprehensive evaluation value in the range of 0.6 to 0.8, and a high-efficiency weight adjustment function for adjusting the feature quantity parameters with a comprehensive evaluation value in the range of 0.8 to 1.0; Among them, the calculation formula of the distribution effect evaluation function is expressed as follows: ; Where, is the comprehensive evaluation value, For the execution success rate, is the average response time, is the inverse of the average response time, is resource utilization; The calculation formula of the inefficient weight adjustment function is as follows: ; Where, The parameter for the number of features adjusted for the inefficient case; is the current feature quantity parameter; The range is 0 to 0.2; is the number of task categories; The calculation formula of the medium and low efficiency weight adjustment function is as follows: ; Where, is the parameter for the number of features adjusted under medium and low efficiency conditions; The range is 0.2~0.4; is the number of service instances; The calculation formula of the medium-efficiency weight adjustment function is as follows: ; Where, is the parameter of the number of features adjusted under the medium effect condition; The range is 0.4 to 0.6; Evaluate the number of dimensions for load; The calculation formula of the efficient weight adjustment function is as follows: ; Where, is the parameter for the number of features adjusted under medium and high efficiency conditions; The range is 0.6 to 0.8; The calculation formula of the efficient weight adjustment function is as follows: ; Where, is the parameter for the number of features adjusted for high efficiency; The range is 0.8~1.
0.
2. The microservice architecture implementation method for intelligent dispatching of planned tasks according to claim 1 is characterized in that: The task metadata storage structure includes a task identifier, task type, resource requirement, priority value, dependency, creation time, and expected execution time.
3. The microservice architecture implementation method for intelligent dispatching of planned tasks according to claim 2 is characterized in that: The service instance monitoring module updates the service instance status information every 30 seconds through the heartbeat mechanism. Each microservice node regularly sends a heartbeat packet containing status information to the registration center. After receiving the heartbeat packet, the registration center updates the node status table. When a node fails to send a heartbeat packet for more than 90 seconds, it is marked as unavailable.
4. The microservice architecture implementation method for intelligent dispatching of planned tasks according to claim 3 is characterized in that: The load evaluation algorithm performs weighted calculation on the CPU usage, memory occupancy, network bandwidth usage, and task processing queue length according to weight ratios of 0.3, 0.25, 0.2, and 0.
25.
5. The microservice architecture implementation method for intelligent dispatching of planned tasks according to claim 4 is characterized in that: The multi-dimensional feature matching algorithm is based on the similarity calculation between task resource requirements and service instance capabilities. The similarity threshold is set to above 0.75 for matching. The calculation steps include extracting the resource requirement feature vector of the task and the capability feature vector of the service instance, calculating the Euclidean distance between the two feature vectors, and normalizing the distance value to a similarity score between 0 and 1.
6. The microservice architecture implementation method for intelligent dispatching of planned tasks according to claim 5 is characterized in that: The task optimization allocation model is a sequence-to-sequence model based on the Transformer architecture, which consists of two parts: an encoder and a decoder. The encoder is responsible for processing the feature information of tasks and service instances, and the decoder is responsible for generating the optimal task allocation sequence.
7. The microservice architecture implementation method for intelligent dispatching of planned tasks according to claim 6 is characterized in that: The feature quantity parameter of the task optimization allocation model is dynamically adjusted according to three parameters: the number of task categories, the number of service instances, and the number of load evaluation dimensions.
8. The microservice architecture implementation method for intelligent dispatching of planned tasks according to claim 7 is characterized in that: The step of establishing a training data set for the task optimization allocation model includes collecting historical task dispatch records containing data in four dimensions: task characteristics, service instance status, allocation results, and execution effect.
9. The microservice architecture implementation method for intelligent dispatching of planned tasks according to claim 8 is characterized in that: The number of task categories includes three basic categories: immediate tasks, scheduled tasks, and batch tasks, as well as other task categories expanded according to actual needs. The number of service instances is the total number of microservice nodes in the system that can be used to execute tasks. The number of load assessment dimensions includes four dimensions: CPU utilization, memory occupancy, network bandwidth utilization, and task processing queue length.
Citation Information
Patent Citations
Communication command management method and system based on micro-service framework
CN117544656A
Strong-adaptation distributed data distribution method supporting dynamic expansion
CN119960991A