Task diagnosis method and device for message queue, equipment and storage medium

By detecting the resource usage of the container collection and calculating the expected number of copies, the number of containers is adjusted to adapt to the message queue task requirements, which solves the problem of low resource usage efficiency in the existing technology and achieves flexible optimization of resource usage and efficient processing of diagnostic tasks. .

CN118567893APending Publication Date: 2024-08-30CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410704370.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-03
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

The existing technology cannot effectively adapt to changes in the number of message queue tasks, resulting in low resource usage efficiency, and the diagnosis process is too mechanical and cannot flexibly adjust resource usage.

Method used

By detecting the current resource usage ratio of the container collection, calculate the expected number of copies, and adjust the number of containers based on this number to adapt to resource usage needs, optimize resource usage, and ensure parallel processing of diagnostic tasks and resource usage efficiency.

Benefits of technology

It has improved resource usage efficiency and can adjust the number of containers in real time when resource usage conditions are not met, adapting to the parallel processing requirements of diagnostic tasks and avoiding resource waste and overload.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567893A
    Figure CN118567893A
Patent Text Reader

Abstract

The invention relates to the technical field of diagnosis, and discloses a task diagnosis method and device for a message queue, equipment and a storage medium, and the method comprises the steps: detecting whether a current resource usage amount ratio of a container set meets a current resource usage condition or not; if not, the expected copy number is calculated according to the current copy number, the current resource usage amount ratio and the expected resource usage amount ratio corresponding to the container set; the number of containers in the container set is adjusted according to the expected copy number, and the to-be-diagnosed task in the message queue is diagnosed according to the adjusted container set; wherein each container in the container set corresponds to one to-be-diagnosed task. According to the method, the container for diagnosing the to-be-diagnosed task in the message queue can be adaptively increased or decreased, so that the corresponding resource usage amount is adaptively increased or decreased, parallel processing of multiple diagnosis tasks can be ensured, the resource usage amount for diagnosis can be optimized and adjusted in real time, and the resource usage efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of diagnostic technology, and in particular to a task diagnostic method, device, equipment and storage medium for a message queue. Background Art

[0002] In the process of diagnosing various tasks in the message queue, as the number of tasks increases or decreases, the resource usage required for the diagnosis process will change accordingly, which will affect the concurrent processing capability for various diagnosis tasks.

[0003] Currently, the task diagnosis process for message queues is relatively mechanical and cannot adapt to changes in the number of diagnostic tasks in message queues, resulting in low resource utilization efficiency. Summary of the invention

[0004] In view of the above problems, the present application provides a task diagnosis method, apparatus, device and storage medium for a message queue, which are used to adaptively adjust resource usage to improve resource utilization efficiency.

[0005] According to one aspect of the present application, a task diagnosis method for a message queue is provided, the task diagnosis method comprising: detecting whether a current resource usage ratio of a container set meets a current resource usage condition; if not, calculating an expected number of copies according to a current number of copies corresponding to the container set, the current resource usage ratio and an expected resource usage ratio; adjusting the number of containers in the container set according to the expected number of copies, and diagnosing the tasks to be diagnosed in the message queue according to the adjusted container set; wherein each container in the container set corresponds to a task to be diagnosed.

[0006] In an optional manner, the expected number of replicas is calculated based on the current number of replicas corresponding to the container set, the current resource usage ratio and the expected resource usage ratio, further including: taking the quotient of the current resource usage ratio and the expected resource usage ratio to obtain a quotient value; multiplying the quotient value and the current number of replicas, and rounding the calculated product to use the obtained integer as the expected number of replicas.

[0007] In an optional manner, the task diagnosis method also includes: determining a target preset fault tree corresponding to the vehicle identification from a preset fault tree according to the vehicle identification; generating the task to be diagnosed according to the bottom event determined from the target preset fault tree, and sending the task to be diagnosed to the message queue.

[0008] In an optional manner, the current resource usage condition includes a preset upper limit ratio of resource usage and a preset lower limit ratio of resource usage; the detection of whether the current resource usage ratio of the container set meets the current resource usage condition further includes: if it is detected that the current resource usage ratio of the container set reaches the upper limit ratio of resource usage, it indicates that the current resource usage ratio does not meet the current resource usage condition, and the expected number of copies is greater than the current number of copies; or if it is detected that the current resource usage ratio of the container set is lower than the lower limit ratio of resource usage, it indicates that the current resource usage ratio does not meet the current resource usage condition, and the expected number of copies is less than the current number of copies.

[0009] In an optional manner, before adjusting the number of containers in the container set according to the expected number of replicas, the task diagnosis method further includes: if the current resource usage ratio reaches the resource usage upper limit ratio, detecting whether the number of containers in the container set is less than the expected number of replicas; if so, performing the step of adjusting the number of containers in the container set according to the expected number of replicas.

[0010] In an optional manner, before adjusting the number of containers in the container set according to the expected number of replicas, the task diagnosis method further includes: if the current resource usage ratio is lower than the lower limit of resource usage ratio, detecting whether the number of containers in the container set is greater than the expected number of replicas; if yes, performing the step of adjusting the number of containers in the container set according to the expected number of replicas.

[0011] In an optional manner, diagnosing the tasks to be diagnosed in the message queue according to the adjusted container set further includes: diagnosing the tasks to be diagnosed in the message queue using the resource usage of the containers in the adjusted container set; wherein the resource usage of one container corresponds to one task to be diagnosed.

[0012] According to another aspect of the present application, a task diagnosis device for a message queue is provided, the task diagnosis device comprising: a detection module, used to detect whether the current resource usage ratio of a container set meets the current resource usage condition; a calculation module, used to calculate the expected number of copies according to the current number of copies corresponding to the container set, the current resource usage ratio and the expected resource usage ratio if the detection condition is not met; a diagnosis module, used to adjust the number of containers in the container set according to the expected number of copies, and diagnose the tasks to be diagnosed in the message queue according to the adjusted container set; wherein each container in the container set corresponds to a task to be diagnosed.

[0013] According to one aspect of the present application, an electronic device is provided, including: a controller; and a memory for storing one or more programs, which, when the one or more programs are executed by the controller, perform the above-mentioned task diagnosis method.

[0014] According to one aspect of the present application, a computer-readable storage medium is also provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the above-mentioned task diagnosis method.

[0015] According to one aspect of the present application, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned task diagnosis method.

[0016] The present application monitors the current resource usage ratio in real time, and when the current resource usage conditions are not met, calculates the expected number of replicas based on relevant parameters to adjust the number of containers in the container set, that is, adaptively increases or decreases the containers used to diagnose the tasks to be diagnosed in the message queue, and then adaptively increases or decreases the corresponding resource usage. This not only ensures the parallel processing of multiple diagnostic tasks, but also optimizes and adjusts the resource usage used for diagnosis in real time, thereby improving resource utilization efficiency.

[0017] The above description is only an overview of the technical solutions of the embodiments of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0019] Figure 1 It is a flowchart of a task diagnosis method for a message queue shown in an exemplary embodiment of the present application.

[0020] Figure 2 is based on Figure 1 The exemplary embodiment shown is a flow chart of another task diagnosis method for a message queue.

[0021] Figure 3 is based on Figure 1 The exemplary embodiment shown is a flow chart of another task diagnosis method for a message queue.

[0022] Figure 4 It is a schematic diagram of an application scenario of the task diagnosis method of the present application for a message queue.

[0023] Figure 5 It is a structural diagram of a task diagnosis device for a message queue shown in an exemplary embodiment of the present application.

[0024] Figure 6 It is a structural diagram of a computer system of an electronic device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0025] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0026] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0027] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0028] The term "multiple" as used in this application refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.

[0029] The existing task diagnosis process for message queues is relatively mechanical, and the concurrent processing capability of message queues is limited and relatively fixed, which cannot adapt to the changes in the number of diagnostic tasks of message queues, resulting in low resource utilization efficiency.

[0030] To this end, one aspect of the present application provides a task diagnosis method for a message queue. Figure 1 , Figure 1 1 is a flowchart of a task diagnosis method for a message queue shown in an exemplary embodiment of the present application. The task diagnosis method at least includes S110 to S130, which are described in detail as follows:

[0031] S110: Detect whether the current resource usage ratio of the container set meets the current resource usage condition.

[0032] A container set is a collection of all containers, which refers to all containers. For example, a container set can be a collection of all pods in a Kubernetes cluster. A pod is the smallest basic unit of deployment and management in a cluster. In this scenario, a container set represents at least one pod.

[0033] The current resource usage ratio is a ratio of the current resource usage to the total environment resources. For example, if the current CPU utilization is 80%, then the ratio of the current CPU usage to the total CPU usage is 80%.

[0034] The current resource usage condition is a preset current standard that characterizes the current resource usage ratio; if the condition is met, it indicates that the current resource usage ratio is within the current standard range, otherwise it is not within the current standard range. For example, the current standard range of the resource usage ratio represented by the current resource usage condition is 30% to 80%. If the current resource usage ratio is 50%, the current resource usage ratio of the container set meets the current resource usage condition; if the current resource usage ratio is 85%, the current resource usage ratio of the container set does not meet the current resource usage condition.

[0035] S120: If not, the expected number of replicas is calculated according to the current number of replicas corresponding to the container set, the current resource usage ratio and the expected resource usage ratio.

[0036] The current number of replicas is the number of replicas currently in use. The expected resource usage ratio is the boundary value of the expected adjusted resource usage ratio. For example, the boundary values ​​of the expected resource usage ratio are 10% and 90%, that is, the expected adjusted resource usage ratio is between 10% and 90%, that is, it is not expected to be lower than 10% or higher than 90%.

[0037] Exemplarily, the current resource usage ratio is divided by the expected resource usage ratio to obtain a quotient; the quotient is multiplied by the current number of copies, and the product is rounded up to obtain the integer as the expected number of copies. In a preferred embodiment, the average value of the relevant parameters is introduced to make the calculated expected number of copies more accurate, the current average resource usage ratio is divided by the expected average resource usage ratio, the quotient is multiplied by the current number of copies, and the product is rounded up to obtain a more accurate expected number of copies. For example, the expected number of copies is calculated using the following formula:

[0038] desiredReplocas=

[0039] ceil(currentReplicas×(cerrentMetricValue / desiredMetricValue));

[0040] Among them, desiredReplocas represents the desired number of replicas, ceil represents the rounding function, currentReplicas represents the current number of replicas, currentMetricValue represents the current average resource usage ratio, and desiredMetricValue represents the desired average resource usage ratio.

[0041] If yes, it indicates that there is no need to adjust the resource usage in the current task diagnosis process, and further, there is no need to adjust the number of containers in the container set.

[0042] S130: adjusting the number of containers in the container set according to the expected number of replicas, and diagnosing the tasks to be diagnosed in the message queue according to the adjusted container set; wherein each container in the container set corresponds to a task to be diagnosed.

[0043] The expected number of replicas is used as the number of containers in the adjusted container set to increase or decrease the number of containers in the container set to achieve expansion or reduction of processing resources. For example, if the current number of replicas is 2 and the expected number of replicas is 3, the number of containers in the container set is adjusted from 2 to 3, that is, the expansion operation is performed.

[0044] Each task to be diagnosed can be placed in a single container for diagnosis, that is, multiple diagnosis tasks can be isolated, and the resource usage of one container can be used for the diagnosis of one task to be diagnosed, so as to realize the parallel processing of multiple tasks to be diagnosed, and adapt the corresponding processing resources to each task to be diagnosed, so as to ensure the normal progress of the diagnosis task. Exemplarily, the resource usage of the container in the adjusted container set is used to diagnose the tasks to be diagnosed in the message queue; wherein the resource usage of one container corresponds to one task to be diagnosed.

[0045] This embodiment monitors the current resource usage ratio in real time, and when the current resource usage conditions are not met, calculates the expected number of replicas based on relevant parameters to adjust the number of containers in the container set, that is, adaptively increases or decreases the containers used to diagnose the tasks to be diagnosed in the message queue, and then adaptively increases or decreases the corresponding resource usage. This not only ensures the parallel processing of multiple diagnostic tasks, but also optimizes and adjusts the resource usage for diagnosis in real time, thereby improving resource utilization efficiency.

[0046] In another exemplary embodiment of the present application, the source of the diagnostic task in the message queue is described in detail. Figure 2 , Figure 2 is based on Figure 1 The exemplary embodiment shown in FIG. 1 is a flow chart of another task diagnosis method for a message queue. The task diagnosis method is as follows: Figure 1 Based on the S110 to S130 shown, S210 to S220 are also included, which are described in detail as follows:

[0047] S210: Determine a target preset fault tree corresponding to the vehicle identification from the preset fault trees according to the vehicle identification.

[0048] The vehicle identification is a number, code or text that represents the identity of the vehicle, such as the frame number, the vehicle factory serial number, etc. The vehicle identification can also be an identification that represents the model or series of vehicles.

[0049] There are multiple preset fault trees, and each vehicle identification corresponds to a corresponding preset fault tree. The preset fault trees corresponding to different identifications may be the same or different, and this application does not limit them.

[0050] Exemplarily, the vehicle identification is matched with a preset vehicle identification, and the preset fault tree corresponding to the successfully matched preset vehicle identification is used as the target preset fault tree, that is, the fault tree that can be used for fault diagnosis of the vehicle corresponding to the vehicle identification.

[0051] S220: Generate a task to be diagnosed according to the bottom event determined from the target preset fault tree, and send the task to be diagnosed to a message queue.

[0052] Based on the corresponding fault message on the vehicle side, the corresponding bottom event is determined from the target preset fault tree, and the corresponding task to be diagnosed is generated according to the determined bottom event and sent to the message queue for caching. This embodiment caches multiple diagnostic tasks through the message queue to avoid downtime due to insufficient idle processing resources when directly diagnosing a large number of tasks to be diagnosed.

[0053] This embodiment introduces a fault tree to diagnose the vehicle side, and generates tasks to be diagnosed that are sent to the message queue based on the determined bottom events, so as to cache multiple tasks to be diagnosed, so as to avoid too many tasks to be diagnosed running at the same time, and to avoid downtime due to insufficient idle processing resources, so as to avoid missing or errors in diagnostic tasks.

[0054] In another exemplary embodiment of the present application, how to detect whether the current resource usage ratio of the container set meets the current resource usage condition is described in detail. Figure 3 , Figure 3 is based on Figure 1 The exemplary embodiment shown in FIG. 1 is a flow chart of another task diagnosis method for a message queue. The task diagnosis method is as follows: Figure 1 The S110 shown further includes S310 or S320; wherein the current resource usage condition includes a preset resource usage upper limit ratio and a preset resource usage lower limit ratio, which are described in detail as follows:

[0055] S310: If it is detected that the current resource usage ratio of the container set reaches the resource usage upper limit ratio, it indicates that the current resource usage ratio does not meet the current resource usage condition, and the expected number of replicas is greater than the current number of replicas.

[0056] This situation indicates that the current resource usage ratio of the container set has reached the upper limit, that is, the current resource usage has reached the preset maximum resource usage. If the upper limit is exceeded, the normal diagnosis of each task to be diagnosed cannot be guaranteed. In this case, it is necessary to increase the amount of idle resources to expand the processing resources required for task diagnosis. The number of replicas represents the number of diagnostic tasks that can be diagnosed at the same time. Obviously, this situation requires expansion, so the expected number of replicas must be greater than the current number of replicas.

[0057] Exemplarily, the upper limit of resource usage is 80%. If the current resource usage of the container set is 80%, it indicates that the current resource usage does not meet the current resource usage conditions, and the processing resources required for the diagnosis task need to be expanded.

[0058] The number of containers after the expansion operation should be greater than the number of containers at the current moment. In order to avoid errors or failures in the expansion process, in some embodiments, before the expansion operation, it is also necessary to detect whether the number of containers in the container set is less than the expected number of copies; if yes, the step of adjusting the number of containers in the container set according to the expected number of copies is executed, that is, the expansion operation is performed; if no, it indicates that the number of containers after the expansion is less than the number of containers at the current moment, which is obviously unreasonable, and an error processing can be performed at this time. The detection operation before the expansion is performed to ensure the correct implementation of the expansion operation.

[0059] S320: If it is detected that the current resource usage ratio of the container set is lower than the lower limit ratio of resource usage, it indicates that the current resource usage ratio does not meet the current resource usage condition, and the expected number of replicas is less than the current number of replicas.

[0060] This situation indicates that the current resource usage ratio of the container set has reached the lower limit, that is, the current resource usage has reached the preset minimum resource usage. If it is lower than the upper limit, it will cause a waste of idle processing resources. In this case, the amount of idle resources can be reduced to reduce the processing resources required for task diagnosis, and the excess idle resources can be used elsewhere to improve resource utilization efficiency. Obviously, this situation requires expansion, so the expected number of replicas must be less than the current number of replicas.

[0061] Exemplarily, the lower limit of resource usage is 40%. If the current resource usage of the container set is 40%, it indicates that the current resource usage does not meet the current resource usage conditions, and the processing resources need to be reduced in order to reasonably set the corresponding processing resources and improve the utilization efficiency of the processing resources.

[0062] The number of containers after the scaling down operation should be less than the number of containers at the current moment. In order to avoid errors or failures in the scaling down process, in some embodiments, before the scaling down operation, it is also necessary to detect whether the number of containers in the detection container set is greater than the expected number of replicas; if so, the step of adjusting the number of containers in the container set according to the expected number of replicas is executed, that is, the scaling down operation is performed; if not, it indicates that the number of containers after scaling down is greater than the number of containers at the current moment, which is obviously unreasonable, and an error processing can be performed at this time. The detection operation before scaling down can ensure the correct implementation of the scaling down operation.

[0063] This embodiment illustrates the situation where the current resource usage ratio does not meet the current resource usage conditions. By simply comparing the current resource usage ratio with the boundary value of the resource usage ratio, it is possible to quickly determine whether the current resource usage ratio of the container set meets the current resource usage conditions.

[0064] In another exemplary embodiment of the present application, the application scenarios of the above-mentioned multiple task diagnosis methods are exemplarily described. Figure 4 , Figure 4 : This is a schematic diagram of the application scenario of the task diagnosis method for message queues in this application. Among them, Kubernetes can automatically perform container management operation tasks, and it has built-in commands for deploying applications, changing applications, scaling applications according to changing needs, monitoring applications, etc., so as to manage applications more easily.

[0065] HPA (Horizontal Pod Autoscale) is a controller used to control the horizontal scaling of Pods. HPA periodically checks the Pod's metrics data, calculates the number of replicas required to meet the target value configured by the HPA resources, and then adjusts the replicas field of the target resource (such as Deployment).

[0066] Kafka is a high-throughput, persistent, distributed publish-subscribe message queue system.

[0067] xxl-job is a distributed task scheduling platform. Its core design goal is to be fast to develop, easy to learn, lightweight, and easy to expand. It can trigger fault tree diagnosis tasks at regular intervals.

[0068] The vhr-backend service queries the bottom events of the diagnostic fault tree, generates diagnostic task information, and delivers the information to the message queue Kafka.

[0069] Metrics-Server is an aggregator of the core monitoring data of the Kubernetes cluster. It stores the monitoring data of each node in the cluster and provides an API for analysis and use.

[0070] Deploy HPA (Horizontal Pod Autoscaler) in the Kubernetes cluster, and set the CPU utilization upper limit of the diagnostic task to 80% in the HPA resource object. When the CPU utilization of the diagnostic task pod reaches 80%, the automatic expansion operation will be triggered. HPA queries the Metrics Server and collects the CPU information of each diagnostic task pod in the Kuberentes cluster. The CPU information indicates that the current CPU utilization has exceeded 80%, which indicates that expansion operations are needed. The expected number of copies of the diagnostic task pod is calculated, and the number of copies of the upstream control Depolyment of the diagnostic task pod is updated. In this way, the number of diagnostic task pods can be expanded, the dynamic scaling of the fault tree diagnostic task can be realized, the message processing rate of the Kafka queue can be improved, the message backlog can be avoided, and the efficiency of batch fault tree diagnosis of scheduled tasks can be improved.

[0071] This application uses the HPA characteristics of the distributed system deployed in Kubernetes to achieve dynamic expansion and contraction of the message monitoring service, increase and decrease processing resources in real time, improve the utilization rate of processing resources, and reduce the time consumption of the entire fault tree diagnosis.

[0072] Another aspect of the present application also provides a task diagnosis device for a message queue, such as Figure 5 As shown, Figure 5 1 is a schematic diagram of a task diagnosis device for a message queue according to an exemplary embodiment of the present application. The task diagnosis device 500 includes:

[0073] The detection module 510 is used to detect whether the current resource usage ratio of the container set meets the current resource usage condition.

[0074] The calculation module 530 is used to calculate the expected number of replicas according to the current number of replicas corresponding to the container set, the current resource usage ratio and the expected resource usage ratio if the answer is no.

[0075] The diagnosis module 550 is used to adjust the number of containers in the container set according to the expected number of replicas, and diagnose the tasks to be diagnosed in the message queue according to the adjusted container set; wherein each container in the container set corresponds to a task to be diagnosed.

[0076] In another exemplary embodiment of the present application, the calculation module 530 further includes:

[0077] The first calculation unit is used to calculate the quotient of the current resource usage ratio and the expected resource usage ratio to obtain a quotient value.

[0078] The second calculation unit is used to perform a product operation on the quotient and the current number of replicas, and round the calculated product to use the obtained integer as the expected number of replicas.

[0079] In another exemplary embodiment of the present application, the task diagnosis device 500 further includes:

[0080] The determination module is used to determine a target preset fault tree corresponding to the vehicle identification from the preset fault trees according to the vehicle identification.

[0081] The sending module is used to generate a task to be diagnosed according to the bottom event determined from the target preset fault tree, and send the task to be diagnosed to the message queue.

[0082] In another exemplary embodiment of the present application, the current resource usage condition includes a preset resource usage upper limit ratio and a preset resource usage lower limit ratio; the detection module 510 further includes:

[0083] The first condition unit is used to indicate that if it is detected that the current resource usage ratio of the container set reaches the resource usage upper limit ratio, the current resource usage ratio does not meet the current resource usage condition, and the expected number of replicas is greater than the current number of replicas.

[0084] The second situation unit is used to indicate that if it is detected that the current resource usage ratio of the container set is lower than the lower limit ratio of the resource usage, the current resource usage ratio does not meet the current resource usage condition, and the expected number of replicas is less than the current number of replicas.

[0085] In another exemplary embodiment of the present application, the task diagnosis device 500 further includes:

[0086] The first sub-detection module is used to detect whether the number of containers in the container set is less than the expected number of replicas if the current resource usage ratio reaches the resource usage upper limit ratio.

[0087] The first adjustment module is configured to, if the answer is yes, execute the step of adjusting the number of containers in the container set according to the expected number of replicas.

[0088] In another exemplary embodiment of the present application, the task diagnosis device 500 further includes:

[0089] The second sub-detection module is used to detect whether the number of containers in the container set is greater than the expected number of replicas if the current resource usage ratio is lower than the resource usage lower limit ratio.

[0090] The second adjustment module is configured to, if the answer is yes, execute the step of adjusting the number of containers in the container set according to the expected number of replicas.

[0091] In another exemplary embodiment of the present application, the diagnosis module 550 further includes:

[0092] The diagnosis unit is used to diagnose the tasks to be diagnosed in the message queue by using the resource usage of the containers in the adjusted container set; wherein the resource usage of one container corresponds to one task to be diagnosed.

[0093] The task diagnosis device of the present application monitors the current resource usage ratio in real time. When the current resource usage conditions are not met, the expected number of replicas is calculated based on relevant parameters to adjust the number of containers in the container set, that is, adaptively increase or decrease the containers used to diagnose the tasks to be diagnosed in the message queue, and then adaptively increase or decrease the corresponding resource usage. This can not only ensure the parallel processing of multiple diagnostic tasks, but also optimize and adjust the resource usage used for diagnosis in real time, thereby improving resource utilization efficiency.

[0094] It should be noted that the task diagnosis device provided in the above embodiment and the task diagnosis method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiment and will not be repeated here.

[0095] Another aspect of the present application provides an electronic device, including: a controller; and a memory for storing one or more programs, which, when executed by the controller, perform the above-mentioned task diagnosis method.

[0096] See also Figure 6 , Figure 6 1 is a schematic diagram of the structure of a computer system of an electronic device shown in an exemplary embodiment of the present application, which shows a schematic diagram of the structure of a computer system of an electronic device suitable for implementing an embodiment of the present application.

[0097] It should be noted that Figure 6 The computer system 600 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0098] like Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage part 608 to the random access memory (RAM) 603, such as executing the method in the above embodiment. In the RAM 603, various programs and data required for system operation are also stored. The CPU 601, ROM 602 and RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0099] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read therefrom is installed into the storage section 608 as needed.

[0100] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 609, and / or installed from a removable medium 611. When the computer program is executed by a central processing unit (CPU) 601, various functions defined in the system of the present application are executed.

[0101] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0102] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0103] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0104] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the task diagnosis method as described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0105] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the task diagnosis method provided in each of the above embodiments.

[0106] According to one aspect of an embodiment of the present application, a computer system is also provided, including a central processing unit (CPU), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage portion into a random access memory (RAM), such as executing the method in the above embodiment. In RAM, various programs and data required for system operation are also stored. CPU, ROM and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.

[0107] The following components are connected to the I / O interface: an input part including a keyboard, a mouse, etc.; an output part including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part including a hard disk, etc.; and a communication part including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication part performs communication processing via a network such as the Internet. A drive is also connected to the I / O interface as needed. Removable media, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive as needed so that the computer program read therefrom is installed into the storage part as needed.

[0108] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.

Claims

1. A task diagnosis method for a message queue, characterized in that: The task diagnosis method comprises: Check whether the current resource usage ratio of the container set meets the current resource usage conditions; If not, the expected number of replicas is calculated according to the current number of replicas corresponding to the container set, the current resource usage ratio and the expected resource usage ratio; The number of containers in the container set is adjusted according to the expected number of replicas, and the tasks to be diagnosed in the message queue are diagnosed according to the adjusted container set; wherein each container in the container set corresponds to a task to be diagnosed.

2. The task diagnosis method according to claim 1, characterized in that: The step of calculating the expected number of replicas according to the current number of replicas corresponding to the container set, the current resource usage ratio and the expected resource usage ratio further includes: The current resource usage ratio is divided by the expected resource usage ratio to obtain a quotient value; The quotient is multiplied by the current number of replicas, and the calculated product is rounded to an integer, so that the obtained integer is used as the expected number of replicas.

3. The task diagnosis method according to claim 1, characterized in that: The task diagnosis method further includes: Determine a target preset fault tree corresponding to the vehicle identification from the preset fault trees according to the vehicle identification; The task to be diagnosed is generated according to the bottom event determined from the target preset fault tree, and the task to be diagnosed is sent to the message queue.

4. The task diagnosis method according to claim 1, characterized in that: The current resource usage conditions include a preset resource usage upper limit ratio and a preset resource usage lower limit ratio; The detecting whether the current resource usage ratio of the container set meets the current resource usage condition further includes: If it is detected that the current resource usage ratio of the container set reaches the resource usage upper limit ratio, it indicates that the current resource usage ratio does not meet the current resource usage condition, and the expected number of replicas is greater than the current number of replicas; or If it is detected that the current resource usage ratio of the container set is lower than the lower limit ratio of resource usage, it indicates that the current resource usage ratio does not meet the current resource usage condition, and the expected number of replicas is less than the current number of replicas.

5. The task diagnosis method according to claim 4, characterized in that: Before adjusting the number of containers in the container set according to the expected number of replicas, the task diagnosis method further includes: If the current resource usage ratio reaches the resource usage upper limit ratio, detecting whether the number of containers in the container set is less than the expected number of replicas; If yes, the step of adjusting the number of containers in the container set according to the expected number of replicas is performed.

6. The task diagnosis method according to claim 4, characterized in that: Before adjusting the number of containers in the container set according to the expected number of replicas, the task diagnosis method further includes: If the current resource usage ratio is lower than the resource usage lower limit ratio, detecting whether the number of containers in the container set is greater than the expected number of replicas; If yes, the step of adjusting the number of containers in the container set according to the expected number of replicas is performed.

7. The task diagnosis method according to any one of claims 1 to 6, characterized in that: The diagnosing the tasks to be diagnosed in the message queue according to the adjusted container set further includes: The resource usage of the containers in the adjusted container set is used to diagnose the tasks to be diagnosed in the message queue; wherein the resource usage of one container corresponds to one task to be diagnosed.

8. A task diagnosis device for a message queue, characterized in that: The task diagnosis device comprises: A detection module is used to detect whether the current resource usage ratio of the container set meets the current resource usage conditions; A calculation module, for calculating the expected number of replicas according to the current number of replicas corresponding to the container set, the current resource usage ratio and the expected resource usage ratio, if the answer is no; A diagnosis module is used to adjust the number of containers in the container set according to the expected number of replicas, and diagnose the tasks to be diagnosed in the message queue according to the adjusted container set; wherein each container in the container set corresponds to a task to be diagnosed.

9. An electronic device, characterized in that: include: Controller; A memory for storing one or more programs, which, when executed by the controller, enables the controller to implement the task diagnosis method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the task diagnosis method according to any one of claims 1 to 7.