Method, apparatus, device, storage medium and program product for message scheduling
By processing preceding messages in a distributed cluster based on message relationships and duration prediction models, the problem of load imbalance is solved, and efficient resource allocation and processing efficiency are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA MOBILEHANGZHOUINFORMATION TECH CO LTD
- Filing Date
- 2024-12-27
- Publication Date
- 2026-06-30
AI Technical Summary
In a distributed cluster, dependencies between messages lead to uneven load, wasted resources, and long waiting times for servers and message consumers, resulting in resource consumption.
The server determines the preceding messages based on the preset relationships between messages, uses a duration prediction model to obtain the processing time of the preceding messages, and allocates messages to be processed when the processing results are available. Combined with an action prediction model, the processing actions are optimized in different environments to avoid long-term resource occupation.
This effectively avoids long waiting times for servers and message consumers, optimizes resource allocation, and improves the load balancing and processing efficiency of the distributed cluster.
Smart Images

Figure CN122309183A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of artificial intelligence technology, and in particular relates to a method, apparatus, device, storage medium and program product for message scheduling. Background Technology
[0002] In software engineering, to improve software development efficiency, continuous integration (CI) and continuous deployment software development pipelines can be used to ensure rapid iteration and deployment of code during the development process through task orchestration and automated execution.
[0003] In a continuous integration environment, effective message scheduling ensures the orderly execution of tasks. Currently, a distributed cluster is introduced, consisting of multiple nodes, each acting as a message consumer. Multiple consumers in the distributed cluster can jointly consume a message queue. When processing messages with dependencies, the consumer needs to call the preceding message to complete the processing of the current message. However, in a distributed cluster, forcibly assigning dependent messages to the same consumer through rules can lead to uneven load distribution and wasted resources. Summary of the Invention
[0004] This application provides a message scheduling method, apparatus, device, storage medium, and program product. The server can obtain the processing results of preceding messages according to the processing time, thereby completing the processing of messages to be assigned. This avoids long waiting times for the server and message consumers, thus preventing resource consumption by the server and message consumers.
[0005] In a first aspect, embodiments of this application provide a message scheduling method applied to a server, the method comprising:
[0006] Receive messages to be assigned;
[0007] The preceding message of the message to be assigned is determined based on the preset association relationship between messages;
[0008] The feature data of the preceding message is input into the duration prediction model to obtain the processing duration of the preceding message;
[0009] After waiting for the processing time, obtain the processing result of the preceding message;
[0010] If the processing result indicates that the preceding message processing is complete, the message to be assigned is assigned to the message consumer.
[0011] In one possible implementation, the message to be assigned includes routing information; before determining that the message to be assigned has a preceding message based on a preset association relationship between messages, the method further includes:
[0012] The message queue that matches the routing information is searched according to the preset routing rule table;
[0013] The step of determining that the message to be assigned has a preceding message based on a preset association relationship between messages includes:
[0014] Based on the preset association relationship corresponding to the message queue, find the preceding message of the message to be assigned.
[0015] In one possible implementation, before inputting the feature data of the preceding message into the duration prediction model to obtain the processing duration of the preceding message, the method further includes:
[0016] Obtain scheduling information for historical messages, including feature data and historical processing time of the historical messages;
[0017] The feature data of the historical messages are used as input to the neural network model, and the historical processing time is used as the label data of the neural network model to train the duration prediction model.
[0018] In one possible implementation, assigning the message to be assigned to the message consumer includes:
[0019] Obtain the environmental information of the message to be assigned, which indicates the status of the message queue to which the message to be assigned belongs.
[0020] The environmental information is input into the action prediction model to obtain the expected value for each processing action corresponding to the message to be assigned.
[0021] If the processing action corresponding to the maximum expected value is to be sent, the message to be allocated is sent to the message consumer.
[0022] In one possible implementation, before inputting the environmental information into the action prediction model to obtain the expected value corresponding to each processing action of the message to be assigned, the method further includes:
[0023] Environmental information for obtaining historical messages;
[0024] The environmental information of the historical messages is input into the action prediction model. The action prediction model calculates the transmission delay of each processing action under the environmental information of each historical message. The processing action with the minimum transmission delay is taken as the target processing action corresponding to the environmental information of the historical message. The correspondence between the environmental information of the historical messages and the target processing actions is constructed so that the action prediction model can predict the processing action corresponding to the message to be assigned based on the correspondence between the environmental information of the historical messages and the target processing actions.
[0025] In one possible implementation, after assigning the message to be assigned to the message consumer, the method further includes:
[0026] The message consumer receives the processing result of the preceding message, which includes the processing time of the message consumer.
[0027] The feature data of the preceding message is input into the duration prediction model to obtain the processing duration of the preceding message;
[0028] The remaining processing time of the preceding message is calculated based on the already processed time and the processing time of the preceding message.
[0029] After waiting for the remaining processing time, obtain the processing result of the preceding message;
[0030] If the processing result indicates that the preceding message processing is complete, the message to be assigned is assigned to the message consumer.
[0031] Secondly, embodiments of this application provide a message scheduling apparatus applied to a server, the apparatus comprising:
[0032] The receiving module is used to receive messages to be assigned.
[0033] The determination module is used to determine the preceding message of the message to be assigned based on the preset association relationship between messages;
[0034] The duration prediction module is used to input the feature data of the preceding message into the duration prediction model to obtain the processing duration of the preceding message;
[0035] The acquisition module is used to acquire the processing result of the preceding message after waiting for the processing time.
[0036] The allocation module is used to allocate the message to be allocated to the message consumer when the processing result indicates that the processing of the preceding message has ended.
[0037] Thirdly, embodiments of this application provide an electronic device, the device comprising: a processor and a memory storing computer program instructions;
[0038] When the processor executes the computer program instructions, it implements the message scheduling method as described in any one of the first aspects.
[0039] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the message scheduling method as described in any one of the first aspects.
[0040] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform the message scheduling method as described in any one of the first aspects.
[0041] This application discloses a message scheduling method, apparatus, device, storage medium, and program product. After receiving a message to be allocated, the server can determine whether there is a preceding message based on a preset association between messages. If a preceding message exists, the characteristic data of the preceding message is input into a duration prediction module to obtain the processing duration of the preceding message. In this way, the server can obtain the processing result of the preceding message according to the processing duration, thereby completing the processing of the message to be allocated. This avoids long waiting times for the server and message consumers, thus preventing resource consumption by the server and message consumers. Attached Figure Description
[0042] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a flowchart illustrating a message scheduling method provided in an embodiment of this application;
[0044] Figure 2 This is a flowchart illustrating a retry mechanism method provided in an embodiment of this application;
[0045] Figure 3 This is a flowchart illustrating a duration prediction model training method provided in an embodiment of this application;
[0046] Figure 4 This is a flowchart illustrating a method for training an action prediction model according to an embodiment of this application;
[0047] Figure 5This is a schematic diagram of the structure of a message scheduling system provided in an embodiment of this application;
[0048] Figure 6 This is an exemplary schematic diagram of a message scheduling method provided in an embodiment of this application;
[0049] Figure 7 This is an exemplary schematic diagram of a retry mechanism method provided in an embodiment of this application;
[0050] Figure 8 This is a schematic diagram of the structure of a message scheduling device provided in an embodiment of this application;
[0051] Figure 9 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation
[0052] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0053] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0054] To address the problems existing in the prior art, embodiments of this application provide a message scheduling method, apparatus, device, storage medium, and program product, firstly based on... Figure 1 This application introduces a message scheduling method provided by an embodiment, such as... Figure 1 As shown, this method is applied to a server, and the method includes:
[0055] S101, Receive the message to be assigned.
[0056] Among them, the message to be assigned refers to the message sent by the message sender. The message sender can be a component developer, software developer, or application development vendor. The message to be assigned can be component code, application code, or documentation, etc.
[0057] In addition, to ensure the convenience and security of data transmission, the message sender can define the message to be assigned as a string and send it. After receiving the message to be assigned, the server compresses it to obtain a compressed message, and then encrypts the compressed message using an encryption algorithm. This ensures the integrity and security of the message transmission process and avoids message transmission abnormalities or interruptions caused by the message to be assigned being too long.
[0058] In one example, the compression method described above can be GZIP compression, and the encryption algorithm can be a 128-bit Advanced Encryption Standard (AES) symmetric encryption algorithm. This application does not impose specific limitations on the compression method and encryption algorithm.
[0059] S102. Determine the preceding message of the message to be assigned based on the preset association relationship between messages.
[0060] In this context, a preceding message refers to a message sent by the same sender as the message to be assigned. When processing messages, message consumers sometimes need to refer to the processing results of preceding messages for certain message processing. That is, the message consumer first needs to obtain the preceding messages and then use their processing results to determine the processing method for that message. The message to be assigned carries a pre-defined association with preceding messages; based on this pre-defined association, the server can determine the preceding messages that need to be referenced.
[0061] S103. Input the feature data of the preceding message into the duration prediction model to obtain the processing duration of the preceding message.
[0062] Among them, the feature data can be feature data related to the parsing time, such as construction time, parsing time, node machine performance data, code complexity, code volume, message queue throughput, etc.
[0063] Specifically, construction time refers to the time required for the message sender to construct the message, and parsing time refers to the time required for the server to process the message and obtain the processing result from the time the message is received. The node machine is the message consumer mentioned above. Feature data related to parsing time can be selected based on experience, and this application embodiment does not impose restrictions on the feature data.
[0064] S104. After the waiting time, obtain the processing result of the preceding message.
[0065] After a message consumer finishes processing a preceding message, it can send the processing result to the server, which stores the message processing result corresponding to the message sender. Subsequently, after waiting for the designated processing time, the server can retrieve the processing result of the preceding message from this list of message processing results.
[0066] S105. If the processing result indicates that the processing of the preceding message has ended, the message to be assigned is assigned to the message consumer.
[0067] Using the above method, after receiving a message to be assigned, the server can determine whether there is a preceding message based on the preset correlation between messages. If a preceding message exists, its feature data is input into the duration prediction module to obtain the processing duration of the preceding message. In this way, the server can obtain the processing result of the preceding message according to the processing duration, thus completing the processing of the message to be assigned. This avoids long waiting times for both the server and message consumers, thereby minimizing resource consumption for both.
[0068] It should be noted that the server stores a preset routing rule table. Based on this, before determining the preceding message of the message to be assigned according to the preset association relationship between messages in S102 above, the method further includes:
[0069] The message queue is searched and matched with the routing information according to the preset routing rule table.
[0070] It should be noted that the server includes multiple message queues, each corresponding to a message sender and multiple message consumers. Each message consumer processes one message from its queue. Therefore, after the server receives a message to be assigned, it determines the message queue to which the message belongs based on the routing information and routing rule table within the message.
[0071] Accordingly, based on the preset relationships between messages, it is determined that the message to be assigned has a preceding message, including:
[0072] Based on the preset association relationship corresponding to the message queue, find the preceding message of the message to be assigned.
[0073] Using the method provided in this application, based on the routing information in the message, the corresponding message queue can be matched according to a preset routing rule table. This message queue includes other messages from the sender of the message to be assigned. In this way, the server can accurately find the preset association relationship corresponding to the message queue, thereby determining the preceding message of the message to be assigned.
[0074] In some embodiments of this application, the allocation of the message to be allocated to the message consumer in S105 above can be specifically implemented as follows:
[0075] Step 1: Obtain the environment information of the message to be assigned.
[0076] Among them, the environmental information is used to indicate the status of the message queue to which the message to be assigned belongs.
[0077] In one example, the environment information could be things like the length of the message queue and network bandwidth.
[0078] Step 2: Input the environmental information into the action prediction model to obtain the expected value of each processing action corresponding to the message to be assigned.
[0079] The action prediction model can predict the expected value for each processing action under this environmental information. The expected value represents the transmission delay caused by performing different processing on the message to be allocated under this environment.
[0080] The processing action can be to send, suspend, or wait.
[0081] Step 3: If the processing action corresponding to the maximum expected value is to be sent, send the message to be allocated to the message consumer.
[0082] Using the method provided in this application, the server obtains the current message queue's environment information, and then uses an action prediction model to predict the expected value corresponding to each processing action, thereby determining the processing action corresponding to the message to be allocated in the current environment. In this way, by using a pre-trained action prediction model to predict processing actions in different environments, scheduling strategies for different environments can be accurately generated, making the generated scheduling strategies more closely aligned with actual business needs.
[0083] After assigning the messages to be distributed to message consumers, the server can also receive message processing results from the consumers, ensuring that these results can be retrieved promptly and messages can be processed smoothly. Specifically, for example... Figure 2 As shown, after S105 above, where the processing result indicates that the processing of the preceding message has ended, and the message to be assigned is assigned to the message consumer, the method further includes:
[0084] S201, Receive the processing result of the preceding message from the message consumer.
[0085] The processing result includes the processing time of the message consumer.
[0086] Specifically, the processing result indicates whether the preceding message has been processed. After receiving the processing result, the server stores the processing result queue corresponding to the message queue locally. The processing result queue includes the preceding message and the processing result of the preceding message.
[0087] S202. Input the feature data of the preceding message into the duration prediction model to obtain the processing duration of the preceding message.
[0088] S203. Calculate the remaining processing time of the preceding message based on the processing time already processed and the processing time of the preceding message.
[0089] S204. After waiting for the remaining processing time, obtain the processing result of the preceding message.
[0090] S205. If the processing result indicates that the processing of the preceding message has ended, the message to be assigned is assigned to the message consumer.
[0091] Specifically, the method for the server to allocate messages to be allocated is described in the relevant embodiments above, and will not be repeated here.
[0092] Using the method provided in this application embodiment, the message consumer can send the processing result of each message back to the server. The server can then determine whether the message has finished processing based on the processing result. If the message has not finished processing, the server calculates the remaining processing time of the message based on the predicted processing time and the processing time already processed, and then reassigns the message to the message consumer to obtain the processing result of each message.
[0093] The following are combined with Figure 3 This section introduces methods for training duration prediction models and combining them with... Figure 4 This paper introduces methods for training action prediction models.
[0094] like Figure 3 As shown, Figure 3 A training method for a duration prediction model provided in this application embodiment specifically includes:
[0095] S301. Obtain scheduling information for historical messages.
[0096] The scheduling information includes characteristic data of historical messages and historical processing time.
[0097] Specifically, for historical message scheduling information, the server can convert the scheduling information into vector form through methods such as feature encoding. For example, for categorical features, feature encoding can be performed to convert the categorical features into numerical feature vectors. For numerical features, standardization can be performed to scale the numerical features and avoid excessively large ranges. In this way, the server can process the feature data of the scheduling information.
[0098] S302. Use the feature data of historical messages as input to the neural network model, and use the historical processing time as the label data of the neural network model to train and obtain the duration prediction model.
[0099] Specifically, the hyperparameters of the model are pre-set, such as the learning rate, regularization parameter, number of trees, and tree depth. Through multiple iterations of optimization using multiple models, a duration prediction model is obtained.
[0100] Furthermore, the scheduling information of the aforementioned historical messages is divided into a test set and a training set. During the training process, the error between the predicted and actual values can be calculated using the training set, along with the mean squared error (MSE) evaluation metric. Based on model performance and feature importance, the model's hyperparameters are adjusted, specifically using grid search or random search methods for performance tuning. Subsequently, the model's parameters are continuously adjusted using the test set to improve the accuracy of the model's predictions.
[0101] It should be noted that the methods for model training provided in this application embodiment are not specifically limited.
[0102] The method provided in this application uses the scheduling information of historical messages to train a duration prediction model, which improves the accuracy of the prediction results.
[0103] like Figure 4 As shown, Figure 4 A method for training an action prediction model provided in this application embodiment specifically includes:
[0104] S401, Obtain environmental information for historical messages.
[0105] The environmental information of historical messages can be information that affects historical scheduling, such as the length of the message queue corresponding to the historical message or the network bandwidth. This application embodiment does not limit this.
[0106] S402. Input the environmental information of historical messages into the action prediction model. The action prediction model calculates the transmission delay of each processing action under the environmental information of each historical message. The processing action with the minimum transmission delay is taken as the target processing action corresponding to the environmental information of the historical message. The correspondence between the environmental information of historical messages and the target processing actions is constructed so that the action prediction model can predict the processing action corresponding to the message to be assigned based on the correspondence between the environmental information of historical messages and the target processing actions.
[0107] Specifically, the action prediction model constructs a Q-table, which stores the Q-value of each state and different actions that constitute a state-action pair. The dimension of the Q-table is the number of states multiplied by the number of actions. The preset initial learning rate, discount factor, and initial Q-value of each state-action pair are obtained to construct the Q-table.
[0108] The action prediction model selects the action corresponding to each state according to the ε-greedy policy, and then calculates the Q-value for performing the corresponding action in the current state. The Q-value is updated based on the calculated state and reward until the action prediction model reaches its maximum number of iterations or the calculated Q-value is less than a preset threshold, at which point the iteration process stops. At this point, the Q-value table contains the optimal Q-value for each state-action pair. Based on this Q-value table, after receiving a message to be assigned, the action prediction model can determine the expected value for each action by calculating the similarity between the environmental information of the message to be assigned and the states in the Q-value table.
[0109] Specifically, the Q value can be updated using the following formula:
[0110] Q(s,a)=Q(s,a)+α[reward+γMax a′ Q(s ′ ,a ′ )-Q(s,a)]
[0111] Where Q(s, a) represents the Q value corresponding to action a in state s; α represents the learning rate; γ represents the discount rate; and Q(s) ′ ,a ′ ) indicates that in state s ′ Next, process action a is adopted. ′ The corresponding Q value; reward represents the state transitioning from s to s. ′ Then, the feedback given by the environment; Max a′ Q(s ′ ,a ′ ) indicates from s ′ All possible actions a ′ In the middle, select the largest Q value.
[0112] Using the method provided in this application, by acquiring the environmental information of historical messages, the action prediction model can calculate the transmission delay of each processing action under the environmental information of historical messages, thereby determining the optimal processing action corresponding to different environments. Thus, after subsequently acquiring the environmental information of the message to be assigned, the optimal processing action corresponding to the environment of the message to be assigned can be predicted, thereby improving the accuracy of the prediction results.
[0113] This application also provides a system architecture employing the above-described message scheduling method, such as... Figure 5 As shown, the system architecture includes a message encryption unit, a message registration unit, a message scheduling unit, and a message processing unit.
[0114] The message encryption unit is used to compress and encrypt the received message body, ensuring the security and efficiency of message transmission. Message compression reduces message size and improves transmission efficiency; encryption technology ensures message security during transmission, preventing theft or malicious tampering. The combined use of compression and encryption algorithms further enhances message security, ensuring reliable message transmission.
[0115] Message Registration Unit: Serving as the registration center for the entire message scheduling method, it receives, stores, and transmits messages, while also storing message scheduling unit registration information. This registration information includes routing rules corresponding to each scheduling unit. Message distribution is achieved by matching the routing rules in the registration information with the routing information carried in the message.
[0116] The message scheduling unit is used to receive or retrieve messages, generate scheduling policies, and allocate received or retrieved messages to the corresponding message processing units according to the scheduling policies. On one hand, it receives messages distributed by the message registration unit and sends them to the message processing units to implement the business logic processing of the messages; on the other hand, it can actively retrieve messages from the message registration unit in case of retry mechanisms or other abnormal situations. The message scheduling unit generates scheduling policies mainly based on setting the message delivery time and the nodes of the message processing units. First, if the current message has related preceding messages, the processing time of the preceding messages is predicted based on a duration prediction model to assist in deciding the message delivery time. Second, based on the load and consumption status of each processing node in the message processing unit, Q-Learning reinforcement learning is used to decide the specific node in the message processing unit to which the current message is delivered, thereby achieving dynamic adjustment of the message scheduling policy. Specifically, the method of deciding the node for message delivery based on Q-Learning reinforcement learning is the same as the method mentioned above that determines the message consumer corresponding to the message to be allocated through an action prediction model.
[0117] Message processing unit: Used to process messages according to specific business logic. This specific business logic is pre-configured based on experience. The message processing unit operates in cluster mode, meaning multiple message processing units exist. A single message scheduling unit supports parallel processing by multiple message processing units, ensuring timely message scheduling and processing. After processing according to the business logic, the message processing unit outputs the results for use by other devices or systems. The aforementioned message processing unit is a processing node in cluster mode and represents the smallest unit of message processing.
[0118] The following combination Figure 6 This section describes how the message scheduling unit generates message scheduling policies, such as... Figure 6 As shown, the method includes:
[0119] S601, The message scheduling unit receives messages distributed by the message registration unit.
[0120] In this context, the message refers to the message to be assigned in the above embodiments. Each message scheduling unit corresponds to a message queue, that is, each message scheduling unit corresponds to a message sender, and each message scheduling unit corresponds to multiple message processing units.
[0121] S602. Does a preceding dependency exist?
[0122] If yes, then execute S603; otherwise, execute S606.
[0123] Specifically, the message scheduling unit determines whether there is a preceding message based on the preset association relationship corresponding to each message queue. If there is a preceding message, then the message has a preceding dependency.
[0124] S603. Combining historical data of preceding messages, predict the processing time of preceding messages based on the LightGBM algorithm, calculate the remaining processing time of preceding messages under the retry mechanism, and decide the time point for message delivery.
[0125] The historical data refers to the feature data of the preceding messages in the above embodiments. The processing time of the preceding messages predicted based on the LightGBM algorithm is the processing time of each preceding message predicted based on the duration prediction model in the above embodiments, which will not be elaborated here.
[0126] S604. Has the processing of the preceding message been completed?
[0127] If yes, then execute S606; otherwise, execute S605.
[0128] S605. Based on the predicted value, suspend the current message processing process and wait until the previous message processing is completed.
[0129] The predicted value is the processing time obtained from the above prediction.
[0130] S606, Input message information, process unit cluster load information.
[0131] Among them, the message information and the processing unit cluster load information are the environmental information of the message to be allocated in the above embodiment, and the unit cluster load information is the load information of the message processing unit.
[0132] S607. Based on the constructed Q-Learning model, obtain the expected value of each action in this state, and select the processing action corresponding to the maximum expected value.
[0133] The Q-Learning model is the action prediction model mentioned above. The specific method for training the action prediction model can be found in the relevant description in the above embodiments, and will not be repeated here.
[0134] S608. Based on the processing action, the decision-making message processing unit corresponding to the message generates a message scheduling strategy.
[0135] In this process, after predicting the processing action of the message to be assigned, the message scheduling unit can generate a message scheduling strategy based on the execution action.
[0136] S609. Send the message to the corresponding message processing unit.
[0137] Using the method provided in this application, after receiving the message to be allocated from the message registration unit, the message scheduling unit uses a duration prediction model to predict the processing time of preceding messages. This allows the message scheduling unit to query the processing results of preceding messages according to their processing times, preventing the message to be allocated from occupying parsing resources for extended periods within the processing time. This also avoids the message processing unit from being unable to obtain the processing results of preceding messages, thus preventing prolonged occupation of parsing resources. Furthermore, the action prediction model can determine the optimal processing action for the message to be allocated in the current environment, thereby ensuring the working efficiency of the processing unit cluster.
[0138] exist Figure 6 Based on the embodiments, this application also provides a retry mechanism. If a fault occurs during message processing by the message processing unit, resulting in the message not being fully processed, the message processing unit can report the processing result to the message registration unit. Then, the message scheduling unit can reassign a corresponding message processing unit to the message based on the processing result in the message registration unit. Specifically, as shown... Figure 7 As shown, the method includes:
[0139] S701 The message processing unit decrypts and decompresses the received message to restore its true content and performs corresponding message processing according to business logic.
[0140] The message encryption unit can first compress the message, and then encrypt the compressed message to obtain an encrypted compressed message, thereby ensuring the integrity, security and convenience of the information.
[0141] S702. Is message processing normal?
[0142] If yes, then execute S704; otherwise, execute S703.
[0143] S703. Transfer to the message scheduling unit to redefine the message scheduling strategy, and re-enter the corresponding message processing unit according to the strategy.
[0144] The method for the message scheduling unit to generate the scheduling strategy is described in the above embodiments and will not be repeated here.
[0145] S704 After message processing is completed, a termination message is sent back to the message processing unit to determine the progress of message processing.
[0146] S705, Output message processing results.
[0147] Using the method provided in this application embodiment, the message processing unit can report the processing result of each message to the message registration unit. Then, the message scheduling unit can determine whether the message processing is finished based on the processing result. If the processing is not finished, the message scheduling unit can re-formulate the scheduling strategy for the message and re-allocate and schedule the message to the message consumer to obtain the processing result of each message.
[0148] Based on the same concept, embodiments of this application provide a message scheduling apparatus applied to a server, such as... Figure 8 As shown, the device includes:
[0149] Receiver module 801 is used to receive messages to be assigned;
[0150] The determining module 802 is used to determine the preceding message required for the message to be allocated based on the preset association relationship between messages;
[0151] The duration prediction module 803 is used to input the feature data of the preceding message into the duration prediction model to obtain the processing duration of the preceding message;
[0152] The acquisition module 804 is used to acquire the processing result of the preceding message after waiting for the processing time.
[0153] The allocation module 805 is used to allocate the message to be allocated to the message consumer when the processing result indicates that the processing of the preceding message has ended.
[0154] In one possible implementation, the message to be assigned includes routing information; the device further includes:
[0155] The lookup module is used to search for message queues that match the routing information according to a preset routing rule table;
[0156] The determining module 802 is specifically used for:
[0157] Based on the preset association relationship corresponding to the message queue, find the preceding message of the message to be assigned.
[0158] In one possible implementation, the device further includes:
[0159] The acquisition module 804 is also used to acquire scheduling information of historical messages, the scheduling information including feature data of the historical messages and historical processing time;
[0160] The training module is used to take the feature data of the historical messages as input to the neural network model and the historical processing duration as the label data of the neural network model to train the duration prediction model.
[0161] In one possible implementation, the allocation module 805 is specifically used for:
[0162] Obtain the environmental information of the message to be assigned, which indicates the status of the message queue to which the message to be assigned belongs.
[0163] The environmental information is input into the action prediction model to obtain the expected value for each processing action corresponding to the message to be assigned.
[0164] If the processing action corresponding to the maximum expected value is to be sent, the message to be allocated is sent to the message consumer.
[0165] In one possible implementation, the allocation module 805 is also used for:
[0166] Environmental information for obtaining historical messages;
[0167] The environmental information of the historical messages is input into the action prediction model. The action prediction model calculates the transmission delay of each processing action under the environmental information of each historical message. The processing action with the minimum transmission delay is taken as the target processing action corresponding to the environmental information of the historical message. The correspondence between the environmental information of the historical messages and the target processing actions is constructed so that the action prediction model can predict the processing action corresponding to the message to be assigned based on the correspondence between the environmental information of the historical messages and the target processing actions.
[0168] In one possible implementation, the device further includes:
[0169] The receiving module 801 is specifically used to receive the processing result of the preceding message fed back by the message consumer, wherein the processing result includes the processing time of the message consumer;
[0170] The duration prediction module 803 is used to input the feature data of the preceding message into the duration prediction model to obtain the processing duration of the preceding message;
[0171] The calculation module is used to calculate the remaining processing time of the preceding message based on the processed time and the processing time of the preceding message;
[0172] The acquisition module 804 is also used to acquire the processing result of the preceding message after waiting for the remaining processing time;
[0173] The allocation module 805 is further configured to allocate the message to be allocated to the message consumer when the processing result indicates that the preceding message processing has ended.
[0174] It should be noted that the message scheduling device is the same as the message scheduling method applied to the server described above. All implementation methods in the above method embodiments are applicable to the embodiments of this device and can achieve the same technical effect.
[0175] Figure 9 A schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application is shown.
[0176] An electronic device may include a processor 901 and a memory 902 storing computer program instructions.
[0177] Specifically, the processor 901 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0178] Memory 902 may include mass storage for data or instructions. For example, and not limitingly, memory 902 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 902 may include removable or non-removable (or fixed) media. Where appropriate, memory 902 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 902 is non-volatile solid-state memory.
[0179] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the methods according to one aspect of this disclosure.
[0180] The processor 901 implements any of the message scheduling methods described in the above embodiments by reading and executing computer program instructions stored in the memory 902.
[0181] In one example, the electronic device may also include a communication interface 903 and a bus 904. For example, Figure 9 As shown, the processor 901, memory 902, and communication interface 903 are connected through bus 904 and complete communication with each other.
[0182] The communication interface 903 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0183] Bus 904 includes hardware, software, or both, that couples components of an electronic device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 1004 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.
[0184] Furthermore, in conjunction with the message scheduling methods in the above embodiments, this application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the message scheduling methods in the above embodiments.
[0185] In conjunction with the message scheduling methods in the above embodiments, this application embodiment can provide a computer program product in which the instructions in the computer program product are executed by the processor of an electronic device, causing the electronic device to perform any of the message scheduling methods in the above embodiments.
[0186] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0187] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0188] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0189] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0190] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A method of message scheduling, characterized by, Applied to a server, the method includes: Receive messages to be assigned; The preceding message of the message to be assigned is determined based on the preset association relationship between messages; The feature data of the preceding message is input into the duration prediction model to obtain the processing duration of the preceding message; After waiting for the processing time, obtain the processing result of the preceding message; If the processing result indicates that the preceding message processing is complete, the message to be assigned is assigned to the message consumer.
2. The method of claim 1, wherein, The message to be assigned includes routing information; before determining the preceding message of the message to be assigned based on the preset association between messages, the method further includes: The message queue that matches the routing information is searched according to the preset routing rule table; The step of determining the preceding message of the message to be assigned based on the preset association relationship between messages includes: Based on the preset association relationship corresponding to the message queue, find the preceding message of the message to be assigned.
3. The method of claim 1, wherein, Before inputting the feature data of the preceding message into the duration prediction model to obtain the processing duration of the preceding message, the method further includes: Obtain scheduling information for historical messages, including feature data and historical processing time of the historical messages; The feature data of the historical messages are used as input to the neural network model, and the historical processing time is used as the label data of the neural network model to train the duration prediction model.
4. The method of claim 1, wherein, The step of assigning the message to be assigned to the message consumer includes: Obtain the environmental information of the message to be assigned, wherein the environmental information is used to indicate the status of the message queue to which the message to be assigned belongs; The environmental information is input into the action prediction model to obtain the expected value for each processing action corresponding to the message to be assigned. If the processing action corresponding to the maximum expected value is to be sent, the message to be allocated is sent to the message consumer.
5. The method of claim 4, wherein, Before inputting the environmental information into the action prediction model to obtain the expected value corresponding to each processing action of the message to be assigned, the method further includes: Environmental information for obtaining historical messages; The environmental information of the historical messages is input into the action prediction model. The action prediction model calculates the transmission delay of each processing action under the environmental information of each historical message. The processing action with the minimum transmission delay is taken as the target processing action corresponding to the environmental information of the historical message. The correspondence between the environmental information of the historical messages and the target processing actions is constructed so that the action prediction model can predict the processing action corresponding to the message to be assigned based on the correspondence between the environmental information of the historical messages and the target processing actions.
6. The method of claim 1, wherein, After assigning the message to be assigned to the message consumer, the method further includes: The message consumer receives the processing result of the preceding message, which includes the processing time of the message consumer. The feature data of the preceding message is input into the duration prediction model to obtain the processing duration of the preceding message; The remaining processing time of the preceding message is calculated based on the already processed time and the processing time of the preceding message. After waiting for the remaining processing time, obtain the processing result of the preceding message; If the processing result indicates that the preceding message processing is complete, the message to be assigned is assigned to the message consumer.
7. An apparatus for message scheduling, the apparatus comprising: Applied to a server, the device includes: The receiving module is used to receive messages to be assigned. The determination module is used to determine the preceding message of the message to be assigned based on the preset association relationship between messages; The duration prediction module is used to input the feature data of the preceding message into the duration prediction model to obtain the processing duration of the preceding message; The acquisition module is used to acquire the processing result of the preceding message after waiting for the processing time. The allocation module is used to allocate the message to be allocated to the message consumer when the processing result indicates that the processing of the preceding message has ended.
8. An electronic device, comprising: The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the message scheduling method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that, when executed by a processor, implement the message scheduling method as described in any one of claims 1-6.
10. A computer program product, characterised in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device performs the message scheduling method as described in any one of claims 1-6.