Task processing method and device, storage medium, and electronic device

By monitoring and processing the resource usage of Greenplum Cluster Database, it solves the problem of abnormal task execution in the cluster database, ensures the normal execution of tasks under high pressure, and improves system reliability and user experience.

CN114490077BActive Publication Date: 2024-10-22ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210122369.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-09
Publication Date
2024-10-22
Estimated Expiration
2042-02-09

AI Technical Summary

Technical Problem

In Greenplum Cluster Database, existing technology is difficult to effectively monitor and process resource consumption and performance, causing tasks to fail to execute normally under high pressure and affecting user experience.

Method used

By obtaining the resource usage of node resources in the cluster database, determine the average resource usage, and handle abnormal tasks according to preset thresholds, including deleting tasks with abnormal execution times and canceling repeatedly executed tasks to ensure the normal execution of tasks.

Benefits of technology

It achieves normal execution of tasks under high pressure on cluster databases, solves resource consumption and performance issues, and improves system reliability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490077B_ABST
    Figure CN114490077B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a task processing method and device, a storage medium, and an electronic device, the method comprising: when it is determined that the tasks currently executed in the cluster database include abnormal tasks, obtaining the resource utilization rate of the node resources in the cluster database according to a preset time interval, and determining M resource utilization rates, wherein the resource utilization rate is used to represent the usage of the resources in the cluster database, and M is a natural number greater than 1; using the M resource utilization rates to determine the average resource utilization rate of the cluster database to determine the resource utilization rate of the cluster database; and processing the abnormal tasks according to the resource utilization rate of the cluster database. Through the present invention, the problem of processing abnormal tasks in the cluster database in the related art is solved, and the effect of ensuring the normal execution of tasks is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of data processing, and in particular, to a task processing method and device, a storage medium, and an electronic device. Background Art

[0002] Greenplum is a relational database for database warehouse applications, developed based on Postgresql. It uses a shared-nothing large-scale parallel processing architecture, with advantages such as horizontal scalability, high availability, and high performance. However, during use, due to hardware problems or improper use, the cluster often cannot provide services normally, and the operation and maintenance personnel need to handle it. If the operation and maintenance personnel cannot handle it in time, it will affect the relevant business on site and bring a bad experience to users.

[0003] In response to the above problems, the following common processing methods are used: deploying a Greenplum cluster status monitoring device to self-check, self-recover, and self-start the faulty nodes in the Greenplum cluster.

[0004] This solution is mainly used to monitor the operation status of the cluster, and can only ensure that the abnormal operation status of the cluster is handled. It does not monitor the cluster resource consumption and cluster performance. When the cluster pressure is high, although the cluster operation status is normal, most tasks cannot be executed normally due to the high cluster pressure. Summary of the invention

[0005] The embodiments of the present invention provide a task processing method and device, a storage medium, and an electronic device to at least solve the problem of processing abnormal tasks in a cluster database in the related art.

[0006] According to one embodiment of the present invention, a task processing method is provided, comprising: in a case where it is determined that tasks currently being executed in a cluster database include abnormal tasks, obtaining resource utilization rates of node resources in the cluster database at preset time intervals, and determining M resource utilization rates, wherein the resource utilization rates are used to represent resource utilization conditions in the cluster database, and M is a natural number greater than 1; determining an average resource utilization rate of the cluster database using the M resource utilization rates to determine the resource utilization rate of the cluster database; and processing the abnormal tasks according to the resource utilization rate of the cluster database.

[0007] According to another embodiment of the present invention, a task processing device is provided, including: a first acquisition module, for obtaining the resource utilization rate of the node resources in the cluster database at a preset time interval when it is determined that the tasks currently executed in the cluster database include abnormal tasks, and determining M resource utilization rates, wherein the resource utilization rate is used to represent the usage of the resources in the cluster database, and the M is a natural number greater than 1; a first determination module, for determining the average resource utilization rate of the cluster database using the M resource utilization rates, so as to determine the resource utilization rate of the cluster database; and a first processing module, for processing the abnormal tasks according to the resource utilization rate of the cluster database.

[0008] In an exemplary embodiment, the above-mentioned device also includes: a second acquisition module, which is used to obtain the resource utilization rate of the node resources in the cluster database at a preset time interval when it is determined that the tasks currently executed in the cluster database include abnormal tasks, and before determining M resource utilization rates, obtain the difference between the start execution time and the current time of the task currently executed in the above-mentioned cluster database, and determine it as the first execution time of the above-mentioned task currently executed; a second determination module is used to determine the above-mentioned task currently executed as the above-mentioned abnormal task when the above-mentioned first execution time is greater than the first preset threshold.

[0009] In an exemplary embodiment, the above-mentioned device also includes: a third acquisition module, which is used to obtain the resource utilization rate of the node resources in the cluster database at a preset time interval when it is determined that the tasks currently executed in the cluster database include abnormal tasks, and before determining the M resource utilization rates, obtain the N tasks currently executed in the above-mentioned cluster database, wherein the above-mentioned N is a natural number greater than 1; and a third determination module, which is used to determine the same tasks among the above-mentioned N tasks as the above-mentioned abnormal tasks.

[0010] In an exemplary embodiment, the above-mentioned device also includes: a fourth determination module, which is used to determine the average resource utilization rate of the above-mentioned cluster database by using the above-mentioned M resource utilization rates, and then determine that the server resource is abnormal when the above-mentioned average resource utilization rate is greater than a second preset threshold value, so as to determine that there is an abnormality in the resources of the above-mentioned cluster database, wherein the above-mentioned node resources include the above-mentioned server resources.

[0011] In an exemplary embodiment, the above-mentioned first processing module includes: a fifth determination module, used to determine the task type of the above-mentioned abnormal task when the above-mentioned resource utilization rate is greater than the third preset threshold; and a second processing module, used to process the above-mentioned abnormal task according to the task type of the above-mentioned abnormal task.

[0012] In an exemplary embodiment, the first processing module includes: a first deleting module, configured to delete the abnormal tasks in chronological order when the abnormal tasks include tasks with abnormal execution times.

[0013] In an exemplary embodiment, the first processing module includes: a first cancellation module, configured to cancel the execution of the repeated task when the abnormal task includes a repeated task.

[0014] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when run.

[0015] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0016] Through the present invention, when it is determined that the tasks currently executed in the cluster database include abnormal tasks, the resource utilization rate of the node resources in the cluster database is obtained according to the preset time interval, and M resource utilization rates are determined, wherein the resource utilization rate is used to represent the usage of the resources in the cluster database, and M is a natural number greater than 1; the average resource utilization rate of the cluster database is determined by using the M resource utilization rates to determine the resource utilization rate of the cluster database; and the abnormal tasks are processed according to the resource utilization rate of the cluster database. The purpose of processing abnormal tasks based on the resource utilization in the cluster database is achieved. The normal execution of tasks can be guaranteed when the pressure on the cluster database is relatively large. Therefore, the problem of processing abnormal tasks in the cluster database in the related art can be solved, and the effect of ensuring the normal execution of tasks can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a hardware structure block diagram of a mobile terminal of a task processing method according to an embodiment of the present invention;

[0018] Figure 2 is a flowchart of a task processing method according to an embodiment of the present invention;

[0019] Figure 3 is a flow chart of monitoring a cluster database according to an embodiment of the present invention;

[0020] Figure 4 is a structural block diagram of a task processing device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0021] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with the embodiments.

[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0023] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a task processing method according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0024] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the task processing method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0025] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0026] In this embodiment, a task processing method is provided. Figure 2 is a flowchart of a task processing method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0027] Step S202, when it is determined that the tasks currently executed in the cluster database include abnormal tasks, obtain resource utilization rates of node resources in the cluster database at preset time intervals, and determine M resource utilization rates, where the resource utilization rate is used to represent the utilization of resources in the cluster database, and M is a natural number greater than 1;

[0028] Step S204, determining an average resource utilization rate of the cluster database using the M resource utilization rates to determine the resource utilization rate of the cluster database;

[0029] Step S206: Process the abnormal task according to the resource usage rate of the cluster database.

[0030] In this embodiment, the cluster database includes but is not limited to Greenplum. Greenplum is a relational database for database warehouse applications, developed based on Postgresql. It adopts a shared-nothing large-scale parallel processing architecture and has the advantages of horizontal scalability, high availability, and high performance.

[0031] The resources in the cluster database include but are not limited to the node resource central processing unit (CPU) or the usage of input / output IO devices.

[0032] In this embodiment, the processing of the abnormal task includes deleting the abnormal task or canceling the execution of the abnormal task.

[0033] The execution subject of the above steps may be a terminal, etc., but is not limited thereto.

[0034] Through the above steps, when it is determined that the tasks currently executed in the cluster database include abnormal tasks, the resource utilization rate of the node resources in the cluster database is obtained according to the preset time interval, and M resource utilization rates are determined, wherein the resource utilization rate is used to represent the usage of resources in the cluster database, and M is a natural number greater than 1; the average resource utilization rate of the cluster database is determined by using the M resource utilization rates to determine the resource utilization rate of the cluster database; and the abnormal tasks are processed according to the resource utilization rate of the cluster database. The purpose of processing abnormal tasks based on the resource utilization in the cluster database is achieved. The normal execution of tasks can be guaranteed when the pressure on the cluster database is high. Therefore, the problem of processing abnormal tasks in the cluster database in the related technology can be solved, and the effect of ensuring the normal execution of tasks can be achieved.

[0035] In an exemplary embodiment, when it is determined that the tasks currently executed in the cluster database include abnormal tasks, resource utilization rates of node resources in the cluster database are obtained at preset time intervals, and before determining M resource utilization rates, the method further includes:

[0036] S1, obtaining the difference between the start execution time of the currently executed task and the current time in the cluster database, and determining it as the first execution time of the currently executed task;

[0037] S2: When the first execution time is greater than a first preset threshold, determine the currently executed task as an abnormal task.

[0038] In this embodiment, for example, a query statement whose execution time exceeds a certain threshold, or a copy statement whose execution time exceeds a certain threshold is obtained.

[0039] The specific SQL for the task whose query execution time exceeds a certain threshold is as follows:

[0040] select*from pg_stat_activity where(UPPER(current_query)like'SELECT%%'or UPPER(current_query)like'WITH%%')and now()-query_start>'SELECT_LIMIT'and current_query not like' <idle>%%'and procpid<>pg_backend_pid(); where SELECT_LIMIT is the query time threshold.

[0041] Similarly, the SQL statement for querying copy tasks whose execution time exceeds a certain threshold is as follows:

[0042] select*from pg_stat_activity where UPPER(current_query)like'COPY%%'and current_query not like' <idle>%%'and now()-query_start>'COPY_LIMITs'andprocpid<>pg_backend_pid(); where COPY_LIMIT is the import time threshold.

[0043] In an exemplary embodiment, when it is determined that the tasks currently executed in the cluster database include abnormal tasks, resource utilization rates of node resources in the cluster database are obtained at preset time intervals, and before determining M resource utilization rates, the method further includes:

[0044] S1, obtain N tasks currently executed in the cluster database, where N is a natural number greater than 1;

[0045] S2, determining the same tasks among the N tasks as abnormal tasks.

[0046] In an exemplary embodiment, after determining the average resource usage rate of the cluster database using the M resource usage rates, the method further includes:

[0047] S1, when the average resource usage rate is greater than a second preset threshold, determining that the server resources are abnormal, so as to determine that there is an abnormality in the resources of the cluster database, wherein the node resources include server resources.

[0048] In this embodiment, node resources include but are not limited to server resources CPU or IO resources. In the case of abnormal tasks, it is necessary to check the node resource (CPU / IO) usage in the cluster. In order to avoid short-term CPU and IO peaks that affect the detection accuracy, the CPU and IO can be sampled six times continuously, once every second. The CPU is sampled using the top tool, and the IO is sampled using the iostat tool. Since the data of the first sampling during the sampling process is inaccurate, the first sampling data needs to be removed each time sampling, and the average of the remaining five sampling data is taken.

[0049] For example, the CPU sampling command is as follows:

[0050] top-bn 6-d 1|grep Cpu|awk'{print$5}'|awk-F'%”{print$1}'|cut-f 1-d".";

[0051] For example, the IO sampling command is as follows:

[0052] iostat-dx 1 6|grep sd|awk'{print$1"_"$12"|"}'

[0053] The above IO sampling results are similar to: sda_72.80, sda is the drive letter, 72.8 is the disk usage. Therefore, it is necessary to group the data of each disk from the test results, extract the usage, and calculate the average value.

[0054] If the IO average of any node CPU or any data disk reaches the threshold, it is considered that the database performance pressure is caused by insufficient server resources.

[0055] In an exemplary embodiment, processing abnormal tasks according to the resource usage of the cluster database includes:

[0056] S1, when the resource usage rate is greater than a third preset threshold, determining the task type of the abnormal task;

[0057] S2, processing the abnormal task according to the task type of the abnormal task.

[0058] In this embodiment, the task types of abnormal tasks include task timeout and task duplication.

[0059] In an exemplary embodiment, processing the abnormal task according to the task type of the abnormal task includes:

[0060] S1. When the abnormal tasks include tasks with abnormal execution time, the abnormal tasks are deleted in chronological order.

[0061] In this embodiment, for example, the task with the longest execution time is deleted.

[0062] In an exemplary embodiment, processing the abnormal task according to the task type of the abnormal task includes:

[0063] S1, when the abnormal task includes a repeatedly executed task, cancel the execution of the repeatedly executed task.

[0064] In this embodiment, for example, the earliest executed task among multiple identical tasks is retained, and the execution of other tasks is cancelled.

[0065] The present invention will be described below in conjunction with specific embodiments:

[0066] This embodiment takes the monitoring of the Greenplum database as an example. Figure 3 As shown, the following steps are included:

[0067] S301, regularly connect to the Greenplum cluster database.

[0068] S302, obtaining from the pg_stat_activity table of Greenplum the query statements whose execution time exceeds a certain threshold, or the copy statements whose execution time exceeds a certain threshold, or a batch of similar SQL statements being executed.

[0069] The pg_stat_activity system table contains a field (query_start) for the start time of the SQL statement. The difference between the current time and the start time of the SQL statement is the SQL statement execution time. The specific SQL for tasks where the query execution time exceeds a certain threshold is as follows:

[0070] select*from pg_stat_activity where(UPPER(current_query)like'SELECT%%'or UPPER(current_query)like'WITH%%')and now()-query_start>'SELECT_LIMIT'and current_query not like' <idle>%%'and procpid<>pg_backend_pid(), where SELECT_LIMIT is the query time threshold.

[0071] Similarly, the SQL statement for querying copy tasks whose execution time exceeds a certain threshold is as follows:

[0072] select*from pg_stat_activity where UPPER(current_query)like'COPY%%'and current_query not like' <idle>%%'and now()-query_start>'COPY_LIMITs'andprocpid<>pg_backend_pid(), where COPY_LIMIT is the import time threshold.

[0073] The method for judging whether there is a batch of similar SQL statements is that considering that the scheduled execution tasks are mainly query statements, similar SQL statements are mainly searched from query statements. The judgment logic is to intercept all the strings before where in the query statement. If all the strings before where are exactly the same, they can be considered to be similar SQL statements. If the number of similar SQL statements exceeds 3, it is considered that a batch of similar SQL statements are running.

[0074] S303, if there is a task that meets any of the above conditions, it is considered that there is performance pressure on the database. It is necessary to check the usage of node resources (CPU / IO) in the cluster. In order to avoid short-term CPU and IO peaks that affect the detection accuracy, the CPU and IO are sampled six times in succession, once every second. The CPU is sampled using the top tool, and the IO is sampled using the iostat tool. Since the data of the first sampling during the sampling process is inaccurate, the first sampling data needs to be removed each time sampling, and the average of the remaining five sampling data is taken.

[0075] The CPU sampling command is as follows:

[0076] top-bn 6-d 1|grep Cpu|awk'{print$5}'|awk-F'%”{print$1}'|cut-f 1-d".";

[0077] The IO sampling commands are as follows:

[0078] iostat-dx 1 6|grep sd|awk'{print$1"_"$12"|"}';

[0079] The above IO sampling results are similar to: sda_72.80, sda is the drive letter, 72.8 is the disk usage. Therefore, it is necessary to group the data of each disk from the test results, extract the usage, and calculate the average value.

[0080] S304, if the IO average of any node CPU or any data disk reaches the threshold, it is considered that the database performance pressure is caused by insufficient server resources. At this time, re-check the statements that meet the threshold in the first step. If the query statement exceeds the threshold, cancel the query task with the earliest start time. If a batch of similar SQLs are being executed, only the earliest statement is retained and other similar statements are canceled. The above canceled tasks are recorded in the log file, and the corresponding business can be optimized regularly based on the tasks with poor performance canceled in the log file.

[0081] In order to ensure that data access is not affected, the access statement is not canceled. At the same time, considering that there may be scheduled tasks in the cluster, if the next task has already started before the last scheduled task is completed, multiple similar tasks will be piled up, consuming a large amount of system resources. Therefore, it is necessary to keep only the earliest task and cancel other tasks to ensure that the earliest task has sufficient resources.

[0082] In this embodiment, when canceling a task, first use the pg_cancel_backend() function provided by Greenplum to cancel it according to the task pid. If the cancellation fails, use pg_terminate_backend() to cancel it. After the cancellation task is completed, the monitoring task is executed again in a loop until the database has no performance pressure.

[0083] In summary, this embodiment can monitor cluster pressure and resource usage in real time, promptly discover tasks with large resource consumption, and record them in logs. Later, the business can be checked according to the logs to optimize unreasonable business. When the server resource pressure is high, resulting in abnormal access and other tasks, query tasks with large resource consumption can be discovered and canceled in time to reduce cluster load and ensure normal execution of access and other tasks with less resource consumption.

[0084] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0085] In this embodiment, a task processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0086] Figure 4 is a structural block diagram of a task processing device according to an embodiment of the present invention. Figure 4 As shown, the device comprises:

[0087] A first acquisition module 42 is used to acquire resource utilization rates of node resources in the cluster database at preset time intervals and determine M resource utilization rates when it is determined that the tasks currently executed in the cluster database include abnormal tasks, wherein the resource utilization rate is used to represent the utilization of resources in the cluster database, and M is a natural number greater than 1;

[0088] A first determining module 44, configured to determine an average resource utilization rate of the cluster database by using the M resource utilization rates, so as to determine the resource utilization rate of the cluster database;

[0089] The first processing module 46 is used to process abnormal tasks according to the resource usage rate of the cluster database.

[0090] In an exemplary embodiment, the apparatus further includes: a second acquisition module, configured to, when it is determined that the tasks currently executed in the cluster database include abnormal tasks, acquire resource utilization rates of node resources in the cluster database at preset time intervals, and before determining the M resource utilization rates, acquire the difference between the start execution time of the task currently executed in the cluster database and the current time, and determine it as the first execution time of the task currently executed;

[0091] The second determining module is used to determine the currently executed task as the abnormal task when the first execution time is greater than a first preset threshold.

[0092] In an exemplary embodiment, the above device further comprises:

[0093] a third acquisition module, configured to, when it is determined that the tasks currently executed in the cluster database include abnormal tasks, acquire resource utilization rates of node resources in the cluster database at preset time intervals, and before determining the M resource utilization rates, acquire N tasks currently executed in the cluster database, where N is a natural number greater than 1;

[0094] The third determining module is used to determine the same tasks among the N tasks as the abnormal tasks.

[0095] In an exemplary embodiment, the above device further comprises:

[0096] The fourth determination module is used to determine the average resource utilization rate of the cluster database by using the M resource utilization rates, and when the average resource utilization rate is greater than a second preset threshold, determine that the server resources are abnormal, so as to determine that there is an abnormality in the resources of the cluster database, wherein the node resources include the server resources.

[0097] In an exemplary embodiment, the first processing module comprises:

[0098] A fifth determining module, configured to determine the task type of the abnormal task when the resource usage rate is greater than a third preset threshold;

[0099] The second processing module is used to process the abnormal task according to the task type of the abnormal task.

[0100] In an exemplary embodiment, the first processing module comprises:

[0101] The first deleting module is used to delete the abnormal tasks in chronological order when the abnormal tasks include tasks with abnormal execution time.

[0102] In an exemplary embodiment, the first processing module comprises:

[0103] The first canceling module is used to cancel the execution of the repeated task when the abnormal task includes a repeated task.

[0104] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0105] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0106] In this embodiment, the computer-readable storage medium may be configured to store a computer program for executing the above steps.

[0107] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0108] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0109] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0110] In an exemplary embodiment, the processor may be configured to execute the above steps through a computer program.

[0111] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0112] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0113] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.< / idle> < / idle> < / idle> < / idle>

Claims

1. A task processing method, characterized in that: include: In the case where it is determined that the tasks currently executed in the cluster database include abnormal tasks, resource utilization rates of node resources in the cluster database are obtained at preset time intervals, and M resource utilization rates are determined, wherein the resource utilization rates are used to represent the utilization of resources in the cluster database, and M is a natural number greater than 1; Determine the average resource utilization rate of the cluster database by using the M resource utilization rates to determine the resource utilization rate of the cluster database; The abnormal task is processed according to the resource usage rate of the cluster database.

2. The method according to claim 1, characterized in that When it is determined that the tasks currently executed in the cluster database include abnormal tasks, obtaining resource utilization rates of node resources in the cluster database at preset time intervals, and before determining the M resource utilization rates, the method further includes: Obtaining a difference between the start execution time of a task currently being executed in the cluster database and the current time, and determining the difference as the first execution time of the task currently being executed; When the first execution time is greater than a first preset threshold, the currently executed task is determined as the abnormal task.

3. The method according to claim 1, characterized in that When it is determined that the tasks currently executed in the cluster database include abnormal tasks, obtaining resource utilization rates of node resources in the cluster database at preset time intervals, and before determining the M resource utilization rates, the method further includes: Obtaining N tasks currently being executed in the cluster database, where N is a natural number greater than 1; The same tasks among the N tasks are determined as the abnormal tasks.

4. The method according to claim 1, characterized in that: After determining the average resource utilization rate of the cluster database using the M resource utilization rates, the method further includes: When the average resource usage rate is greater than a second preset threshold, it is determined that the server resources are abnormal, so as to determine that there is an abnormality in the resources of the cluster database, wherein the node resources include the server resources.

5. The method according to claim 1, characterized in that Processing the abnormal task according to the resource usage rate of the cluster database includes: When the resource usage rate is greater than a third preset threshold, determining a task type of the abnormal task; The abnormal task is processed according to the task type of the abnormal task.

6. The method according to claim 5, characterized in that Processing the abnormal task according to the task type of the abnormal task includes: In a case where the abnormal tasks include tasks with abnormal execution times, the abnormal tasks are deleted in chronological order.

7. The method according to claim 5, characterized in that Processing the abnormal task according to the task type of the abnormal task includes: In a case where the abnormal task includes a repeatedly executed task, execution of the repeatedly executed task is canceled.

8. A task processing device, characterized in that: include: A first acquisition module is used to obtain resource utilization rates of node resources in the cluster database at preset time intervals when it is determined that the tasks currently executed in the cluster database include abnormal tasks, and determine M resource utilization rates, wherein the resource utilization rates are used to represent the utilization of resources in the cluster database, and M is a natural number greater than 1; A first determining module, configured to determine an average resource utilization rate of the cluster database by using the M resource utilization rates, so as to determine the resource utilization rate of the cluster database; The first processing module is used to process the abnormal task according to the resource usage rate of the cluster database.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the method described in any one of claims 1 to 7 when executed by a processor.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 7.