Database performance monitoring method and related product
By using the statistical view and dynamic performance view of shared memory in the database, periodically compute and update performance indicators, the impact of database performance monitoring on load in the existing technology is solved, and the work efficiency of database and the reliability of performance analysis is improved. .
Patent Information
- Application Number
- CN202411046784.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-12-13
AI Technical Summary
Existing database performance monitoring methods will affect the database load, especially in high-frequency TPS queries, resulting in large frequency of database performance query and large load, affecting database efficiency.
The statistical view in shared memory is used to store the total processing volume of the set type events of the database, and calculate the performance indicators of the database according to the preset statistical cycle, update the performance indicators, and display them through the dynamic performance view to avoid the database hibernation and reduce the load impact.
It realizes monitoring and analysis of database performance, improves database work efficiency, reduces the impact on database load, and improves the reliability and flexibility of performance queries.
Smart Images

Figure CN119127635A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to a database performance monitoring method and related products. Background Art
[0002] The performance of a database can reflect the speed at which the database responds to user requests. Taking TPS (Transaction Per Second) and QPS (Queries Per Second) as examples, the larger the TPS of a database, the faster the database processes transactions, and the larger the QPS of a database, the faster the database processes SQL (Structured Query Language) statements. Therefore, in order to ensure the reliability of database operation, it is necessary to monitor the performance of the database to obtain the performance change trend of the database.
[0003] The performance monitoring method of the database in the prior art will have an impact on the load of the database. Taking the query of TPS as an example, the query method of the TPS of the database includes: firstly, querying the TPS of the database for the first time, then controlling the database to sleep for one second, and reducing the TPS of the database for the second time after one second; finally, calculating the difference between the TPS queried for the second time and the TPS queried for the first time.
[0004] Since each time the database TPS is queried, the database needs to be controlled to sleep for one second, it will affect the load on the database. The higher the query frequency of the database TPS, the greater the load on the database. Summary of the invention
[0005] The present invention provides a database performance monitoring method and related products, which are used to reduce the impact of database performance query on the database load, so as to achieve the purpose of improving the working efficiency of the database.
[0006] In particular, in a first aspect, the present invention provides a method for monitoring performance of a database, comprising:
[0007] After each completion of a set type of event, the total processing volume of the set type of events by the database is counted, and the total processing volume is stored in a data structure of the shared memory using a statistical view;
[0008] Acquiring a periodic variation of the set type of event from the statistical view according to a preset statistical period;
[0009] Calculating a set performance index of the database according to the periodic variation and the preset statistical period;
[0010] The set performance indicator is updated to measure the working efficiency of the database in processing the set type of event by using the set performance indicator.
[0011] Furthermore, the shared memory is also provided with a dynamic performance view for storing the set performance indicator, and after the setting performance indicator is updated, it also includes:
[0012] The dynamic performance view is updated according to the calculated set performance indicator.
[0013] Further, the dynamic performance view includes a first dynamic performance view and a second dynamic performance view, and the updating of the dynamic performance view according to the calculated set performance indicator includes:
[0014] storing the calculated set performance indicator in the first dynamic performance view;
[0015] Moving the set performance indicators stored in the first dynamic performance view and having a time interval with the current moment greater than a first preset time interval to the second dynamic performance view;
[0016] The set performance indicators stored in the second dynamic performance view and having a time interval with the current moment greater than a second preset time length are deleted.
[0017] Further, after the total processing amount is stored in the data structure of the shared memory using the statistical view, the method further includes:
[0018] After receiving the performance query instruction, determining the query target time period according to the set time in the performance query instruction;
[0019] Querying the processing volume of the set type of events by the database within the query target time period from the statistical view to obtain a target processing volume;
[0020] According to the target processing volume and the duration of the query target time period, a set performance index of the database at the set time is calculated.
[0021] Furthermore, before periodically acquiring the periodic variation of the set type of event from the statistical view according to the preset statistical period, the method further includes:
[0022] Obtain user configuration parameters of the database, and obtain the preset statistical period from the user configuration parameters.
[0023] Furthermore, before counting the total processing amount of the set type events by the database after each set type event is completed, the method further includes:
[0024] Obtaining user configuration parameters of the database, and determining whether to enable a performance indicator statistics function of the database according to the user configuration parameters;
[0025] If started, the step of counting the total processing volume of the set type events by the database after each set type event is completed is executed.
[0026] Furthermore, the set performance indicator is TPS, QPS, CPS, IOPS, data throughput per second, delay distribution per second or CPU utilization per second.
[0027] Furthermore, after the set performance indicator is periodically updated, the method further includes:
[0028] A line graph is generated according to the set performance indicator to display the performance change trend of the database.
[0029] In a second aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of any of the above-mentioned methods for monitoring database performance.
[0030] In a third aspect, the present invention further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of any of the above database performance monitoring methods.
[0031] The database performance monitoring method provided by the present invention can use the statistical view in the shared memory to store the total processing volume of the database for the set type of events, then obtain the periodic variation from the statistical view according to the preset statistical period, and calculate the set performance index of the database according to the periodic variation and the preset statistical period, so as to periodically update the set performance index of the database and realize the monitoring of the performance of the database. Due to the technical solution of the present invention, it is not necessary to control the database to sleep during the process of querying the set performance index of the database, so that it will not affect the load of the database, and can improve the working efficiency of the database.
[0032] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:
[0034] Figure 1is a schematic flow chart of a method for monitoring database performance according to an embodiment of the present invention;
[0035] Figure 2 It is a statistical view of SQL statements in a database performance monitoring method according to an embodiment of the present invention;
[0036] Figure 3 It is a statistical view of transactions in a database performance monitoring method according to an embodiment of the present invention;
[0037] Figure 4 is a schematic diagram of a first dynamic performance view in a database performance monitoring method according to an embodiment of the present invention;
[0038] Figure 5 is a line graph of the TPS of a database in a database performance monitoring method according to an embodiment of the present invention;
[0039] Figure 6 is a schematic flow chart of a database performance query in a database performance monitoring method according to an embodiment of the present invention.
[0040] Figure 7 is a schematic flow chart of a method for monitoring database performance according to another embodiment of the present invention;
[0041] Figure 8 is a schematic diagram of a computer program product according to an embodiment of the present invention;
[0042] Fig. 9 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention. DETAILED DESCRIPTION
[0043] Refer to the following Figures 1 to 9 To describe a database performance monitoring method and related products of an embodiment of the present invention. In the description of this embodiment, it should be understood that the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features, that is, include one or more of the features. In the description of the present invention, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. When a feature "includes or contains" one or some of the features it covers, unless otherwise specifically described, this indicates that other features are not excluded and may further include other features.
[0044] Figure 1 FIG. 1 is a schematic flow chart of a method for monitoring database performance according to an embodiment of the present invention. The method may generally include:
[0045] Step S102: after the database completes each event of the set type, the total processing volume of the database for the event of the set type is counted, and the total processing volume is stored in the data structure of the shared memory using a statistical view;
[0046] Step S104: according to a preset statistical period, obtaining the periodic variation of the set type of event from the statistical view in the shared memory;
[0047] Step S106: Calculating the set performance index of the database according to the acquired periodic variation and the preset statistical period;
[0048] Step S108: Update the set performance indicators of the database.
[0049] In the above step S102, the setting type event can be selected according to the performance to be monitored. For example, if the TPS or QPS of the database is to be monitored, the setting type event can be a transaction or an SQL statement, wherein the processing of a transaction includes executing a transaction, committing or rolling back a transaction, and after committing or rolling back a transaction, it is considered that a transaction is completed. The processing of an SQL statement includes parsing the SQL statement and generating an execution plan after receiving an SQL statement request, and then executing the query according to the execution plan, and after the query is completed, it is considered that a SQL statement is completed.
[0050] After each processing of a set type of event is completed, the total processing volume of the set type of event processed by the database is updated, and the updated result is stored in the statistical view of the shared memory for easy calling in subsequent execution steps.
[0051] In the above step S104, a timer may be used to obtain the periodic variation of the database processing set type events from the statistical view in the shared memory according to a preset statistical period. Specifically, it includes:
[0052] After the database is started, start the timer and obtain the timer duration;
[0053] Determine whether the timing duration of the timer is greater than or equal to the preset statistical period;
[0054] If so, the timing duration of the timer is reset to zero, and the periodic change in the database's processing of the set type of events is obtained from the statistical view in the shared memory. The periodic change refers to the number of set type events processed by the database in the time period between the last update of the set performance indicator of the database and the current moment.
[0055] Assuming that by querying the statistical view, it is obtained that the database's processing volume for the set type of events at the current moment is W1, and the database's processing volume for the set type of events before the preset statistical period is W0, then the periodic change in the database's processing of the set type of events at the current moment is △W=W1-W0.
[0056] Taking the setting type event as QPS as an example, suppose the statistical view used to store the amount of SQL statements processed by the database in the shared memory is sys_stat_sqlcount, then the statistical view can be queried through the following query instruction to obtain the total number of SQL statements processed by the database at the current moment:
[0057] select*from sys_stat_sqlcount;
[0058] like Figure 2 As shown, the query results obtained according to the above query instructions include the type sql_type, execution times and execution time of the SQL statement processed by the database at the current moment, wherein the types of SQL statements may include: DML (Data Manipulation Language), DDL (Data Definition Language), DCL (Data Control Language), TCL (Transaction Control Language) and Other SQL.
[0059] For example, if the event type is transaction, and the statistical view used to store the amount of transactions processed by the database in the shared memory is sys_stat_transactions, then the statistical view can be queried through the following query command to obtain the total number of transactions completed by the database at the current moment:
[0060] select*from sys_stat_transactions;
[0061] like Figure 3 As shown, the query result obtained according to the above query instruction includes the transaction number datid, the committed transaction amount xact_commit and the rolled back transaction amount xact_rollback of the database completed at the current moment.
[0062] In the above step S106, the set performance index of the database refers to the efficiency of the database in processing set type events. Assuming that the preset statistical period is T, preferably 15 seconds, the set performance index P of the database at the current moment can be calculated as:
[0063] P=△W / T
[0064] In this embodiment, the set performance index of the database is calculated once every preset statistical period T.
[0065] In the above step S108, after the set performance index of the database at the current moment is calculated, the set performance index may be stored to monitor the performance of the database.
[0066] According to the above content, the database performance monitoring method in this embodiment can use a statistical view to store the total processing volume of the database for set type events, and periodically update the set performance indicators of the database according to the statistical view and the preset statistical period to monitor the performance of the database. Due to the technical solution of this embodiment, there is no need to control the database to sleep during the process of querying the set performance indicators of the database, so it will not affect the load of the database, and can improve the working efficiency of the database.
[0067] In some embodiments of the present invention, a dynamic performance view is also provided in the shared memory of the database, and the dynamic performance view is used to store set performance indicators of the database.
[0068] Accordingly, after updating the set performance index of the database in the above step S106, the following steps are further included:
[0069] The calculated set performance index is stored in the dynamic performance view in the shared memory to update the dynamic performance view.
[0070] In this embodiment, the set performance index stored in the dynamic performance view in the shared memory includes the data sampling start time begin time, sampling end time end time, preset statistical period interval, measurement item metric and measurement value value of the set performance index, as shown in Table 1, wherein the data types of the start time begin time and the end time end time are both timestamp(0), the data type of the preset statistical period interval is integer, and the data types of the measurement item metric and measurement value value of the set performance index are text and numeric respectively. Taking the TPS and QPS of the database as an example, the TPS and QPS of the database can be viewed through the dynamic performance view.
[0071] Field Name type illustrate begin_time timestamp(0) Sampling start time end_time timestamp(0) Sampling end time interval integer Preset duration metric text Measurement items value numeric Measurements
[0072] Table 1
[0073] Through the technical solution of this embodiment, a dynamic performance view can be used to display the set performance indicators of the database, so as to facilitate query and analysis of the set performance indicators of the database, thereby improving the reliability and convenience of monitoring the set performance indicators of the database.
[0074] In some embodiments of the present invention, the dynamic performance view in the shared memory of the database includes a first dynamic performance view and a second dynamic performance view, and the method for updating the dynamic performance view includes:
[0075] storing the calculated set performance index in the first dynamic performance view;
[0076] Acquire a set performance indicator in the first dynamic performance view whose interval with the current moment is greater than a first preset time length, move the set performance indicator to the second dynamic performance view, and delete the set performance indicator from the first dynamic performance view;
[0077] The set performance indicators in the second dynamic performance view whose interval with the current moment is greater than the second preset time length are deleted.
[0078] In this embodiment, the first dynamic performance view is sys_stat_metric, the second dynamic performance view is sys_stat_metric_history, the first preset time length is t1, and t1 is preferably 1 hour; the second preset time length is t2, and t2 is preferably 8 days.
[0079] Taking the TPS and QPS of the database as an example, the first dynamic performance view can be queried through the following command to obtain the set performance indicators of the database within the most recent first preset time period:
[0080] select*from sys_stat_metric order by begin_time desc;
[0081] After the query instruction, order by begin_time desc indicates that each TPS and QPS are sorted according to the sampling start time begin_time, and the first dynamic performance view obtained according to the query instruction is as follows: Figure 4 As shown, the performance of the database within a first preset time period before the current moment can be viewed through the first dynamic performance view.
[0082] In this embodiment, the first dynamic performance view and the second dynamic performance view have the same structure, and the second dynamic performance view can be queried in an analogous manner to the query method of the first dynamic performance view.
[0083] The technical solution of this embodiment adopts different dynamic performance views to store the set performance indicators of the database in different time periods. The first dynamic performance view can be used to view the performance of the database within a first preset time period before the current moment to understand the current performance data of the database; the second dynamic performance view can be used to view the performance of the database within a second preset time period before the current moment to understand the historical performance data of the database. And through the first dynamic performance view and the second dynamic performance view, a comprehensive statistical analysis of the performance of the database can be performed in different time dimensions to improve the comprehensiveness and reliability of the database performance analysis. In some embodiments of the present invention, the database performance monitoring method of the present invention is as follows: Figure 5 As shown, in the above step S102, after adopting the statistical view to store the obtained total processing amount of the database for the set type of event into the data structure of the shared memory, it also includes:
[0084] Step S202: Detect whether a performance query instruction is received;
[0085] If yes, execute step S204;
[0086] Step S204: determining a query target time period according to the set time in the received performance query instruction;
[0087] Step S206: querying the processing volume of the set type of events in the database within the query target time period from the statistical view in the shared memory, and taking the processing volume as the target processing volume;
[0088] Step S208: Calculate the set performance index of the database at the set time according to the above target processing volume and the duration of the query target time period.
[0089] Taking an application scenario as an example, if the performance query instruction received in the above step S202 is an instruction for querying the real-time performance of the database, the current moment is used as the set moment in the above step S204, and the set time period before the current moment is used as the query target time period; if the performance query instruction received in the above step S202 is an instruction for querying the performance of the database at a certain moment, the moment is used as the set moment in the above step S204, and the set time period before the set moment is used as the query target time period.
[0090] In this embodiment, it is assumed that the statistical view in the shared memory is tt_metric, and the statistical view stores the transaction processing volume of the data block and the SQL statement processing volume. In this embodiment, the instruction for querying the real-time TPS of the database is:
[0091] select*from tt_metric where metric='TPS'order by end_time desc limit1;
[0092] The command used to query the real-time QPS of the database is:
[0093] select*from tt_metric where metric='QPS'order by end_time desc limit1;
[0094] 'TPS'order by end_time desc limit 1
[0095] Assuming the above set time is 2024-03-21 13:44:30', the command for querying the TPS of the database at the set time is:
[0096] select*from tt_metric where metric='QPS'and end_time='2024-03-2113:44:30';
[0097] After obtaining the query target time period, the start time and the end time of the query target time period are obtained, and in the above step S206, the total processing volume U0 of the database for the set type of events at the start time of the query target time period and the total processing volume U1 of the set events at the end time of the query target time period are obtained from the statistical view in the shared memory, and based on the above total processing volume U0 and total processing volume U1, the target processing volume △U1=U1-U0 of the database for the set type of events within the query target time period is calculated.
[0098] Assuming that the duration of the above-mentioned set time period is T1, and the duration T1 is preferably 15 seconds, then in the above-mentioned step S208, the set performance index P1 of the database at the set time can be calculated as
[0099] P1=△U1 / T1
[0100] Through the technical solution of this embodiment, after receiving the user's performance query instruction, the target processing volume can be queried from the statistical view in the shared memory according to the performance query instruction, and the set performance indicators of the database at the target time can be calculated based on the target processing volume, thereby not only improving the reliability of performance monitoring of the database, but also improving the flexibility of the database.
[0101] In some embodiments of the present invention, before obtaining the periodic variation of the set type of event from the statistical view in the shared memory according to the preset statistical period in the above step S104, the following is further included:
[0102] Obtain user configuration parameters of the database, and obtain a preset statistical period based on the user configuration parameters.
[0103] Through the technical solution of this embodiment, the user can configure the update frequency of the database for the set performance indicators by setting the user configuration parameters of the database, thereby improving the configurability of the performance monitoring frequency of the database and improving the reliability of the database operation.
[0104] In some embodiments of the present invention, the performance monitoring method of the present invention further includes, before the above step S102:
[0105] Obtain the user configuration parameters of the database, and determine whether the database has started the performance indicator statistics function based on the user configuration parameters;
[0106] If it is started, the above step S102 is executed to count the total processing volume of the set type of events by the database after each processing of the set type of events is completed.
[0107] In this embodiment, the performance statistics switch track_real_stats can be set in the user configuration parameters of the database. The statistics switch track_real_stats is a configurable parameter of the database, and by setting the value of the statistics switch track_real_stats, it can be driven whether to start the performance indicator statistics function of the database.
[0108] For example, if the value of the statistical switch track_real_stats is 1, it is determined that the performance indicator statistical function of the database is started, so the above step S102 is executed, and the set performance indicators of the database are periodically updated; if the value of the statistical switch track_real_stats is 0, it is determined that the performance statistical function of the database is not started, so the set performance indicators of the database are not updated.
[0109] Through the technical solution of this embodiment, the user can determine whether to start the performance indicator statistics function of the database by configuring the database performance statistics switch track_real_stats, thereby improving the configurability of the database performance monitoring startup and improving the reliability of the database operation.
[0110] In some embodiments of the present invention, the performance indicators of the database include at least one of TPS, QPS, CPS (Connection Per Second, the number of connections established per second), IOPS (Input / Output Operations Per Second, the amount of data input / output per second), data throughput per second, delay distribution per second, and CPU utilization per second.
[0111] Through the technical solution of this embodiment, various performances of the database can be monitored to improve the reliability and completeness of the database performance monitoring.
[0112] In some embodiments of the present invention, after updating the set performance index of the database in the above step S106, the following further includes:
[0113] Generate a line chart based on the set performance indicators of the database to show the performance change trend of the database.
[0114] Taking TPS as an example, after each update of the TPS of the database, a performance report on the TPS of the database is generated according to the TPS, and a line graph on the TPS of the database is generated through the performance report. Figure 6 As shown, in this line chart, time is used as the horizontal axis and TPS value is used as the vertical axis, which can show the change trend of the TPS of the database.
[0115] Through the technical solution of this embodiment, the performance change trend of the database can be displayed through a line graph, so as to intuitively understand the change trend of the set performance indicators of the database, provide convenience for analyzing the performance of the database, and improve the reliability of performance monitoring of the database.
[0116] In some embodiments of the present invention, the process of the database performance monitoring method is as follows: Figure 7 As shown, the following steps are included:
[0117] Step S302: obtaining user configuration parameters of the database, and judging whether the database has started the performance indicator statistics function according to the user configuration parameters;
[0118] If yes, execute step S304;
[0119] Step S304: after the database completes each event of the set type, the total processing volume of the database for the event of the set type is counted, and the total processing volume is stored in the data structure of the shared memory using a statistical view;
[0120] Step S306: Determine whether a performance query instruction is received;
[0121] If yes, execute step S308; if no, execute step S314;
[0122] Step S308: according to a preset statistical period, obtaining the periodic variation of the set type of event from the statistical view in the shared memory;
[0123] Step S310: Calculating the set performance index of the database according to the acquired periodic variation and the preset statistical period;
[0124] Step S312: updating the set performance indicators of the database, and updating the dynamic performance view and generating a line chart according to the set performance indicators of the database;
[0125] Step S314: acquiring a set time according to the received performance query instruction, and taking a set time period before the set time as a query target time period;
[0126] Step S316: query the processing volume of the set type of events in the database within the query target time period from the statistical view in the shared memory, and use the processing volume as the target processing volume;
[0127] Step S318: Calculate the set performance index of the database at the target time according to the above target processing volume and the duration of the above target query time period.
[0128] The technical solution of this embodiment does not need to control the database to sleep during the process of querying the set performance indicators of the database, so it will not affect the load of the database and can improve the working efficiency of the database.
[0129] The flow chart provided by the present embodiment is not intended to indicate that the operation of the method will be performed in any particular order, or that all operations of the method are included in all every case. In addition, the method may include additional operations. Within the scope of the technical ideas provided by the present embodiment method, additional changes can be made to the above method.
[0130] It should be understood that in some embodiments, each part can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.
[0131] This embodiment also provides a computer program product 10 and a computer readable storage medium 20 . Figure 8 is a schematic diagram of a computer program product 10 according to an embodiment of the present invention, Fig. 9 is a schematic diagram of a computer-readable storage medium 20 according to an embodiment of the present invention. The computer program product 10 includes a computer program 11, which implements the steps of any of the above-mentioned database performance monitoring methods when executed by a processor 32. The computer-readable storage medium 20 stores the above-mentioned computer program 11, which implements the steps of any of the above-mentioned database performance monitoring methods when executed by a processor 32. The computer device 30 may include a memory 31, a processor 32, and a computer program 11 stored in the memory 31 and running on the processor 32.
[0132] The computer program 11 for performing the operation of the present invention may be an assembly instruction, an instruction set architecture (ISA) instruction, a machine instruction, a machine-related instruction, a microcode, a firmware instruction, a state setting data, a configuration data of an integrated circuit, or a source code or an object code written in any combination of one or more programming languages and process programming languages. The computer program 11 may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider via the Internet). In some embodiments, in order to perform various aspects of the present invention, an electronic circuit including, for example, a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA) may execute computer-readable program instructions by utilizing the state information of the computer-readable program instructions to personalize the electronic circuit.
[0133] In the description of this embodiment, the computer program product 10 is a related product including the computer program 11 .
[0134] For the purposes of the description of this embodiment, the computer-readable storage medium 20 is a tangible device capable of retaining and storing the computer program 11, which may be any device that can contain, store, communicate, propagate or transmit the program 11 for use with or in conjunction with an instruction execution system, device or apparatus. More specific examples (a non-exhaustive list) of the computer-readable storage medium 20 include the following: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, and any suitable combination of the foregoing.
[0135] At this point, those skilled in the art should recognize that, although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived based on the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.
Claims
1. A method for monitoring database performance, characterized in that: include: After each completion of a set type of event, the total processing volume of the set type of events by the database is counted, and the total processing volume is stored in a data structure of the shared memory using a statistical view; Acquiring a periodic variation of the set type of event from the statistical view according to a preset statistical period; Calculating a set performance index of the database according to the periodic variation and the preset statistical period; The set performance indicator is updated to measure the working efficiency of the database in processing the set type of event by using the set performance indicator.
2. The method for monitoring database performance according to claim 1, characterized in that: The shared memory is also provided with a dynamic performance view for storing the set performance index, and after the set performance index is updated, further comprising: The dynamic performance view is updated according to the calculated set performance indicator.
3. The database performance monitoring method according to claim 2, characterized in that: The dynamic performance view includes a first dynamic performance view and a second dynamic performance view, and the updating of the dynamic performance view according to the calculated set performance index includes: storing the calculated set performance indicator in the first dynamic performance view; Moving the set performance indicators stored in the first dynamic performance view and having a time interval with the current moment greater than a first preset time interval to the second dynamic performance view; The set performance indicators stored in the second dynamic performance view and having a time interval with the current moment greater than a second preset time length are deleted.
4. The method for monitoring database performance according to claim 1, characterized in that: After storing the total processing volume in the data structure of the shared memory using the statistical view, the method further includes: After receiving the performance query instruction, determining the query target time period according to the set time in the performance query instruction; Querying the processing volume of the set type of events by the database within the query target time period from the statistical view to obtain a target processing volume; According to the target processing volume and the duration of the query target time period, a set performance index of the database at the set time is calculated.
5. The method for monitoring database performance according to claim 1, characterized in that: Before periodically acquiring the periodic variation of the set type of event from the statistical view according to the preset statistical period, the method further includes: Obtain user configuration parameters of the database, and obtain the preset statistical period from the user configuration parameters.
6. The method for monitoring database performance according to claim 1, characterized in that: Before counting the total processing amount of the set type events by the database after each completion of the set type event, the method further includes: Obtaining user configuration parameters of the database, and determining whether to enable a performance indicator statistics function of the database according to the user configuration parameters; If started, the step of counting the total processing volume of the set type events by the database after each set type event is completed is executed.
7. The method for monitoring database performance according to claim 1, characterized in that: The set performance indicator is TPS, QPS, CPS, IOPS, data throughput per second, delay distribution per second or CPU utilization per second.
8. The method for monitoring database performance according to claim 1, characterized in that: After the set performance indicator is periodically updated, the method further includes: A line graph is generated according to the set performance indicator to display the performance change trend of the database.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the database performance monitoring method according to any one of claims 1 to 8 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the database performance monitoring method described in any one of claims 1 to 8 are implemented.
