Task message transmission method and apparatus, and electronic device, storage medium and program product
By obtaining task execution data of the task execution system, determining the execution stage and calculating the priority of task messages, and using buffer queues to transmit task messages, the problem of poor flexibility in the transmission of task messages is solved, and the efficiency of task scheduling and system stability are achieved.
Patent Information
- Application Number
- PCT/CN2024/134448
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-25
- Filing Date
- 2024-11-26
- Publication Date
- 2025-07-31
Smart Images

Figure CN2024134448_31072025_PF_FP_ABST
Abstract
Description
Task message transmission method, device, electronic device, storage medium and program product
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on January 25, 2024, with application number 202410101868.4 and application name “Task Message Transmission Method, Device, Electronic Device and Computer-readable Storage Medium”. Technical Field
[0002] The present application relates to the field of cloud technology, and in particular to a task message transmission method, device, electronic device, storage medium and program product.
[0003] Background of the Invention
[0004] With the development of cloud technology, cloud vendors can provide an increasingly diverse range of cloud services. Specifically, cloud service users can send request messages to cloud vendors through their computers. The cloud vendors can then generate task messages based on the request messages and transmit the task messages to the task execution system, which then processes the task messages to provide the requested cloud services to the cloud service users.
[0005] However, in actual work scenarios, the resource configuration and task message processing volume of the task execution system will change, but the above solution cannot perceive these changes, making it difficult for the task message transmission process to match the task processing situation of the task execution system, and the task message transmission process has poor flexibility. Summary of the Invention
[0006] Embodiments of the present application provide a task message transmission method, device, electronic device, storage medium, and program product, which can improve the transmission flexibility of task messages.
[0007] In one aspect, an embodiment of the present application provides a task message transmission method, which is executed by an electronic device and includes:
[0008] Acquiring task execution data of a task execution system, the task execution system being used to process a plurality of task messages, the task execution data comprising indicator data generated when the task execution system executes the tasks carried in the task messages within a preset time period;
[0009] determining execution phase information of the task execution system based on the task execution data;
[0010] When the execution stage information indicates that the task execution system is in a first execution stage, calculating a first priority of a first task message to be transmitted in the first execution stage; and
[0011] Based on the first priority, the first task message is inserted into a first target position of a buffer queue, and the first task message is transmitted to the task execution system through the buffer queue.
[0012] On the other hand, an embodiment of the present application further provides a task message transmission device, including:
[0013] An execution data acquisition module is used to acquire task execution data of a task execution system, wherein the task execution system is used to process multiple task messages, and the task execution data includes indicator data generated when the task execution system executes the tasks carried in the task messages within a preset time period;
[0014] an execution phase determination module, configured to determine execution phase information of the task execution system based on the task execution data;
[0015] A first phase module is configured to calculate a first priority of a first task message to be transmitted in a first execution phase when the execution phase information indicates that the task execution system is in a first execution phase; and
[0016] A transmission module is configured to insert the first task message into a first target position of a buffer queue based on the first priority, and transmit the first task message to the task execution system through the buffer queue.
[0017] On the other hand, an embodiment of the present application further provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor is used to run the computer program in the memory to implement the steps in the task message transmission method provided in the embodiment of the present application.
[0018] On the other hand, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the steps in the task message transmission method provided in the embodiment of the present application.
[0019] On the other hand, an embodiment of the present application further provides a computer program product, including a computer program or instructions, which are executed by a processor to implement the steps in the task message transmission method provided in the embodiment of the present application.
[0020] BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0022] FIG1 is a schematic diagram of the structure of a cloud service system using an embodiment of the present application;
[0023] FIG2 is a flow chart of a task message transmission method according to an embodiment of the present application;
[0024] FIG3 is another flow chart of a task message transmission method according to an embodiment of the present application;
[0025] FIG4 is a schematic diagram of the structure of a cloud service provider provided in an embodiment of the present application;
[0026] FIG5 is another flowchart of a task message transmission method according to an embodiment of the present application;
[0027] FIG6 is a schematic diagram of the structure of a task message transmission device provided in an embodiment of the present application;
[0028] FIG7 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
[0029] Implementation Method
[0030] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0031] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the numbers used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "corresponding to" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] It is understandable that in several embodiments of the present application, related data such as user information (such as task messages, etc.) are involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0033] Cloud technology refers to the general term for network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. The backend services of technical network systems, such as those found on video websites, image websites, and numerous portals, require significant computing and storage resources. Data from all industries requires a powerful cloud computing system. Cloud computing refers to the delivery and usage model of services, providing required services on-demand and in an easily scalable manner over the network. Specifically, it includes grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing.
[0034] The various embodiments of the present application mainly relate to how cloud computing service providers (referred to as cloud service providers, or cloud vendors) can more flexibly and efficiently transmit and process task messages from users when providing cloud computing services to users, thereby improving the supply stability of cloud computing services.
[0035] The embodiments of the present application provide a task message transmission method, device, electronic device, storage medium and program product. The task message transmission device can be integrated into a task message transmission system (referred to as the task transmission system), and the task transmission system can be integrated on at least one electronic device, which can include at least one of a terminal and a server.
[0036] The task execution system in the embodiment of the present application can be integrated into at least one electronic device, and the electronic device can include at least one of a terminal and a server.
[0037] The task transmission system and task execution system in the embodiments of the present application may also be integrated on the same (multiple) electronic devices, or may be integrated on different electronic devices respectively. The specific implementation may be flexibly handled according to actual conditions and will not be elaborated here.
[0038] Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to these. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.
[0039] In an embodiment of the present application, the task transmission system can receive task messages generated in real time and transmit the task messages to the task execution system, which is used to process the task messages.
[0040] To improve the consistency of task message transmission and processing, the task transmission system can obtain task execution data from the task execution system. This data includes various metrics from the task execution system during task message processing. Based on this data, the task execution system's execution phase can be determined. Task messages can be transmitted to the task execution system using different methods depending on the execution phase.
[0041] 1 is a schematic diagram of the structure of a cloud service system according to an embodiment of the present invention. The entire cloud service system includes a cloud service user 110, a cloud service provider 120, and a cloud service control platform 130.
[0042] Cloud service consumers 110 refer to users, enterprises, or other organizations that utilize various cloud services. Cloud service control platform 130 is a unified platform that controls cloud service providers 120 in providing cloud services to cloud service consumers 110. Both cloud service consumers 110 and cloud service control platform 130 can send pending task messages, such as request messages and control messages, to cloud service providers 120 and receive corresponding task responses from cloud service providers 120.
[0043] The cloud service provider 120 includes a task transmission system 121 and a task execution system 122. In other examples, the cloud service provider 120 may also include other related systems and functional modules, which will not be described in detail here.
[0044] The task transmission system 121 and the task execution system 122 can be integrated on the server 1 and the server 2, respectively. The task transmission system 121 can receive task messages from the cloud service user 110 and the cloud service control platform 130, obtain indicator data (referred to as task execution data) of the task execution system 122 during the task message processing process, and then determine the execution stage information of the task execution system 122 based on the task execution data. Then, based on the execution stage information, the task message is transmitted to the task execution system 122 in different ways.
[0045] If the execution stage information indicates that the task execution system 122 is in a peak period, the priority P1 of the task message M1 received during the peak period can be calculated, and then the task message M1 can be saved at position P1 in the buffer queue based on the priority P1, so that the task message M1 with a higher priority can be transmitted to the task execution system 122 faster through the buffer queue.
[0046] For another example, the execution phase information indicates that the task execution system is in a non-peak period, and the task message M2 received during the non-peak period can be directly transmitted to the task execution system 122 .
[0047] FIG1 is an example of an application scenario for transmitting task messages of the present application, and is primarily used to introduce the task transmission system described in the embodiments of the present application. In the actual application of the technical solutions described in the embodiments of the present application, the electronic devices involved in the task transmission method and the steps performed by each electronic device can be flexibly adjusted and are not limited to the content described in FIG1.
[0048] The task message transmission method of the present application will be further described below in conjunction with embodiments. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0049] The various embodiments of the present application are intended to solve the problems existing in task scheduling in a cloud computing environment. By comprehensively considering factors such as task priority, availability, observability, and scheduling performance, tasks are logically divided into queues according to priority, and dynamically adjusted according to the characteristics of the tasks and the load of the queues to achieve the best task scheduling effect. The advantage is that different priorities can be assigned to different tasks according to the importance and urgency of the tasks, ensuring that important tasks are given priority; at the same time, by considering the availability and observability of the tasks, the stability and reliability of the system can be improved; finally, by dynamically adjusting the load of the queues, the efficiency and scheduling performance of the system can be guaranteed.
[0050] FIG2 shows a flow chart of a task message transmission method of the present application, as executed by an electronic device, for example, the server 1 integrated with the task transmission system 121 in FIG1 . As shown in FIG2 , the task message transmission method may include:
[0051] 210. Obtain task execution data of the task execution system. The task execution system is used to process multiple task messages. The task execution data includes indicator data generated when the task execution system executes the tasks carried in the task messages within a preset time period.
[0052] Among them, the task message may include a request message from the cloud service user and / or a control message from the cloud service control platform. The task message carries information about at least one task, which may include any task that may be involved in the cloud computing model, such as the above-mentioned control message indicating inventory calculation, cloud server creation, cloud server fault migration, etc., and the above-mentioned request message indicating password modification, deletion / modification / addition of data, etc.
[0053] The control message sent by the cloud service control platform may also be a specific control instruction generated by the cloud service control platform after receiving a request message from a cloud service user, and encapsulated into a new message, which is then sent to the task transmission system as a control message.
[0054] Among them, the task execution system refers to the system that processes task messages, which is used to process at least one task carried in the task message, so that the cloud service provider can provide the cloud service requested by the cloud service user, and also enable the cloud service provider to operate stably under the control of the cloud service control platform.
[0055] Specifically, the task execution system can include multiple message queues and multiple task worker threads. Each message queue can correspond to at least one task worker thread, and each task worker thread can correspond to at least one message queue. The message queue can temporarily store task messages and distribute these task messages to the task worker threads in an orderly manner. The tasks corresponding to the task messages can be processed by at least one task worker thread.
[0056] The task execution data may include indicator data generated by the task execution system during the process of processing task messages. The task execution data may include indicator data of the message queue, indicator data of the task worker thread, etc. The preset time period may be a period of time within a preset length of time before the current time point, which is a historical time period. The duration may be set based on a compromise between the efficiency and accuracy of task scheduling.
[0057] The indicator data of a message queue may include the indicator data of the message queue itself and the indicator data of the task messages temporarily stored in the message queue, such as the number of task messages in the message queue, the number of message queues, the number of non-empty message queues, the length of time task messages stay in the message queue, the congestion indicator data of the message queue, etc.
[0058] The indicator data of the task worker thread may include the indicator data of the task worker thread itself and the indicator data of the task messages processed by the task worker thread, such as the number of task messages processed by the task worker thread or the number of tasks executed, the number of task worker threads, the number of abnormal task worker threads, the number of task worker threads that process task messages, and so on.
[0059] In an embodiment of the present application, the task execution data may include reported task execution data and processed task execution data.
[0060] In one example, the task execution system directly reports the task execution data to the task transmission system.
[0061] In another example, the cloud service provider also includes a module for processing task execution data. The module obtains the current task execution data from the task execution system, processes all or part of the received task execution data to obtain new task execution data, and then sends the processed new task execution data to the task transmission system.
[0062] In some embodiments of the present application, the system status information of the task execution system can be determined based on some task execution data, and then the task messages to be transmitted during different task states can be processed differently according to the system status of the task execution system represented by the system status information.
[0063] Among them, the system status information may include status information representing whether the task execution system is operating normally. The system status information may include first status information and second status information. The first status information may represent that the task execution system is in a first system state. The first system state may include an abnormal system state. The second status information may represent that the task execution system is in a second system state. The second system state may include a normal system state.
[0064] In some embodiments of the present application, task execution data may include congestion indicator data for each message queue, and the congestion indicator data may include data reflecting the degree of congestion in the message queue. For example, the number of task messages accumulated in the message queue can be used as a congestion indicator data. The specific congestion indicator data can be flexibly selected in actual application scenarios and is not limited here.
[0065] If the congestion index data matches a preset third threshold, it is determined that the task execution system corresponds to the first state information. The match may include being greater than the third threshold, greater than or equal to the third threshold, or the difference between the congestion index data and the preset third threshold being greater than a certain value. For example, multiple message queues may correspond to congestion index data D1. If the congestion index data D1 is greater than the threshold, it can be determined that the task execution system is in an abnormal state.
[0066] In some embodiments of the present application, execution result data of each of the first number of task messages in the task execution system can also be obtained. The execution result data can indicate whether the task corresponding to the task message is successfully executed. Then, based on the execution result data, the task execution success rate of the task execution system can be evaluated.
[0067] The calculation process of the task execution success rate may include: determining the task message indicated by the execution result data as a successful execution as the target task message, and statistically obtaining a second number of the target task messages; based on the first number and the second number, calculating the task execution success rate of the task execution system.
[0068] If the execution result information indicates that the task message is executed successfully, the task message is determined to be the target task message, and the above operation is performed on all execution result information to finally obtain a second number of target task messages, which is less than or equal to the first number; the quotient of the second number and the first number is calculated to obtain the task execution success rate.
[0069] If the task execution success rate matches the preset second threshold, the system status information of the task execution system is determined to be the first status information. The match may include being less than the second threshold, less than and equal to the second threshold, the difference between the task execution success rate and the second threshold being greater than / less than a certain value, etc.
[0070] For example, the execution result information of 100 task messages is obtained, and the task messages whose execution result information indicates successful execution are determined as target task messages. 20 target task messages are obtained, and the task execution success rate is calculated as 20 / 100 = 0.2. 0.2 is less than the threshold value of 0.3, and it is determined that the task execution system is in an abnormal state.
[0071] In some embodiments of the present application, the task execution data may include the number of task worker threads that process task messages or execute tasks in the task execution system within a preset time period, referred to as the number of task threads. Due to factors such as system performance, the total number of configurable task worker threads in the task execution system (i.e., the preset fourth threshold) is limited, so the number of task threads can be compared to see if it matches the fourth threshold. If it matches, the system status information of the task execution system is determined to be the first status information. The match here can be equal, or the difference between the two is less than the preset threshold, etc.
[0072] For example, the number of task threads C of the task execution system is obtained. If the number of task threads C is equal to the maximum number of threads of the task execution system, it is determined that the task execution system has reached the expansion limit and is in an abnormal state.
[0073] In an embodiment of the present application, when the system state information indicates that the task execution system is in the first system state, the task message (such as the third task message) to be transmitted during the first system state can be processed according to the task type information of the task message.
[0074] Specifically, when the task type information of the third task message matches the preset task type, the third task message is discarded;
[0075] When the task type information of the third task message does not match the preset task type, the second priority of the third task message is calculated, and based on the second priority, the third task message is inserted into the second target position of the buffer queue, and the third task message is transmitted to the task execution system through the buffer queue.
[0076] Therefore, in an embodiment of the present application, after determining that the task execution system is in an abnormal state, task messages of lower importance can be discarded first based on the task type information, thereby initially reducing the task processing burden of the abnormal task execution system and improving the stability of task execution messages and even cloud service providers under abnormal circumstances.
[0077] The task type information may include the type information of the task carried in the task message. Specifically, there are multiple ways to divide the task types. In the embodiment of the present application, in order to ensure smooth use of the cloud service by the cloud service user, the task types can be divided according to the subject corresponding to the task (cloud service user / cloud service control platform), according to the importance of the task to the cloud service user, or according to the characteristics of the task itself, etc.
[0078] The preset task types may include types that are less important to the cloud service user, types for which the subject corresponding to the task is not the cloud service user, and so on.
[0079] The matching between the task type information and the preset task type can be understood as equality or similarity. The preset task type and the matching can be flexibly selected and processed in actual application scenarios and are not limited here.
[0080] For example, after determining that the task execution system is in an abnormal state, the task type TA of the task message M3 can be obtained to determine whether the task type TA matches the preset task type T1. If it matches, the task message M3 is directly discarded; if it does not match, the priority P3 of the task message M3 can be calculated, and then based on the priority P3, the position of the task message M3 in the buffer queue can be determined, and finally the task message 3 can be transmitted to the task execution system through the buffer queue.
[0081] Accordingly, in some embodiments of the present application, when the task execution success rate does not match the preset second threshold, the congestion index data does not match the preset third threshold, and the number of task threads (i.e., the number of task working threads executing the task) does not match the preset fourth threshold, the system status information of the task execution system is determined to be the second status information, and the second status information indicates that the task execution system is in the second system state, i.e., the normal system state.
[0082] For example, if the congestion index data of the task execution system is less than the third threshold, the task execution success rate is greater than the second threshold, and the number of task threads is less than the maximum number of threads of the task execution system, it can be determined that the task execution system is in a normal state.
[0083] In some embodiments of the present application, step 220 may be executed when the second state information of the task execution system indicates that the task execution system is in the second system state.
[0084] 220. Determine execution phase information of the task execution system based on the task execution data.
[0085] Among them, the execution stage information may include information characterizing the stage in which the task execution system is located. The task execution system may be in different stages. For example, the execution stage information may include first stage information and second stage information. The first stage information may characterize that the task execution system is in the first execution stage. The first execution stage may be a peak period when the processing pressure of the task execution system is relatively high. The second stage information may characterize that the task execution system is in the second execution stage. The second execution stage may be a non-peak period when the processing pressure of the task execution system is normal or low.
[0086] In one example, the execution phase division criterion can be the busyness of the task execution system in processing task messages. The busyness can be quantified by, for example, the average number of task messages processed by all task worker threads in the task execution system per unit time. The higher the average number, the busier the task execution system.
[0087] In another example, the execution phase can be divided into two stages: the number of pending task messages and the current processing capacity of the task execution system. This difference can be quantified by, for example, the ratio of the number of pending task messages to the number of task messages processed by the task execution system (i.e., the number of tasks executed) over a historical period. When the ratio is greater than 1, the task execution system will have to process more task messages.
[0088] Correspondingly, there may be multiple ways to determine the execution stage information based on the task execution data.
[0089] In some embodiments of the present application, the average number of task executions may be used, where the average number of task executions is the average number of task messages processed by all task worker threads within a unit of time.
[0090] Specifically, the task execution data may include the number of tasks executed by each task worker thread within a preset time period, and the number of task worker threads that executed tasks within the preset time period. The number of task messages processed is the same as the number of tasks executed. The number of tasks executed by a task worker thread that has not processed a task message is 0, and the task worker thread that executes a task is also the working task worker thread. The preset time periods for counting the number of tasks executed and the number of execution threads may remain the same or may be different.
[0091] The number of task executions of all task worker threads can be summed to obtain the total number of task executions, and then the quotient of the total number of task executions and the number of execution threads can be calculated to obtain the average number of task executions of the task execution system.
[0092] Then, the execution stage information can be determined based on the matching result between the preset first threshold and the task execution average.
[0093] When the task execution average matches the first threshold, determining the execution stage information as first stage information;
[0094] When the task execution average does not match the first threshold, the execution stage information is determined to be second stage information.
[0095] The first threshold value may be preset, and the matching may include greater than, greater than and equal to, the difference between the average number of task executions and the first threshold value being greater than a certain value, and the like.
[0096] For example, the number of tasks executed by each of the 200 task worker threads processing task messages in the task execution system can be calculated as follows: number of tasks x1 - number of tasks x200, (number of tasks x1 + ... + number of tasks x200) / 200 = average number of tasks executed. If the average number of tasks executed is greater than 6 (a preset first threshold), the task execution system is determined to correspond to the first stage, meaning that the task execution system is in its peak period.
[0097] In some embodiments of the present application, the number of task executions of all task working threads can be summed to obtain the total number of task executions, and then the total number of task messages to be transmitted in the cloud service provider can be obtained, and the ratio between the total number to be transmitted and the total number of task executions can be calculated. If this ratio is greater than a predetermined value, it is determined that the task execution system corresponds to the first stage information; if this ratio is not greater than the predetermined value, it is determined that the task execution system corresponds to the second stage information.
[0098] For example, the total number of tasks executed by the task execution system in the historical time period can be determined: the total number of task executions, the total number of task messages to be transmitted in the cloud service provider can be obtained: the total number to be transmitted, and P = total number of task executions / total number to be transmitted can be calculated. If P is greater than 0.95, it is determined that the task execution system is in the peak period; otherwise, it is determined that the task execution system is in the off-peak period.
[0099] 230. When the execution stage information indicates that the task execution system is in a first execution stage, calculate a first priority of a first task message to be transmitted in the first execution stage.
[0100] 240. Based on the first priority, insert the first task message into a first target position of the buffer queue, and transmit the first task message to the task execution system through the buffer queue.
[0101] The buffer queue can include a queue for temporarily storing task messages. The buffer queue can be a priority queue. When a new task message needs to enter the buffer queue, it can be temporarily stored in an appropriate position in the buffer queue based on the priority of the task message. This allows more important and urgent task messages to be transmitted to the task execution system more quickly through the buffer queue during the first execution phase.
[0102] In an embodiment of the present application, after determining that the execution phase message of the task execution system indicates that it is in the first execution phase, the task message to be transmitted during this period (such as the first task message) can be processed. Specifically, the first priority of the first task message can be calculated, and then the first task message can be inserted into the first target position of the buffer queue based on the first priority.
[0103] Specifically, there are many ways to determine the first priority of the first task message. For example, a correspondence table between task type information and priority can be pre-built. First, the task type information of the first task message is determined, and then the priority corresponding to the task type information is found in the correspondence table, and the priority is determined as the first priority of the first task message.
[0104] In some embodiments of the present application, the transmission waiting time of the first task message to be transmitted in the first execution phase can be obtained, and the waiting time threshold corresponding to the first task message can be determined. Then, based on the transmission waiting time and the waiting time threshold, the first priority of the first task message can be calculated.
[0105] Among them, the transmission waiting time may include the waiting time in the task transmission system or cloud service provider. Specifically, the difference between the time point when the task transmission system or cloud service provider receives the task message and the current time point can be calculated, and the difference can be determined as the transmission waiting time.
[0106] The waiting time threshold may include a preset value, and the data may be flexibly set based on the sensitivity of the task or its type of task to the waiting time, its importance within the cloud service provider, and the like.
[0107] There are many ways to determine the waiting time threshold, such as searching the waiting time threshold corresponding to the task carried in the task message from the preset first data table, or querying the waiting time threshold corresponding to the task type information of the task message from the preset second data table, and so on.
[0108] Priority represents the priority of a task message among all other pending task messages. For example, creating a cloud server is the highest-priority task. Cloud service providers must commit to a Service Level Agreement (SLA), requiring optimized execution to prevent business losses. Alternatively, hot migration of a cloud service is a low-priority task and can be delayed during periods of task congestion.
[0109] There are many ways to determine the priority based on the waiting time threshold and the transmission waiting time. For example, the priority is determined based on the difference between the transmission waiting time and the waiting time threshold. If the difference is positive, the priority is higher, and the larger the value, the higher the priority; if the difference is zero, the priority is second highest; if the difference is negative, the priority is lower, and the larger the absolute value of the difference, the lower the priority.
[0110] In some embodiments of the present application, the process of calculating the first priority based on the transmission waiting time and the waiting time threshold may include:
[0111] When the transmission waiting time is less than or equal to the waiting time threshold, determining a first preset score corresponding to the first task message, and calculating the first priority based on the transmission waiting time and the first preset score;
[0112] When the transmission waiting time is greater than the waiting time threshold, determine the first preset score and the second preset score corresponding to the difference between the transmission waiting time and the waiting time threshold, and calculate the first priority based on the first preset score, the waiting time threshold, the second preset score, and the difference.
[0113] For details, please refer to the following formula: T_score=W_t*W_s+D_t*D_s
[0114] Among them, T_score is the priority, W_s is the first preset score, which represents the weight within the waiting time threshold; D_s is the second preset score, which represents the weight outside the waiting time threshold, that is, the weight corresponding to the above difference.
[0115] When the transmission waiting time is less than the waiting time threshold, W_t is the transmission waiting time and D_t is zero;
[0116] When the transmission waiting time is greater than the waiting time threshold, W_t is the waiting time threshold, and D_t is the difference between the transmission waiting time and the waiting time threshold.
[0117] Through W_s and D_s, we can distinguish the urgency of waiting and speed up the priority scheduling of tasks that have been waiting for too long.
[0118] For example, the transmission waiting time of task message M1 is 30s. According to the task carried by task message M1, the corresponding waiting time threshold is 40s. It is determined that the transmission waiting time of 30s is less than the waiting time threshold 40s. The first preset score corresponding to task message M1 is 2, and the priority of task message M1 is P1=30*2=60.
[0119] For another example, the transmission waiting time of task message M2 is 100s. According to the task carried by task message M2, the corresponding waiting time threshold is 70s. It is determined that the transmission waiting time of 100s is greater than the waiting time threshold 70s. The first preset score corresponding to task message M2 is 4 and the second preset score is 10. The priority of task message M2 is P2 = 70*4+(100-70)*10 = 580.
[0120] The above scheduling mechanism can be used to schedule tasks according to their priority while taking into account the task's tolerance scheduling time (i.e., W_t). Based on the task priority, it ensures the priority execution of important tasks during peak hours. By configuring scheduling parameters, it improves business scheduling efficiency and ensures stable business operation during peak hours.
[0121] In this embodiment, the first preset score and the second preset score are both pre-set values, which can be flexibly set based on the sensitivity of the task or its type of task to the waiting time, its importance within the cloud service provider, etc.
[0122] There are many ways to search for the first preset score and the second preset score. For example, the first preset score corresponding to the task carried in the task message can be searched from a preset third data table.
[0123] In some embodiments of the present application, the process of determining the first preset score corresponding to the first preset score of the first task message further specifically includes: obtaining a first preset type score table, the first preset type score table including multiple preset task type information and the preset score corresponding to each task type information; and searching the first preset score corresponding to the task type information of the first task message from the first preset type score table.
[0124] For example, obtain a preset score table, which includes multiple preset task types and preset scores corresponding to each preset task type, determine the task type T1 of the task message M1, and search the preset score S1 corresponding to the task type T1 from the preset score table, and determine that the preset score S1 is the first preset score corresponding to the task message M1.
[0125] In the embodiment of the present application, the process of determining the second preset score is similar to the process of determining the first preset score, so it will not be repeated here.
[0126] Specifically, the process of inserting the first task message into the first target position of the buffer queue based on the first priority may include: sorting the first priority and the existing priority of at least one task message in the buffer queue to obtain the sorting result of the first priority; determining the first target position of the first task message in the buffer queue according to the sorting result, and inserting the first task message into the first target position.
[0127] The buffer queue may include multiple existing task messages, each of which corresponds to an existing priority. The buffer queue stores the existing task messages with the priorities from high to low in sequence from the head to the tail.
[0128] In an embodiment of the present application, the first priority can be sorted with all existing priorities to determine the sorting result of the first priority among all priorities, and then the first task message can be inserted into the first target position corresponding to the sorting result. The existing priority of the existing task message near the head of the team next to the first target position is higher than the first priority, and the existing priority of the existing task message near the tail of the team next to the first target position is lower than the first priority.
[0129] In this way, the first task message can be adjusted to an appropriate position, thereby improving the flexibility of the task message transmission process, so that during the first execution phase or the first system state, high-priority task messages can be transmitted to the task execution system faster, thereby improving system stability and the transmission and processing efficiency of task messages.
[0130] For example, the buffer queue includes task messages M3-M6, and the priorities P3-P6 are 20, 40, 100, and 650 respectively. The priority P1 of task message M1 is determined to be 60. These five priorities can be sorted, and the sorting result of priority P1 can be determined to be the third. Task message M1 can be inserted between task message M4 and task message M5.
[0131] For another example, the buffer queue includes task messages M3-M6, and the priorities P3-P6 are 20, 40, 100, and 650 respectively. The priority P2 of task message M2 is determined to be 580. These five priorities can be sorted, and the sorting result of priority P2 can be determined to be the second. Task message M2 can be inserted between task message M5 and task message M6.
[0132] The process of calculating the first priority of the first task message and inserting the first task message into the first target position of the buffer queue based on the first priority in step 230 is similar to the process of calculating the second priority of the third task message and inserting the third task message into the second target position of the buffer queue based on the second priority in the previous text. For details, please refer to the description here.
[0133] In some embodiments of the present application, it is also possible to determine whether the threads in the task execution system are fully loaded, and based on the determination result, flexibly adjust the task message transmission process or the task execution system to improve system stability.
[0134] Specifically, the total number of all task working threads in the task execution system can be obtained, which is referred to as the total number of task threads for short; if the number of task working threads that execute tasks within a preset time period (i.e., the number of execution threads) matches the total number of task threads, it is determined that the task execution system is in a thread-fully loaded state; when the task execution system is in a thread-fully loaded state and the number of execution threads does not match the preset fourth threshold, the task execution system is triggered to add a new task working thread.
[0135] When the task execution system is in a thread-full state, the number of execution threads matches a preset fourth threshold, and the number of task messages to be transmitted in the thread-full state does not match the number of execution threads, inserting task messages into the buffer queue is stopped.
[0136] Among them, the number of execution threads is not greater than the total number of task threads.
[0137] If the number of execution threads matches the total number of task threads, the match can be such as the two are equal, or the difference is less than a certain value, then it is determined that the task execution system is in a thread-loaded state. At this time, you can first consider expanding the task execution system, such as adding new task worker threads, to meet the higher task message processing needs.
[0138] However, there is an upper limit (i.e., the fourth threshold) on the number of task worker threads that can be configured in the task execution system. Therefore, it is also possible to determine whether the number of execution threads is equal to the fourth threshold. If they are equal, it is considered that the task execution system has reached the expansion limit and new task worker threads cannot be added.
[0139] At this time, it is possible to further determine whether the number of task messages to be transmitted matches the number of execution threads. The match can be less than, equal to, etc. If it does not match, it can be determined that the execution pressure of the task execution system is large. In order to maintain system stability, the insertion of task messages into the buffer queue can be stopped.
[0140] For example, the total number of task threads TSumm and the number of execution threads ESum are obtained. If the number of execution threads ESum is equal to the total number of task threads TSumm, it is determined that the task execution system E1 is in a thread-full-load state.
[0141] Then determine the numerical relationship between the number of execution threads ESum and the preset fourth threshold. If the former is less than the latter, it can trigger the addition of a new task worker thread in the task execution system E1; if the former is equal to the latter, it can be compared whether the total number of task messages to be transmitted is greater than the number of execution threads ESum. If it is greater, temporarily stop inserting the task messages to be transmitted into the buffer queue.
[0142] In an embodiment of the present application, the task execution data of the task execution system can be obtained. The task execution data may include relevant indicator data in the process of the task execution system processing the task message. Then, the execution stage information of the task execution system can be determined through the task execution data. The different execution stages to which the task execution system belongs (represented by the execution stage information) can be determined by the situation of the task execution system processing the task message (represented by the task execution data). If the task execution system is in the first execution stage, the first execution stage is, for example, a stage in which the amount of task message processing per unit time is large. The embodiment of the present application can perform priority scheduling on the task messages to be transmitted in the first execution stage. Specifically, the priority of the task message can be calculated and inserted into the target position of the buffer queue according to the priority, so that the high-priority task messages in the buffer queue can be transmitted to the task execution system faster, effectively improving the transmission flexibility of the task message.
[0143] The task message transmission method of the present application will be further described below in conjunction with embodiments. The task message transmission method can be integrated into a task transmission system, which can be integrated into an electronic device, such as a server. Specifically, a flowchart of the task message transmission method can be shown in FIG3 , including:
[0144] 310. The electronic device obtains task execution data from the task execution system.
[0145] In the embodiment of the present application, referring to the schematic diagram of the cloud service provider structure shown in FIG4 , the cloud service provider 400 may include a message generation interface 410, a task execution system 420, and a task execution system 430. Specifically, the task execution system 420 includes a task message flow control interface 421, a buffer scheduler 422, an indicator data collector 423, an indicator data feedback controller 424, and the like.
[0146] Among them, the message generation interface 410 can receive API requests, including the above-mentioned request messages from the cloud service user and / or control messages from the cloud service control platform, and generate task messages based on the API requests, and send the task messages to the buffer scheduler 422 for buffering and storing them in the buffer queue.
[0147] The task message flow control interface 421 can determine whether the task execution system 420 is in an abnormal state, whether it is in a peak period, whether the thread is fully loaded, etc. based on the task execution data, thereby determining the system status information of the task execution system 420 and sending the corresponding system status information to the buffer scheduler 422.
[0148] The buffer scheduler 422 can prioritize the task messages to be transmitted in the task transmission system 420 when the task execution system 420 is in peak period or abnormal state, and transmit these task messages to the task execution system 430 in order of priority through the buffer queue.
[0149] The indicator data collector 423 can receive task execution data reported by the task execution system 430 and transmit it to the indicator data feedback controller 424. The indicator data feedback controller 424 can process all or part of the task execution data to obtain processed task execution data. The indicator data feedback controller 424 can transmit the initially received or processed task execution data to the task message flow control interface 421 to determine the execution stage and system status of the task execution system 430.
[0150] The frequency and time interval for the task execution system 430 to report task execution data can be flexibly set, such as minute level.
[0151] Task execution data can include multiple types, such as task execution data related to task message throughput, such as the total number of currently executed tasks, the average execution time of a single task, the average task execution time of various task types, etc.; task execution data related to message queues in the task execution system, such as the number of tasks temporarily stored in the message queue, queue congestion indicators, etc.; task execution data related to task working threads in the task execution system, such as the total number of task threads, the task processing capacity of a single task thread (such as the number of tasks processed per unit time), the number of abnormal task threads, the overall task processing capacity of all task threads, etc.
[0152] Part of the task execution data refers to data that has a higher weight for determining the system status information of the task execution system 420 .
[0153] 320. The electronic device obtains congestion index data of each message queue in the task execution system within a preset time period and execution result data of each of the first number of executed task messages.
[0154] 330. Determine system status information of the task execution system based on the congestion indicator data and the execution result data.
[0155] 340. When the system state information indicates that the task execution system is in the first system state (ie, the system abnormal state), the electronic device processes the third task message to be transmitted during the first system state according to the task type information of the third task message.
[0156] 350. When the system state information indicates that the task execution system is in the second system state (ie, the normal system state), the electronic device determines the execution phase information of the task execution system based on the task execution data.
[0157] For example, in combination with the flowchart of Figure 5, in 510, the task transmission system can first determine the system status of the task execution system, specifically whether the task execution success rate is too low (the task execution success rate is less than the preset second threshold), whether the congestion index data is too high (the congestion index data is greater than the preset third threshold), or whether the system expansion capacity of the task execution system has reached the upper limit (the number of execution threads is equal to the preset fourth threshold), etc., to determine whether the task is in an abnormal state.
[0158] If the task execution system is in an abnormal state, in 520, the less important part of the task message to be transmitted (the task type information of the task message matches the preset task type) can be discarded, and the priority of the remaining task messages to be transmitted can be determined. In 530, the remaining task messages to be transmitted can be inserted into the buffer queue according to the priority.
[0159] If the task execution system is in a normal state, in 540 , the task execution average of the task execution system may be calculated, and it may be determined whether the task execution average is greater than a preset first threshold, thereby determining whether the task execution system is in a peak period.
[0160] 360. When the execution stage information indicates that the task execution system is in the first execution stage (i.e., peak period), the electronic device determines the first priority of the task message to be transmitted in the first execution stage, inserts the task message into the first target position of the buffer queue based on the first priority, and transmits the task message to the task execution system through the buffer queue.
[0161] 370. When the execution stage information indicates that the task execution system is in the second execution stage (i.e., non-peak period), the electronic device directly transmits the task message to be transmitted in the second execution stage to the task execution system.
[0162] In one example, combined with the flowchart of Figure 5, if the task execution system is in peak period, the priority of the task message to be transmitted can be directly determined, and then inserted into the buffer queue according to the priority, that is, 530 in Figure 5 is executed; if the task execution system is in non-peak period, the task message can be directly transmitted to the task execution system 580.
[0163] 380. When the number of execution threads included in the task execution data matches the total number of task threads, the electronic device determines that the task execution system is in a thread-full state.
[0164] 391. When the task execution system is in the first execution stage and the thread is fully loaded, and the number of execution threads does not match the preset fourth threshold, the electronic device triggers the task execution system to add a new task working thread.
[0165] 392. When the task execution system is in the first execution stage and the thread is fully loaded, the number of execution threads matches the preset fourth threshold, and the number of task messages to be transmitted in the thread is fully loaded does not match the number of execution threads, the electronic device stops inserting task messages into the buffer queue.
[0166] Combined with the flowchart of Figure 5, after determining the task peak period, in 550, it can be determined whether the total number of task threads is equal to the number of execution threads, thereby determining whether the task execution system is fully loaded with threads; when fully loaded, in 560, it is determined whether the number of execution threads is equal to the maximum number of threads configurable for the task execution system (i.e., the fourth threshold), that is, whether the expansion upper limit is reached. If the former is less than the latter, then in 570, the task execution system can be triggered to add a new task worker thread; if the former is equal to the latter, then in 590, it can be determined whether the number of execution threads is less than the total number of task messages to be transmitted. If so, priority scheduling can be stopped, that is, task messages can be stopped from being inserted into the buffer queue, thereby reducing the system burden and ensuring system stability.
[0167] The method described in the embodiments of the present application can be efficiently scheduled according to the priority and resource demand of the task, improve the response speed and processing efficiency of the task, and automatically adjust the scheduling strategy and priority of the task to improve the utilization and throughput of the system. It is also equipped with a system detection and feedback function, which can monitor the resource utilization of the system and the processing of the task in real time, and adjust and optimize according to the feedback information. It improves the efficiency and accuracy of task scheduling, optimizes system performance, and enhances business stability. The above method has the advantages of high efficiency, intelligence, and stability, and can provide efficient task scheduling services for public cloud platforms, further improving the performance and stability of the system.
[0168] To better implement the above method, the embodiment of the present application further provides a task message transmission device. As shown in FIG6 , the task message transmission device 600 may include an execution data acquisition module 610, an execution stage determination module 620, a first stage module 630, and a transmission module 640, wherein:
[0169] An execution data acquisition module 610 is configured to acquire task execution data from a task execution system, the task execution system being configured to process multiple task messages, the task execution data including indicator data generated when the task execution system executes the tasks carried in the task messages within a preset time period;
[0170] An execution stage determination module 620, configured to determine execution stage information of the task execution system based on the task execution data;
[0171] A first phase module 630 is configured to calculate a first priority of a first task message to be transmitted in a first execution phase when the execution phase information indicates that the task execution system is in a first execution phase;
[0172] The transmission module 640 is configured to insert the first task message into a first target position of a buffer queue based on the first priority, and transmit the first task message to the task execution system through the buffer queue.
[0173] In some embodiments of the present application, the task message transmission device further includes a second phase module, wherein:
[0174] The second stage module is configured to directly transmit a task message to be transmitted in the second execution stage to the task execution system when the execution stage information indicates that the task execution system is in the second execution stage.
[0175] In some embodiments of the present application, the task execution system includes a plurality of message queues for storing task messages, and the apparatus further includes:
[0176] An execution result acquisition module is configured to acquire congestion index data of each message queue in the task execution system within the preset time period; and acquire execution result data of each of a first number of task messages executed by the task execution system within the preset time period;
[0177] a system status determination module, configured to determine system status information of the task execution system based on the congestion index data and the execution result data;
[0178] The first state module is configured to process the third task message to be transmitted according to task type information of the third task message when the system state information indicates that the task execution system is in a first system state.
[0179] In some embodiments of the present application, the first state module includes a discard submodule and a transmission submodule, wherein:
[0180] a discarding submodule, configured to discard the third task message when the task type information matches a preset task type;
[0181] A transmission submodule is used to calculate the second priority of the third task message when the task type information does not match the task type, insert the third task message into the second target position of the buffer queue based on the second priority, and transmit the third task message to the task execution system through the buffer queue.
[0182] In some embodiments of the present application, the task execution system further includes a plurality of task worker threads, the task worker threads being used to execute the tasks carried in the task message, and the task execution data including the number of tasks executed by each task worker thread within the preset time period, and the number of task worker threads executing tasks within the preset time period;
[0183] The execution phase determination module includes a summation submodule, a fusion submodule and a determination submodule, wherein:
[0184] a summing submodule, configured to sum the number of tasks executed by the plurality of task worker threads to obtain a total number of tasks executed when the system state information indicates that the task execution system is in a second system state;
[0185] a fusion submodule, configured to obtain an average number of task executions of the task execution system according to the total number of task executions and the number of task worker threads executing the tasks;
[0186] The determination submodule is used to determine the execution stage information of the task execution system according to the average number of task executions.
[0187] In some embodiments of the present application, the execution phase information includes first phase information and second phase information, and the determination submodule includes a first determination unit and a second determination unit, wherein:
[0188] a first determining unit, configured to determine, when the task execution average matches a preset first threshold, that the execution stage information is the first stage information, wherein the first stage information indicates that the task execution system is in the first execution stage;
[0189] The second determining unit is configured to determine, when the task execution average does not match the first threshold, that the execution stage information is the second stage information, wherein the second stage information indicates that the task execution system is in the second execution stage.
[0190] In some embodiments of the present application, the system status determination module includes a target determination submodule, a success rate submodule and a system status submodule, wherein:
[0191] a target determination submodule, configured to determine the task message whose execution result data indicates successful execution as a target task message, and to obtain a second number of the target task messages by counting;
[0192] a success rate submodule, configured to calculate a task execution success rate of the task execution system based on the first number and the second number;
[0193] The system status submodule is used to determine the system status information of the task execution system according to the congestion index data, the task execution success rate and the number of task worker threads that execute tasks within the preset time period.
[0194] In some embodiments of the present application, the system status submodule includes a first status unit and a second status unit, wherein:
[0195] a first state unit, configured to determine that the system state information is first state information when the task execution success rate matches a preset second threshold, the congestion index data matches a preset third threshold, or the number of task worker threads executing the task matches a preset fourth threshold, wherein the first state information indicates that the task execution system is in a first system state;
[0196] The second status unit is used to determine that the system status information is the second status information when the task execution success rate does not match the second threshold, the congestion index data does not match the third threshold, and the number of task working threads executing the task does not match the fourth threshold, and the second status information represents that the task execution system is in the second system state.
[0197] In some embodiments of the present application, the task message transmission device further includes a thread full load module and a thread new addition module, wherein:
[0198] a thread full load module, configured to determine that the task execution system is in a thread full load state when the number of task worker threads executing the task matches the total number of all task worker threads in the task execution system;
[0199] The thread adding module is used to trigger the task execution system to add a task worker thread when the task execution system is in a thread full load state and the number of task worker threads executing the task does not match the fourth threshold.
[0200] In some embodiments of the present application, the task message transmission device further includes a stop module, wherein:
[0201] A stop module is used to stop inserting task messages into the buffer queue when the task execution system is in a thread-full load state, the number of task worker threads executing the task matches the fourth threshold, and the number of task messages to be transmitted in the thread-full load state does not match the number of task worker threads executing the task.
[0202] In some embodiments of the present application, the first phase module includes a duration submodule and a priority submodule, wherein:
[0203] a duration submodule, configured to obtain a transmission waiting time of the first task message and determine a waiting time threshold corresponding to the first task message;
[0204] The priority submodule is configured to calculate the first priority based on the transmission waiting time and the waiting time threshold.
[0205] In some embodiments of the present application, the priority submodule includes a first calculation unit and a second calculation unit, wherein:
[0206] a first calculating unit, configured to determine a first preset score corresponding to the first task message when the transmission waiting time is less than or equal to the waiting time threshold, and calculate the first priority based on the transmission waiting time and the first preset score;
[0207] A second calculation unit is used to determine the first preset score and a second preset score corresponding to the difference between the transmission waiting time and the waiting time threshold when the transmission waiting time is greater than the waiting time threshold, and calculate the first priority based on the first preset score, the waiting time threshold, the second preset score, and the difference.
[0208] In some embodiments of the present application, the first stage module includes a sorting submodule and an insertion submodule, wherein:
[0209] a sorting submodule, configured to sort the first priority and the priority of at least one task message in the buffer queue to obtain a sorting result of the first priority;
[0210] An inserting submodule is configured to determine the first target position of the first task message in the buffer queue according to the sorting result, and insert the first task message into the first target position.
[0211] In some embodiments of the present application, the first computing unit may be specifically configured to:
[0212] Obtaining a first preset type score table, where the first preset type score table includes a plurality of preset task type information and a preset score corresponding to each task type information;
[0213] The first preset score corresponding to the task type information of the first task message is searched from the first preset type score table.
[0214] The present application also provides an electronic device, as shown in FIG7 , which shows a schematic diagram of the structure of the electronic device involved in the present application embodiment. The electronic device may be a terminal or a server, etc. Specifically:
[0215] The electronic device may include components such as a processor 701 with one or more processing cores, a memory 702 with one or more computer-readable storage media, a power supply 703, and an input unit 704. Those skilled in the art will appreciate that the electronic device structure shown in FIG7 does not limit the electronic device and may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0216] Processor 701 is the control center of the electronic device. It connects all parts of the electronic device using various interfaces and circuits. It performs various functions of the electronic device and processes data by running or executing computer programs and / or modules stored in memory 702 and accessing data stored in memory 702. Optionally, processor 701 may include one or more processing cores. Preferably, processor 701 may integrate an application processor and a modem processor. The application processor primarily processes the operating system, user interface, and computer programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 701.
[0217] The memory 702 can be used to store computer programs and modules. The processor 701 executes various functional applications and data processing by running the computer programs and modules stored in the memory 702. The memory 702 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory 702 may also include a memory controller to provide the processor 701 with access to the memory 702.
[0218] The electronic device also includes a power supply 703 for supplying power to various components. Preferably, the power supply 703 can be logically connected to the processor 701 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The power supply 703 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0219] The electronic device may further include an input unit 704, which may be configured to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0220] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 701 in the electronic device will load the executable files corresponding to one or more computer program processes into the memory 702 according to the following instructions, and the processor 701 will run the application stored in the memory 702 to implement various functions as follows:
[0221] Acquire task execution data of a task execution system, where the task execution system is used to process multiple task messages, and the task execution data includes at least one indicator data of the task execution system in the process of processing the task messages; determine the execution stage information of the task execution system based on the task execution data; if the execution stage information indicates that the task execution system is in a first execution stage, calculate the first priority of a first task message to be transmitted in the first execution stage, and insert the first task message into a first target position of a buffer queue based on the first priority, so as to transmit the first task message to the task execution system through the buffer queue.
[0222] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0223] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0224] To this end, an embodiment of the present application provides a computer-readable storage medium storing a computer program that can be loaded by a processor to execute the steps of any of the task message transmission methods provided in the embodiments of the present application. For example, the computer program can execute the following steps:
[0225] Acquire task execution data of a task execution system, where the task execution system is used to process multiple task messages, and the task execution data includes at least one indicator data of the task execution system in the process of processing the task messages; determine the execution stage information of the task execution system based on the task execution data; if the execution stage information indicates that the task execution system is in a first execution stage, calculate the first priority of a first task message to be transmitted in the first execution stage, and insert the first task message into a first target position of a buffer queue based on the first priority, so as to transmit the first task message to the task execution system through the buffer queue.
[0226] The computer-readable storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0227] Since the computer program stored in the computer-readable storage medium can execute the steps in any task message transmission method provided in the embodiments of the present application, the beneficial effects that can be achieved by any task message transmission method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0228] The present application also provides a computer program product, comprising a computer program stored in a computer-readable storage medium. A processor of an electronic device reads the computer program from the computer-readable storage medium and executes the computer program, causing the electronic device to perform the methods provided in various optional implementations of the task message transmission method.
[0229] The above is a detailed introduction to a task message transmission method, device, electronic device and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A task message transmission method, executed by an electronic device, the method comprising: Obtaining task execution data of a task execution system, the task execution system being used to process multiple task messages, the task execution data including metric data generated by the task execution system when executing tasks carried in the task messages within a preset time period; Determining execution stage information of the task execution system based on the task execution data; When the execution stage information indicates that the task execution system is in a first execution stage, calculating a first priority of a first task message to be transmitted in the first execution stage; And, Based on the first priority, inserting the first task message into a first target position of a buffer queue, and transmitting the first task message to the task execution system through the buffer queue.
2. The method according to claim 1, further comprising: When the execution stage information indicates that the task execution system is in a second execution stage, directly transmitting a task message to be transmitted in the second execution stage to the task execution system.
3. The method according to claim 1 or 2, wherein, The task execution system includes multiple message queues for storing task messages, and the method further comprises: Obtaining congestion metric data of each message queue in the task execution system within the preset time period; Obtaining execution result data of each of the first number of task messages executed by the task execution system within the preset time period; Determining system state information of the task execution system based on the congestion metric data and the execution result data; When the system state information indicates that the task execution system is in a first system state, processing the third task message according to the task type information of the third task message to be transmitted.
4. The method according to claim 3, wherein, The when the system state information indicates that the task execution system is in a first system state, processing the third task message according to the task type information of the third task message to be transmitted, includes: When the task type information matches a preset task type, discarding the third task message; When the task type information does not match the task type, calculating a second priority of the third task message, and based on the second priority, inserting the third task message into a second target position of the buffer queue, and transmitting the third task message to the task execution system through the buffer queue.
5. The method according to claim 3 or 4, wherein, The task execution system further includes multiple task worker threads for executing tasks carried in the task messages, and the task execution data includes the number of tasks executed by each task worker thread within the preset time period, and the number of task worker threads executing tasks within the preset time period; The determining execution stage information of the task execution system based on the task execution data includes: When the system state information indicates that the task execution system is in a second system state, summing up the number of tasks executed by the multiple task worker threads to obtain a total task execution number; Obtaining an average task execution number of the task execution system according to the total task execution number and the number of task worker threads executing tasks. Determine the execution phase information according to the average task execution.
6. The method according to claim 5, wherein The execution phase information includes first-phase information and second-phase information. Determining the execution phase information according to the average task execution includes: When the average task execution matches a preset first threshold, determine that the execution phase information is the first-phase information, where the first-phase information indicates that the task execution system is in the first execution phase; When the average task execution does not match the first threshold, determine that the execution phase information is the second-phase information, where the second-phase information indicates that the task execution system is in the second execution phase.
7. The method according to any one of claims 3 to 6, wherein Determining the system state information of the task execution system based on the congestion metric data and the execution result data includes: Determine the task messages indicating successful execution in the execution result data as target task messages, and count the second number of the target task messages; Calculate the task execution success rate of the task execution system based on the first number and the second number; Determine the system state information of the task execution system according to the congestion metric data, the task execution success rate, and the number of task worker threads that execute tasks within the preset time period.
8. The method according to claim 7, wherein Determining the system state information of the task execution system according to the congestion metric data, the task execution success rate, and the number of task worker threads that execute tasks within the preset time period includes: When the task execution success rate matches a preset second threshold, the congestion metric data matches a preset third threshold, or the number of task worker threads that execute tasks matches a preset fourth threshold, determine that the system state information is the first state information, where the first state information indicates that the task execution system is in the first system state; When the task execution success rate does not match the second threshold, the congestion metric data does not match the third threshold, and the number of task worker threads that execute tasks does not match the fourth threshold, determine that the system state information is the second state information, where the second state information indicates that the task execution system is in the second system state.
9. The method according to claim 8, further comprising: When the number of task worker threads that execute tasks matches the total number of all task worker threads in the task execution system, determine that the task execution system is in a thread full-load state; When the task execution system is in a thread full-load state and the number of task worker threads that execute tasks does not match the fourth threshold, trigger the task execution system to add task worker threads.
10. The method according to claim 9, further comprising: When the task execution system is in a thread full-load state, the number of task worker threads that execute tasks matches the fourth threshold, and the number of task messages to be transmitted in the thread full-load state does not match the number of task worker threads that execute tasks, stop inserting task messages into the buffer queue.
11. The method according to any one of claims 1 to 10, wherein When the execution phase information indicates that the task execution system is in the first execution phase, calculating a first priority of a first task message to be transmitted in the first execution phase includes: Obtaining a transmission waiting duration of the first task message and determining a waiting duration threshold corresponding to the first task message; Calculating the first priority based on the transmission waiting duration and the waiting duration threshold.
12. The method according to claim 11, wherein, The calculating the first priority based on the transmission waiting duration and the waiting duration threshold includes: When the transmission waiting duration is less than or equal to the waiting duration threshold, determining a first preset score corresponding to the first task message and calculating the first priority based on the transmission waiting duration and the first preset score; When the transmission waiting duration is greater than the waiting duration threshold, determining the first preset score and a second preset score corresponding to a difference between the transmission waiting duration and the waiting duration threshold, and calculating the first priority based on the first preset score, the waiting duration threshold, the second preset score, and the difference.
13. The method according to any one of claims 1 to 12, wherein, The inserting the first task message into a first target position in a buffer queue based on the first priority includes: Sorting the first priority and priorities of at least one task message in the buffer queue to obtain a sorting result of the first priority; Determining the first target position of the first task message in the buffer queue according to the sorting result and inserting the first task message into the first target position.
14. The method according to claim 13, wherein, The determining the first preset score corresponding to the first task message when the transmission waiting duration is less than or equal to the waiting duration threshold includes: Obtaining a first preset type score table, where the first preset type score table includes multiple preset task type information and preset scores corresponding to each task type information; Searching for the first preset score corresponding to the task type information of the first task message from the first preset type score table.
15. A task message transmission device includes: An execution data acquisition module, configured to acquire task execution data of a task execution system, where the task execution system is used to process multiple task messages, and the task execution data includes metric data generated when the task execution system executes tasks carried in the task messages within a preset time period; An execution phase determination module, configured to determine execution phase information of the task execution system based on the task execution data; A first phase module, configured to calculate a first priority of a first task message to be transmitted in the first execution phase when the execution phase information indicates that the task execution system is in the first execution phase; And, A transmission module, configured to insert the first task message into a first target position in a buffer queue based on the first priority and transmit the first task message to the task execution system through the buffer queue.
16. The device according to claim 15, further includes: A second-stage module, configured to directly transmit, to the task execution system, task messages to be transmitted during the second execution stage when the execution stage information indicates that the task execution system is in the second execution stage.
17. The device according to claim 15 or 16, wherein The task execution system includes a plurality of message queues for storing task messages, and the apparatus further includes: An execution result acquisition module, configured to acquire congestion metric data of each message queue in the task execution system within the preset time period; and acquire execution result data of the first number of task messages executed by the task execution system within the preset time period; A system state determination module, configured to determine system state information of the task execution system based on the congestion metric data and the execution result data; A first state module, configured to process the third task message according to the task type information of the third task message to be transmitted when the system state information indicates that the task execution system is in the first system state.
18. An electronic device, including a memory and a processor; the memory stores an application program, and the processor is configured to run the application program in the memory to execute the steps in the task message transmission method according to any one of claims 1 to 14.
19. A computer-readable storage medium, storing a computer program, where the computer program is suitable for being loaded by a processor to execute the steps in the task message transmission method according to any one of claims 1 to 14.
20. A computer program product, including a computer program, where the computer program is stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device executes the steps in the method according to any one of claims 1 to 14.
Citation Information
Patent Citations
Method and equipment for task scheduling
CN112346829A
Processing task dynamic allocation method and device, electronic equipment and readable storage medium
CN116069518A
Task message transmission method and device, computer equipment and computer readable storage medium
CN117651075A
Batch data processing method and apparatus, computer device and storage medium
WO2020228177A1
Task scheduling method and apparatus, device, storage medium, computer program and computer program product
WO2023071172A1
Cited By
Data acquisition method, chip, circuit, electronic device, storage medium and computer program product
CN122507589A