Model deployment method, device, electronic device and computer readable medium
By acquiring and analyzing historical database query logs, training the query performance information generation model, and performing data clustering processing, the problem of inaccurate determination of database query performance consumption in the existing technology is solved, and efficient and real-time performance consumption query is achieved.
Patent Information
- Application Number
- CN202410493262.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-23
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-04-23
AI Technical Summary
When determining the performance consumption of database query, the artificial analysis is not accurate enough, and the background performance data retrieval has data lag, which cannot be achieved in real-time acquisition, and the generated query performance information model is not accurate enough.
By obtaining the historical database query log, extracting the query feature information set and query performance information, using this data to train the query performance information to generate the model, and performing data clustering processing to generate the data cluster, and finally model deployment is carried out to determine the query performance consumption.
It realizes accurate determination of database query performance consumption, avoids inaccuracy of human analysis and lag in background data retrieval, and improves the query efficiency of performance consumption.
Smart Images

Figure CN118394616B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a model deployment method, device, electronic device, and computer-readable medium. Background Art
[0002] At present, databases have been widely used in various fields and can effectively realize data storage and query. The performance consumption caused by database query is usually determined by manual analysis or background performance data retrieval.
[0003] However, when using the above method to determine the performance consumption caused by database queries, the following technical problems often occur:
[0004] The manual analysis method is not accurate enough and the accuracy of the analysis is low. The backend performance data retrieval method has a certain data lag and cannot achieve real-time acquisition.
[0005] In the process of adopting technical solutions to solve the above-mentioned technical problem 1, the following technical problem 2 is often accompanied: the query performance information generation model obtained is still not accurate enough.
[0006] The above information disclosed in this Background section is only for enhancement of understanding of the background of the inventive concept and therefore it may contain information that does not form the prior art that is already known in this country to a person of ordinary skill in the art. Summary of the invention
[0007] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.
[0008] Some embodiments of the present disclosure propose a model deployment method, an apparatus, an electronic device, and a computer-readable medium to solve one or more of the technical problems mentioned in the above background technology section.
[0009] In a first aspect, some embodiments of the present disclosure provide a model deployment method, comprising: obtaining a sequence of historical database query logs, wherein each historical database query log comprises: a database statement, execution plan information and query consumption time; for each historical database query log in the above historical database query log sequence, executing the following generation steps: determining the query performance information corresponding to the above historical database query log; extracting the query feature information set corresponding to the above historical database query log; using the obtained query feature information set sequence as a training data set and the obtained query performance information sequence as a label set to perform model training on an initial query performance information generation model to generate a query performance information generation model; executing data clustering processing on the above training data set to generate a data cluster set; obtaining cluster center data corresponding to each data cluster in the above data cluster set; and executing model deployment on the obtained cluster center data set and the above query performance information generation model.
[0010] In a second aspect, some embodiments of the present disclosure provide a model deployment device, comprising: a first acquisition unit, configured to acquire a sequence of historical database query logs, wherein each historical database query log includes: a database statement, execution plan information and query consumption time; a first execution unit, configured to perform the following generation steps for each historical database query log in the above historical database query log sequence: determining the query performance information corresponding to the above historical database query log; extracting the query feature information set corresponding to the above historical database query log; a training unit, configured to use the obtained query feature information set sequence as a training data set and the obtained query performance information sequence as a label set to perform model training on an initial query performance information generation model to generate a query performance information generation model; a second execution unit, configured to perform data clustering processing on the above training data set to generate a data cluster set; a second acquisition unit, configured to acquire cluster center data corresponding to each data cluster in the above data cluster set; and a deployment unit, configured to perform model deployment on the obtained cluster center data set and the above query performance information generation model.
[0011] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner in the first aspect.
[0012] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner in the first aspect is implemented.
[0013] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the model deployment method of some embodiments of the present disclosure, the trained query performance information is used to generate a model and a data cluster, and the performance consumption caused by executing the target database query can be accurately determined. Specifically, the reason for the inaccurate determination of the relevant performance consumption is that the manual analysis method is not accurate enough and the accuracy of the analysis is low. There is a certain data lag in the method of retrieving the background performance data, and it is not possible to obtain it in real time. Based on this, the model deployment method of some embodiments of the present disclosure first obtains a historical database query log sequence. Among them, each historical database query log includes: database statements, execution plan information and query consumption time. Here, the historical database query log sequence is obtained as a basic data set to facilitate subsequent clustering processing and model training. Then, for each historical database query log in the above historical database query log sequence, the following generation steps are performed: the first step is to determine the query performance information corresponding to the above historical database query log as the output purpose of the subsequent model training, which is convenient for the subsequent optimization training of the model. The second step is to extract the query feature information set corresponding to the above historical database query log as the input of the model, so that the model learns more feature information. Then, the obtained query feature information set sequence is used as a training data set, and the obtained query performance information sequence is used as a label set to train the initial query performance information generation model, so as to generate a query performance information generation model that generates query performance information more accurately. Next, data clustering processing is performed on the above training data set to generate a data cluster set, so as to cluster data with similar features into one category to obtain individual data clusters. Secondly, the cluster center data corresponding to each data cluster in the above data cluster set is obtained to facilitate the subsequent determination of the query performance corresponding to the data query. Finally, the model deployment is performed for the obtained cluster center data set and the above query performance information generation model. Here, by generating a cluster center data set and a query performance information generation model, not only can the accurate determination of the query performance information be guaranteed, but also different determination methods can be adaptively selected for different query timeliness, which greatly improves the query efficiency of performance consumption. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
[0015] Figure 1 is a flow chart of some embodiments of the model deployment method according to the present disclosure;
[0016] Figure 2is a schematic diagram of the structure of some embodiments of the model deployment device according to the present disclosure;
[0017] Figure 3 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0018] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0019] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.
[0020] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0021] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0022] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0023] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0024] refer to Figure 1 , shows a process 100 of some embodiments of the model deployment method according to the present disclosure. The model deployment method comprises the following steps:
[0025] Step 101, obtaining a historical database query log sequence.
[0026] In some embodiments, the execution subject of the above-mentioned model deployment method can obtain a historical database query log sequence through a wired connection method or a wireless connection method. Among them, the historical database query log sequence can be each database query log generated in a historical time period. The database query log can be a log recorded by the database query process. The historical database query log can be a log recorded by the database query process at a historical time. Among them, each historical database query log includes: a database statement, execution plan information and query consumption time. The database statement can be a query statement in the historical database query log. The execution plan information can be the execution plan corresponding to the query statement. The query consumption time can be the consumption time corresponding to the database query process.
[0027] Step 102: for each historical database query log in the above historical database query log sequence, perform the following generation steps:
[0028] Step 1021, determining the query performance information corresponding to the historical database query log.
[0029] In some embodiments, the execution subject may determine the query performance information corresponding to the historical database query log. The query performance information may characterize the performance consumption corresponding to the query process corresponding to the historical database query log. In practice, the query performance information may include but is not limited to at least one of the following: the number of read and write operations, and the lock waiting time.
[0030] As an example, the execution subject may determine the query performance information corresponding to the historical database query log by querying the background performance data.
[0031] Step 1022: extract the query feature information set corresponding to the historical database query log.
[0032] In some embodiments, the above-mentioned execution entity can extract the query feature information set corresponding to the above-mentioned historical database query log. Among them, the query feature information can be the feature content corresponding to the query feature. The query feature information set can be the various feature information reflected in the query process corresponding to the historical database query log. The query feature set corresponding to the query feature information set includes: a query type feature set and an index feature set. The query type feature set may include but is not limited to at least one of the following: query type (for example, SELECT type, INSERT type, UPDATE type, DELETE type), the number of tables involved, the number and complexity of columns in the WHERE clause, the number of JOIN operations and associated conditions, and whether ORDER BY or GROUP BY is used. The index feature set may include but is not limited to at least one of the following: the name of the index used, the index type (for example, B-tree, hash, full-text index, etc.), and the degree of index coverage.
[0033] As an example, the execution subject may extract the query feature information set corresponding to the historical database query log by extracting feature information related information.
[0034] Step 103, using the obtained query feature information set sequence as a training data set and the obtained query performance information sequence as a label set, and performing model training on the initial query performance information generation model to generate a query performance information generation model.
[0035] In some embodiments, the above-mentioned execution entity may use the obtained query feature information set sequence as a training data set and the obtained query performance information sequence as a label set to perform model training on the initial query performance information generation model to generate a query performance information generation model. Among them, the initial query performance information generation model may be a query performance information generation model that has not yet been trained. The query performance information generation model may be a neural network model that generates query performance information. In practice, the query performance information generation model may be a multi-layer series convolutional neural network (CNN). The query performance information generation model is a neural network model that has been trained.
[0036] In some optional implementations of some embodiments, the query performance information in the query performance information sequence includes: response time prediction information and abnormal problem identification information. Among them, the response time prediction information may be the predicted time consumed by the server to respond to the database query. The abnormal problem identification information may be the identification information of whether the performance problem may be caused. The initial query performance information generation model includes: an initial response time prediction model, an initial abnormal problem identification model, and an initial multi-type output model for outputting the response time and abnormal problems. The initial response time prediction model may be a response time prediction model that has not yet been trained. The response time prediction model may be a neural network model that generates response time prediction information. That is, the output of the response time prediction model may be the response time prediction information. In practice, the response time prediction model may be a regression model. For example, the response time prediction model may be one of the following: a multi-layer convolutional neural network model, a plurality of series-connected residual networks, and a multi-layer fully connected layer. The initial abnormal problem identification model may be an abnormal problem identification model that has not yet been trained. The abnormal problem identification model may be a neural network model that generates abnormal problem identification information. That is, the output of the abnormal problem identification model is abnormal problem identification information. The abnormal problem identification model may be a classification model. For example, the abnormal problem identification model can be one of the following: multiple residual networks connected in series, multiple layers of fully connected layers. The initial multi-type output model for outputting response time and abnormal problems can be a multi-type output model that has not yet been trained. The multi-type output model can be a neural network model that outputs response time and abnormal problems. In practice, the multi-type output model can include: a feature extraction model, a first fully connected layer, and a second fully connected layer. The feature extraction model can be a model that extracts feature information of input data. The first fully connected layer can be a network layer that outputs response time prediction information. The second fully connected layer can be a network layer that outputs abnormal problem identification information.
[0037] Optionally, the above method uses the obtained query feature information set sequence as a training data set and the obtained query performance information sequence as a label set to perform model training on the initial query performance information generation model to generate the query performance information generation model, which may include the following steps:
[0038] The first step is to obtain training data from the above training data set as target training data.
[0039] As an example, the execution subject may randomly obtain training data from the training data set as target training data.
[0040] In the second step, for the target training data, perform the following training steps:
[0041] Sub-step 1: input the target training data into the initial response time prediction model to generate first response time prediction information.
[0042] Sub-step 2: input the target training data into the initial abnormal problem identification model to generate first abnormal problem identification information.
[0043] Sub-step 3: input the target training data into the initial multi-type output model to generate second response time prediction information and second abnormal problem identification information.
[0044] Sub-step 4: obtaining query performance information for the target training data as target query performance information. The target query performance information may be actual performance consumption information during the query process of the target training data.
[0045] Sub-step 5, generating model loss information based on the first response time prediction information, the first abnormal problem identification information, the second response time prediction information, the second abnormal problem identification information and the target query performance information.
[0046] As an example, first, the first information loss information between the first response time prediction information and the first abnormal problem identification information and the target query performance information is determined using the cross entropy loss function. Then, the second information loss information between the second response time prediction information and the second abnormal problem identification information and the target query performance information is determined using the cross entropy loss function. Finally, the first information loss information and the second information loss information are averaged as the model loss information.
[0047] In the third step, in response to determining that the model loss information table has converged, the initial query performance information generation model is determined as the query performance information generation model.
[0048] Optionally, after the "third step", the steps further include:
[0049] In the first step, in response to determining that the model loss information representation has not converged, the model parameters in the initial query performance information generation model are updated according to the model loss information to obtain an updated query performance information generation model.
[0050] As an example, the above-mentioned execution entity can update the model parameters in the initial query performance information generation model by back propagation according to the model loss information to obtain the updated query performance information generation model.
[0051] The second step is to remove the target training data from the training data set to obtain the removed training data set.
[0052] The third step is to obtain training data from the removed training data set as candidate training data.
[0053] As an example, the execution subject may randomly select training data from the removed training data set as candidate training data.
[0054] In the fourth step, the updated query performance information generation model is used as the initial query performance information generation model, and the candidate training data is used as the target training data, and the above training steps are continued.
[0055] Considering the problems of the above conventional solutions, facing the above technical problem 2: the query performance information generation model obtained is still not accurate enough. Combining the advantages / technical status, we can decide to adopt the following solution.
[0056] Optionally, the above method uses the obtained query feature information set sequence as a training data set and the obtained query performance information sequence as a label set to perform model training on the initial query performance information generation model to generate the query performance information generation model, which may include the following steps:
[0057] The first step is to perform data clustering on each training data in the training data set to generate training data clusters.
[0058] As an example, the execution subject may perform data clustering processing on each training data in the training data set by using a K-means algorithm according to a query feature information set corresponding to each training data, so as to generate a training data cluster set.
[0059] The second step is to generate at least one cluster feature information corresponding to each training data cluster in the above training data cluster set. The cluster feature information can represent the common representative features corresponding to each training data in the training data cluster. For example, the at least one cluster feature information may include: the query statement is short, and the number of columns and complexity in the WHERE clause meet the preset degree.
[0060] In the third step, for each training data, perform the following label generation steps:
[0061] Sub-step 1: determining at least one cluster feature information corresponding to the training data as at least one target cluster feature information.
[0062] Sub-step 2: determining the data distance between the training data and the corresponding cluster center data, wherein the cluster center data may be the cluster center in the data cluster corresponding to the training data.
[0063] Sub-step 3, determining the numerical interval corresponding to the above data distance.
[0064] As an example, the execution subject may determine the numerical range corresponding to the data distance by querying a table, which may be a table of various numerical ranges.
[0065] Sub-step 4: Determine the label degree information corresponding to the numerical interval. The label degree information can be a numerical value between 0 and 1. The larger the numerical value, the higher the authenticity of the label.
[0066] In the fourth step, the obtained query feature information set sequence is used as the training data set, the obtained query performance information sequence is used as the label set, and the obtained at least one cluster feature label set is used as the cluster label set and the corresponding label degree information set to perform model training on the initial query performance information generation model to generate a query performance information generation model.
[0067] The content in the above “optionally”, as an inventive point of the present disclosure, solves the technical problem mentioned in the background technology that “the query performance information generation model obtained is still not accurate enough.” Based on this, the present disclosure adds at least one cluster feature label set as a cluster label set and a corresponding label degree information set, so that the query performance information model can better distinguish the data clusters to which each training data belongs, so as to make the query performance information model more accurate.
[0068] Optionally, the step of inputting the target training data into the initial multi-type output model to generate the second response time prediction information and the second abnormal problem identification information may include the following steps:
[0069] In the first step, the target training data is input into the first data feature extraction model included in the initial multi-type output model to generate the first data feature information, and the target training data is input into the second data feature extraction model included in the initial multi-type output model to generate the second data feature information. The first data feature extraction model and the second data feature extraction model can both be neural network models for further extracting data feature information. The first data feature extraction model can be a 7-layer convolutional layer connected in series. The second data feature extraction model can be a 9-layer convolutional layer connected in series. The first data feature information and the second data feature information can be information in vector form.
[0070] The second step is to perform feature information splicing on the first data feature information and the second data feature information to generate spliced feature information.
[0071] The third step is to input the above-mentioned spliced feature information into the multi-level feature extraction model included in the initial multi-type output model to generate multi-level feature extraction information. The multi-level feature extraction model can be a neural network model that deeply extracts feature information of data. In practice, the multi-level feature extraction model can be a residual model with 20 layers in series.
[0072] In the fourth step, the multi-level feature extraction information is input into the response time prediction information layer included in the initial multi-type output model to generate a response time prediction matrix and a second response time prediction information. The response time prediction information layer may be a network layer that outputs the response time prediction information. The response time prediction information layer includes: a plurality of first fully connected layers and a first activation function layer connected in series. The response time prediction matrix may be the output matrix of the last fully connected layer in the plurality of first fully connected layers connected in series. The response time prediction matrix may be a matrix that characterizes the semantics of the information corresponding to the response time prediction information. The first activation function layer may be a Sigmoid activation function.
[0073] In the fifth step, the multi-level feature extraction information is input into the abnormal problem identification layer included in the initial multi-type output model to generate an abnormal problem identification matrix and second abnormal problem identification information.
[0074] Among them, the abnormal problem identification layer can be a network layer that outputs abnormal problem identification information. The abnormal problem identification layer includes: a plurality of second fully connected layers connected in series and a second activation function layer. The abnormal problem identification matrix can be an output matrix of the last fully connected layer in the plurality of second fully connected layers connected in series. The abnormal problem identification matrix can be a matrix that represents the semantics of the information corresponding to the abnormal problem identification information. The second activation function layer can be a ReLU activation function.
[0075] Optionally, the target query performance information includes: a target response time label and a target abnormal problem label. The target response time label may be a time label of an actual response time under the training data corresponding to the target query performance information. The target abnormal problem label may be a problem label of actual abnormal problem information under the training data corresponding to the target query performance information. The problem label may be a label indicating whether an abnormal problem occurs.
[0076] Optionally, the generating of the model loss information according to the first response time prediction information, the first abnormal problem identification information, the second response time prediction information, the second abnormal problem identification information and the target query performance information may include the following steps:
[0077] The first step is to generate first loss information for the first response time prediction information and the second response time prediction information. The first loss information can represent the information difference between the first response time prediction information and the second response time prediction information. The larger the first loss information, the larger the information difference.
[0078] As an example, the execution entity may generate the first loss information for the first response time prediction information and the second response time prediction information through a mean square error loss function.
[0079] The second step is to generate second loss information for the first abnormal problem identification information and the second abnormal problem identification information, wherein the second loss information may represent the information difference between the first abnormal problem identification information and the second abnormal problem identification information.
[0080] As an example, the execution entity may generate second loss information for the first abnormal problem identification information and the second abnormal problem identification information through a classification cross entropy loss function.
[0081] The third step is to generate third loss information for the first response time prediction information and the target response time label. The third loss information can represent the information difference between the first response time prediction information and the target response time label. The generation method of the third loss information can refer to the generation method of the first loss information.
[0082] The fourth step is to generate fourth loss information for the first abnormal problem identification information and the target abnormal problem label. The fourth loss information can represent the information difference between the first abnormal problem identification information and the target abnormal problem label. The generation method of the fourth loss information can refer to the generation method of the second loss information.
[0083] The fifth step is to combine the second response time prediction information and the second abnormal problem identification information to generate combined query performance information.
[0084] Step 6: Generate fifth loss information for the target query performance information and the combined query performance information, wherein the fifth loss information may represent the information difference between the target query performance information and the combined query performance information.
[0085] As an example, the execution entity may utilize a cross entropy loss function to generate fifth loss information for the target query performance information and the combined query performance information.
[0086] The seventh step is to determine the feature difference information between the response time prediction matrix and the first data feature information as the sixth loss information, wherein the sixth loss information may represent the semantic difference between the semantics corresponding to the response time prediction matrix and the semantics corresponding to the first data feature information.
[0087] As an example, the execution entity may determine feature difference information between the response time prediction matrix and the first data feature information through a mean square error loss function as sixth loss information.
[0088] In the eighth step, feature difference information between the abnormal problem identification matrix and the second data feature information is determined as the seventh loss information. The seventh loss information can represent the difference in meaning between the semantics corresponding to the abnormal problem identification matrix and the semantics corresponding to the second data feature information. The generation of the seventh loss information can refer to the generation of the sixth loss information.
[0089] The ninth step is to generate the above-mentioned model loss information based on the above-mentioned first loss information, the above-mentioned second loss information, the above-mentioned third loss information, the above-mentioned fourth loss information, the above-mentioned fifth loss information, the above-mentioned sixth loss information and the seventh loss information.
[0090] As an example, the execution entity may perform weighted sum processing on the first loss information, the second loss information, the third loss information, the fourth loss information, the fifth loss information, the sixth loss information and the seventh loss information to generate model loss information.
[0091] In some optional implementations of some embodiments, the query performance information generation model is applied through the following steps:
[0092] The first step is to obtain first database query information corresponding to the first database query request in response to receiving the first database query request and the request speed is greater than the preset speed. The first database query request may be a request to execute a database query. The request speed may be the response speed of the database query result. The request speed may be determined based on time. The first database query information may include: the query content of the database query and the database query statement.
[0093] The second step is to input the above-mentioned first database query information into the above-mentioned query performance information generation model to generate query performance information.
[0094] The third step is to generate warning information for the query performance information, wherein the warning information may be alarm information for performance consumption in the query performance information.
[0095] The fourth step is to send the query performance information and the warning information to the target terminal.
[0096] Step 104: Perform data clustering processing on the training data set to generate data clusters.
[0097] In some embodiments, the execution subject may perform data clustering processing on the training data set to generate a data cluster set, wherein each data in the data cluster has similar query feature information.
[0098] As an example, the execution subject may perform data clustering processing on the training data set according to the query feature information set sequence through a K-means clustering algorithm to generate a data cluster set.
[0099] Step 105: Obtain cluster center data corresponding to each data cluster in the above data cluster set.
[0100] In some embodiments, the execution entity may obtain cluster center data corresponding to each data cluster in the data cluster set.
[0101] In some optional implementations of some embodiments, the cluster center dataset is applied through the following steps:
[0102] The first step is to obtain second database query information corresponding to the second database query request in response to receiving the second database query request and the request speed is less than the preset speed. The second database query request may be a request to execute a database query. The second database query information may refer to the relevant explanation of the first database query information.
[0103] The second step is to determine the query feature information set corresponding to the second database query information as the real-time query feature information set.
[0104] The third step is to select, based on the real-time query feature information set, cluster center data having a feature information proximity relationship with the second database query information from the cluster center data set as target cluster center data.
[0105] As an example, the execution subject may determine the feature similarity between the real-time query feature information set and the query feature information set corresponding to each cluster center data, and then select the cluster center data with the largest corresponding feature similarity from the cluster center data set as the target cluster center data.
[0106] The fourth step is to determine the query performance information corresponding to the target cluster center data as the query performance information corresponding to the second database query information.
[0107] Step 106 , executing model deployment for the obtained cluster center data set and the query performance information generation model.
[0108] In some embodiments, the execution entity may execute model deployment for the obtained cluster center data set and the query performance information generation model.
[0109] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the model deployment method of some embodiments of the present disclosure, the trained query performance information is used to generate a model and a data cluster, and the performance consumption caused by executing the target database query can be accurately determined. Specifically, the reason for the inaccurate determination of the relevant performance consumption is that the manual analysis method is not accurate enough and the accuracy of the analysis is low. There is a certain data lag in the method of retrieving the background performance data, and it is not possible to obtain it in real time. Based on this, the model deployment method of some embodiments of the present disclosure first obtains a historical database query log sequence. Among them, each historical database query log includes: database statements, execution plan information and query consumption time. Here, the historical database query log sequence is obtained as a basic data set to facilitate subsequent clustering processing and model training. Then, for each historical database query log in the above historical database query log sequence, the following generation steps are performed: the first step is to determine the query performance information corresponding to the above historical database query log as the output purpose of the subsequent model training, which is convenient for the subsequent optimization training of the model. The second step is to extract the query feature information set corresponding to the above historical database query log as the input of the model, so that the model learns more feature information. Then, the obtained query feature information set sequence is used as a training data set, and the obtained query performance information sequence is used as a label set to train the initial query performance information generation model, so as to generate a query performance information generation model that generates query performance information more accurately. Next, data clustering processing is performed on the above training data set to generate a data cluster set, so as to cluster data with similar features into one category to obtain individual data clusters. Secondly, the cluster center data corresponding to each data cluster in the above data cluster set is obtained to facilitate the subsequent determination of the query performance corresponding to the data query. Finally, the model deployment is performed for the obtained cluster center data set and the above query performance information generation model. Here, by generating a cluster center data set and a query performance information generation model, not only can the accurate determination of the query performance information be guaranteed, but also different determination methods can be adaptively selected for different query timeliness, which greatly improves the query efficiency of performance consumption.
[0110] Further references Figure 2 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a model deployment device, and these device embodiments are Figure 1 Corresponding to the method embodiments shown, the model deployment device can be specifically applied to various electronic devices.
[0111] like Figure 2As shown, a model deployment device 200 includes: a first acquisition unit 201, a first execution unit 202, a training unit 203, a second execution unit 204, a second acquisition unit 205 and a deployment unit 206. Among them, the first acquisition unit 201 is configured to acquire a sequence of historical database query logs, wherein each historical database query log includes: database statements, execution plan information and query consumption time; the first execution unit 202 is configured to perform the following generation steps for each historical database query log in the above historical database query log sequence: determine the query performance information corresponding to the above historical database query log; extract the query feature information set corresponding to the above historical database query log; the training unit 203 is configured to use the obtained query feature information set sequence as a training data set and the obtained query performance information sequence as a label set to perform model training on the initial query performance information generation model to generate a query performance information generation model; the second execution unit 204 is configured to perform data clustering processing on the above training data set to generate a data cluster set; the second acquisition unit 205 is configured to acquire the cluster center data corresponding to each data cluster in the above data cluster set; the deployment unit 206 is configured to perform model deployment on the obtained cluster center data set and the above query performance information generation model.
[0112] It is understandable that the units recorded in the model deployment device 200 and the reference Figure 1 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the model deployment device 200 and the units contained therein, and will not be repeated here.
[0113] Reference below Figure 3 , which shows a structural schematic diagram of an electronic device (eg, an electronic device) 300 suitable for implementing some embodiments of the present disclosure. Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0114] like Figure 3 As shown, the electronic device 300 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 into a random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic device 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0115] Typically, the following devices may be connected to the I / O interface 305: input devices 306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 308 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 309. The communication devices 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3 The electronic device 300 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 3 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0116] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 309, or installed from the storage device 308, or installed from the ROM 302. When the computer program is executed by the processing device 301, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.
[0117] It should be noted that the computer-readable medium in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0118] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0119] The computer-readable medium may be included in the electronic device; or it may exist independently without being assembled into the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains a historical database query log sequence, wherein each historical database query log includes: database statements, execution plan information, and query consumption time; for each historical database query log in the historical database query log sequence, performs the following generation steps: determines the query performance information corresponding to the historical database query log; extracts the query feature information set corresponding to the historical database query log; uses the obtained query feature information set sequence as a training data set and the obtained query performance information sequence as a label set to perform model training on the initial query performance information generation model to generate a query performance information generation model; performs data clustering processing on the training data set to generate a data cluster set; obtains cluster center data corresponding to each data cluster in the data cluster set; and performs model deployment on the obtained cluster center data set and the query performance information generation model.
[0120] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, 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., via the Internet using an Internet service provider).
[0121] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0122] The units described in some embodiments of the present disclosure may be implemented by software or by hardware. The described units may also be provided in a processor, for example, may be described as: a processor comprising a first acquisition unit, a first execution unit, a training unit, a second execution unit, a second acquisition unit, and a deployment unit. The names of these units do not, in certain cases, constitute limitations on the units themselves, for example, the first acquisition unit may also be described as a "unit for acquiring a historical database query log sequence".
[0123] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0124] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.
Claims
1. A model deployment method, comprising: Obtain a historical database query log sequence, wherein each historical database query log includes: database statements, execution plan information, and query consumption time; For each historical database query log in the historical database query log sequence, the following generation steps are performed: Determining query performance information corresponding to the historical database query log; Extracting the query feature information set corresponding to the historical database query log; The obtained query feature information set sequence is used as a training data set, and the obtained query performance information sequence is used as a label set, and the initial query performance information generation model is trained to generate a query performance information generation model, wherein the query performance information in the query performance information sequence includes: response time prediction information and abnormal problem identification information, and the initial query performance information generation model includes: an initial response time prediction model, an initial abnormal problem identification model, and an initial multi-type output model for outputting response time and abnormal problems; and The method uses the obtained query feature information set sequence as a training data set and the obtained query performance information sequence as a label set to perform model training on the initial query performance information generation model to generate the query performance information generation model, including: Acquire training data from the training data set as target training data; For the target training data, perform the following training steps: Inputting the target training data into the initial response time prediction model to generate first response time prediction information; Inputting the target training data into the initial abnormal problem identification model to generate first abnormal problem identification information; Inputting the target training data into the initial multi-type output model to generate second response time prediction information and second abnormal problem identification information; Obtaining query performance information for target training data as target query performance information; Generate model loss information according to the first response time prediction information, the first abnormal problem identification information, the second response time prediction information, the second abnormal problem identification information, and the target query performance information; In response to determining that the model loss information table collection convergence is complete, determining the initial query performance information generation model as the query performance information generation model; In response to determining that the model loss information representation has not converged, updating the model parameters in the initial query performance information generation model according to the model loss information to obtain an updated query performance information generation model; Removing target training data from the training data set to obtain a removed training data set; Obtain training data from the removed training data set as candidate training data; Using the updated query performance information generation model as the initial query performance information generation model and the candidate training data as the target training data, and continuing to perform the training step; Performing data clustering processing on the training data set to generate data clusters; Obtaining cluster center data corresponding to each data cluster in the data cluster set; A model deployment is performed to generate a model based on the obtained cluster center data set and the query performance information.
2. The method according to claim 1, wherein: The step of inputting the target training data into the initial multi-type output model to generate the second response time prediction information and the second abnormal problem identification information includes: Inputting the target training data into a first data feature extraction model included in the initial multi-type output model to generate first data feature information, and inputting the target training data into a second data feature extraction model included in the initial multi-type output model to generate second data feature information; Performing feature information splicing on the first data feature information and the second data feature information to generate spliced feature information; Inputting the spliced feature information into a multi-level feature extraction model included in the initial multi-type output model to generate multi-level feature extraction information; Inputting the multi-level feature extraction information into the response time prediction information layer included in the initial multi-type output model to generate a response time prediction matrix and second response time prediction information; The multi-level feature extraction information is input into the abnormal problem identification layer included in the initial multi-type output model to generate an abnormal problem identification matrix and second abnormal problem identification information.
3. The method according to claim 2, wherein: The target query performance information includes: a target response time label and a target abnormal problem label; and The generating model loss information according to the first response time prediction information, the first abnormal problem identification information, the second response time prediction information, the second abnormal problem identification information and the target query performance information includes: generating first loss information for the first response time prediction information and the second response time prediction information; generating second loss information for the first abnormal problem identification information and the second abnormal problem identification information; generating third loss information for the first response time prediction information and the target response time label; generating fourth loss information for the first abnormal problem identification information and the target abnormal problem label; combining the second response time prediction information and the second abnormal problem identification information to generate combined query performance information; generating fifth loss information for the target query performance information and the combined query performance information; determining feature difference information between the response time prediction matrix and the first data feature information as sixth loss information; determining feature difference information between the abnormal problem identification matrix and the second data feature information as seventh loss information; The model loss information is generated according to the first loss information, the second loss information, the third loss information, the fourth loss information, the fifth loss information, the sixth loss information and the seventh loss information.
4. The method according to claim 1, wherein: The query performance information generation model is applied by the following steps: In response to receiving a first database query request and the request speed is greater than a preset speed, obtaining first database query information corresponding to the first database query request; Inputting the first database query information into the query performance information generation model to generate query performance information; generating early warning information for the query performance information; The query performance information and the warning information are sent to a target terminal.
5. The method according to claim 1, wherein: The cluster center dataset is applied by following the steps below: In response to receiving a second database query request and the request speed is less than a preset speed, obtaining second database query information corresponding to the second database query request; Determine a query feature information set corresponding to the query information of the second database as a real-time query feature information set; According to the real-time query feature information set, cluster center data having a feature information proximity relationship with the second database query information is screened out from the cluster center data set as target cluster center data; The query performance information corresponding to the target cluster center data is determined as the query performance information corresponding to the second database query information.
6. A model deployment device, comprising: A first acquisition unit is configured to acquire a historical database query log sequence, wherein each historical database query log includes: a database statement, execution plan information, and query consumption time; The first execution unit is configured to perform the following generation steps for each historical database query log in the historical database query log sequence: determining the query performance information corresponding to the historical database query log; extracting the query feature information set corresponding to the historical database query log; A training unit is configured to use the obtained query feature information set sequence as a training data set and the obtained query performance information sequence as a label set to perform model training on an initial query performance information generation model to generate a query performance information generation model, wherein the query performance information in the query performance information sequence includes: response time prediction information and abnormal problem identification information, and the initial query performance information generation model includes: an initial response time prediction model, an initial abnormal problem identification model, and an initial multi-type output model for outputting response time and abnormal problems; and the method of using the obtained query feature information set sequence as a training data set and the obtained query performance information sequence as a label set to perform model training on the initial query performance information generation model to generate a query performance information generation model includes: acquiring training data from the training data set as target training data; and performing the following training steps for the target training data: inputting the target training data into the initial response time prediction model to generate first response time prediction information; inputting the target training data into the initial abnormal problem identification model to generate first an abnormal problem identification information; inputting the target training data into the initial multi-type output model to generate the second response time prediction information and the second abnormal problem identification information; obtaining the query performance information for the target training data as the target query performance information; generating the model loss information according to the first response time prediction information, the first abnormal problem identification information, the second response time prediction information, the second abnormal problem identification information and the target query performance information; in response to determining that the model loss information representation has converged, determining the initial query performance information generation model as the query performance information generation model; in response to determining that the model loss information representation has not converged, updating the model parameters in the initial query performance information generation model according to the model loss information to obtain an updated query performance information generation model; removing the target training data from the training data set to obtain a training data set after removal; obtaining the training data from the training data set after removal as the candidate training data; using the updated query performance information generation model as the initial query performance information generation model and the candidate training data as the target training data, and continuing to execute the training steps; A second execution unit is configured to perform data clustering processing on the training data set to generate a data cluster set; A second acquisition unit is configured to acquire cluster center data corresponding to each data cluster in the data cluster set; The deployment unit is configured to execute model deployment for generating a model based on the obtained cluster center data set and the query performance information.
7. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
8. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Hypothesis data intelligent management method and device and computer readable storage medium
CN111339063A
Data query monitoring method and device, electronic equipment and storage medium
CN113032277A