WO2018201864A1 - 一种数据库性能诊断方法、装置、设备以及存储介质 - Google Patents

一种数据库性能诊断方法、装置、设备以及存储介质 Download PDF

Info

Publication number
WO2018201864A1
WO2018201864A1 PCT/CN2018/082520 CN2018082520W WO2018201864A1 WO 2018201864 A1 WO2018201864 A1 WO 2018201864A1 CN 2018082520 W CN2018082520 W CN 2018082520W WO 2018201864 A1 WO2018201864 A1 WO 2018201864A1
Authority
WO
WIPO (PCT)
Prior art keywords
scripts
preset
time
resource consumption
consumption rate
Prior art date
Application number
PCT/CN2018/082520
Other languages
English (en)
French (fr)
Inventor
黄伟星
谢川江
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2018201864A1 publication Critical patent/WO2018201864A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • G06F11/3414Workload generation, e.g. scripts, playback

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a database performance diagnosis method, apparatus, device, and storage medium.
  • the embodiment of the present application provides a database performance diagnosis method, device, device, and storage medium, which can automatically identify a script that causes poor database performance and send a corresponding alarm notification to an administrator, so that the administrator can perform database optimization in time. Improve the efficiency of database performance diagnosis.
  • the embodiment of the present application provides a database performance diagnosis method, which includes: obtaining a resource consumption rate of all scripts in a database; and querying, in all scripts, a certain resource consumption rate in a preset time period that is greater than a preset resource consumption rate.
  • a script that identifies one or more scripts in the plurality of scripts whose performance indicators are greater than a preset performance indicator as a target script; generates an alarm notification correspondingly according to the target script and sends the notification to the administrator.
  • the embodiment of the present application provides a database performance diagnosis apparatus, which includes: a first obtaining unit, configured to acquire a resource consumption rate of all scripts in a database; and a query unit, configured to query a preset in all scripts a plurality of scripts in which the resource consumption rate is greater than the preset resource consumption rate; the first identifying unit is configured to identify one or more scripts whose performance indicators are greater than the preset performance indicators in the plurality of scripts as target scripts; And correspondingly generating an alarm notification according to the target script and sending the notification to the administrator.
  • the embodiment of the present application provides a database performance diagnosis device, the device includes: a memory and a processor; a memory, configured to store a program for implementing database performance diagnosis; and a processor, configured to run the storage in the memory a program to perform the following operations: obtaining resource consumption rates of all scripts in the database; querying, in all scripts, several scripts whose resource consumption rate is greater than a preset resource consumption rate in a preset time; identifying performance in the plurality of scripts One or more scripts whose metrics are greater than the preset performance metrics are used as target scripts; correspondingly, the alert notifications are generated according to the target scripts and sent to the administrator.
  • the embodiment of the present application further provides a computer readable storage medium, where the one or more computer programs are stored, and the one or more computer programs may be one or more
  • the processor performs the following steps: obtaining a resource consumption rate of all the scripts in the database; querying, in all scripts, a plurality of scripts whose resource consumption rate is greater than a preset resource consumption rate in a preset time; identifying the plurality of scripts One or more scripts whose performance indicators are greater than the preset performance indicator are used as target scripts; correspondingly, the alarm notifications are generated according to the target scripts and sent to the administrator.
  • the embodiment of the present application can automatically identify the script that causes the performance of the database to deteriorate and send the corresponding alarm notification to the administrator, so that the administrator can perform database optimization and improve the efficiency of database performance diagnosis in time.
  • FIG. 1 is a schematic flow chart of a database performance diagnosis method provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of a distribution of a CPU usage curve of a sample script in a database performance diagnosis method according to an embodiment of the present application.
  • FIG. 3 is a schematic diagram of a distribution of a cumulative time curve of a sample script occupying a CPU in a database diagnostic method according to an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of a database performance diagnosis method according to another embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a database performance diagnosis method according to another embodiment of the present application.
  • FIG. 6 is a schematic block diagram of a database performance diagnosis apparatus according to an embodiment of the present application.
  • FIG. 7 is another schematic block diagram of a database performance diagnosis apparatus according to an embodiment of the present application.
  • FIG. 8 is another schematic block diagram of a database performance diagnosis apparatus according to an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a database performance diagnosis device according to an embodiment of the present application.
  • FIG. 1 is a schematic flowchart of a database performance diagnosis method according to Embodiment 1 of the present application. As shown in FIG. 1, the steps of the method include S101 to S104.
  • the resource consumption rate of the script in the database may be the CPU usage rate of the script, or may be the CPU occupied time of the script; if the resource consumption rate is the CPU usage rate, the CPU of all the scripts in the database is acquired.
  • the usage rate if the resource consumption rate occupies the accumulated time of the CPU, acquires the cumulative CPU time of all the scripts in the database; wherein, the device obtains the CPU usage of the script and the accumulated CPU time by checking the CPU usage.
  • all the scripts of the current database include a script a, a script b, a script c, and a script d.
  • the CPU usage of the device f for the script a is A1
  • the script b is The CPU usage rate
  • the CPU usage of the script c is C1
  • the CPU usage of the script d is D1.
  • the preset time period M may be half an hour or one hour, which is not limited herein.
  • all scripts of the current database include a script a, a script b, a script c, and a script d.
  • the cumulative CPU occupation time of the device acquisition script a is A2, script b.
  • the accumulated CPU occupation time is B2
  • the CPU accumulated time of the script c is C2
  • the CPU occupation time of the script D is D2; wherein the preset time period N can be half an hour or one hour, here Not limited.
  • S102 Query, in all scripts, a plurality of scripts whose resource consumption rate is greater than a preset resource consumption rate in a preset time.
  • the resource consumption rate is the CPU usage rate
  • query, in all the scripts a number of scripts in which the CPU usage rate is greater than the preset CPU usage rate in a preset time; if the resource consumption rate is occupied by the CPU In the cumulative time, the scripts are queried in a number of scripts in which the accumulated CPU time is greater than the preset CPU occupation time in a preset time; wherein the preset time may be ten minutes, may be half an hour, or may be For one hour, the specific preset time can be set by the user, which is not limited herein.
  • the preset resource consumption rate may be set by the user.
  • the resource consumption rate is the CPU usage rate
  • the user may set a preset CPU usage rate of 60%, or may set a preset.
  • the CPU usage rate is 80%.
  • the specific preset CPU usage is not limited here; as shown in Figure 2, in the preset time period M, if the user sets the preset CPU usage rate to 60%, then In all scripts of the current database, such as script a, script b, script c, and script d, the script whose CPU usage is greater than the preset CPU usage includes script b and script c; if the resource consumption rate occupies CPU cumulative time, The user can set the preset CPU occupation time to 2h (two hours), or set other preset CPU occupation time.
  • the specific preset CPU usage time is set by the user, which is not limited here; As shown in FIG. 3, in the preset time period N, if the user sets the preset occupied CPU cumulative time to 2h, all the scripts in the current database, such as script a, script b, script c, and script d, occupy CPU accumulation. Time is greater than Script set occupation of accumulated CPU time, including scripts and script b c.
  • each of the several scripts runs in the device CPU, and there are two execution indicators, including the number of executions and the average response time, where the number of executions refers to the number of operations of the script in the CPU.
  • the average response time refers to the average time of the script in the CPU from the initial state to the running state.
  • the number of executions of the script and the average response time in the CPU are the main factors for determining the abnormality of the database;
  • the number of executions is used as the first performance indicator, and the average response time of the script in the CPU is taken as the second performance indicator, and the results of the first performance indicator and the second performance indicator are comprehensively considered as the performance indicators of the script, wherein
  • the first performance indicator and the second performance indicator are separately considered and the results are respectively obtained, and the results of the first performance indicator and the second performance indicator are separately considered to obtain the final performance index, and may also be comprehensively considered by setting the relationship form.
  • the first performance indicator and the second performance indicator are obtained as the final performance indicator.
  • the preset performance indicator may be set by the user according to the result of comprehensively considering the first performance indicator and the second performance indicator, and is not limited herein; the effect of comprehensively considering the execution times of the script and the average response time is because A high number of executions or a high average response time does not necessarily mean that the performance index of the script is poor.
  • the scripts with poor performance indicators identified may be one or more scripts.
  • S104 Generate an alarm notification corresponding to the target script and send it to the administrator.
  • the identified target script represents a script with poor performance in the current database
  • a script with poor performance in a database abnormal situation is often caused by an abnormality in the database, and thus the identified The target script is the cause of an exception in the database.
  • the target script includes the execution number of the script, the average response time, the location of the script in the current database, and the like, and generates an alarm notification to the administrator; since the details of the target script with the abnormality are recorded in the alarm notification Therefore, the administrator can use the alarm notification to timely understand the cause of the database abnormality, and timely solve the problem and optimize the database for the corresponding abnormality and the detailed information in the alarm notification, wherein the administrator can It is the administrator of the current database, and may be the operation and maintenance personnel of the current database, or the related personnel who maintain the database.
  • the alarm notification may be sent to the administrator's mailbox by email, and in actual application, The transmission form of the alarm notification is not limited herein.
  • FIG. 4 is a schematic flowchart of a database performance diagnosis method according to Embodiment 2 of the present application. As shown in FIG. 4, the steps of the method include S201 to S208.
  • S202 Query, in all scripts, several scripts whose resource consumption rate is greater than a preset resource consumption rate in a preset time.
  • the execution times are used as execution indicators of the script running in the device CPU, and the device may obtain the execution times of the script within a preset time by using the usage of the script in the CPU, wherein the preset The time can be half an hour or one hour.
  • the specific preset time can be set by the user, which is not limited herein.
  • the average response time refers to an average value of time required by the script in the CPU from the initial state to the running state, and the device may set the preset time and record the preset time.
  • the average time required to execute the script multiple times is calculated according to the recorded time as the average response time; wherein the preset time may be half an hour or a
  • the specific preset time can be set by the user, which is not limited herein.
  • the device performs a weighting calculation on the execution times and the average response time of each script to obtain a corresponding weighting threshold.
  • the user may define the weight ratio by itself, and the calculation method may be: Set the weight to 0.8, and then perform the weighting calculation to obtain the weighted value of the execution times. Set the weight for the average response time to 0.2, and then perform the weighting calculation to obtain the weighted value of the average response time, then the weighted value of both the execution number and the average response time.
  • the sum is the weighted threshold, which is used to measure the impact of the script on the performance of the database.
  • the script is a poorly performing script in the current database.
  • the preset threshold is pre-stored in the background of the device, and the pre-stored preset threshold may be set by the user.
  • the weighted threshold is greater than the preset threshold, the corresponding script is in the current database.
  • a poorly performing script when it is determined that the weighted threshold is less than the preset threshold, the corresponding script is not a poorly performing script in the current database.
  • the one or more scripts whose weighting threshold is greater than a preset threshold are used as the target script.
  • the corresponding script is a script with poor performance in the current database, and the script is used as the target script.
  • the embodiment of the present application obtains the number of executions of each script in the plurality of scripts within a preset time, and calculates an average response time of each script, and then performs the number of executions of each script and the The average response time is weighted according to a preset rule to obtain a corresponding weighted threshold. If the weighted threshold is greater than a preset threshold, one or more scripts whose weighted threshold is greater than a preset threshold may be used as a target script, thereby A poorly performing script is accurately obtained from several scripts as a target script, and the target script is correspondingly generated to generate an alarm notification and sent to the administrator.
  • FIG. 5 is a schematic flowchart of a database performance diagnosis method according to Embodiment 3 of the present application. As shown in FIG. 5, the steps of the method include S301 to S307.
  • S302 Query, in all scripts, a plurality of scripts whose resource consumption rate is greater than a preset resource consumption rate in a preset time.
  • the execution times are used as execution indicators of the script running in the device CPU, and the device may obtain the execution times of the script within a preset time by using the usage of the script in the CPU, wherein the preset The time can be half an hour or one hour.
  • the specific preset time can be set by the user, which is not limited herein.
  • the average response time refers to an average value of time required by the script in the CPU from the initial state to the running state, and the device may set the preset time and record the preset time.
  • the average time required to execute the script multiple times is calculated according to the recorded time as the average response time; wherein the preset time may be half an hour or a
  • the specific preset time can be set by the user, which is not limited herein.
  • S305 Determine whether the number of executions and the average response time of each script are greater than a preset range.
  • the range of the number of executions and the range of the average response time are set in advance, and the preset range may be set by the user. If the number of executions of each of the plurality of scripts falls within a preset range, the script corresponding to the number of executions is not a poorly performing script in the current database; if each of the plurality of scripts is executed The number of times is greater than the preset range, and the script corresponding to the number of executions is a script with poor performance in the current database.
  • the number of executions of each script in the plurality of scripts in a preset time is obtained, and the average response time of each script is calculated, and the number of executions and the average response time of each script are determined. Whether it is greater than a preset range, if the number of executions and the average response time are greater than a preset range, one or more corresponding scripts are identified as target scripts, so that poor performance can be accurately obtained from several scripts.
  • the script acts as a target script and generates an alert notification corresponding to the target script and sends it to the administrator.
  • the embodiment of the present application further provides a database performance diagnosis apparatus, where the apparatus 400 includes: a first acquisition unit 401, a query unit 402, a first identification unit 403, and a generation unit. 404.
  • the first obtaining unit 401 is configured to acquire resource consumption rates of all scripts in the database.
  • the querying unit 402 is configured to query, in all scripts, a plurality of scripts whose resource consumption rate is greater than a preset resource consumption rate in a preset time.
  • the first identifying unit 403 is configured to identify one or more scripts in the plurality of scripts whose performance indicators are greater than a preset performance indicator as the target script.
  • the generating unit 404 is configured to generate an alarm notification corresponding to the target script and send it to the administrator.
  • the first obtaining unit 401 is specifically configured to: acquire CPU usage of all scripts in the database.
  • the query unit 402 is specifically configured to: query, in the script, a plurality of scripts whose CPU usage is greater than a preset CPU usage rate within a preset time.
  • the first obtaining unit 401 is further configured to: acquire a cumulative CPU time occupied by all scripts in the database.
  • the query unit 402 is further configured to: query, in all scripts, a plurality of scripts that occupy a CPU accumulated time in a preset time greater than a preset accumulated CPU cumulative time.
  • the embodiment of the present application further provides a database performance diagnosis apparatus, where the apparatus 500 includes: a first acquisition unit 501, a query unit 502, a second acquisition unit 503, and a first The calculation unit 504, the weighting processing unit 505, the first determination unit 506, the second identification unit 507, and the generation unit 508.
  • the first obtaining unit 501 is configured to acquire a resource consumption rate of all scripts in the database.
  • the querying unit 502 is configured to query, in all scripts, a plurality of scripts whose resource consumption rate is greater than a preset resource consumption rate in a preset time.
  • the second obtaining unit 503 is configured to acquire the number of executions of each of the several scripts in a preset time.
  • the first calculating unit 504 is configured to calculate an average response time of each of the plurality of scripts within a preset time.
  • the weighting processing unit 505 is configured to perform weighting processing on the execution times of the scripts and the average response time according to a preset rule to obtain a corresponding weighting threshold.
  • the first determining unit 506 is configured to determine whether the weighting threshold is greater than a preset threshold.
  • the second identifying unit 507 is configured to use one or more scripts whose weighting threshold is greater than a preset threshold as a target script.
  • the generating unit 508 is configured to generate an alarm notification corresponding to the target script and send it to the administrator.
  • the embodiment of the present application further provides a database performance diagnosis apparatus, where the apparatus 600 includes: a first acquisition unit 601, a query unit 602, a third acquisition unit 603, and a second The calculation unit 604, the second determination unit 605, the third identification unit 606, and the generation unit 607.
  • the first obtaining unit 601 is configured to acquire resource consumption rates of all scripts in the database.
  • the querying unit 602 is configured to query, in all scripts, a plurality of scripts whose resource consumption rate is greater than a preset resource consumption rate in a preset time.
  • the third obtaining unit 603 is configured to acquire the number of executions of each of the several scripts in a preset time.
  • the second calculating unit 604 is configured to calculate an average response time of each of the plurality of scripts within a preset time.
  • the second determining unit 605 is configured to determine whether the number of executions of each script and the average response time are greater than a preset range.
  • the third identifying unit 606 is configured to identify one or more scripts whose execution times and the average response time are greater than a preset range as the target script.
  • the generating unit 607 is configured to generate an alarm notification corresponding to the target script and send it to the administrator.
  • the above database performance diagnostic terminal can be implemented in the form of a computer program that can be run on the device as shown in FIG.
  • FIG. 9 is a schematic structural diagram of a database performance diagnosis device according to the present application.
  • the device 700 can include: an input device 701, an output device 702, a transceiver device 703, a memory 704, and a processor 705, wherein the input device 701 is configured to receive input data of an external access control device.
  • the input device 701 described in the embodiment of the present application may include a keyboard, a mouse, a photoelectric input device, a sound input device, a touch input device, a scanner, and the like.
  • the output device 702 is configured to output output data of the access control device to the outside.
  • the output device 702 described in this embodiment of the present application may include a display, a speaker, a printer, and the like.
  • the transceiver device 703 is configured to send data to or receive data from other devices through a communication link.
  • the transceiver 703 of the embodiment of the present application may include a transceiver device such as a radio frequency antenna.
  • the memory 704 can include a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium can store an operating system and store program instructions for implementing a database performance diagnostic method.
  • the internal memory provides an environment for the operation of program instructions in a non-volatile storage medium.
  • the processor 705 is used to provide computing and control capabilities to support the operation of the entire database performance diagnostic device.
  • the processor 705 can be caused to execute the above database performance diagnosis method.
  • the processor 705 is configured to run a program that implements a database performance diagnosis method stored in the memory 704 to perform the following operations: acquiring resource consumption rates of all scripts in the database; and querying preset time in all scripts A plurality of scripts that have an internal resource consumption rate greater than a preset resource consumption rate; and one or more scripts whose performance indicators are greater than a preset performance indicator in the plurality of scripts are identified as target scripts; and an alarm is generated correspondingly according to the target script Notify and send to the administrator.
  • the one or more scripts that identify performance indicators in the plurality of scripts that are greater than the preset performance indicators are used as target scripts, including: acquiring each of the plurality of scripts within a preset time The number of executions; calculating an average response time of each of the plurality of scripts within a preset time; performing the weighting on the number of executions of each script and the average response time according to a preset rule to obtain a corresponding weighting a threshold value; determining whether the weighting threshold is greater than a preset threshold; and using one or more scripts whose weighting threshold is greater than a preset threshold as a target script.
  • the one or more scripts that identify performance indicators in the plurality of scripts that are greater than the preset performance indicators are used as target scripts, including: acquiring each of the plurality of scripts within a preset time The number of executions; calculating an average response time of each of the plurality of scripts within a preset time; determining whether the number of executions of each script and the average response time are greater than a preset range; identifying the number of executions and One or more scripts whose average response time is greater than a preset range is used as the target script.
  • the resource consumption rate includes a CPU usage rate
  • the resource consumption rate of all scripts in the database is obtained, including: acquiring CPU usage of all scripts in the database; and querying the preset time in all scripts.
  • the number of scripts whose internal resource consumption rate is greater than the preset resource consumption rate includes: querying, in all scripts, several scripts whose CPU usage is greater than the preset CPU usage rate within a preset time.
  • the resource consumption rate includes a CPU accumulation time
  • the resource consumption rate of all the scripts in the database is obtained, including: acquiring a CPU cumulative time of all scripts in the database; and querying presets in all scripts A number of scripts in which the resource consumption rate is greater than the preset resource consumption rate, including: querying, in all scripts, a number of scripts that occupy a CPU cumulative time greater than a preset CPU occupation time in a preset time.
  • the embodiment of the database performance diagnostic device shown in FIG. 9 does not constitute a limitation on the specific configuration of the database performance diagnostic device.
  • the database performance diagnostic device may include more than the illustration. Or fewer parts, or combine some parts, or different parts.
  • the database performance diagnostic device may include only the memory and the processor. In such an embodiment, the structure and function of the memory and the processor are the same as those of the embodiment shown in FIG. 9, and details are not described herein again.
  • a computer readable storage medium storing one or more computer programs, the one or more computer programs being executable by one or more processors to perform the database performance diagnostics described above method.
  • the foregoing storage medium of the present application includes: a magnetic disk, an optical disk, a read-only memory (ROM), and the like, which can store various program codes.
  • the units in all the embodiments of the present application may be implemented by a general-purpose integrated circuit, such as a CPU (Central Processing Unit), or by an ASIC (Application Specific Integrated Circuit).
  • a general-purpose integrated circuit such as a CPU (Central Processing Unit), or by an ASIC (Application Specific Integrated Circuit).
  • the units in the apparatus of the embodiment of the present application may be combined, divided, and deleted according to actual needs.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

一种数据库性能诊断方法、装置、设备以及存储介质,其中所述方法包括:获取数据库中所有脚本的资源消耗率(S101);在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本(S102);识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本(S103);根据所述目标脚本相对应地生成告警通知并发送至管理员(S104)。该方法可以自动将导致数据库性能变差的脚本识别出来并将相应的告警通知发送给管理员,以便管理员及时地进行数据库优化、提高数据库性能诊断的效率。

Description

一种数据库性能诊断方法、装置、设备以及存储介质
本申请要求于2017年5月5日提交中国专利局、申请号为CN201710313807.4、申请名称为“一种数据库性能诊断方法、装置以及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及一种数据库性能诊断方法、装置、设备以及存储介质。
背景技术
目前,由于数据库中存储了机密数据,因此一般只有数据库管理人员有权限查询和管理数据库。当数据库异常时,数据库应用运维人员因为权限问题无法及时获取数据库相对应的脚本资源,进而无法快速诊断出导致数据库异常的原因,故无法及时解决数据库异常问题,此时数据库应用运维人员需要通过数据库管理人员来获取数据库的脚本资源,再进行诊断和修复,因此导致了数据库性能诊断效率低,并且数据库异常问题无法及时得到解决。
发明内容
本申请实施例提供一种数据库性能诊断方法、装置、设备以及存储介质,可以自动将导致数据库性能变差的脚本识别出来并发送相应的告警通知给管理员,以便管理员及时地进行数据库优化、提高了数据库性能诊断的效率。
一方面,本申请实施例提供了一种数据库性能诊断方法,该方法包括:获取数据库中所有脚本的资源消耗率;在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本;识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本;根据所述目标脚本相对应地生成告警通知并发送至管理员。
另一方面,本申请实施例提供了一种数据库性能诊断装置,该装置包括:第一获取单元,用于获取数据库中所有脚本的资源消耗率;查询单元,用于在 所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本;第一识别单元,用于识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本;生成单元,用于根据所述目标脚本相对应地生成告警通知并发送至管理员。
又一方面,本申请实施例提供了一种数据库性能诊断设备,所述设备包括:存储器以及处理器;存储器,用于存储实现数据库性能诊断的程序;处理器,用于运行所述存储器中存储的程序,以执行以下操作:获取数据库中所有脚本的资源消耗率;在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本;识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本;根据所述目标脚本相对应地生成告警通知并发送至管理员。
再一方面,本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者一个以上计算机程序,所述一个或者一个以上计算机程序可被一个或者一个以上的处理器执行,以实现如下步骤:获取数据库中所有脚本的资源消耗率;在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本;识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本;根据所述目标脚本相对应地生成告警通知并发送至管理员。
本申请实施例可以自动将导致数据库性能变差的脚本识别出来并将相应的告警通知发送给管理员,以便管理员及时地进行数据库优化、提高数据库性能诊断的效率。
附图说明
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的一种数据库性能诊断方法的示意流程图。
图2是本申请实施例提供的一种数据库性能诊断方法中样本脚本CPU使用率曲线分布情况的一示意图。
图3是本申请实施例提供的一种数据库性诊断方法中样本脚本占用CPU累计时间曲线分布情况的一示意图。
图4是本申请另一实施例提供的一种数据库性能诊断方法的示意流程图。
图5是本申请另一实施例提供的一种数据库性能诊断方法的示意流程图。
图6是本申请实施例提供的一种数据库性能诊断装置的示意性框图。
图7是本申请实施例提供的一种数据库性能诊断装置的另一示意性框图。
图8是本申请实施例提供的一种数据库性能诊断装置的另一示意性框图。
图9是本申请实施例提供的一种数据库性能诊断设备的结构组成示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
请参阅图1,图1是本申请实施例一提供的一种数据库性能诊断方法的示意流程图。如图1所示,该方法的步骤包括S101~S104。
S101,获取数据库中所有脚本的资源消耗率。在本申请实施例中,数据库中脚本的资源消耗率可以是脚本的CPU使用率,也可以是脚本占用CPU累计时间;如果所述资源消耗率为CPU使用率,则获取数据库中所有脚本的CPU使用率,如果所述资源消耗率为占用CPU累计时间,则获取数据库中所有脚本占用CPU累计时间;其中,装置通过查看CPU使用情况获取脚本的CPU使用率和占用CPU累计时间。例如图2所示,在装置中,当前数据库的所有脚本包括脚本a、脚本b、脚本c、脚本d,在预设时间段M内,装置获取脚本a的CPU使用率为A1,脚本b的CPU使用率为B1、脚本c的CPU使用率为C1,脚本d的CPU使用率为D1;其中,预设的时间段M可以是半个小时,也可以是一个小时,在此不作限定。例如图3所示,在装置中,当前数据库的所有脚本包括脚本a、脚本b、脚本c、脚本d,在预设时间段N内,装置获取脚本a的占用CPU累计时间为A2、脚本b的占用CPU累计时间为B2、脚本c的占用CPU累计时间为C2、脚本D的占用CPU累计时间为D2;其中,预设的时间段N可以是半个小时,也可以是一个小时,在此不作限定。
S102,在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本。在本申请实施例中,如果所述资源消耗率为CPU使用率,则在所有脚本中查询预设时间内CPU使用率大于预设CPU使用率的若干脚本;如果所述资源消耗率为占用CPU累计时间,则在所有脚本中查询预设时间内占用CPU累计时间大于预设占用CPU累计时间的若干个脚本;其中,所述预设时间可以是十分钟,可以是半个小时,也可以是一个小时,具体的预设时间可以由用户自行设置,在此不作限定。需要说明的是,所述预设的资源消耗率可以由用户自行设置,例如,如果所述资源消耗率为CPU使用率,用户可以设置预设的CPU使用率为60%,也可以设置预设的CPU使用率为80%,具体的预设的CPU使用率在此不作限定;如图2所示,在预设时间段M内,如果用户设置预设的CPU使用率为60%,则在当前数据库的所有脚本如脚本a、脚本b、脚本c、脚本d中,CPU使用率大于预设的CPU使用率的脚本包括脚本b和脚本c;如果所述资源消耗率为占用CPU累计时间,用户可以设置预设的占用CPU累计时间为2h(两个小时),也可以设置其它的预设占用CPU累计时间,具体的预设的占用CPU累计时间由用户自行设置,在此不作限定;如图3所示,在预设时间段N内,如果用户设置预设的占用CPU累计时间为2h,则在当前数据库的所有脚本如脚本a、脚本b、脚本c、脚本d中,占用CPU累计时间大于预设占用CPU累计时间的脚本包括脚本b和脚本c。
S103,识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本。在本申请实施例中,所述若干个脚本中的每个脚本在装置CPU中运行存在两个执行指标,包括执行次数以及平均响应时间,其中执行次数指的是脚本在CPU中的运算次数,平均响应时间指的是脚本在CPU中从初始状态到运行状态所需要的时间的平均值,此外,在CPU中脚本的执行次数以及平均响应时间是判断数据库发生异常的主要因素;将脚本在CPU中的执行次数作为第一性能指标,将脚本在CPU中的平均响应时间作为第二性能指标,综合考虑第一性能指标和第二性能指标的结果作为所述脚本的性能指标,其中,可以先单独考虑第一性能指标和第二性能指标并分别得出结果,再将第一性能指示和第二性能指标单独考虑的结果综合起来得到最终的性能指标,也可以通过设置关系式的形式综合考虑第一性能指标和第二性能指标并得到结果作为最终的性能指标。需要说明的是,所述预设性能指标可以由用户根据综合考虑第 一性能指标和第二性能指标的结果自行设置,在此不作限定;综合考虑脚本的执行次数以及平均响应时间的影响是因为执行次数高或者平均响应时间高不一定表示该脚本的性能指标差,此外,通过将所述若干脚本中每个脚本的性能指标与预设的性能指标进行比较,并将识别出的目标脚本定义为性能指标较差的脚本,所识别出的性能指标较差的脚本可以是一个或者多个脚本。
S104,根据所述目标脚本相对应地生成告警通知并发送至管理员。在本申请实施例中,由于所识别出的目标脚本表示当前数据库中性能较差的脚本,而在数据库异常情况中性能较差的脚本往往是导致数据库出现异常的根据原因,因此所识别出的目标脚本便是导致数据库出现异常的原因。具体地,将所述目标脚本包括脚本的执行次数、平均响应时间、脚本在当前数据库中的位置等信息生成告警通知发送给管理员;由于在告警通知中记录了出现异常的目标脚本的详细信息,因此管理员可以通过该告警通知及时了解到导致数据库异常的原因,并针对相对应的异常以及该告警通知中的详细信息及时做出解决问题的方案并对数据库进行优化,其中,管理员可以是当前数据库的管理员,可以是当前数据库的运维人员,也可以是维护数据库的相关人员,所述告警通知可以通过邮件的形式发送至管理员的邮箱中,另外,在实际应用中所述告警通知的发送形式在此不作限定。
由以上可见,本申请实施例通过获取数据库中所有脚本的资源消耗率,在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本,识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本,根据所述目标脚本相对应地生成告警通知并发送至管理员,可以自动将导致数据库性能变差的脚本识别出来并将相应的告警通知发送给管理员,以便管理员及时地进行数据库优化、提高数据库性能诊断的效率。
请参阅图4,图4是本申请实施例二提供的一种数据库性能诊断方法的示意流程图。如图4所示,该方法的步骤包括S201~S208。
S201,获取数据库中所有脚本的资源消耗率。
S202,在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本。
S203,获取所述若干个脚本中每个脚本在预设时间内的执行次数。在本申请实施例中,所述执行次数作为脚本在装置CPU中运行的执行指标,装置可以 通过脚本在CPU中的使用情况获取在预设时间内所述脚本的执行次数,其中,该预设时间可以是半个小时,也可以是一个小时,具体的预设时间可以由用户自行设置,在此不作限定。
S204,计算所述若干个脚本中每个脚本在预设时间内的平均响应时间。在本申请实施例中,所述平均响应时间指的是脚本在CPU中从初始状态到运行状态所需要的时间的平均值,装置可以通过设置预设时间,并记录下在该预设时间内每次执行脚本时所需要的时间,根据所记录下的时间计算多次执行脚本时所需要的平均时间作为该平均响应时间;其中,所述预设时间可以是半个小时,也可以是一个小时,具体的预设时间可以由用户自行设置,在此不作限定。
S205,对各脚本的所述执行次数以及所述平均响应时间按照预设规则进行加权处理得到相对应的加权阈值。在本申请实施例中,装置后台会将各脚本的所述执行次数和平均响应时间进行加权计算得出相对应的加权阈值,其中,用户可以自行定义权重比例,计算方法可以为:针对执行次数设置权重为0.8,再进行加权计算得到执行次数的加权值,针对平均响应时间设置权重为0.2,再进行加权计算得出平均响应时间的加权值,那么执行次数和平均响应时间二者的加权值之和即为所述加权阈值,该加权阈值用于衡量脚本对数据库性能的影响度,其中,加权阈值越大、与该加权阈值相对应的脚本对数据库性能的影响度就越大、相对应的脚本则为当前数据库中性能较差的脚本。
S206,判断所述加权阈值是否大于预先设置的阈值。在本申请实施例中,装置后台会预存有预设阈值,预存的预设阈值可以由用户自行设定,当判断所述加权阈值大于该预设阈值时,则相对应的脚本为当前数据库中性能较差的脚本;当判断所述加权阈值小于该预设阈值时,则相对应的脚本不是当前数据库中性能较差的脚本。
S207,将所述加权阈值大于预先设置的阈值的一个或者多个脚本作为目标脚本。在本申请实施例中,若判断所述加权阈值大于预设的阈值,相对应的脚本为当前数据库中性能较差的脚本,将这种脚本作为目标脚本。
S208,根据所述目标脚本相对应地生成告警通知并发送至管理员。
由以上可见,本申请实施例通过获取所述若干个脚本中每个脚本在预设时间内的执行次数,并计算每个脚本的平均响应时间,再对各脚本的所述执行次数以及所述平均响应时间按照预设规则进行加权处理得到相对应的加权阈值, 若所述加权阈值大于预先设置的阈值,将所述加权阈值大于预先设置的阈值的一个或者多个脚本作为目标脚本,从而可以准确地从若干个脚本中获得性能较差的脚本作为目标脚本,并将该目标脚本相对应地生成告警通知并发送至管理员。
请参阅图5,图5是本申请实施例三提供的一种数据库性能诊断方法的示意流程图。如图5所示,该方法的步骤包括S301~S307。
S301,获取数据库中所有脚本的资源消耗率。
S302,在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本。
S303,获取所述若干个脚本中每个脚本在预设时间内的执行次数。在本申请实施例中,所述执行次数作为脚本在装置CPU中运行的执行指标,装置可以通过脚本在CPU中的使用情况获取在预设时间内所述脚本的执行次数,其中,该预设时间可以是半个小时,也可以是一个小时,具体的预设时间可以由用户自行设置,在此不作限定。
S304,计算所述若干个脚本中每个脚本在预设时间内的平均响应时间。在本申请实施例中,所述平均响应时间指的是脚本在CPU中从初始状态到运行状态所需要的时间的平均值,装置可以通过设置预设时间,并记录下在该预设时间内每次执行脚本时所需要的时间,根据所记录下的时间计算多次执行脚本时所需要的平均时间作为该平均响应时间;其中,所述预设时间可以是半个小时,也可以是一个小时,具体的预设时间可以由用户自行设置,在此不作限定。
S305,判断各脚本的所述执行次数以及平均响应时间是否大于预先设置的范围。在本申请实施例中,预先设置所述执行次数的范围以及平均响应时间的范围,预先设置的范围可以由用户自行设定。若所述若干个脚本中每个脚本的执行次数落入预先设置的范围,与该执行次数相对应的脚本不是当前数据库中性能较差的脚本;若所述若干个脚本中每个脚本的执行次数大于预先设置的范围,与该执行次数相对应的脚本为当前数据库中性能较差的脚本。
S306,识别出所述执行次数以及平均响应时间大于预先设置的范围的一个或者多个脚本作为目标脚本。
S307,根据所述目标脚本相对应地生成告警通知并发送至管理员。
由以上可见,本申请实施例通过获取所述若干个脚本中每个脚本在预设时 间内的执行次数,并计算每个脚本的平均响应时间,判断各脚本的所述执行次数以及平均响应时间是否大于预先设置的范围,若所述执行次数以及平均响应时间大于预先设置的范围,识别出相对应的一个或者多个脚本作为目标脚本,从而可以准确地从若干个脚本中获得性能较差的脚本作为目标脚本,并将该目标脚本相对应地生成告警通知并发送至管理员。
请参阅图6,对应上述一种数据库性能诊断方法,本申请实施例还提出一种数据库性能诊断装置,该装置400包括:第一获取单元401、查询单元402、第一识别单元403、生成单元404。
其中,所述第一获取单元401,用于获取数据库中所有脚本的资源消耗率。查询单元402,用于在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本。第一识别单元403,用于识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本。生成单元404,用于根据所述目标脚本相对应地生成告警通知并发送至管理员。其中,所述第一获取单元401具体用于:获取数据库中所有脚本的CPU使用率。所述查询单元402具体用于:在所述脚本中查询预设时间内CPU使用率大于预设CPU使用率的若干个脚本。所述第一获取单元401还具体用于:获取数据库中所有脚本占用CPU累计时间。所述查询单元402还具体用于:在所有脚本中查询预设时间内占用CPU累计时间大于预设占用CPU累计时间的若干个脚本。
请参阅图7,对应上述一种数据库性能诊断方法,本申请实施例还提一种数据库性能诊断装置,该装置500包括:第一获取单元501、查询单元502、第二获取单元503、第一计算单元504、加权处理单元505、第一判断单元506、第二识别单元507、生成单元508。
其中,所述第一获取单元501,用于获取数据库中所有脚本的资源消耗率。查询单元502,用于在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本。第二获取单元503,用于获取所述若干个脚本中每个脚本在预设时间内的执行次数。第一计算单元504,用于计算所述若干个脚本中每个脚本在预设时间内的平均响应时间。加权处理单元505,用于对各脚本的所述执行次数以及所述平均响应时间按照预设规则进行加权处理得到相对应的加权阈值。第一判断单元506,用于判断所述加权阈值是否大于预先设置的阈值。第二识别单元507,用于将所述加权阈值大于预先设置的阈值的一个或者多个脚本作为目 标脚本。生成单元508,用于根据所述目标脚本相对应地生成告警通知并发送到管理员。
请参阅图8,对应上述一种数据库性能诊断方法,本申请实施例还提出一种数据库性能诊断装置,该装置600包括:第一获取单元601、查询单元602、第三获取单元603、第二计算单元604、第二判断单元605、第三识别单元606、生成单元607。
其中,所述第一获取单元601,用于获取数据库中所有脚本的资源消耗率。查询单元602,用于在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本。第三获取单元603,用于获取所述若干个脚本中每个脚本在预设时间内的执行次数。第二计算单元604,用于计算所述若干个脚本中每个脚本在预设时间内的平均响应时间。第二判断单元605,用于判断各脚本的所述执行次数以及平均响应时间是否大于预先设置的范围。第三识别单元606,用于识别出所述执行次数以及平均响应时间大于预先设置的范围的一个或者多个脚本作为目标脚本。生成单元607,用于根据所述目标脚本相对应地生成告警通知并发送至管理员。
上述数据库性能诊断终端可以实现为一种计算机程序的形式,计算机程序可以在如图9所示的设备上运行。
图9为本申请一种数据库性能诊断设备的结构组成示意图。如图9所示,该设备700可包括:输入装置701、输出装置702、收发装置703、存储器704以及处理器705,其中:所述输入装置701,用于接收外部访问控制设备的输入数据。具体实现中,本申请实施例所述的输入装置701可包括键盘、鼠标、光电输入装置、声音输入装置、触摸式输入装置、扫描仪等。所述输出装置702,用于对外输出访问控制设备的输出数据。具体实现中,本申请实施例所述的输出装置702可包括显示器、扬声器、打印机等。所述收发装置703,用于通过通信链路向其他设备发送数据或者从其他设备接收数据。具体实现中,本申请实施例的收发装置703可包括射频天线等收发器件。所述存储器704,可以包括非易失性存储介质和内存储器。非易失性存储介质可存储操作系统和存储用于实现数据库性能诊断方法的程序指令。内存储器为非易失性存储介质中的程序指令的运行提供环境。处理器705用于提供计算和控制能力,支撑整个数据库性能诊断设备的运行。上述程序指令被处理器705执行时,可使得处理器705 执行上述数据库性能诊断方法。具体地,所述处理器705,用于运行所述存储器704中存储的实现数据库性能诊断方法的程序,以执行如下操作:获取数据库中所有脚本的资源消耗率;在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本;识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本;根据所述目标脚本相对应地生成告警通知并发送至管理员。
在一个实施例中,所述识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本,包括:获取所述若干个脚本中每个脚本在预设时间内的执行次数;计算所述若干个脚本中每个脚本在预设时间内的平均响应时间;对各脚本的所述执行次数以及所述平均响应时间按照预设规则进行加权处理得到相对应的加权阈值;判断所述加权阈值是否大于预先设置的阈值;将所述加权阈值大于预先设置的阈值的一个或者多个脚本作为目标脚本。
在一个实施例中,所述识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本,包括:获取所述若干个脚本中每个脚本在预设时间内的执行次数;计算所述若干个脚本中每个脚本在预设时间内的平均响应时间;判断各脚本的所述执行次数以及平均响应时间是否大于预先设置的范围;识别出所述执行次数以及平均响应时间大于预先设置的范围的一个或者多个脚本作为目标脚本。
在一个实施例中,所述资源消耗率包括CPU使用率,所述获取数据库中所有脚本的资源消耗率,包括:获取数据库中所有脚本的CPU使用率;所述在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本,包括:在所有脚本中查询预设时间内CPU使用率大于预设CPU使用率的若干个脚本。
在一个实施例中,所述资源消耗率包括占用CPU累计时间,所述获取数据库中所有脚本的资源消耗率,包括:获取数据库中所有脚本占用CPU累计时间;所述在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本,包括:在所有脚本中查询预设时间内占用CPU累计时间大于预设占用CPU累计时间的若干个脚本。
本领域技术人员可以理解,图9中示出的数据库性能诊断设备的实施例并不构成对数据库性能诊断设备具体构成的限定,在其他实施例中,数据库性能诊断设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的 部件布置。例如,在一些实施例中,数据库性能诊断设备可以仅包括存储器及处理器,在这样的实施例中,存储器及处理器的结构及功能与图9所示实施例一致,在此不再赘述。
一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者一个以上计算机程序,所述一个或者一个以上计算机程序可被一个或者一个以上的处理器用来执行,以实现上述数据库性能诊断方法。
本申请前述的存储介质包括:磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等各种可以存储程序代码的介质。
本申请所有实施例中的单元可以通过通用集成电路,例如CPU(Central Processing Unit,中央处理器),或通过ASIC(Application Specific Integrated Circuit,专用集成电路)来实现。
本申请实施例方法中的步骤可以根据实际需要进行顺序调整、合并和删减。
本申请实施例装置中的单元可以根据实际需要进行合并、划分和删减。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。

Claims (20)

  1. 一种数据库性能诊断方法,其特征在于,所述方法包括:
    获取数据库中所有脚本的资源消耗率;
    在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本;
    识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本;
    根据所述目标脚本相对应地生成告警通知并发送至管理员。
  2. 如权利要求1所述的方法,其特征在于,所述识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本,包括:
    获取所述若干个脚本中每个脚本在预设时间内的执行次数;
    计算所述若干个脚本中每个脚本在预设时间内的平均响应时间;
    对各脚本的所述执行次数以及所述平均响应时间按照预设规则进行加权处理得到相对应的加权阈值;
    判断所述加权阈值是否大于预先设置的阈值;
    将所述加权阈值大于预先设置的阈值的一个或者多个脚本作为目标脚本。
  3. 如权利要求1所述的方法,其特征在于,所述识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本,包括:
    获取所述若干个脚本中每个脚本在预设时间内的执行次数;
    计算所述若干个脚本中每个脚本在预设时间内的平均响应时间;
    判断各脚本的所述执行次数以及平均响应时间是否大于预先设置的范围;
    识别出所述执行次数以及平均响应时间大于预先设置的范围的一个或者多个脚本作为目标脚本。
  4. 如权利要求1所述的方法,其特征在于,所述资源消耗率包括CPU使用率,所述获取数据库中所有脚本的资源消耗率,包括:
    获取数据库中所有脚本的CPU使用率;
    所述在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本,包括:
    在所有脚本中查询预设时间内CPU使用率大于预设CPU使用率的若干个 脚本。
  5. 如权利要求1所述的方法,其特征在于,所述资源消耗率包括占用CPU累计时间,所述获取数据库中所有脚本的资源消耗率,包括:
    获取数据库中所有脚本占用CPU累计时间;
    所述在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本,包括:
    在所有脚本中查询预设时间内占用CPU累计时间大于预设占用CPU累计时间的若干个脚本。
  6. 一种数据库性能诊断装置,其特征在于,所述装置包括:
    第一获取单元,用于获取数据库中所有脚本的资源消耗率;
    查询单元,用于在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本;
    第一识别单元,用于识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本;
    生成单元,用于根据所述目标脚本相对应地生成告警通知并发送至管理员。
  7. 如权利要求6所述的装置,其特征在于,所述第一识别单元,包括:
    第二获取单元,用于获取所述若干个脚本中每个脚本在预设时间内的执行次数;
    第一计算单元,用于计算所述若干个脚本中每个脚本在预设时间内的平均响应时间;
    加权处理单元,用于对各脚本的所述执行次数以及所述平均响应时间按照预设规则进行加权处理得到相对应的加权阈值;
    第一判断单元,用于判断所述加权阈值是否大于预先设置的阈值;
    第二识别单元,用于将所述加权阈值大于预先设置的阈值的一个或者多个脚本作为目标脚本。
  8. 如权利要求6所述的装置,其特征在于,所述第一识别单元,包括:
    第三获取单元,用于获取所述若干个脚本中每个脚本在预设时间内的执行次数;
    第二计算单元,用于计算所述若干个脚本中每个脚本在预设时间内的平均响应时间;
    第二判断单元,用于判断各脚本的所述执行次数以及平均响应时间是否大于预先设置的范围;
    第三识别单元,用于识别出所述执行次数以及平均响应时间大于预先设置的范围的一个或者多个脚本作为目标脚本。
  9. 如权利要求6所述的装置,其特征在于,所述资源消耗率包括CPU使用率,所述第一获取单元,具体用于:
    获取数据库中所有脚本的CPU使用率;
    所述查询单元,具体用于:
    在所述脚本中查询预设时间内CPU使用率大于预设CPU使用率的若干个脚本。
  10. 如权利要求6所述的装置,其特征在于,所述资源消耗率包括占用CPU累计时间,所述第一获取单元,具体用于:
    获取数据库中所有脚本占用CPU累计时间;
    所述查询单元具体用于:
    在所有脚本中查询预设时间内占用CPU累计时间大于预设占用CPU累计时间的若干个脚本。
  11. 一种数据库性能诊断设备,其特征在于,所述设备包括:存储器以及处理器;
    存储器,用于存储实现数据库性能诊断的程序;
    处理器,用于运行所述存储器中存储的程序,以执行以下操作:
    获取数据库中所有脚本的资源消耗率;
    在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本;
    识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本;
    根据所述目标脚本相对应地生成告警通知并发送至管理员。
  12. 如权利要求11所述的设备,其特征在于,所述识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本,包括:
    获取所述若干个脚本中每个脚本在预设时间内的执行次数;
    计算所述若干个脚本中每个脚本在预设时间内的平均响应时间;
    对各脚本的所述执行次数以及所述平均响应时间按照预设规则进行加权处理得到相对应的加权阈值;
    判断所述加权阈值是否大于预先设置的阈值;
    将所述加权阈值大于预先设置的阈值的一个或者多个脚本作为目标脚本。
  13. 如权利要求11所述的设备,其特征在于,所述识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本,包括:
    获取所述若干个脚本中每个脚本在预设时间内的执行次数;
    计算所述若干个脚本中每个脚本在预设时间内的平均响应时间;
    判断各脚本的所述执行次数以及平均响应时间是否大于预先设置的范围;
    识别出所述执行次数以及平均响应时间大于预先设置的范围的一个或者多个脚本作为目标脚本。
  14. 如权利要求11所述的设备,其特征在于,所述资源消耗率包括CPU使用率,所述获取数据库中所有脚本的资源消耗率,包括:
    获取数据库中所有脚本的CPU使用率;
    所述在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本,包括:
    在所有脚本中查询预设时间内CPU使用率大于预设CPU使用率的若干个脚本。
  15. 如权利要求11所述的设备,其特征在于,所述资源消耗率包括占用CPU累计时间,所述获取数据库中所有脚本的资源消耗率,包括:
    获取数据库中所有脚本占用CPU累计时间;
    所述在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本,包括:
    在所有脚本中查询预设时间内占用CPU累计时间大于预设占用CPU累计时间的若干个脚本。
  16. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有一个或者一个以上计算机程序,所述一个或者一个以上计算机程序可被一个或者一个以上的处理器执行,以实现如下步骤:
    获取数据库中所有脚本的资源消耗率;
    在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚 本;
    识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本;
    根据所述目标脚本相对应地生成告警通知并发送至管理员。
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本,包括:
    获取所述若干个脚本中每个脚本在预设时间内的执行次数;
    计算所述若干个脚本中每个脚本在预设时间内的平均响应时间;
    对各脚本的所述执行次数以及所述平均响应时间按照预设规则进行加权处理得到相对应的加权阈值;
    判断所述加权阈值是否大于预先设置的阈值;
    将所述加权阈值大于预先设置的阈值的一个或者多个脚本作为目标脚本。
  18. 如权利要求16所述的计算机可读存储介质,其特征在于,所述识别出所述若干个脚本中性能指标大于预设性能指标的一个或者多个脚本作为目标脚本,包括:
    获取所述若干个脚本中每个脚本在预设时间内的执行次数;
    计算所述若干个脚本中每个脚本在预设时间内的平均响应时间;
    判断各脚本的所述执行次数以及平均响应时间是否大于预先设置的范围;
    识别出所述执行次数以及平均响应时间大于预先设置的范围的一个或者多个脚本作为目标脚本。
  19. 如权利要求16所述的计算机可读存储介质,其特征在于,所述资源消耗率包括CPU使用率,所述获取数据库中所有脚本的资源消耗率,包括:
    获取数据库中所有脚本的CPU使用率;
    所述在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本,包括:
    在所有脚本中查询预设时间内CPU使用率大于预设CPU使用率的若干个脚本。
  20. 如权利要求16所述的计算机可读存储介质,其特征在于,所述资源消耗率包括占用CPU累计时间,所述获取数据库中所有脚本的资源消耗率,包括:
    获取数据库中所有脚本占用CPU累计时间;
    所述在所有脚本中查询预设时间内资源消耗率大于预设资源消耗率的若干个脚本,包括:
    在所有脚本中查询预设时间内占用CPU累计时间大于预设占用CPU累计时间的若干个脚本。
PCT/CN2018/082520 2017-05-05 2018-04-10 一种数据库性能诊断方法、装置、设备以及存储介质 WO2018201864A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710313807.4 2017-05-05
CN201710313807.4A CN107908532A (zh) 2017-05-05 2017-05-05 一种数据库性能诊断方法、装置以及设备

Publications (1)

Publication Number Publication Date
WO2018201864A1 true WO2018201864A1 (zh) 2018-11-08

Family

ID=61839947

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/082520 WO2018201864A1 (zh) 2017-05-05 2018-04-10 一种数据库性能诊断方法、装置、设备以及存储介质

Country Status (2)

Country Link
CN (1) CN107908532A (zh)
WO (1) WO2018201864A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763398B (zh) 2018-05-22 2021-08-17 腾讯科技(深圳)有限公司 数据库配置参数处理方法、装置、计算机设备和存储介质
CN110188116B (zh) * 2019-04-10 2020-11-10 口碑(上海)信息技术有限公司 核对脚本的处理方法及装置、存储介质、电子装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102609472A (zh) * 2012-01-18 2012-07-25 深圳市同洲视讯传媒有限公司 进行分布式数据库系统性能测试的方法及系统
US20140215271A1 (en) * 2013-01-28 2014-07-31 Hewlett-Packard Development Company, L.P. Allocating test capacity from cloud systems
CN104461856A (zh) * 2013-09-22 2015-03-25 阿里巴巴集团控股有限公司 基于云计算平台的性能测试方法、装置及系统
CN106407830A (zh) * 2015-07-29 2017-02-15 阿里巴巴集团控股有限公司 一种基于云的数据库的检测方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102609472A (zh) * 2012-01-18 2012-07-25 深圳市同洲视讯传媒有限公司 进行分布式数据库系统性能测试的方法及系统
US20140215271A1 (en) * 2013-01-28 2014-07-31 Hewlett-Packard Development Company, L.P. Allocating test capacity from cloud systems
CN104461856A (zh) * 2013-09-22 2015-03-25 阿里巴巴集团控股有限公司 基于云计算平台的性能测试方法、装置及系统
CN106407830A (zh) * 2015-07-29 2017-02-15 阿里巴巴集团控股有限公司 一种基于云的数据库的检测方法和装置

Also Published As

Publication number Publication date
CN107908532A (zh) 2018-04-13

Similar Documents

Publication Publication Date Title
US20200358826A1 (en) Methods and apparatus to assess compliance of a virtual computing environment
US9633552B2 (en) Methods, systems, and devices for managing, reprioritizing, and suppressing initiated alarms
US9246777B2 (en) Computer program and monitoring apparatus
JP2018506104A (ja) 計測されたソフトウェアを分析するためのデータストリーム処理言語
US9176798B2 (en) Computer-readable recording medium, failure prediction device and applicability determination method
US10896073B1 (en) Actionability metric generation for events
US9524223B2 (en) Performance metrics of a computer system
CN109960635B (zh) 实时计算平台的监控和报警方法、系统、设备及存储介质
CN113824768B (zh) 负载均衡系统中的健康检查方法及装置和流量转发方法
US9658908B2 (en) Failure symptom report device and method for detecting failure symptom
US20120185732A1 (en) Method of measuring and diagnosing misbehaviors of software components and resources
US11669374B2 (en) Using machine-learning methods to facilitate experimental evaluation of modifications to a computational environment within a distributed system
US10275303B2 (en) Mechanism for running diagnostic rules across multiple nodes
WO2018201864A1 (zh) 一种数据库性能诊断方法、装置、设备以及存储介质
US10237161B2 (en) System and method for dynamically testing networked target systems
CN110633165B (zh) 故障处理方法、装置、系统服务器及计算机可读存储介质
JP2015184818A (ja) サーバ、モデル適用可否判定方法およびコンピュータプログラム
US11181290B2 (en) Alarm processing devices, methods, and systems
US10255128B2 (en) Root cause candidate determination in multiple process systems
CN110851316A (zh) 异常预警方法及装置、系统、电子设备、存储介质
US20220107858A1 (en) Methods and systems for multi-resource outage detection for a system of networked computing devices and root cause identification
JP2016017917A (ja) 機器消費電力推定装置及びコンピュータプログラム
CN114513334A (zh) 风险管理方法和风险管理装置
US20240020172A1 (en) Preventing jitter in high performance computing systems
US20230048513A1 (en) Intelligent cloud service health communication to customers

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18794091

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 18/02/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18794091

Country of ref document: EP

Kind code of ref document: A1