Database monitoring method and device, model training method and device, equipment and storage medium

By using prediction models of embedded layer, linear attention layer and fully connected layer to process the operation data of cloud databases, the problems of low efficiency and low reliability of cloud database monitoring and management are solved, and higher prediction accuracy and database performance are achieved.

CN119883795APending Publication Date: 2025-04-25CHINA TELECOM CLOUD TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411791194.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The existing technology has problems of low efficiency and low reliability when monitoring and managing cloud databases, and it is difficult to track real-time changes in database operation status in a timely manner.

Method used

By obtaining the first data set of the target database and inputting it into a prediction model including an embedding layer, a linear attention layer and a fully connected layer for processing, the first prediction data matrix is ​​generated, thereby determining the prediction operation data of the target database at the second moment.

Benefits of technology

It improves the accuracy of predicted operation data, improves the efficiency and reliability of monitoring and management of database operation status, and thus improves the operation performance of database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883795A_ABST
    Figure CN119883795A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a database monitoring method and device, a model training method and device, equipment and a storage medium. The method comprises the steps of obtaining a first data set of a target database; inputting the first data set into a target prediction model; the target prediction model comprises an embedded layer, a linear attention layer and a full connection layer; obtaining a first time sequence feature matrix based on the first data set by using an embedding layer; acquiring a first weight matrix based on the first time sequence feature matrix by using a linear attention layer; obtaining a first prediction data matrix based on the first weight matrix by using the full connection layer; and determining first prediction operation data of the target database at the second moment according to the first prediction data matrix. According to the embodiment of the invention, the efficiency and reliability of the process of monitoring and managing the running state of the target database based on the first predicted running data are improved, and the running performance of the target database is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer technology, and in particular relates to a database monitoring method, a model training method, a device, a equipment and a storage medium. Background Art

[0002] With the rapid development of businesses in all walks of life, the amount of data continues to increase, and the data types have become more complex. In order to meet different business needs, a variety of database deployment methods have emerged. Among them, cloud databases have been widely used due to their many advantages such as elastic scalability, high availability and easy management.

[0003] In terms of dealing with changes in database load, cloud databases provide elastic scaling capabilities, but in actual applications, the speed and accuracy of automatic expansion and contraction are still insufficient to meet the needs of all load changes. In related technologies, in order to improve the performance of cloud databases, cloud database administrators usually need to spend a lot of time on database operation status monitoring and troubleshooting.

[0004] However, due to the limited energy of administrators, it is difficult to track the real-time changes in the database operation status and take corresponding measures in a timely manner, resulting in low efficiency and low reliability of related technologies in the process of monitoring and managing cloud databases. Summary of the invention

[0005] The embodiments of the present invention provide a database monitoring method, a model training method, an apparatus, a device and a storage medium to solve the problems of low efficiency and low reliability in the process of monitoring and managing cloud databases in related technologies.

[0006] In order to solve the above problems, in a first aspect, an embodiment of the present invention discloses a database monitoring method, the method comprising:

[0007] Acquire a first data set of a target database; the first data set includes first operation data of the target database at at least two first moments in a first time period;

[0008] Inputting the first data set into a target prediction model; the target prediction model comprises an embedding layer, a linear attention layer, and a fully connected layer connected in sequence;

[0009] Acquire a first time series feature matrix corresponding to the first data set based on the first data set by using the embedding layer;

[0010] Using the linear attention layer to obtain a first weight matrix corresponding to the first data set based on the first temporal feature matrix;

[0011] Obtaining a first prediction data matrix corresponding to the first data set using the fully connected layer based on the first weight matrix;

[0012] A first prediction data matrix output by the target prediction model is obtained, and first prediction operation data of the target database at a second moment is determined based on the first prediction data matrix; the second moment is a moment after the first moment.

[0013] In a second aspect, an embodiment of the present invention discloses a model training method, the method comprising:

[0014] Acquire an operation data sample set of a target database; the operation data sample set includes an operation data sample and a label sample corresponding to the operation data sample;

[0015] In each round of training, the prediction model to be trained is trained using the operation data sample to obtain second prediction operation data corresponding to the operation data sample;

[0016] Determine a loss value corresponding to the prediction model to be trained according to the second prediction operation data and the label sample;

[0017] The model parameters of the prediction model to be trained are adjusted according to the loss value, and the next round of training is performed until the loss value meets the preset conditions to obtain the target prediction model as described above.

[0018] In a third aspect, an embodiment of the present invention discloses a database monitoring device, the device comprising:

[0019] A first acquisition module is used to acquire a first data set of a target database; the first data set includes first operation data of the target database at least two first moments in a first time period;

[0020] An input module, configured to input the first data set into a target prediction model; the target prediction model comprises an embedding layer, a linear attention layer, and a fully connected layer connected in sequence;

[0021] A second acquisition module, configured to acquire a first time series feature matrix corresponding to the first data set based on the first data set by using the embedding layer;

[0022] A third acquisition module is used to acquire a first weight matrix corresponding to the first data set based on the first time series feature matrix using the linear attention layer;

[0023] A fourth acquisition module, configured to acquire a first prediction data matrix corresponding to the first data set based on the first weight matrix using the fully connected layer;

[0024] The first determination module is used to obtain a first prediction data matrix output by the target prediction model, and determine the first prediction operation data of the target database at a second moment according to the first prediction data matrix; the second moment is a moment after the first moment.

[0025] In a fourth aspect, an embodiment of the present invention discloses a model training device, the device comprising:

[0026] A fifth acquisition module is used to acquire an operation data sample set of a target database; the operation data sample set includes an operation data sample and a label sample corresponding to the operation data sample;

[0027] A training module, used to train the prediction model to be trained using the operation data sample in each round of training to obtain second prediction operation data corresponding to the operation data sample;

[0028] A second determination module, used to determine the loss value corresponding to the prediction model to be trained according to the second prediction operation data and the label sample;

[0029] The training module is also used to adjust the model parameters of the prediction model to be trained according to the loss value, and perform the next round of training until the loss value meets the preset conditions to obtain the target prediction model as described above.

[0030] In the fifth aspect, an embodiment of the present invention further discloses an electronic device, which includes a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store executable instructions, and the executable instructions enable the processor to execute the database monitoring method as described above, or execute the model training method as described above.

[0031] An embodiment of the present invention further discloses a readable storage medium. When instructions in the readable storage medium are executed by a processor of an electronic device, the processor is enabled to execute the database monitoring method as described above, or to execute the model training method as described above.

[0032] The embodiments of the present invention include the following advantages:

[0033] The database monitoring method provided by the embodiment of the present invention obtains a first data set of the target database and inputs the first data set into a target prediction model. In the process of using the target prediction model to process at least two first operating data with a time series relationship in the first data set to obtain a first prediction data matrix corresponding to the first data set, the method fully considers the influence of the time series relationship between the first operating data on the operating data of the target database, so that the first predicted operating data of the target database at the second moment determined according to the first prediction data matrix output by the target prediction model is closer to the actual operating data of the target database at the second moment, thereby improving the accuracy of the first predicted operating data obtained by the embodiment of the present invention, improving the efficiency and reliability of the process of monitoring and managing the operating status of the target database based on the first predicted operating data, and being conducive to improving the operating performance of the target database. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0035] Figure 1 is a flowchart of the steps of a database monitoring method provided by an embodiment of the present invention;

[0036] Figure 2 is a schematic diagram of the structure of a target prediction model provided by an embodiment of the present invention;

[0037] Figure 3 is a schematic diagram of a first time series characteristic matrix provided by an embodiment of the present invention;

[0038] Figure 4 is a flowchart of the steps of a model training method provided by an embodiment of the present invention;

[0039] Figure 5 is a schematic diagram of the structure of a prediction model to be trained provided by an embodiment of the present invention;

[0040] Figure 6 is a logic block diagram of an electronic device provided by an embodiment of the present invention;

[0041] Figure 7 is a flowchart of another database monitoring method provided by an embodiment of the present invention;

[0042] Figure 8 It is a logic block diagram of a database monitoring device provided by an embodiment of the present invention;

[0043] Fig. 9 It is a logic block diagram of a model training device provided by an embodiment of the present invention;

[0044] Fig.10 It is a structural block diagram of an electronic device for database monitoring and / or model training provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0046] Method Embodiment

[0047] Reference Figure 1 , shows a flowchart of a database monitoring method provided by an embodiment of the present invention, and the method may specifically include the following steps:

[0048] Step S101, obtaining a first data set of a target database; the first data set includes first operating data of the target database at at least two first moments in a first time period.

[0049] Step S102: input the first data set into a target prediction model; the target prediction model includes an embedding layer, a linear attention layer, and a fully connected layer connected in sequence.

[0050] Step S103: using the embedding layer to obtain a first time series feature matrix corresponding to the first data set based on the first data set.

[0051] Step S104: Using the linear attention layer, based on the first time series feature matrix, obtain a first weight matrix corresponding to the first data set.

[0052] Step S105: using the fully connected layer to obtain a first prediction data matrix corresponding to the first data set based on the first weight matrix.

[0053] Step S106, obtaining a first prediction data matrix output by the target prediction model, and determining first prediction operation data of the target database at a second moment according to the first prediction data matrix; the second moment is a moment after the first moment.

[0054] The database monitoring method provided in an embodiment of the present invention can be applied to a first electronic device installed with a target prediction model, and the first electronic device may include but is not limited to a smart terminal, a computer, a personal digital assistant (PDA), a tablet computer, a vehicle-mounted device, etc.

[0055] In an embodiment of the present invention, the first electronic device can collect the operation data of the target database according to a preset collection cycle, and store the operation data in a preset storage area according to a one-to-one correspondence between the operation data and the collection time. Among them, the value of the preset collection cycle can be determined according to the monitoring requirements of the target database; specifically, the preset collection cycle can be 1 second (s), 30s, 1 minute (min), 2min, 5min, etc. Among them, the preset storage area can be a local storage area of ​​the first electronic device, or a non-local storage area accessible to the first electronic device. In addition, the first electronic device can also regularly clean up the operation data stored in the preset storage area based on the "first in first out" principle according to the collection time of the operation data in the preset storage area according to the preset processing cycle.

[0056] The operation data of the target database refers to the real-time operation load data of the target database; specifically, the operation data of the target database may include but is not limited to: disk input / output (I / O) occupancy, memory occupancy, central processing unit (CPU) occupancy, network throughput and number of session connections, etc.

[0057] Among them, the first operating data and the first predicted operating data in the embodiment of the present invention are both operating data of the target database; specifically, the first operating data are operating data of the target database at the first moment collected by the first electronic device according to a preset collection period; the first predicted operating data are operating data of the target database at the second moment predicted by the first electronic device using a target prediction model.

[0058] In step S101, the first electronic device first determines a first time period and a first moment within the first time period; then, based on a one-to-one correspondence between the operation data and the collection moment, obtains the operation data corresponding to the first moment from a preset storage area, and determines the operation data corresponding to the first moment as the first operation data of the target database at the first moment; finally, determines a set consisting of each first operation data as the first data set of the target database.

[0059] The first time period is the time period before the moment t when the first electronic device executes step S101; the first time period may include the moment t when the first electronic device executes step S101, or may not include the moment t when the first electronic device executes step S101; if the first time period includes the moment t when the first electronic device executes step S101, the moment t when the first electronic device executes step S101 is used as the right end point value of the first time period. The first time period includes at least two first moments, and the time intervals between adjacent first moments are equal.

[0060] In some embodiments, the first moment in the first time period includes the endpoint values ​​on both sides of the first time period; exemplarily, the first time period is [tn, t], then the first moment in the first time period includes at least tn and t. In other embodiments, the first moment in the first time period includes the endpoint values ​​on both sides of the first time period and the middle value between the endpoint values ​​on both sides of the first time period; exemplarily, the first time period is [tn, t], then the first moment in the first time period includes at least tn, t, t-n+1, ​​t-n+2, etc.

[0061] The number of the first operating data in the first data set is equal to the number of the first moments in the first time period, and the number of the first operating data in the first data set is also at least 2.

[0062] In the embodiment of the present invention, the first operation data in the first data set may reflect the time sequence relationship between the first moments corresponding to the first operation data; specifically:

[0063] In some embodiments, the first operating data in the first data set may be arranged in a time sequence between first moments corresponding to the first operating data.

[0064] In some other embodiments, a time tag is set in the first operating data in the first data set, and the time tag is used to indicate a first time corresponding to the first operating data.

[0065] Specifically, the first data set can be expressed as: [x t-n ,x t-n+1 ,…,x t ]; where x i represents any first operating data in the first data set, and the value range of i is [tn, t-n+1, ​​…, t]. The first time period can be expressed as [tn, t-n+1, ​​…, t], and the first moment includes tn, t-n+1, ​​…, t; t represents the moment when the first electronic device executes step S101, and n+1 represents the number of first moments in the first time period, that is, the number of first operating data in the first data set.

[0066] In an embodiment of the present invention, when the first electronic device obtains the first data set through step S101, it can input the first data set into a pre-trained target prediction model through step S102 to perform operations corresponding to steps S103 to S105 using the target prediction model.

[0067] Reference Figure 2 , showing a schematic diagram of the structure of a target prediction model provided by an embodiment of the present invention; the target prediction model includes an embedding layer, a linear attention layer and a fully connected layer connected in sequence. Among them, the embedding layer is used to obtain a first time series feature matrix corresponding to the first data set based on the first data set in step S103, and input the first time series feature matrix into the linear attention layer; the linear attention layer is used to obtain a first weight matrix corresponding to the first data set based on the first time series feature matrix input by the embedding layer in step S104, and input the first weight matrix into the fully connected layer; the fully connected layer is used to obtain a first prediction data matrix corresponding to the first data set based on the first weight matrix input by the linear attention layer in step S105, and output the first prediction data matrix.

[0068] Specifically, in step S103, the first electronic device can use the embedding layer to extract the eigenvalues ​​corresponding to each first operating data in the first data set, and sort the eigenvalues ​​corresponding to the first operating data according to the time series relationship between the first moments corresponding to the first operating data, to obtain a high-dimensional feature representation matrix of each first operating data in the first data set, and determine the high-dimensional feature representation matrix as the first time series feature matrix corresponding to the first data set.

[0069] Among them, the first time series feature matrix includes the eigenvalues ​​corresponding to each first operating data in the first data set, and the first time series feature matrix can also reflect the time series relationship between the first moments corresponding to the first operating data, so that in step S104, the linear attention layer can fully consider the impact of the time series relationship between the first operating data on the operating data of the target database in the process of obtaining the first weight matrix, thereby improving the accuracy and rationality of the first weight matrix.

[0070] After the embedding layer obtains the first temporal feature matrix through step S103, the first temporal feature matrix is ​​input into the linear attention layer.

[0071] In step S104, the first electronic device uses the linear attention layer to calculate the attention distribution matrix based on the first time series feature matrix input by the embedding layer, and determines the calculated attention distribution matrix as the first weight matrix corresponding to the first data set. Specifically, the linear attention layer can obtain the first weight matrix corresponding to the first data set based on the first time series feature matrix by a calculation method of the attention distribution matrix known to those skilled in the art.

[0072] As an example, the attention distribution matrix is ​​calculated as follows:

[0073]

[0074] Where A represents the attention distribution matrix; Q represents the query matrix corresponding to the first temporal feature matrix; K represents the key matrix corresponding to the first temporal feature matrix; K T represents the transposed matrix of the key matrix; d represents the characteristic dimension of the first time series feature matrix.

[0075] When the linear attention layer obtains the first weight matrix through step S104, the first weight matrix is ​​input into the fully connected layer.

[0076] In an embodiment of the present invention, the fully connected layer includes a linear transformation layer and an activation function layer, and the linear transformation layer and the activation function layer are stacked to form a fully connected layer. Among them, the linear transformation layer is used to perform a linear transformation on the first weight matrix to capture the linear relationship between each feature in the first weight matrix to obtain an intermediate matrix; the activation function is used to activate the intermediate matrix outputted by the linear transformation to capture the nonlinear relationship between each feature in the intermediate matrix, thereby improving the expression ability of the first initial prediction data matrix outputted by the activation function layer.

[0077] Specifically, in step S105, after receiving the first weight matrix input by the linear attention layer, the fully connected layer first performs a linear transformation on the first weight matrix through the linear transformation layer to capture the linear relationship between each feature in the first weight matrix to obtain an intermediate matrix, and inputs the intermediate matrix to the activation function layer; then, the intermediate matrix is ​​activated through the activation function layer to capture the nonlinear relationship between each feature in the intermediate matrix to obtain a first prediction data matrix, and outputs the first prediction data matrix.

[0078] After obtaining the first prediction data matrix corresponding to the first data set through step S105, the target prediction model outputs the first prediction data matrix.

[0079] The first prediction data matrix includes the eigenvalues ​​corresponding to the first prediction operation data of the target database predicted by the target prediction model at the second moment, and the first prediction data matrix can also reflect the time series relationship between the eigenvalues ​​corresponding to the first prediction operation data.

[0080] In step S106, the first electronic device can obtain the first prediction data matrix output by the target prediction model, and determine the eigenvalues ​​corresponding to each second moment based on the time series relationship between the eigenvalues ​​in the first prediction data matrix; then, based on the eigenvalues ​​corresponding to the second moment, determine the first prediction operation data of the target database at the second moment.

[0081] It can be understood that the first predicted operating data includes the operating data of the target database at the second moment. Specifically, the first predicted operating data may include but is not limited to the disk input / output occupancy, memory occupancy, central processing unit occupancy, network throughput and number of session connections of the target database at the second moment.

[0082] It should be noted that the second moment is any moment after the first moment in the first time period. The number of the second moments is at least 1. When the number of the second moments is greater than 1, the time intervals between adjacent second moments are equal.

[0083] In some embodiments, after determining the first predicted operating data of the target database at the second moment in step S106 , the first electronic device may display the first predicted operating data of the target database at the second moment to the target database administrator through a display device.

[0084] In other embodiments, after the first electronic device determines the first predicted operating data of the target database at the second moment through step S106, it can organize the second moment and the first predicted operating data corresponding to the second moment into a target file of a preset format according to a one-to-one correspondence between the second moment and the first predicted operating data, and send the target file to a preset address, so that the target database administrator can obtain the target file from the preset address and obtain the first predicted operating data of the target database at the second moment from the target file.

[0085] In some other embodiments, after the first electronic device determines the first predicted operating data of the target database at the second moment through step S106, it may adjust the configuration parameters of the target database according to the first predicted operating data of the target database at the second moment and before the target database runs to the second moment, so that when the target database runs to the second moment, the configuration of the target database can meet the load requirement of the target database at the second moment, thereby improving the efficiency and accuracy of the process of monitoring and managing the operating status of the target database by the first electronic device based on the first predicted operating data, which is conducive to improving the operating performance of the target database.

[0086] Of course, after obtaining the first predicted operation data of the target database at the second moment, the target database administrator can also adjust the configuration parameters of the target database according to the first predicted operation data of the target database at the second moment, so that when the target database runs to the second moment, the configuration of the target database can meet the load requirement of the target database at the second moment.

[0087] The database monitoring method provided by the embodiment of the present invention obtains a first data set of the target database and inputs the first data set into a target prediction model. In the process of using the target prediction model to process at least two first operating data with a time series relationship in the first data set to obtain a first prediction data matrix corresponding to the first data set, the method fully considers the influence of the time series relationship between the first operating data on the operating data of the target database, so that the first predicted operating data of the target database at the second moment determined according to the first prediction data matrix output by the target prediction model is closer to the actual operating data of the target database at the second moment, thereby improving the accuracy of the first predicted operating data obtained by the embodiment of the present invention, improving the efficiency and reliability of the process of monitoring and managing the operating status of the target database based on the first predicted operating data, and being conducive to improving the operating performance of the target database.

[0088] In addition, the first electronic device can determine the first predicted operating data of the target database at each second moment in the future period of time based on the first prediction data matrix output by the target prediction model, and the first operating data in the first data set input into the target prediction model is encoded through the embedding layer, linear attention layer and fully connected layer of the target prediction model. No feature engineering is required, and it has end-to-end one-stop prediction capability for operating data. The first electronic device only needs to collect the first operating data during the operation of the target database and input it into the target prediction model, and use the target prediction model to automatically encode the first operating data and output the prediction result, which has high flexibility and availability.

[0089] Optionally, the step S103 of using the embedding layer to obtain a first time series feature matrix corresponding to the first data set based on the first data set includes:

[0090] Step S1031: extracting feature values ​​of the first operating data in the first data set by using the embedding layer.

[0091] Step S1032: Generate a first feature vector corresponding to the first operating data according to the feature value using the embedding layer.

[0092] Step S1033: using the embedding layer to sort the first feature vectors corresponding to the first operating data according to the temporal relationship between the first moments, to obtain a first temporal feature matrix corresponding to the first data set.

[0093] In the embodiment of the present invention, in the process of obtaining the first time series feature matrix corresponding to the first data set based on the first data set by using the embedding layer, the first electronic device specifically:

[0094] First, the first electronic device extracts the characteristic value of each first operating data in the first data set by using the embedding layer through step S1031; when the first operating data includes disk input / output occupancy, memory occupancy, central processing unit occupancy, network throughput and number of session connections, the characteristic value may include a first characteristic value for reflecting the disk input / output occupancy, a second characteristic value for reflecting the memory occupancy, a third characteristic value for reflecting the central processing unit occupancy, a fourth characteristic value for reflecting the network throughput and a fifth characteristic value for reflecting the number of session connections.

[0095] Then, the first electronic device arranges the eigenvalues ​​of the first operation data extracted in step S101 in a preset order by using the embedding layer in step S1032 to obtain a first eigenvector corresponding to the first operation data. As an example, the preset order is: first eigenvalue, third eigenvalue, second eigenvalue, fifth eigenvalue, fourth eigenvalue; as another example, the preset order is: first eigenvalue, second eigenvalue, third eigenvalue, fourth eigenvalue, fifth eigenvalue.

[0096] Through step S1032, the first electronic device can generate a first feature vector corresponding to each first operating data in the first data set.

[0097] Finally, the first electronic device executes step S1033. First, the embedding layer is used to determine the timing relationship between the first moments corresponding to each first operating data. Then, the embedding layer is used to arrange the first feature vectors corresponding to the first operating data in order from top to bottom according to the temporal sequence of the first moments corresponding to the first operating data, so as to obtain a first timing feature matrix.

[0098] In the first time series feature matrix, the first feature vectors serve as rows in the first time series feature matrix, and the feature values ​​corresponding to the same data type in the operating data in different first feature vectors constitute columns in the first time series feature matrix. The data types include disk input / output occupancy, memory occupancy, CPU occupancy, network throughput, and number of session connections.

[0099] The rows in the first time series feature matrix are arranged from top to bottom according to the time sequence between the first moments corresponding to the first operating data; it can be understood that, among the first moments corresponding to the first operating data, the first feature vector corresponding to the first moment with the earliest time sequence (that is, the first first moment in the first time period) is the first row of the first time series feature matrix, and the first feature vector corresponding to the first moment with the latest time sequence (that is, the last first moment in the first time period) is the last row of the first time series feature matrix.

[0100] The number of rows of the first time series feature matrix is ​​the same as the number of first operating data in the first data set; the number of columns of the first time series feature matrix is ​​the same as the number of eigenvalues ​​in the first eigenvector.

[0101] As an example, see Figure 3 , showing a schematic diagram of a first time series feature matrix provided by an embodiment of the present invention, the first data set includes first operating data 1 of the target database at the first moment 1, first operating data 2 of the target database at the first moment 2, first operating data 3 of the target database at the first moment 3, and first operating data 4 of the target database at the first moment 4; wherein, the time sequence between the first moments in the first time period is: first moment 1, first moment 2, first moment 3, first moment 4; it can be understood that the first moment 1 is the first first moment in the first time period, and the first moment 4 is the last first moment in the first time period.

[0102] The characteristic values ​​of the first operation data 1 extracted by the first electronic device in step S1031 include H 11 , H 12 , H 13 , H 14 and H 15 , the characteristic values ​​of the first operation data 2 include H 21 , H 22 , H23 , H 24 and H 25 , the characteristic values ​​of the first operation data 3 include H 31 , H 32 , H 33 , H 34 and H 35 , the characteristic values ​​of the first operation data 4 include H 41 , H 42 , H 43 , H 44 and H 45 .

[0103] The first characteristic vector corresponding to the first operating data 1 generated by the first electronic device in step S1032 is [H 11 ,H 12 ,H 13 ,H 14 ,H 15 ], the first eigenvector corresponding to the first running data 2 is [H 21 ,H 22 ,H 23 ,H 24 ,H 25 ], the first eigenvector corresponding to the first running data 3 is [H 31 ,H 32 ,H 33 ,H 34 ,H 35 ], the first eigenvector corresponding to the first running data 4 is [H 41 ,H 42 ,H 43 ,H 44 ,H 45 ].

[0104] The first electronic device obtains the first time series characteristic matrix through step S1033 as follows Figure 3 The matrix H shown in the figure shows that in the first time series feature matrix, the first eigenvector corresponding to the first moment 1 in the time sequence is [H 11 ,H 12 ,H 13 ,H 14 ,H 15 ] as the first row of the first time series feature matrix, the first feature vector corresponding to the first moment 4 at the end of the time sequence [H 41 ,H 42 ,H 43 ,H 44 ,H 45 ] as the last row of the first time series feature matrix.

[0105] In the database monitoring method provided by an embodiment of the present invention, when the first electronic device uses the embedding layer to obtain the first time series feature matrix, not only the eigenvalues ​​of the first operating data of the target database but also the time series relationship between the first moments corresponding to each first operating data is considered, so that the first time series feature matrix not only includes the eigenvalues ​​corresponding to each first operating data in the first data set, but also reflects the time series relationship of the first operating data, which is beneficial for the linear attention layer and the full connection in the target prediction model to efficiently extract the long-range information of the target database in the first time period based on the time series relationship of the first operating data, thereby improving the accuracy and reliability of the first predicted operating data of the target database at the second moment determined by the first electronic device based on the first predicted data matrix output by the target prediction model.

[0106] Optionally, the step S104 of using the linear attention layer to obtain a first weight matrix corresponding to the first data set based on the first temporal feature matrix includes:

[0107] Step S1041: Use the linear attention layer to obtain the query matrix and key matrix corresponding to the first temporal feature matrix.

[0108] Step S1042: Use the linear attention layer to obtain a first mapping matrix corresponding to the query matrix and a second mapping matrix corresponding to the key matrix.

[0109] Step S1043: Use the linear attention layer to calculate the product of the transposed matrix of the first mapping matrix and the second mapping matrix to obtain a first weight matrix corresponding to the first data set.

[0110] In an embodiment of the present invention, in a process in which the first electronic device uses a linear attention layer to obtain a first weight matrix corresponding to the first data set based on the first temporal feature matrix, specifically:

[0111] First, the first electronic device uses the linear attention layer to obtain the query matrix and key matrix corresponding to the first time series feature matrix through step S1041; specifically, the first electronic device uses the linear attention layer to calculate the product between the first time series feature matrix and the first conversion matrix to obtain the query matrix (Q) corresponding to the first time series feature matrix; the first electronic device uses the linear attention layer to calculate the product between the first time series feature matrix and the second conversion matrix to obtain the key matrix (K) corresponding to the first time series feature matrix; wherein the first conversion matrix and the second conversion matrix are conversion matrices obtained after model training of the target prediction model for obtaining the query matrix and key matrix corresponding to the first time series feature matrix.

[0112] Then, the first electronic device uses the linear attention layer to obtain the first mapping matrix corresponding to the query matrix and the second mapping matrix corresponding to the key matrix in step S1042. Specifically, the linear attention layer can use the random feature map Map the query matrix to a high-dimensional random feature space to obtain the first mapping matrix, and use the random feature map The key matrix is ​​mapped to a high-dimensional random feature space to obtain a second mapping matrix.

[0113] Among them, the random feature map is a function that maps the input vector u to a high-dimensional random feature space. The mapping process can be achieved through a series of random projections and orthogonal transformations to generate random features with specific properties. The mapping function is obtained after model training of the target prediction model and is used to obtain a first mapping matrix corresponding to the query matrix and a second mapping matrix corresponding to the key matrix.

[0114] Finally, the first electronic device calculates the product between the transposed matrix of the first mapping matrix and the second mapping matrix using the linear attention layer through step S1043 to obtain a first weight matrix corresponding to the first data set.

[0115] Specifically, the first electronic device can use the fast attention via positive orthogonal random features (FAVOR+) mechanism of the linear attention layer to calculate the product between the transposed matrix of the first mapping matrix and the second mapping matrix to obtain a first weight matrix corresponding to the first data set:

[0116]

[0117] Where A(i,j) represents the first weight matrix; K(qi,kj) represents the kernel function of FAVOR+attention mechanism; qi represents the i-th row of the query matrix; kj represents the j-th row of the key matrix; represents the first mapping matrix corresponding to the query matrix; Represents the first mapping matrix corresponding to the key matrix; Represents the transposed matrix of the first mapping matrix.

[0118] In the database monitoring method provided by the embodiment of the present invention, the linear attention layer of the target preset model adopts the FAVOR+ attention mechanism to obtain the first weight matrix corresponding to the first data set. Compared with the traditional attention mechanism, the embodiment of the present invention approximates the kernel function of the FAVOR+ attention mechanism, implicitly calculates the attention distribution weight, and uses the matrix operation rules to reduce the time complexity to linear, thereby reducing the model calculation complexity from O(L 2 ) is reduced to O(L), which makes the linear attention layer more concise and efficient in capturing long sequences of contextual information, reduces the time and memory cost for the first electronic device to obtain the first weight matrix corresponding to the first data set, and thus improves the efficiency and responsiveness of the process of monitoring and managing the operating status of the target database, which is conducive to improving the operating performance of the target database.

[0119] Optionally, in step S106, determining the first prediction operation data of the target database at the second moment according to the first prediction data matrix includes:

[0120] Step S1061: Determine a second moment corresponding to a second eigenvector in the first prediction data matrix.

[0121] Step S1062: Determine the first prediction operation data of the target database at the second moment according to the second eigenvector corresponding to the second moment in the first prediction data matrix.

[0122] The second eigenvector is a row vector of the first prediction data matrix. The number of columns of the first prediction data matrix is ​​the same as the number of columns of the first time series feature matrix obtained in step S103.

[0123] In the embodiment of the present invention, the eigenvalues ​​in the first eigenvector are eigenvalues ​​of the first operating data, and the eigenvalues ​​in the second eigenvector are eigenvalues ​​of the first predicted operating data. It is understandable that, in the case where the first operating data includes disk input / output occupancy, memory occupancy, CPU occupancy, network throughput, and number of session connections, the first predicted operating data determined by the first electronic device in step S106 also includes disk input / output occupancy, memory occupancy, CPU occupancy, network throughput, and number of session connections.

[0124] The specific values ​​of the disk input / output occupancy rate, memory occupancy rate, CPU occupancy rate, network throughput and number of session connections in the first predicted operation data may be the same as or different from the specific values ​​of the disk input / output occupancy rate, memory occupancy rate, CPU occupancy rate, network throughput and number of session connections in the first operation data. When the specific values ​​of the disk input / output occupancy rate, memory occupancy rate, CPU occupancy rate, network throughput and number of session connections in the first predicted operation data are the same as the specific values ​​of the disk input / output occupancy rate, memory occupancy rate, CPU occupancy rate, network throughput and number of session connections in the first operation data, the eigenvalues ​​in the first eigenvector are the same as the eigenvalues ​​in the second eigenvector; when the specific values ​​of the disk input / output occupancy rate, memory occupancy rate, CPU occupancy rate, network throughput and number of session connections in the first predicted operation data are different from the specific values ​​of the disk input / output occupancy rate, memory occupancy rate, CPU occupancy rate, network throughput and number of session connections in the first operation data, the eigenvalues ​​in the first eigenvector are different from the eigenvalues ​​in the second eigenvector.

[0125] In the embodiment of the present invention, the second moment is a moment in a third time period after the first time period. The number of the second moments is at least 1. When the number of the second moments is greater than 1, the time intervals between adjacent second moments are equal.

[0126] The third time period is the time period after the moment t when the first electronic device executes step S101; the third time period may include the moment t when the first electronic device executes step S101, or may not include the moment t when the first electronic device executes step S101; when the third time period includes the moment t when the first electronic device executes step S101, the moment t when the first electronic device executes step S101 is used as the left endpoint value of the third time period.

[0127] Specifically, when the third time period includes the moment t when the first electronic device executes step S101, the third time period can be expressed as [t, t+1,…, t+m], and the second moments include t, t+1,…, t+m; wherein t represents the moment when the first electronic device executes step S101, and m+1 represents the number of second moments in the third time period.

[0128] In an embodiment of the present invention, the number of second eigenvectors in the first prediction data matrix is ​​equal to the number of second moments, and the second eigenvectors in the first prediction data matrix are arranged from top to bottom in the first prediction data matrix according to the chronological order between the second moments.

[0129] In step S1061, the first electronic device may determine the second moment corresponding to the second eigenvector according to the order of the row where the second eigenvector is located in the first prediction data matrix. Specifically, the first electronic device may determine the moment corresponding to the second eigenvector located in the first row in the first prediction data matrix as the second moment with the earliest time sequence (that is, the first second moment in the third time period), and determine the moment corresponding to the second eigenvector located in the last row in the first prediction data matrix as the second moment with the latest time sequence (that is, the last second moment in the third time period).

[0130] In step S1062, the first electronic device determines the first predicted operating data of the target database at the second moment according to the second eigenvector corresponding to the second moment in the first predicted data matrix in a manner reverse to step S1031.

[0131] Reference Figure 4 , shows a flow chart of the steps of a model training method provided by an embodiment of the present invention, and the method may specifically include the following steps:

[0132] Step S201: Acquire an operation data sample set of a target database; the operation data sample set includes operation data samples and label samples corresponding to the operation data samples.

[0133] Step S202: In each round of training, the prediction model to be trained is trained using the operation data sample to obtain second prediction operation data corresponding to the operation data sample.

[0134] Step S203: Determine the loss value corresponding to the prediction model to be trained according to the second prediction operation data and the label sample.

[0135] Step S204: adjust the model parameters of the prediction model to be trained according to the loss value, and perform the next round of training until the loss value meets the preset conditions to obtain the target prediction model.

[0136] The model training method provided in the embodiment of the present invention can be applied to a second electronic device. The second electronic device specifically includes but is not limited to a smart terminal, a computer, a personal digital assistant, a tablet computer, a vehicle-mounted device, etc. The second electronic device can be used alone to execute the model training method provided in the embodiment of the present invention.

[0137] The second electronic device and the aforementioned first electronic device may be the same device or different devices.

[0138] The operating data sample set of the target database is a sample set determined according to the historical operating data of the target database; the operating data sample set includes operating data samples and label samples corresponding to the operating data samples.

[0139] In an embodiment of the present invention, the second electronic device can collect the operation data of the target database according to the preset collection period, and store the operation data in the preset storage area according to the one-to-one correspondence between the operation data and the collection time. The value of the preset collection period can be determined according to the monitoring requirements of the target database; specifically, the preset collection period can be 1s, 30s, 1min, 2min, 5min, etc. The preset storage area can be a local storage area of ​​the second electronic device, or a non-local storage area accessible to the second electronic device.

[0140] In step S201, the second electronic device can obtain the operation data of the target database within the target time period from the preset storage area, and determine the operation data set before the target moment in the target time period as the operation data sample, and determine the operation data set at the target moment in the target time period and after the target moment as the label sample corresponding to the operation data sample.

[0141] Among them, the target time is any time in the target time period except the endpoint time of the target time period; it can be understood that in order to ensure the training effect of the prediction model to be trained, the number of running data in the running data sample can be made greater than the number of running data in the label sample.

[0142] In the embodiment of the present invention, refer to Figure 5 , showing a schematic diagram of the structure of a prediction model to be trained provided by an embodiment of the present invention, the prediction model to be trained includes an embedding layer to be trained, a linear attention layer to be trained and a fully connected layer to be trained, which are connected in sequence.

[0143] In step S202, in each round of training:

[0144] First, the second electronic device inputs the operation data samples in the operation data sample set acquired in step S201 into the prediction model to be trained.

[0145] Then, the second electronic device uses the embedding layer to be trained to obtain a second time series feature matrix corresponding to the running data sample based on the running data sample, and inputs the second time series feature matrix into the linear attention layer to be trained.

[0146] Then, the second electronic device uses the linear attention layer to be trained to obtain the second weight matrix corresponding to the running data sample based on the second time series feature matrix, and inputs the second weight matrix into the fully connected layer to be trained.

[0147] Then, the second electronic device uses the fully connected layer to be trained based on the second weight matrix to obtain a second prediction data matrix corresponding to the running data sample.

[0148] Finally, the second electronic device obtains the second prediction data matrix output by the prediction model to be trained, and determines the second predicted operating data (Yp) corresponding to the operating data sample according to the second prediction data matrix.

[0149] In step S203, the second electronic device determines the loss value (Loss) corresponding to the prediction model to be trained according to the second prediction operation data and the label sample (Yc).

[0150] In step S204, the second electronic device may perform gradient propagation according to the loss value determined in step S203, adjust the model parameters of the prediction model to be trained, and perform the next round of training until the loss value meets the preset conditions to obtain the target prediction model as described in any of the above items.

[0151] In an embodiment of the present invention, the second electronic device can perform operations corresponding to steps S201 to S204 according to a preset training cycle, so that the target prediction model can timely perceive the latest changes in the operating data of the target database and make corresponding adjustments. The embodiment of the present invention is applicable to online real-time prediction scenarios, which can effectively reduce the delay problem during incremental updates of the target prediction model, and is conducive to improving the accuracy of the first predicted operating data of the target database at the second moment determined by the target prediction model in the embodiment of the present invention, thereby improving the efficiency and reliability of the process of monitoring and managing the operating status of the target database based on the first predicted operating data, and is conducive to improving the operating performance of the target database.

[0152] The prediction models to be trained include the target prediction model obtained in step S204, the prediction model newly constructed by the second electronic device, and the prediction model that has undergone at least one round of training.

[0153] Optionally, the step S201 of obtaining a sample set of operating data of a target database includes:

[0154] Step S2011, obtaining a second data set of a target database; the second data set includes second operating data of the target database at at least two third moments in a second time period.

[0155] Step S2012: determine the second operation data of the target database before the fourth moment in the second data set as the operation data sample; the fourth moment is a moment within the second time period.

[0156] Step S2013: Determine second operation data other than the operation data sample in the second data set as a label sample corresponding to the operation data sample.

[0157] In an embodiment of the present invention, when the second electronic device obtains the operating data sample set of the target database, it can first obtain the second data set of the target database through step S2011, then determine the operating data sample from the second data set through step S2012, and determine the label sample corresponding to the operating data sample from the second data set through step S2013.

[0158] The fourth moment is any moment in the second time period except the endpoint moment of the second time period.

[0159] Specifically, the second data set can be expressed as [x c-n ,x c-n+1 ,…,x c ,x c+1 ,…,x c+m ]; where x j represents any second operating data in the second data set, and the value range of j is [cn,c-n+1,…,c,c+1,…,c+m]. The second time period can be expressed as [cn,c-n+1,…,c,c+1,…,c+m], and the third moment includes cn,c-n+1,…,c,c+1,…,c+m.

[0160] When the fourth moment is c, the second electronic device can, through step S2012, c-n ,x c-n+1 ,…,x c ] is determined as the operation data sample; the second electronic device can determine [x c+1 ,…,x c+m ]Determine the label sample corresponding to the running data sample.

[0161] Among them, n+1 is the number of running data in the running data sample; m is the number of running data in the label sample.

[0162] Specifically, when the first electronic device and the second electronic device are the same device, refer to Figure 6 , shows a logical block diagram of an electronic device provided in an embodiment of the present invention, wherein the electronic device includes an operation data acquisition module 601, a prediction model construction module 602, an online real-time training module 603 and a real-time prediction module 604.

[0163] In the case where the first electronic device and the second electronic device are the same device, refer to Figure 7 , shows a flowchart of another database monitoring method provided by an embodiment of the present invention, the method comprising steps S301 to S307:

[0164] Step S301: constructing a prediction model.

[0165] Specifically, the prediction model construction module 602 constructs a prediction model and determines the constructed model as the prediction model to be trained; wherein the prediction model to be trained includes an embedding layer to be trained, a linear attention layer to be trained, and a fully connected layer to be trained that are connected in sequence.

[0166] Step S302: run data sample collection.

[0167] Specifically, the operation data acquisition module 601 obtains a second data set of the target database, and determines the second operation data of the target database before the fourth moment in the second data set as the operation data sample.

[0168] Step S303: collecting label samples.

[0169] Specifically, the operation data collection module 601 determines the second operation data other than the operation data sample in the second data set as a label sample corresponding to the operation data sample.

[0170] Step S304: Operation status prediction.

[0171] Specifically, in each round of training, the online real-time training module 603 uses the operation data samples to train the prediction model to be trained, and obtains the second prediction operation data corresponding to the operation data samples.

[0172] Step S305: Model online training.

[0173] Specifically, the online real-time training module 603 first determines the loss value corresponding to the prediction model to be trained according to the second prediction operation data and the label sample; then adjusts the model parameters of the prediction model to be trained according to the loss value, and performs the next round of training until the loss value meets the preset conditions to obtain the target prediction model. The target prediction model includes an embedding layer, a linear attention layer, and a fully connected layer connected in sequence.

[0174] Step S306: first operation data collection.

[0175] Specifically, the operation data collection module 601 obtains a first data set of the target database; the first data set includes first operation data of the target database at at least two first moments in a first time period.

[0176] Step S307: Operation status prediction.

[0177] Specifically, the real-time prediction module 604 first inputs the first data set into the target prediction model; then, uses the embedding layer to obtain the first time series feature matrix corresponding to the first data set based on the first data set; then, uses the linear attention layer to obtain the first weight matrix corresponding to the first data set based on the first time series feature matrix; then, uses the fully connected layer to obtain the first prediction data matrix corresponding to the first data set based on the first weight matrix; finally, obtains the first prediction data matrix output by the target prediction model, and determines the first prediction running data of the target database at the second moment according to the first prediction data matrix.

[0178] After step S307, the electronic device may also repeatedly perform operations corresponding to steps S302 to S305 according to a preset training cycle, so that the target prediction model can timely perceive the latest changes in the operating data of the target database and make corresponding adjustments.

[0179] In addition, the electronic device can also continue to execute the operations corresponding to steps S306 to S307, realize real-time prediction of the first predicted operating data of the target database at the second moment, and timely adjust the operating status of the target database according to the first predicted operating data, thereby improving the efficiency and reliability of the monitoring and management process of the operating status of the target database, and thereby improving the operating performance of the target database.

[0180] As an example, an embodiment of the present invention provides a flowchart of another method for monitoring a database, the method comprising steps S401 to S408:

[0181] Step S401, the prediction model building module 602 builds a prediction model.

[0182] Step S402: The operation data collection module 601 collects the second operation data of 1024 target databases at and before time c as operation data samples. The preset collection period of the operation data collection module 601 for collecting the operation data of the target database is 1 minute.

[0183] Step S403: The operation data collection module 601 collects the second operation data of 100 target databases after time c as label samples corresponding to the operation data samples.

[0184] Step S404: The online real-time training module 603 inputs the operation data sample collected in step S402 into the prediction model constructed in step S401 to obtain second predicted operation data corresponding to the operation data sample.

[0185] Step S405, the online real-time training module 603 constructs a loss function with the label sample obtained in step S403 and the second prediction operation data obtained in step S404, and obtains the loss value corresponding to the prediction model to be trained; then adjusts the model parameters of the prediction model to be trained according to the loss value, and performs the next round of training until the loss value meets the preset conditions, and obtains the target prediction model. The target prediction model includes an embedding layer, a linear attention layer, and a fully connected layer connected in sequence.

[0186] Step S406 , the operation data collection module 601 collects the first operation data of 1024 target databases before the latest time t to obtain a first data set.

[0187] Step S407, the real-time prediction module 604 inputs the first data set into the target prediction model; then, the embedding layer is used to obtain the first time series feature matrix corresponding to the first data set based on the first data set; then, the linear attention layer is used to obtain the first weight matrix corresponding to the first data set based on the first time series feature matrix; then, the fully connected layer is used to obtain the first prediction data matrix corresponding to the first data set based on the first weight matrix; finally, the first prediction data matrix output by the target prediction model is obtained, and the first prediction operation data of the target database in the next 100 moments is determined according to the first prediction data matrix.

[0188] Step S408: The electronic device repeatedly executes steps S402 to S407 according to a preset training cycle to perform online update and prediction of the target prediction model.

[0189] The time interval of the preset training cycle can be set according to the resource situation of the electronic device. Specifically, the preset training cycle can be set to 1 hour.

[0190] In summary, the database monitoring method provided by the embodiment of the present invention obtains the first data set of the target database and inputs the first data set into the target prediction model. In the process of using the target prediction model to process at least two first operating data with a time series relationship in the first data set to obtain a first prediction data matrix corresponding to the first data set, the method fully considers the influence of the time series relationship between the first operating data on the operating data of the target database, so that the first predicted operating data of the target database at the second moment determined according to the first prediction data matrix output by the target prediction model is closer to the actual operating data of the target database at the second moment, thereby improving the accuracy of the first predicted operating data obtained by the embodiment of the present invention, and improving the efficiency and reliability of the process of monitoring and managing the operating status of the target database based on the first predicted operating data, which is conducive to improving the operating performance of the target database.

[0191] Device Embodiment

[0192] Reference Figure 8 , shows a logical block diagram of a database monitoring device provided by an embodiment of the present invention, the device may include:

[0193] The first acquisition module 801 is used to acquire a first data set of a target database; the first data set includes first operation data of the target database at least two first moments in a first time period;

[0194] An input module 802 is used to input the first data set into a target prediction model; the target prediction model includes an embedding layer, a linear attention layer and a fully connected layer connected in sequence;

[0195] A second acquisition module 803 is used to acquire a first time series feature matrix corresponding to the first data set based on the first data set by using the embedding layer;

[0196] A third acquisition module 804 is used to acquire a first weight matrix corresponding to the first data set based on the first temporal feature matrix using the linear attention layer;

[0197] A fourth acquisition module 805 is used to acquire a first prediction data matrix corresponding to the first data set based on the first weight matrix using the fully connected layer;

[0198] The first determination module 806 is used to obtain the first prediction data matrix output by the target prediction model, and determine the first prediction operation data of the target database at a second moment according to the first prediction data matrix; the second moment is a moment after the first moment.

[0199] Optionally, the second acquisition module includes:

[0200] an extraction submodule, configured to extract a feature value of the first operation data in the first data set by using the embedding layer;

[0201] A generating submodule, configured to generate a first feature vector corresponding to the first operating data according to the feature value by using the embedding layer;

[0202] A sorting submodule is used to use the embedding layer to sort the first feature vectors corresponding to each of the first operating data according to the timing relationship between the first moments, so as to obtain a first timing feature matrix corresponding to the first data set; the number of rows of the first timing feature matrix is ​​the same as the number of the first operating data in the first data set.

[0203] Optionally, the third acquisition module includes:

[0204] A first acquisition submodule, configured to use the linear attention layer to acquire a query matrix and a key matrix corresponding to the first temporal feature matrix;

[0205] A second acquisition submodule, used to acquire a first mapping matrix corresponding to the query matrix and a second mapping matrix corresponding to the key matrix by using the linear attention layer;

[0206] A calculation submodule is used to use the linear attention layer to calculate the product between the transposed matrix of the first mapping matrix and the second mapping matrix to obtain a first weight matrix corresponding to the first data set.

[0207] Optionally, the first determining module includes:

[0208] A first determining submodule, used to determine a second moment corresponding to a second eigenvector in the first prediction data matrix;

[0209] The second determination submodule is used to determine the first prediction operation data of the target database at the second moment according to the second eigenvector corresponding to the second moment in the first prediction data matrix.

[0210] Reference Fig. 9 , shows a logic block diagram of a model training device provided by an embodiment of the present invention, and the device may include:

[0211] The fifth acquisition module 901 is used to acquire an operation data sample set of a target database; the operation data sample set includes an operation data sample and a label sample corresponding to the operation data sample;

[0212] A training module 902 is used to train the prediction model to be trained using the operation data sample in each round of training to obtain second prediction operation data corresponding to the operation data sample;

[0213] A second determination module 903 is used to determine the loss value corresponding to the prediction model to be trained according to the second prediction operation data and the label sample;

[0214] The training module 902 is further used to adjust the model parameters of the prediction model to be trained according to the loss value, and to perform the next round of training until the loss value meets the preset conditions to obtain the target prediction model as described above.

[0215] Optionally, the fifth acquisition module includes:

[0216] A third acquisition submodule is used to acquire a second data set of the target database; the second data set includes second operation data of the target database at at least two third moments in a second time period;

[0217] A third determining submodule is used to determine the second operating data of the target database before a fourth moment in the second data set as the operating data sample; the fourth moment is a moment within the second time period;

[0218] The fourth determining submodule is used to determine second operating data other than the operating data sample in the second data set as a label sample corresponding to the operating data sample.

[0219] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0220] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0221] Reference Fig.10 , is a structural block diagram of an electronic device for database monitoring and / or model training provided by an embodiment of the present invention. Fig.10 As shown, the electronic device includes: a processor, a memory, a communication interface and a communication bus, and the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store executable instructions, and the executable instructions enable the processor to execute the database monitoring method of the aforementioned embodiment, or execute the model training method of the aforementioned embodiment.

[0222] The processor may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other editable devices, transistor logic devices, hardware components or any combination thereof. The processor may also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0223] The communication bus may include a path for transmitting information between the memory and the communication interface. The communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 The fact that only one line is used in the diagram does not mean that there is only one bus or only one type of bus.

[0224] The memory may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable ReadOnly), a CD-ROM (Compact Disa Read Only), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0225] The embodiment of the present invention also provides a non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device (server or terminal), the processor is able to execute Figure 1 The database monitoring method shown, or execute Figure 4 The model training method shown.

[0226] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0227] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0228] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0229] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a predictable manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0230] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0231] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0232] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0233] The above is a detailed introduction to a database monitoring method, model training method, device, equipment and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A database monitoring method, characterized in that: The method comprises: Acquire a first data set of a target database; the first data set includes first operation data of the target database at at least two first moments in a first time period; Inputting the first data set into a target prediction model; the target prediction model comprises an embedding layer, a linear attention layer, and a fully connected layer connected in sequence; Acquire a first time series feature matrix corresponding to the first data set based on the first data set by using the embedding layer; Using the linear attention layer to obtain a first weight matrix corresponding to the first data set based on the first temporal feature matrix; Obtaining a first prediction data matrix corresponding to the first data set using the fully connected layer based on the first weight matrix; A first prediction data matrix output by the target prediction model is obtained, and first prediction operation data of the target database at a second moment is determined based on the first prediction data matrix; the second moment is a moment after the first moment.

2. The method according to claim 1, characterized in that: The using the embedding layer to obtain a first time series feature matrix corresponding to the first data set based on the first data set includes: extracting feature values ​​of the first operating data in the first data set using the embedding layer; generating, using the embedding layer according to the eigenvalue, a first eigenvector corresponding to the first operating data; The embedding layer is used to sort the first feature vectors corresponding to each of the first operating data according to the temporal relationship between the first moments to obtain a first temporal feature matrix corresponding to the first data set; the number of rows of the first temporal feature matrix is ​​the same as the number of the first operating data in the first data set.

3. The method according to claim 1, characterized in that The obtaining, using the linear attention layer based on the first temporal feature matrix, a first weight matrix corresponding to the first data set includes: Using the linear attention layer to obtain a query matrix and a key matrix corresponding to the first temporal feature matrix; Obtaining a first mapping matrix corresponding to the query matrix and a second mapping matrix corresponding to the key matrix using the linear attention layer; The linear attention layer is used to calculate the product between the transposed matrix of the first mapping matrix and the second mapping matrix to obtain a first weight matrix corresponding to the first data set.

4. The method according to claim 1, characterized in that: Determining the first prediction operation data of the target database at the second moment according to the first prediction data matrix includes: Determining a second moment corresponding to a second eigenvector in the first prediction data matrix; The first prediction operation data of the target database at the second moment is determined according to the second eigenvector corresponding to the second moment in the first prediction data matrix.

5. A model training method, characterized in that: The method comprises: Acquire an operation data sample set of a target database; the operation data sample set includes an operation data sample and a label sample corresponding to the operation data sample; In each round of training, the prediction model to be trained is trained using the operation data sample to obtain second prediction operation data corresponding to the operation data sample; Determine a loss value corresponding to the prediction model to be trained according to the second prediction operation data and the label sample; The model parameters of the prediction model to be trained are adjusted according to the loss value, and the next round of training is performed until the loss value meets the preset conditions, thereby obtaining the target prediction model as described in any one of claims 1 to 4.

6. The method according to claim 5, characterized in that The step of obtaining a sample set of operating data of a target database includes: Acquire a second data set of the target database; the second data set includes second operation data of the target database at at least two third moments in a second time period; Determine the second operation data of the target database before a fourth moment in the second data set as the operation data sample; the fourth moment is a moment within the second time period; Determine second operation data other than the operation data sample in the second data set as a label sample corresponding to the operation data sample.

7. A database monitoring device, characterized in that: The device comprises: A first acquisition module is used to acquire a first data set of a target database; the first data set includes first operation data of the target database at least two first moments in a first time period; An input module, configured to input the first data set into a target prediction model; the target prediction model comprises an embedding layer, a linear attention layer, and a fully connected layer connected in sequence; A second acquisition module, configured to acquire a first time series feature matrix corresponding to the first data set based on the first data set by using the embedding layer; A third acquisition module is used to acquire a first weight matrix corresponding to the first data set based on the first time series feature matrix using the linear attention layer; A fourth acquisition module, configured to acquire a first prediction data matrix corresponding to the first data set based on the first weight matrix using the fully connected layer; The first determination module is used to obtain a first prediction data matrix output by the target prediction model, and determine the first prediction operation data of the target database at a second moment according to the first prediction data matrix; the second moment is a moment after the first moment.

8. A model training device, characterized in that: The device comprises: A fifth acquisition module is used to acquire an operation data sample set of a target database; the operation data sample set includes an operation data sample and a label sample corresponding to the operation data sample; A training module, used to train the prediction model to be trained using the operation data sample in each round of training to obtain second prediction operation data corresponding to the operation data sample; A second determination module, used to determine the loss value corresponding to the prediction model to be trained according to the second prediction operation data and the label sample; The training module is also used to adjust the model parameters of the prediction model to be trained according to the loss value, and perform the next round of training until the loss value meets the preset conditions to obtain the target prediction model as described in any one of claims 1 to 4.

9. An electronic device, characterized in that: The electronic device comprises a processor, a memory, a communication interface and a communication bus, and the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store executable instructions, and the executable instructions enable the processor to execute the database monitoring method as described in any one of claims 1 to 4, or execute the model training method as described in any one of claims 5 to 6.

10. A readable storage medium, characterized in that: When the instructions in the readable storage medium are executed by a processor of an electronic device, the processor is enabled to execute the database monitoring method as described in any one of claims 1 to 4, or to execute the model training method as described in any one of claims 5 to 6.

Citation Information

Patent Citations

  • Time series data event prediction method and system based on graph convolutional neural network and application thereof

    CN111367961A

  • Abnormality diagnosis model training method and device, electronic equipment and storage medium

    CN116910573A

  • Target association model training method and device, equipment and medium

    CN118015398A

  • Water quality prediction method, device and equipment based on deep learning and medium

    CN118673467A

  • Attention-based cloud server performance prediction method, system and equipment

    CN118820040A