CN112783747A - Execution time prediction method and device for application program - Google Patents

Execution time prediction method and device for application program Download PDF

Info

Publication number
CN112783747A
CN112783747A CN202110174967.1A CN202110174967A CN112783747A CN 112783747 A CN112783747 A CN 112783747A CN 202110174967 A CN202110174967 A CN 202110174967A CN 112783747 A CN112783747 A CN 112783747A
Authority
CN
China
Prior art keywords
information
execution time
application program
sql statement
training
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110174967.1A
Other languages
Chinese (zh)
Other versions
CN112783747B (en
Inventor
马文莹
张林林
赵欣然
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110174967.1A priority Critical patent/CN112783747B/en
Publication of CN112783747A publication Critical patent/CN112783747A/en
Application granted granted Critical
Publication of CN112783747B publication Critical patent/CN112783747B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

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

Landscapes

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

Abstract

The invention provides an execution time prediction method and device of an application program, and relates to the technical field of big data. The method comprises the following steps: acquiring test environment information and production environment information of an application program to be predicted and statement information of each SQL statement; performing characteristic engineering on statement information of each SQL statement of the application program to be predicted to obtain characteristic data of each SQL statement; obtaining the estimated execution time of each SQL statement in the production environment according to the test environment information, the production environment information, the characteristic data of each SQL statement and the execution time estimation model of the application program to be predicted; and obtaining the estimated execution time of the application program to be predicted in the production environment according to the estimated execution time of each SQL statement in the production environment. The device is used for executing the method. The execution time prediction method and the device for the application program improve the prediction accuracy of the execution time of the application program.

Description

Execution time prediction method and device for application program
Technical Field
The invention relates to the technical field of big data, in particular to an execution time prediction method and device of an application program.
Background
With the continuous development of financial science and technology, the bank business scene shows the blowout trend, and the development of various software projects is continuously increased.
In the prior art, in the acceptance test link of software project development, a tester can test a developed application program under a test environment, and the application program can be composed of SQL statements and can test the correctness and the performability of the SQL statements. Because the difference between the production environment and the test environment is from the aspects of resource allocation, test data and the like, the execution time of the SQL statement in the test environment is deviated from the execution time of the SQL statement in the production environment, so that the execution time of the same SQL statement in the production environment cannot be accurately estimated, and the execution time of the application program in the production environment cannot be accurately predicted.
Disclosure of Invention
To solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for predicting an execution time of an application program, which can at least partially solve the problems in the prior art.
In one aspect, the present invention provides a method for predicting an execution time of an application, including:
obtaining test environment information and production environment information of an application program to be predicted and statement information of each SQL statement of the application program to be predicted; the statement information of each SQL statement comprises the execution time of each SQL statement in a test environment;
performing characteristic engineering on statement information of each SQL statement of the application program to be predicted to obtain characteristic data of each SQL statement;
obtaining the estimated execution time of each SQL statement in the production environment according to the test environment information and the production environment information of the application program to be predicted, the characteristic data of each SQL statement of the application program to be predicted and an execution time estimation model; the execution time estimation model is obtained based on first training data, second training data and corresponding label data training;
and obtaining the estimated execution time of the application program to be predicted in the production environment according to the estimated execution time of each SQL statement of the application program to be predicted in the production environment.
In another aspect, the present invention provides an execution time prediction apparatus for an application, including:
the system comprises a first obtaining unit, a second obtaining unit and a third obtaining unit, wherein the first obtaining unit is used for obtaining test environment information and production environment information of an application program to be predicted and statement information of each SQL statement of the application program to be predicted; the statement information of each SQL statement comprises the execution time of each SQL statement in a test environment;
the characteristic engineering unit is used for performing characteristic engineering on statement information of each SQL statement of the application program to be predicted to obtain characteristic data of each SQL statement;
the prediction unit is used for obtaining the predicted execution time of each SQL statement in the production environment according to the test environment information and the production environment information of the application program to be predicted, the characteristic data of each SQL statement of the application program to be predicted and the execution time prediction model; the execution time estimation model is obtained based on first training data, second training data and corresponding label data training;
and the second obtaining unit is used for obtaining the estimated execution time of the application program to be predicted in the production environment according to the estimated execution time of each SQL statement of the application program to be predicted in the production environment.
In another aspect, the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the execution time prediction method for an application program according to any of the above embodiments when executing the program.
In yet another aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the execution time prediction method for an application program according to any one of the above embodiments.
The execution time prediction method and device for the application program provided by the embodiment of the invention can obtain the test environment information and the production environment information of the application program to be predicted and the statement information of each SQL statement of the application program to be predicted, perform characteristic engineering on the statement information of each SQL statement of the application program to be predicted to obtain the characteristic data of each SQL statement, obtain the predicted execution time of each SQL statement in the production environment according to the test environment information, the production environment information, the characteristic data of each SQL statement of the application program to be predicted and the execution time prediction model, obtain the predicted execution time of the application program to be predicted in the production environment according to the execution time of each predicted SQL statement of the application program to be predicted in the production environment, and realize the prediction of the execution time of the application program in the production environment, the accuracy of the execution time of the application program in the production environment is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
fig. 1 is a flowchart illustrating a method for predicting an execution time of an application according to an embodiment of the present invention.
Fig. 2 is a flowchart illustrating a method for predicting an execution time of an application according to another embodiment of the present invention.
Fig. 3 is a flowchart illustrating an execution time prediction method for an application according to another embodiment of the present invention.
Fig. 4 is a flowchart illustrating an execution time prediction method for an application according to still another embodiment of the present invention.
Fig. 5 is a schematic structural diagram of an execution time prediction apparatus for an application according to an embodiment of the present invention.
Fig. 6 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
Fig. 1 is a schematic flowchart of a method for predicting an execution time of an application according to an embodiment of the present invention, and as shown in fig. 1, the method for predicting an execution time of an application according to an embodiment of the present invention includes:
s101, obtaining test environment information and production environment information of an application program to be predicted and statement information of each SQL statement of the application program to be predicted; the statement information of each SQL statement comprises the execution time of each SQL statement in a test environment;
specifically, in the acceptance test link, when the application to be predicted is tested, the test environment information for running the application to be predicted may be collected, where the test environment information includes, but is not limited to, hardware information, hardware usage information, and software information of the test environment. Before the application program to be predicted is put into production, the production environment information for running the application program to be predicted can be collected, and the production environment information comprises but is not limited to hardware information, hardware use information and software information of a production environment. The server can obtain the test environment information and the production environment information of the application program to be predicted, and can also obtain the statement information of each SQL statement of the application program to be predicted, wherein the statement information of each SQL statement comprises the execution time of each SQL statement in the test environment. Each SQL statement has a corresponding statement type. When the application program to be predicted is tested in the test environment, the execution time of each SQL statement of the application program to be predicted in the test environment can be obtained. The application program to be predicted comprises a plurality of SQL sentences, and each SQL sentence has a corresponding sentence type. The statement information may also include information such as statement type, and is set according to actual needs, and the embodiment of the present invention is not limited. The statement type is set according to actual needs, and the embodiment of the invention is not limited. The execution main body of the execution time prediction method of the application program provided by the embodiment of the invention comprises but is not limited to a server.
S102, performing characteristic engineering on statement information of each SQL statement of the application program to be predicted to obtain characteristic data of each SQL statement;
specifically, the server performs feature engineering on statement information of each SQL statement of the application to be predicted, and obtains feature data corresponding to each SQL statement. The specific mode adopted by the characteristic engineering is set according to actual needs, and the embodiment of the invention is not limited.
S103, obtaining estimated execution time of each SQL statement in the production environment according to the test environment information and the production environment information of the application program to be predicted, the feature data of each SQL statement of the application program to be predicted and an execution time estimation model; the execution time estimation model is obtained based on first training data, second training data and corresponding label data training;
specifically, the server inputs the test environment information and the production environment information of the application program to be predicted, and the feature data of each SQL statement of the application program to be predicted into an execution time estimation model, and the estimated execution time of each SQL statement in the generation environment can be output through the processing of the execution time estimation model. The execution time estimation model is obtained based on the first training data, the second training data and corresponding label data.
S104, obtaining the estimated execution time of the application program to be predicted in the production environment according to the estimated execution time of each SQL statement of the application program to be predicted in the production environment.
Specifically, after obtaining the estimated execution time of each SQL statement of the application program to be predicted in the production environment, the server sums the estimated execution times of each SQL statement of the application program to be predicted in the production environment, and uses the summed result as the estimated execution time of the application program to be predicted in the production environment.
The execution time prediction method for the application program provided by the embodiment of the invention can obtain the test environment information and the production environment information of the application program to be predicted and the statement information of each SQL statement of the application program to be predicted, performing characteristic engineering on the statement information of each SQL statement of the application program to be predicted to obtain the characteristic data of each SQL statement, obtaining the estimated execution time of each SQL statement in the production environment according to the test environment information, the production environment information, the characteristic data of each SQL statement of the application program to be predicted and the execution time estimation model, according to the estimated execution time of each SQL statement of the application program to be predicted in the production environment, the estimated execution time of the application program to be predicted in the production environment is obtained, the estimation of the execution time of the application program in the production environment is achieved, and the estimation accuracy of the execution time of the application program in the production environment is improved. Can provide support and guarantee for the production and on-line of business systems of related industries such as finance and the like.
Fig. 2 is a flowchart of a method for predicting an execution time of an application according to another embodiment of the present invention, and as shown in fig. 2, on the basis of the foregoing embodiments, the step of obtaining the execution time prediction model based on the training of the first training data, the training of the second training data, and the corresponding tag data further includes:
s201, acquiring first training data, second training data and corresponding label data, and dividing the first training data, the second training data and the corresponding label data into a training set and a verification set; the training set comprises test environment information and production environment information corresponding to each SQL statement in a first number of SQL statements, training characteristic data of each SQL statement and corresponding label data; the verification set comprises test environment information and production environment information corresponding to each SQL statement in a second number of SQL statements, training characteristic data of each SQL statement and corresponding label data;
specifically, the test environment information of the application program for training may be collected as the test environment information corresponding to each SQL statement of the application program for training, and the production environment information of the application program for training may be collected as the production environment information corresponding to each SQL statement of the application program for training. The server may use test environment information and production environment information corresponding to each SQL statement of the application program for training as the first training data. The test environment information includes, but is not limited to, hardware information, hardware usage information, and software information of the test environment. The production environment information includes, but is not limited to, hardware information, hardware usage information, and software information of the production environment.
When the application program for training is tested in the test environment, the execution time of each SQL statement of the application program for training in the test environment can be obtained. The server may obtain statement information of each SQL statement of the application for training, where the statement information includes an execution time of each SQL statement in the test environment. The server performs feature engineering on the statement information of each SQL statement of the application program for training, so as to obtain training feature data of each SQL statement, and the training feature data of each SQL statement of the application program for training constitutes the second training data.
When the application program for training is put into use in the production environment, the execution time of each SQL statement of the application program for training in the production environment can be obtained. The server acquires the execution time of each SQL statement of the application program for training in the production environment as the label data corresponding to each SQL statement. And label data corresponding to each SQL statement of the application program for training, namely label data corresponding to the first training data and the second training data.
The server divides the first training data, the second training data and the corresponding label data into a training set and a verification set, wherein the training set is used for training the model, and the verification set is used for verifying the model obtained by training. The training set comprises test environment information and production environment information corresponding to each SQL statement in the first quantity of SQL statements, training characteristic data of each SQL statement and corresponding label data. The verification set comprises test environment information and production environment information corresponding to each SQL statement in the second quantity of SQL statements, and training characteristic data and corresponding label data of each SQL statement. The first number and the second number are set according to practical experience, and the embodiment of the invention is not limited. The test environment information corresponding to each SQL statement is information of a test environment for running each SQL statement, and the production environment information corresponding to each SQL statement is information of a production environment for running each SQL statement.
S202, training to obtain an execution time estimation model to be determined according to the training set and the original model;
specifically, the server inputs test environment information and production environment information corresponding to each SQL statement in the training set, training feature data of each SQL statement and corresponding label data into the original model, trains the original model, continuously adjusts parameters of the original model, and obtains an execution time estimation model to be determined. Wherein, the original model can adopt a Lightgbm model.
S203, if the execution time estimation model to be determined is judged to pass the evaluation of the verification set, taking the execution time estimation model to be determined as the execution time estimation model.
Specifically, after obtaining the execution time prediction model to be determined, the server may evaluate an effect of the execution time prediction model to be determined through the verification set. Inputting test environment information and production environment information corresponding to each SQL statement in the verification set and training characteristic data of each SQL statement into the execution time prediction model to be determined, outputting a prediction result corresponding to each SQL statement, obtaining an error parameter of the execution time prediction model to be determined according to label data corresponding to each SQL statement and the prediction result corresponding to each SQL statement, and taking the execution time prediction model to be determined as the execution time prediction model if the error parameter is less than or equal to an evaluation threshold value, which indicates that the prediction accuracy of the execution time prediction model to be determined meets requirements. If the error parameter is greater than the evaluation threshold, then model training is resumed. The evaluation threshold is set according to practical experience, and the embodiment of the invention is not limited.
For example, the server may be based on a formula
Figure BDA0002940381750000071
Calculating to obtain an error parameter sigma, wherein xiThe label data, y, corresponding to the ith SQL statement representing the set verificationiAnd n represents the number of SQL sentences included in the set verification, namely the second number.
Fig. 3 is a flowchart illustrating a method for predicting an execution time of an application according to yet another embodiment of the present invention, as shown in fig. 3, based on the foregoing embodiments, further including:
s301, acquiring hardware information, hardware use information and software information of a test environment of the application program for training, hardware information, hardware use information and software information of a production environment of the application program for training, and statement types of each SQL statement, execution time of each SQL statement in the test environment and execution time in the production environment of the application program for training;
specifically, hardware information, hardware usage information, and software information of a test environment for the trained application may be collected as test environment information for the trained application. Hardware information, hardware usage information, and software information of a production environment of an application for training may be collected as production environment information of the application for training. The server may obtain hardware information, hardware usage information, and software information for a test environment of the trained application, and hardware information, hardware usage information, and software information for a production environment of the trained application.
When the application program for training is tested in the test environment, the execution time of each SQL statement of the application program for training in the test environment can be obtained. When the application program for training runs in the production environment, the execution time of each SQL statement of the application program for training in the production environment can be obtained. Each SQL statement included in the application for training has a corresponding statement type. The server may obtain a statement type of each SQL statement for the trained application, an execution time of each SQL statement in the test environment, and an execution time of each SQL statement in the production environment.
The hardware information of the test environment includes, but is not limited to, information such as the number of CPUs in the test environment, the CPU frequency in the test environment, the CPU model in the test environment, the memory size in the test environment, the memory frequency in the test environment, the hard disk size in the test environment, and the hard disk specification in the test environment, and is selected according to actual required information, which is not limited in the embodiments of the present invention. The hardware use information of the test environment includes, but is not limited to, information of recording the CPU use percentage, the memory occupation ratio, the hard disk occupation ratio, the current execution task quantity and the like of the SQL statement before the test environment is executed by taking minutes as dimensions. The software information of the test environment includes, but is not limited to, information of a database type, a database version, a database size, and the like of the test environment configuration.
The hardware information of the production environment includes, but is not limited to, the number of CPUs in the production environment, the CPU frequency in the production environment, the CPU model in the production environment, the memory size in the production environment, the memory frequency in the production environment, the hard disk size in the production environment, the hard disk specification in the production environment, and the like. The hardware use information of the production environment includes, but is not limited to, information of recording the CPU use percentage, the memory occupation ratio, the hard disk occupation ratio, the current execution task quantity and the like of the SQL statement before the production environment is executed by taking minutes as dimensions. The software information of the production environment includes, but is not limited to, information of a database type, a database version, a database size, and the like of the production environment configuration.
The statement type of each SQL statement is preset and is set according to actual needs, which is not limited in the embodiments of the present invention. For example, for a Delete statement, a Delete type is set; for the update statement, an update type may be set. For Insert statements, the type is set to increment.
The number of test environments or production environments of the application program for training may be multiple, and the test environments or the production environments may be set according to actual needs. For example, the application program for training is tested in 4 different test environments, and the hardware information, the hardware use information and the software information of the application program for training in 4 different test environments are collected. For example, the application program for training is run in 2 different production environments, and the hardware information, the hardware usage information and the software information of the application program for training in 2 different production environments are collected.
S302, obtaining the first training data according to hardware information, hardware use information and software information of a test environment of the application program for training, and hardware information, hardware use information and software information of a production environment of the application program for training;
specifically, the server corresponds hardware information, hardware usage information, and software information of a test environment of the application program for training, and hardware information, hardware usage information, and software information of a production environment of the application program for training to each SQL statement of the application program for training, and obtains the hardware information, hardware usage information, and software information of the test environment corresponding to each SQL statement, and the hardware information, hardware usage information, and software information of the production environment corresponding to each SQL statement. The hardware information, the hardware using information and the software information of the test environment corresponding to each SQL statement of the application program for training, and the hardware information, the hardware using information and the software information of the production environment corresponding to each SQL statement form the first training data.
And S303, performing characteristic engineering on the statement type of each SQL statement of the application program for training and the execution time of each SQL statement in the test environment to obtain second training data, and taking the execution time of each SQL statement of the application program for training in the production environment as label data corresponding to each SQL statement.
Specifically, the server performs feature engineering on the statement type of each SQL statement of the application program for training and the execution time of each SQL statement in the test environment to obtain feature data corresponding to each SQL statement, and the feature data corresponding to each SQL statement of the application program for training constitutes the second training data. And the server takes the execution time of each SQL statement of the application program for training in the production environment as the label data corresponding to each SQL statement.
For example, for the statement type of the SQL statement, one-hot coding may be adopted to convert the statement type of the SQL statement into numerical data, and the numerical data converted by the statement type of the SQL statement is used as the feature data corresponding to the SQL statement. The SQL statement a is an update statement, the SQL statement B is an Insert statement, and as shown in table 1, the numerical data converted from the statement type of the SQL statement a is 0100, and the numerical data converted from the statement type of the SQL statement B is 0010.
Table 1 numerical data of statement type
Sentence Deletion type Update type Increased type Other types
A 0 1 0 0
B 0 0 1 0
For example, the execution time of each SQL statement may be subjected to feature engineering by using a method of obtaining a maximum value, a minimum value, an average value, a variance, and the like, so as to obtain corresponding feature data.
For example, the information entropy of the SQL statements of the same statement type may be counted as the feature data corresponding to the SQL statements. The proportion of the quantity of the SQL sentences of each sentence type in the quantity of all the SQL sentences in the application program for training can be calculated, the information entropy of the SQL sentences of each sentence type can be calculated based on a calculation formula of the information entropy, and the information entropy of the SQL sentences of each sentence type is used as the corresponding characteristic data of the SQL sentences.
On the basis of the foregoing embodiments, further, the obtaining, by training, the to-be-determined execution time prediction model according to the training set and the original model includes:
training to obtain a plurality of to-be-determined execution time estimation models according to the training set and a plurality of different original models; wherein the different original models are obtained by adjusting the hyper-parameters through a grid search method or a random search method.
Specifically, before model training, hyper-parameters of the original model need to be set, and then the original model is trained. If the hyper-parameters of the original model are set according to experience, the hyper-parameters are not necessarily suitable, and the optimal execution time prediction model cannot be obtained. The initial hyper-parameters can be manually set, then the server adjusts the initial hyper-parameters through a network search method or a random search method, a plurality of groups of hyper-parameters can be obtained, a group of hyper-parameters is configured for each original model, and a plurality of different original models can be obtained. The server trains different original models according to the training set, and a model for estimating the execution time to be determined corresponding to each original model can be obtained.
Fig. 4 is a flowchart illustrating a method for predicting an execution time of an application according to still another embodiment of the present invention, where as shown in fig. 4, the method for predicting an execution time of an application according to the embodiment of the present invention further includes:
s401, evaluating the multiple to-be-determined execution time estimation models according to the verification set to obtain the to-be-determined execution time estimation models passing evaluation;
specifically, after the server trains a plurality of different original models to obtain a plurality of execution time prediction models to be determined, because only one execution time prediction model needs to be used at last, one execution time prediction model to be determined needs to be selected from the plurality of execution time prediction models to be determined as the execution time prediction model. And the server evaluates each to-be-determined execution time estimation model through the verification set to obtain the evaluated to-be-determined execution time estimation model. It can be understood that if none of the plurality of time-estimated models to be determined passes the evaluation, the training of the models needs to be repeated. The specific evaluation process of each to-be-determined execution time prediction model is similar to the evaluation process of the to-be-determined execution time prediction model in step S203, and is not repeated here.
S402, selecting the execution time prediction model to be determined with the highest prediction accuracy from the estimated execution time prediction models to be determined as the execution time prediction model.
Specifically, if only one of the plurality of to-be-determined execution time prediction models passes the evaluation, the to-be-determined execution time prediction model can be directly used as the execution time prediction model. If the plurality of to-be-determined execution time prediction models pass the evaluation, the error parameters of each to-be-determined execution time prediction model in the evaluated to-be-determined execution time prediction models can be compared, the prediction accuracy of the to-be-determined execution time prediction model with the smallest error parameter is highest, and the to-be-determined execution time prediction model with the highest prediction accuracy is used as the execution time prediction model.
On the basis of the above embodiments, further, the statement information further includes a statement type.
Specifically, the statement type of each SQL statement is preset, and each SQL statement has a corresponding statement type. The statement type is set according to actual needs, and the embodiment of the invention is not limited.
For example, for a Delete statement, a Delete type is set; for the update statement, an update type may be set. For Insert statements, the type is set to increment.
On the basis of the foregoing embodiments, further, the test environment information includes hardware information, hardware usage information, and software information of the test environment, and the production environment information includes hardware information, hardware usage information, and software information of the production environment.
Specifically, the hardware information of the test environment includes, but is not limited to, information such as the number of CPUs in the test environment, the CPU frequency in the test environment, the CPU model in the test environment, the memory size in the test environment, the memory frequency in the test environment, the hard disk size in the test environment, and the hard disk specification in the test environment, and is selected according to actual information, which is not limited in the embodiment of the present invention. The hardware use information of the test environment includes, but is not limited to, information of recording the CPU use percentage, the memory occupation ratio, the hard disk occupation ratio, the current execution task quantity and the like of the SQL statement before the test environment is executed by taking minutes as dimensions. The software information of the test environment includes, but is not limited to, information of a database type, a database version, a database size, and the like of the test environment configuration.
The hardware information of the production environment includes, but is not limited to, the number of CPUs in the production environment, the CPU frequency in the production environment, the CPU model in the production environment, the memory size in the production environment, the memory frequency in the production environment, the hard disk size in the production environment, the hard disk specification in the production environment, and the like. The hardware use information of the production environment includes, but is not limited to, information of recording the CPU use percentage, the memory occupation ratio, the hard disk occupation ratio, the current execution task quantity and the like of the SQL statement before the production environment is executed by taking minutes as dimensions. The software information of the production environment includes, but is not limited to, information of a database type, a database version, a database size, and the like of the production environment configuration.
The execution time prediction method of the application program provided by the embodiment of the invention can predict the execution time of the same SQL statement in different environments, realize the cross-environment prediction of the execution time of the SQL statement and further realize the prediction of the execution time of the application program in a production environment. The method can provide support and guarantee for the production and on-line of business systems in related industries such as finance, and the like, and avoid the influence on providing external services caused by the fact that the production of the business systems cannot be completed in limited time due to inaccurate execution time prediction of application programs. On the basis of not changing the existing production test process, additional guarantee is provided for the production of the business system.
Fig. 5 is a schematic structural diagram of an execution time prediction apparatus for an application program according to an embodiment of the present invention, and as shown in fig. 5, the execution time prediction apparatus for an application program according to an embodiment of the present invention includes a first obtaining unit 501, a feature engineering unit 502, a prediction unit 503, and a second obtaining unit 504, where:
the first obtaining unit 501 is configured to obtain test environment information and production environment information of an application to be predicted, and statement information of each SQL statement of the application to be predicted; the statement information of each SQL statement comprises the execution time of each SQL statement in a test environment; the feature engineering unit 502 is configured to perform feature engineering on statement information of each SQL statement of the application to be predicted, and obtain feature data of each SQL statement; the prediction unit 503 is configured to obtain an estimated execution time of each SQL statement in the production environment according to the test environment information, the production environment information, the feature data of each SQL statement of the to-be-predicted application, and the execution time estimation model of the to-be-predicted application; the execution time estimation model is obtained based on first training data, second training data and corresponding label data training; the second obtaining unit 504 is configured to obtain the estimated execution time of the application program to be predicted in the production environment according to the estimated execution time of each SQL statement of the application program to be predicted in the production environment.
Specifically, in the acceptance test link, when the application to be predicted is tested, the test environment information for running the application to be predicted may be collected, where the test environment information includes, but is not limited to, hardware information, hardware usage information, and software information of the test environment. Before the application program to be predicted is put into production, the production environment information for running the application program to be predicted can be collected, and the production environment information comprises but is not limited to hardware information, hardware use information and software information of a production environment. The first obtaining unit 501 may obtain test environment information and production environment information of the application to be predicted, and the first obtaining unit 501 may further obtain statement information of each SQL statement of the application to be predicted, where the statement information of each SQL statement includes execution time of each SQL statement in the test environment. Each SQL statement has a corresponding statement type. When the application program to be predicted is tested in the test environment, the execution time of each SQL statement of the application program to be predicted in the test environment can be obtained. The application program to be predicted comprises a plurality of SQL sentences, and each SQL sentence has a corresponding sentence type. The statement information may also include information such as statement type, and is set according to actual needs, and the embodiment of the present invention is not limited. The statement type is set according to actual needs, and the embodiment of the invention is not limited.
The feature engineering unit 502 performs feature engineering on the statement information of each SQL statement of the application to be predicted, and obtains feature data corresponding to each SQL statement. The specific mode adopted by the characteristic engineering is set according to actual needs, and the embodiment of the invention is not limited.
The prediction unit 503 inputs the test environment information, the production environment information, and the feature data of each SQL statement of the application program to be predicted into the execution time prediction model, and may output the predicted execution time of each SQL statement in the generation environment through the processing of the execution time prediction model. The execution time estimation model is obtained based on the first training data, the second training data and corresponding label data.
After obtaining the estimated execution time of each SQL statement of the application program to be predicted in the production environment, the second obtaining unit 504 sums the estimated execution times of each SQL statement of the application program to be predicted in the production environment, and uses the summed result as the estimated execution time of the application program to be predicted in the production environment.
The execution time prediction device for the application program provided by the embodiment of the invention can obtain the test environment information and the production environment information of the application program to be predicted and the statement information of each SQL statement of the application program to be predicted, performing characteristic engineering on the statement information of each SQL statement of the application program to be predicted to obtain the characteristic data of each SQL statement, obtaining the estimated execution time of each SQL statement in the production environment according to the test environment information, the production environment information, the characteristic data of each SQL statement of the application program to be predicted and the execution time estimation model, according to the estimated execution time of each SQL statement of the application program to be predicted in the production environment, the estimated execution time of the application program to be predicted in the production environment is obtained, the estimation of the execution time of the application program in the production environment is achieved, and the estimation accuracy of the execution time of the application program in the production environment is improved. Can provide support and guarantee for the production and on-line of business systems of related industries such as finance and the like.
The embodiment of the apparatus provided in the embodiment of the present invention may be specifically configured to execute the processing flows of the above method embodiments, and the functions of the apparatus are not described herein again, and refer to the detailed description of the above method embodiments.
Fig. 6 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 6, the electronic device may include: a processor (processor)601, a communication Interface (Communications Interface)602, a memory (memory)603 and a communication bus 604, wherein the processor 601, the communication Interface 602 and the memory 603 complete communication with each other through the communication bus 604. The processor 601 may call logic instructions in the memory 603 to perform the following method: obtaining test environment information and production environment information of an application program to be predicted and statement information of each SQL statement of the application program to be predicted; the statement information of each SQL statement comprises the execution time of each SQL statement in a test environment; performing characteristic engineering on statement information of each SQL statement of the application program to be predicted to obtain characteristic data of each SQL statement; obtaining the estimated execution time of each SQL statement in the production environment according to the test environment information and the production environment information of the application program to be predicted, the characteristic data of each SQL statement of the application program to be predicted and an execution time estimation model; the execution time estimation model is obtained based on first training data, second training data and corresponding label data training; and obtaining the estimated execution time of the application program to be predicted in the production environment according to the estimated execution time of each SQL statement of the application program to be predicted in the production environment.
In addition, the logic instructions in the memory 603 may be implemented in the form of software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The present embodiment discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the method provided by the above-mentioned method embodiments, for example, comprising: obtaining test environment information and production environment information of an application program to be predicted and statement information of each SQL statement of the application program to be predicted; the statement information of each SQL statement comprises the execution time of each SQL statement in a test environment; performing characteristic engineering on statement information of each SQL statement of the application program to be predicted to obtain characteristic data of each SQL statement; obtaining the estimated execution time of each SQL statement in the production environment according to the test environment information and the production environment information of the application program to be predicted, the characteristic data of each SQL statement of the application program to be predicted and an execution time estimation model; the execution time estimation model is obtained based on first training data, second training data and corresponding label data training; and obtaining the estimated execution time of the application program to be predicted in the production environment according to the estimated execution time of each SQL statement of the application program to be predicted in the production environment.
The present embodiment provides a computer-readable storage medium, which stores a computer program, where the computer program causes the computer to execute the method provided by the above method embodiments, for example, the method includes: obtaining test environment information and production environment information of an application program to be predicted and statement information of each SQL statement of the application program to be predicted; the statement information of each SQL statement comprises the execution time of each SQL statement in a test environment; performing characteristic engineering on statement information of each SQL statement of the application program to be predicted to obtain characteristic data of each SQL statement; obtaining the estimated execution time of each SQL statement in the production environment according to the test environment information and the production environment information of the application program to be predicted, the characteristic data of each SQL statement of the application program to be predicted and an execution time estimation model; the execution time estimation model is obtained based on first training data, second training data and corresponding label data training; and obtaining the estimated execution time of the application program to be predicted in the production environment according to the estimated execution time of each SQL statement of the application program to be predicted in the production environment.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In the description herein, reference to the description of the terms "one embodiment," "a particular embodiment," "some embodiments," "for example," "an example," "a particular example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for predicting an execution time of an application program, comprising:
obtaining test environment information and production environment information of an application program to be predicted and statement information of each SQL statement of the application program to be predicted; the statement information of each SQL statement comprises the execution time of each SQL statement in a test environment;
performing characteristic engineering on statement information of each SQL statement of the application program to be predicted to obtain characteristic data of each SQL statement;
obtaining the estimated execution time of each SQL statement in the production environment according to the test environment information and the production environment information of the application program to be predicted, the characteristic data of each SQL statement of the application program to be predicted and an execution time estimation model; the execution time estimation model is obtained based on first training data, second training data and corresponding label data training;
and obtaining the estimated execution time of the application program to be predicted in the production environment according to the estimated execution time of each SQL statement of the application program to be predicted in the production environment.
2. The method of claim 1, wherein the step of training to obtain the execution time prediction model based on the first and second training data and the corresponding label data comprises:
acquiring the first training data, the second training data and corresponding label data, and dividing the first training data, the second training data and the corresponding label data into a training set and a verification set; the training set comprises test environment information and production environment information corresponding to each SQL statement in a first number of SQL statements, training characteristic data of each SQL statement and corresponding label data; the verification set comprises test environment information and production environment information corresponding to each SQL statement in a second number of SQL statements, training characteristic data of each SQL statement and corresponding label data;
training to obtain a to-be-determined execution time estimation model according to the training set and the original model;
and if the execution time estimation model to be determined is judged to pass the evaluation of the verification set, taking the execution time estimation model to be determined as the execution time estimation model.
3. The method of claim 2, wherein the obtaining first and second training data and corresponding label data comprises:
acquiring hardware information, hardware use information and software information of a test environment of the application program for training, hardware information, hardware use information and software information of a production environment of the application program for training, and a statement type of each SQL statement, an execution time of each SQL statement in the test environment and an execution time in the production environment of the application program for training;
obtaining the first training data according to hardware information, hardware use information and software information of a test environment of the application program for training, and hardware information, hardware use information and software information of a production environment of the application program for training;
and performing characteristic engineering on the statement type of each SQL statement of the application program for training and the execution time of each SQL statement in the test environment to obtain second training data, and taking the execution time of each SQL statement of the application program for training in the production environment as label data corresponding to each SQL statement.
4. The method according to claim 2, wherein the training to obtain the model of estimated execution time to be determined according to the training set and the original model comprises:
training to obtain a plurality of to-be-determined execution time estimation models according to the training set and a plurality of different original models; wherein the different original models are obtained by adjusting the hyper-parameters through a grid search method or a random search method.
5. The method of claim 4, further comprising:
evaluating the multiple to-be-determined execution time estimation models according to the verification set to obtain the to-be-determined execution time estimation models passing the evaluation;
and selecting the to-be-determined execution time prediction model with the highest prediction accuracy from the estimated to-be-determined execution time prediction models as the execution time prediction model.
6. The method of claim 1, wherein the statement information further comprises a statement type.
7. The method of any one of claims 1 to 6, wherein the test environment information comprises hardware information, hardware usage information, and software information of the test environment, and the production environment information comprises hardware information, hardware usage information, and software information of the production environment.
8. An execution time prediction apparatus for an application program, comprising:
the system comprises a first obtaining unit, a second obtaining unit and a third obtaining unit, wherein the first obtaining unit is used for obtaining test environment information and production environment information of an application program to be predicted and statement information of each SQL statement of the application program to be predicted; the statement information of each SQL statement comprises the execution time of each SQL statement in a test environment;
the characteristic engineering unit is used for performing characteristic engineering on statement information of each SQL statement of the application program to be predicted to obtain characteristic data of each SQL statement;
the prediction unit is used for obtaining the predicted execution time of each SQL statement in the production environment according to the test environment information and the production environment information of the application program to be predicted, the characteristic data of each SQL statement of the application program to be predicted and the execution time prediction model; the execution time estimation model is obtained based on first training data, second training data and corresponding label data training;
and the second obtaining unit is used for obtaining the estimated execution time of the application program to be predicted in the production environment according to the estimated execution time of each SQL statement of the application program to be predicted in the production environment.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110174967.1A 2021-02-09 2021-02-09 Execution time prediction method and device for application program Active CN112783747B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110174967.1A CN112783747B (en) 2021-02-09 2021-02-09 Execution time prediction method and device for application program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110174967.1A CN112783747B (en) 2021-02-09 2021-02-09 Execution time prediction method and device for application program

Publications (2)

Publication Number Publication Date
CN112783747A true CN112783747A (en) 2021-05-11
CN112783747B CN112783747B (en) 2024-06-11

Family

ID=75761332

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110174967.1A Active CN112783747B (en) 2021-02-09 2021-02-09 Execution time prediction method and device for application program

Country Status (1)

Country Link
CN (1) CN112783747B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113393047A (en) * 2021-06-23 2021-09-14 中国工商银行股份有限公司 Service scene key table prediction method and device
CN113485258A (en) * 2021-06-10 2021-10-08 西安交通大学 Method and system for predicting longest execution time of control logic of coal-fired power plant

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866580A (en) * 2015-05-26 2015-08-26 梁猛 Method for quickly detecting impact caused by database modification to current service
CN105488539A (en) * 2015-12-16 2016-04-13 百度在线网络技术(北京)有限公司 Generation method and device of classification method, and estimation method and device of system capacity
CN108052394A (en) * 2017-12-27 2018-05-18 福建星瑞格软件有限公司 The method and computer equipment of resource allocation based on SQL statement run time
CN110147305A (en) * 2019-04-19 2019-08-20 平安普惠企业管理有限公司 A kind of test model construction method and system based on big data
CN110795450A (en) * 2019-09-12 2020-02-14 连连银通电子支付有限公司 SQL processing method and device
CN111259040A (en) * 2020-02-19 2020-06-09 中国工商银行股份有限公司 SQL statement auditing method and system
CN111290929A (en) * 2020-02-10 2020-06-16 珠海图思科软件有限公司 Equivalent SQL statement performance test method, computer device and computer readable storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866580A (en) * 2015-05-26 2015-08-26 梁猛 Method for quickly detecting impact caused by database modification to current service
CN105488539A (en) * 2015-12-16 2016-04-13 百度在线网络技术(北京)有限公司 Generation method and device of classification method, and estimation method and device of system capacity
CN108052394A (en) * 2017-12-27 2018-05-18 福建星瑞格软件有限公司 The method and computer equipment of resource allocation based on SQL statement run time
CN110147305A (en) * 2019-04-19 2019-08-20 平安普惠企业管理有限公司 A kind of test model construction method and system based on big data
CN110795450A (en) * 2019-09-12 2020-02-14 连连银通电子支付有限公司 SQL processing method and device
CN111290929A (en) * 2020-02-10 2020-06-16 珠海图思科软件有限公司 Equivalent SQL statement performance test method, computer device and computer readable storage medium
CN111259040A (en) * 2020-02-19 2020-06-09 中国工商银行股份有限公司 SQL statement auditing method and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485258A (en) * 2021-06-10 2021-10-08 西安交通大学 Method and system for predicting longest execution time of control logic of coal-fired power plant
CN113393047A (en) * 2021-06-23 2021-09-14 中国工商银行股份有限公司 Service scene key table prediction method and device

Also Published As

Publication number Publication date
CN112783747B (en) 2024-06-11

Similar Documents

Publication Publication Date Title
CN110287477B (en) Entity emotion analysis method and related device
Eismann et al. Predicting the costs of serverless workflows
CN107040397B (en) Service parameter acquisition method and device
CN110689368B (en) Method for designing advertisement click rate prediction system in mobile application
CN112783747B (en) Execution time prediction method and device for application program
US11269760B2 (en) Systems and methods for automated testing using artificial intelligence techniques
CN112910690A (en) Network traffic prediction method, device and equipment based on neural network model
CN102541736A (en) Acceleration test method in software reliability execution process
JPWO2019111435A1 (en) Abnormality judgment device, abnormality judgment method, and program
US8983816B2 (en) Efficient evaluation of network robustness with a graph
CN114818600A (en) Chip verification method and device, electronic equipment and storage medium
CN112819069B (en) Event grading method and device
CN113761193A (en) Log classification method and device, computer equipment and storage medium
CN114139636A (en) Abnormal operation processing method and device
CN107644042B (en) Software program click rate pre-estimation sorting method and server
US11036980B2 (en) Information processing method and information processing system
CN105224449A (en) The method of testing of the application program on mobile terminal and device
CN116560968A (en) Simulation calculation time prediction method, system and equipment based on machine learning
CN113849634B (en) Method for improving interpretability of depth model recommendation scheme
CN113298120B (en) Fusion model-based user risk prediction method, system and computer equipment
US11562110B1 (en) System and method for device mismatch contribution computation for non-continuous circuit outputs
CN113191877A (en) Data feature acquisition method and system and electronic equipment
CN113850314A (en) Customer value grade prediction model establishing method, device, medium and equipment
CN108564135B (en) Method for constructing framework program and realizing high-performance computing program running time prediction
CN112308446A (en) Comprehensive judgment method, system and medium for technology maturity based on multivariate data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant