Keyword-based script performance verification method, device, equipment and storage medium

By analyzing script keywords and association methods, and calculating the amount of data, the problem of inability to obtain script performance in advance in the existing technology is solved, and efficient utilization of resources and normal execution are achieved.

CN112181831BActive Publication Date: 2024-09-27CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011040636.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-28
Publication Date
2024-09-27
Estimated Expiration
2040-09-28

AI Technical Summary

Technical Problem

The existing technology cannot obtain the performance of the script before the script is run, resulting in excessive resource usage and affecting normal execution.

Method used

By obtaining the script file, parsing the script keywords, determining the associated data table and association method, calculating the amount of data required for execution, and outputting the verification results, you can understand the performance of the script execution in advance.

Benefits of technology

You can understand the performance of the script before it is run, avoid resource waste, and improve execution efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112181831B
    Figure CN112181831B
Patent Text Reader

Abstract

The present invention relates to artificial intelligence technology, and is particularly applied to a script performance verification method based on keyword analysis technology. A keyword-based script performance verification method, device, equipment and storage medium are disclosed to obtain the performance of the script before the script is run. The method part includes: obtaining a script file that needs to be verified; parsing the script file with script keywords to obtain the script keywords in the script file; determining all associated data tables used in the script file according to the script keywords, and determining the association conditions between the tables in all associated data tables; determining the association mode between the data tables in all associated data tables according to the association conditions; determining the data information used by the script file according to the associated data tables and the association mode; determining the data volume of the target data required to read when executing the script file according to the data information; and outputting the script file verification result including the data volume.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a keyword-based script performance verification method, device, equipment and storage medium. Background Art

[0002] A script is an executable file written in a certain format using a specific descriptive language. A script language is also called an extended language or a dynamic language. It is a programming language. Scripts are usually saved in text form and are only interpreted or compiled when they are called. When a script is executed, the computer will perform a series of operations to achieve a purpose or function that the writer wants. For example, a query language HQL script (Hibernate Query Language) is a script used to implement a certain data query or processing.

[0003] It can be seen that the performance of the script is extremely important, and it is usually necessary to verify or evaluate the performance of the script. At present, when evaluating the performance of a script, for example, when evaluating the performance of an HQL script on a big data platform, it mainly relies on the experience of the developer or the script execution log after the script is completed. In this solution, it is impossible to obtain the performance of the script before the script is run. Once there is a problem with the script performance and it causes excessive resource usage, it will waste the resources of the big data platform and even affect the execution of other normal scripts. Therefore, a new script performance verification or evaluation method is urgently needed. Summary of the invention

[0004] The present invention provides a keyword-based script performance verification method, device, equipment and storage medium to solve the problem in the prior art that the performance of the script cannot be obtained before the script is run, and once there is a problem with the script performance, it will cause excessive resource usage.

[0005] A keyword-based script performance verification method, comprising:

[0006] Get the script file that needs to be verified;

[0007] Performing script keyword parsing on the script file to obtain script keywords in the script file;

[0008] Determine all associated data tables used by the script file according to the script keywords, and determine the association conditions between the tables in all the associated data tables;

[0009] Determine the association mode between each data table in all the associated data tables according to the association condition;

[0010] Determining the data information used by the script file according to the associated data table and the associated method;

[0011] Determine the amount of target data required to be read when executing the script file according to the data information;

[0012] The output includes the script file verification result of the data volume.

[0013] A keyword-based script performance verification device, comprising:

[0014] The script acquisition module is used to obtain the script file that needs to be verified;

[0015] A script parsing module, used for parsing the script file for script keywords to obtain the script keywords in the script file;

[0016] An association condition determination module, used to determine all the association data tables used by the script file according to the script keywords, and determine the association conditions between the tables in all the association data tables;

[0017] An association mode determination module, used to determine the association mode between the data tables in all the associated data tables according to the association condition;

[0018] A data information determination module, used to determine the data information used by the script file according to the associated data table and the associated method;

[0019] A data volume determination module, used to determine the data volume of target data required to be read when executing the script file according to the data information;

[0020] An output module is used to output a script file verification result including the data volume.

[0021] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned script performance verification method when executing the computer program.

[0022] A computer-readable storage medium stores a computer program, which implements the steps of the above-mentioned script performance verification method when executed by a processor.

[0023] In a scheme provided by the above-mentioned keyword-based script performance verification method, device, computer equipment and storage medium, the script file to be verified is first obtained; the script file is parsed with script keywords to obtain the script keywords in the script file; and all the associated methods for executing the script file are obtained based on the script keywords; then the data information used by the script file is determined according to the associated data table and the associated method; the data volume of the target data required to be read when executing the script file is determined according to the data information; and finally, the script file verification result including the data volume is output for the user to find problems with the script file. In the present invention, before the script is executed or run, some situations of the script file including the data volume can be obtained and output by using the associated methods involved in the script file, so that the possible performance conditions of the script when it is executed can be understood in advance, which solves the problem in the prior art that the performance of the script cannot be obtained before the script is executed or run, resulting in problems with the script performance, which will cause problems such as excessive resource occupation and affect the normal execution of the script, and has a high application scenario. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0025] Figure 1 is a schematic diagram of an application environment of a script performance verification method in an embodiment of the present invention;

[0026] Figure 2 is a flow chart of a script performance verification method in one embodiment of the present invention;

[0027] Figure 3 yes Figure 2 A schematic diagram of a specific implementation in step S20;

[0028] Figure 4 is another flowchart of a script performance verification method according to an embodiment of the present invention;

[0029] Figure 5 is a schematic diagram of a specific implementation method for determining whether data divergence exists in an embodiment of the present invention;

[0030] Figure 6 is a schematic diagram of a specific implementation method of determining whether data skew exists in an embodiment of the present invention;

[0031] Figure 7 is another flowchart of a script performance verification method according to an embodiment of the present invention;

[0032] Figure 8 is a structural schematic diagram of a script performance verification device in one embodiment of the present invention;

[0033] Fig. 9 It is a structural diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION

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

[0035] The present invention relates to the field of artificial intelligence technology, and in particular to a script performance verification application scenario. Specifically, a keyword-based script performance verification method is provided, which can be applied in Figure 1 In an application environment, a client can communicate with a server through a network. The client can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, portable wearable devices and other terminal devices with display modules. The server can be implemented as an independent server or a server cluster consisting of multiple servers.

[0036] In one embodiment, if Figure 2 As shown, a keyword-based script performance verification method is provided, which is applied in Figure 1 The server in the example is used as an example to illustrate the process, including the following steps:

[0037] S10: Obtain the script file that needs to be verified.

[0038] A script file is an executable file, which refers to a piece of executable code written in any scripting language. Scripts are usually saved in text form and are only interpreted or compiled when they are called. When a script file is executed, the computer that executes the script file will execute a series of operations written in the script language to achieve a certain purpose or function that the script file writer wants. For example, the currently commonly used query language HQL script (Hibernate Query Language) is used to implement a script for certain data query or processing. After the writer finishes writing the script file, the script file needs to be performance-checked, and the server can obtain the script file that needs to be checked.

[0039] It should be noted that the scripting language used to write the script file in the embodiment of the present invention can be any type, for example, common languages ​​such as JavaScript, VBScript, Perl, PHP, Python, etc., without specific limitation.

[0040] S20: parsing the script file for script keywords to obtain script keywords in the script file.

[0041] After obtaining the script file to be verified, when verifying the script file, the script file needs to be parsed for script keywords to obtain the script keywords in the script file. The script keywords are the sentence keywords in the script code used to execute or achieve a certain purpose or function.

[0042] For example, if the script file contains the following script code:

[0043] "select form talbe_1, Join talbe_2, on talbe_1.colum1=talbe_2.colum2";

[0044] It is obvious that select form talbe_1, Join talbe_2, colum1=talbe_2.colum2 are all script keywords in the script file.

[0045] Wherein, in one embodiment, Figure 3 As shown, in step S20, that is, parsing the script file for script keywords to obtain the script keywords in the script file, specifically includes the following steps:

[0046] S21: Receive programming language type indication information from a user, where the programming language type indication information is used to indicate the type of programming language used by the script file.

[0047] In order to facilitate the quick acquisition of script keywords in the script file, the programming language type indication information input by the user can be obtained, and the programming language type indication information is used to indicate the programming language type used by the script file. In an application scenario, a script performance verification interface can be provided, which includes a programming language type option for providing the user with input or selection of the programming language type, so as to obtain the corresponding programming language type indication information. For example, if the script file is written in Python, the user can enter the Python programming language type indication information at this time to indicate that the programming language type used by the current script file is Python.

[0048] S22: Acquire keyword information corresponding to the programming language according to the programming language type indication information.

[0049] After the programming language type indication information is obtained, the keyword information corresponding to the programming language can be obtained according to the programming language type indication information. It should be noted that different script programming languages ​​contain different script keywords. Therefore, in order to quickly obtain the script keywords of the script file, the keyword information corresponding to the programming language is obtained according to the programming language type indication information in this embodiment. Among them, all keyword information of the script file can be obtained from the list of all keywords corresponding to the programming language.

[0050] S23: performing script keyword parsing on the script file according to the keyword information to obtain script keywords in the script file.

[0051] After obtaining the keyword information corresponding to the programming language, the script file is parsed for script keywords according to the keyword information to obtain the script keywords in the script file. For example, the statements in the script file may be parsed for text, and the parsing results may be matched with the keyword information to obtain the script keywords in the script file, that is, the keywords in the keyword information may be directly matched with the words in the script file to determine the script keywords in the script file.

[0052] S30: determining all associated data tables used by the script file according to the script keyword, and determining association conditions between tables in all the associated data tables.

[0053] S40: Determine the association mode between the data tables in all the associated data tables according to the association condition.

[0054] It can be understood that when a script file is executed, the data tables involved in the execution will be called, which are called associated data tables in this solution. After obtaining the script keywords in the script file, the meanings expressed by various statements in the script file will be determined based on all the script keywords in the script file, including the calling relationship of the data tables, so as to determine all the associated data tables required to execute the script file, and the association conditions between the tables in all the associated data tables. It should be noted that when the script file is executed, there are usually association conditions in the different associated data tables called by it, as well as the association mode reflected by the association conditions.

[0055] For example, as in the aforementioned code example "select form talbe_1, Join talbe_2, on talbe_1.colum1=talbe_2.colum2", it can be obtained that the associated data tables required when executing the script file include talbe_1 and talbe_2, wherein Join and on talbe_1.colum1=talbe_2.colum2 constitute the associated conditions.

[0056] It should be noted that the association mode refers to whether there is a certain association connection relationship between the associated data tables, and the association mode can be determined by the association condition. Assume that the associated data tables required when executing the script file include associated data table A and associated data table B, and associated data tables A and B are shown as follows:

[0057] Related data table A

[0058] A_ID A_NAME … 1 1 JACK … 2 2 JACK1 … 3 3 JACK3 … 4 4 JACK4 …

[0059] Related data table B

[0060] B_ID B_NAME … 1 2 KATE2 … 2 3 KATE3 … 3 4 KATE4 … 4 5 KATE5 … 5 6 KATE7 …

[0061] Taking the above two related data tables as an example, the association between the related data tables generally includes the following situations:

[0062] Inner join - take the data that exists in both related data tables; for example, suppose the script execution file contains the following code: select A.*, B*from A inner join B on A_ID=B_ID, where select, from, inner join and on constitute a complete association condition, A_ID=B_ID represents the association field, and the code indicates calling the associated data table A and the associated data table B for inner join, that is, the association method of the associated data table A and the associated data table B is inner join, where the associated field involved in the inner join is on A_ID=B_ID, that is, take the data with the same ID, where the data corresponding to the same ID exists in both the associated data table A and the associated data table B, and the final inner join result is shown in the following table:

[0063] Inner Join

[0064] A_ID A_NAME … B_ID B_NAME … 1 2 JACK1 … 2 KATE2 … 2 3 JACK3 … 3 KATE3 … 3 4 JACK4 4 KATE4

[0065] Left join - take all the data in the left table and the data that can be associated with the right table; left join is a type of outer join. For example, suppose the script execution file contains the following code: select A.*,B*from A left join B on A_ID=B_ID, where select, from, left join and on constitute a complete association condition, A_ID=B_ID represents the association field, and the code indicates calling the associated data table A and the associated data table B for a left join, that is, the association method of the associated data table A and the associated data table B is a left join, where the association field involved in the left join is on A_ID=B_ID.

[0066] Left Join

[0067] A_ID A_NAME … B_ID B_NAME … 1 2 JACK1 … 2 KATE2 … 2 3 JACK3 … 3 KATE3 … 3 4 JACK4 … 4 KATE4 … 4 1 JACK …

[0068] Right join - take all the data in the right table and the data that can be associated with the left table; right join is a type of outer join. For example, suppose the script execution file contains the following code: select A.*,B*from A right join B on A_ID=B_ID, where select, right join and on constitute a complete association condition, A_ID=B_ID represents the association field, and the code indicates calling the associated data table A and the associated data table B for a right join, that is, the association method of the associated data table A and the associated data table B is a right join, where the associated field involved in the right join is A_ID=B_ID.

[0069] Right Join

[0070] A_ID A_NAME … B_ID B_NAME … 1 2 JACK1 … 2 KATE2 … 2 3 JACK3 … 3 KATE3 … 3 4 JACK4 … 4 KATE4 … 4 … 5 KATE5 … 5 … 6 KATE7 …

[0071] Full join - retrieve data that exists in either table. For example, suppose the script execution file contains the following code: select A.*,B*from A full join B on A_ID=B_ID, where select, from, full join and on constitute a complete association condition, A_ID=B_ID represents the association field, and the code indicates calling the association data table A and the association data table B for a full join, that is, the association method of the association data table A and the association data table B is a full join, where the association field involved in the full join is on A_ID=B_ID.

[0072] Fully connected

[0073] A_ID A_NAME … B_ID B_NAME … 1 2 JACK1 … 2 KATE2 … 2 3 JACK3 … 3 KATE3 … 3 4 JACK4 4 KATE4 … 4 … 5 KATE5 … 5 … 6 KATE7 … 6 1 JACK … …

[0074] It can be understood that, based on various association modes between the associated data tables, the association mode of the associated data tables used to execute the script file can be clearly known, thereby knowing all the data called or required to execute the script file.

[0075] In addition, it can be seen that different association methods between related data tables will affect the calling or referencing of the data tables when the script is executed. Therefore, in order to clearly know the performance when executing the script, it is necessary to determine the association method between the related data tables in the script. It should be noted that the above association method is only an exemplary description, and there may be other association methods between related data tables, which are not listed here one by one.

[0076] S50: Determine the data information used by the script file according to the associated data table and the associated method.

[0077] Obviously, after obtaining all the associated data tables corresponding to the script file, and the association conditions and association methods between the tables in all the associated data tables, the data information used by the script file can be determined according to the associated data tables and the association methods. For example, the data information may include data volume, primary and foreign keys of the associated data tables, value distribution and other data information.

[0078] S60: Determine the amount of target data required to be read when executing the script file according to the data information.

[0079] S70: Outputting the script file verification result including the data amount.

[0080] For steps S60-S70, after determining the data information used by the script file, the amount of target data required to be read when executing the script file can be determined based on the data information, and output to the client for display, so that the user can know in advance some performance conditions when the script file is executed. For example, in the above code example, the amount of data in the associated data table talbe_1 is 100 million, the amount of data in the associated data table talbe_1 is 50 million, the primary key of talbe_1 is colum1, and the primary key of talbe_2 is colum2.

[0081] It can be seen that the embodiment of the present invention provides a keyword-based script performance verification method, which can obtain some execution performance conditions of the script file before the script is executed or run. It solves the problem in the prior art that the performance of the script cannot be obtained before the script is executed or run, thereby causing waste of resources and other situations that affect the normal execution of the script. It has a high application scenario.

[0082] In one embodiment, in order to more comprehensively understand the performance of the script file when it is executed, the present invention further determines to obtain other information that can be used to understand the script file. Figure 4 As shown, after step S40, that is, after determining the association mode between the tables in all the associated data tables according to the association condition, the following steps are specifically included:

[0083] S80: Determine a data state when executing the script file according to the association method, where the data state includes a data skew state and / or a data divergence state.

[0084] The data divergence state refers to the situation when the script file is executed, there are certain script statements, which will cause data divergence when calling the associated data table. It should be noted that if there is a problem with the script statement, such as a problem with the SQL statement in the script, then when the script file is executed, the query may not get results for a long time because the associated conditional statement is not used correctly. The reasons include the problem of data divergence. To give a simple example, many associated data tables are usually used when using SQL queries. It is thought that the association condition of two associated data tables is the user UID, but it is actually the order ID, or the user UID+date or the user UID+other conditions. If the association condition between the associated data tables is incomplete or wrong at the beginning, this will cause data divergence. Therefore, the data divergence state when executing the script file can be determined by association.

[0085] In one embodiment, there are many cases where data divergence occurs, which is difficult to detect in advance in practical applications. The embodiment of the present invention provides a simple method for determining data divergence, wherein: Figure 5 , the data divergence state is determined by:

[0086] S81: Determine whether there is a Cartesian product relationship between data tables in all the associated data tables according to the association method.

[0087] In the specific application scenario of the present invention, the Cartesian product relationship is used to determine whether data divergence exists. Specifically, the Cartesian product can be used to determine whether a Cartesian product relationship exists between two related data tables. It can be understood that the Cartesian product is a quantity that describes whether there is a cross-connection relationship between two related data tables.

[0088] Taking the aforementioned associated data table A and associated data table B as an example, if the script file contains the following code: select A.*,B*from A cross join B, where select, from, and cross join constitute a complete association condition, the code indicates calling associated data table A and associated data table B to perform Cartesian calculations to obtain the Cartesian product of the two associated data tables, that is, the association method between associated data table A and associated data table B is a cross join.

[0089] Cartesian Product

[0090]

[0091]

[0092] As shown in the table above, when the script file is executed, if the two related data tables have the above Cartesian product relationship.

[0093] S82: If it is determined that a Cartesian product relationship exists between the data tables in all the associated data tables, it is determined that data divergence exists when the script file is executed;

[0094] S83: If it is determined that there is no Cartesian product relationship between the data tables in all the associated data tables, it is determined that there is no data divergence when the script file is executed.

[0095] For steps S82-S83, after determining whether the data tables in all the associated data tables have a Cartesian product relationship according to the association method, if it is determined that the data tables in all the associated data tables have a Cartesian product relationship, it is determined that data divergence exists when the script file is executed; conversely, if it is determined that the data tables in all the associated data tables do not have a Cartesian product relationship, it is determined that data divergence does not exist when the script file is executed.

[0096] It is understandable that if there is a Cartesian product relationship between two associated data tables, the amount of data call calculation when executing the script file will be very huge. To give another simple example, assuming that the number of data items in associated data table 1 is 216, and the number of data items in associated data table 2 associated with associated data table 1 is 3509, the total number of items in the two associated data tables will reach 216*3509=757944. If the above-mentioned associated call relationship exists when executing the script file, when the data cardinality of associated data table 1 or associated data table 2 is at a high level, such as 100,000, the total number of calls will be very huge, which means that there is data divergence when executing the script file.

[0097] It should be noted that, for a cluster system, the cache is generally distributed, that is, different nodes are responsible for a certain range of cache data. The cache data is not dispersed enough, resulting in a large amount of cache data being concentrated on one or several service nodes, which is called data skew. In other words, data skew is a data skew state caused by the poor effect of load balancing implementation. Among them, for the embodiment of the present invention, data skew specifically refers to the state in which the distribution and processing of the data involved in the associated data table is too concentrated when the script file is executed. When the script file is executed, there is an uneven distribution of data, resulting in some data processing tasks being too large and some data processing tasks being too small. At this time, the workload of the corresponding processing nodes will be unevenly distributed, resulting in the execution time of the job of this processing node being much longer than that of other jobs.

[0098] In one embodiment, the data skew state is determined in the following manner, including the following steps:

[0099] S84: Determine whether there is an uneven distribution of the data task processing amount in the associated data table when executing the script file according to the association method, wherein the uneven distribution includes taking the task amount of the first data processing task as a preset integer multiple of the task amount of the second data processing task.

[0100] After obtaining the association mode of the associated data table involved in the script file, it can be determined according to the association mode whether there is an uneven distribution of the data task processing amount in the associated data table when executing the script file, wherein the uneven phenomenon includes the task amount of the first data processing task being a preset integer multiple of the task amount of the second data processing task. The first data processing task and the second data processing task are two different tasks assigned by the script file when processing the data in the associated data table, wherein, if it is found that the task amount of the first data processing task is a preset integer multiple of the task amount of the second data processing task, wherein the preset integer multiple can be set to be greater than 10 times, such as 15 times, 20 times, etc., indicating that the data processing is too concentrated at this time, then it is determined whether there is an uneven distribution of the data task processing amount in the associated data table when executing the script file.

[0101] S85: If it is determined that there is an uneven distribution of the data task processing amount in the associated data table, it is determined that there is data skew.

[0102] S86: If it is determined that there is no uneven distribution of the data task processing amount in the associated data table, it is determined that there is no data skew.

[0103] For steps S85-S86, after determining whether there is an uneven distribution of data task processing volume in the associated data table when executing the script file according to the association method, if it is determined that there is an uneven distribution of data task processing volume in the associated data table, it is determined that there is data skew; if it is determined that there is no uneven distribution of data task processing volume in the associated data table, it is determined that there is no data skew.

[0104] It can be seen that in this embodiment, it is further determined whether there is data skew and a specific judgment method is provided. It can be seen that through this solution, the skew, divergence and other states of the data can be further determined, the performance of the script can be fully understood, and a relatively complete verification of the script can be performed.

[0105] S90: Outputting the script file verification result including the data amount and the data status.

[0106] By determining the data status when executing the script file according to the association method, and outputting the script file verification result including the data volume and the data status, the user can have a more comprehensive understanding of the performance of the script file after being executed, so as to improve the script file in advance.

[0107] like Figure 7 As shown, after step S30, that is, after all associated data tables used by the script file are determined according to the script keywords, the method further includes the following steps:

[0108] S100: Obtain historical script execution log information from a script execution log library.

[0109] S110: Determine the duration of calling the associated data table when other script files are executed according to the historical script execution log information.

[0110] For steps S100-S110, the embodiment of the present invention will obtain historical script execution diary information from the script execution log library, wherein the script execution log library contains execution logs of previous script executions. The embodiment of the present invention will obtain historical script execution diary information from the script execution log library, and determine the duration of calling the associated data table when other script files are executed based on the historical script execution diary information. For example, if the associated data table A is called when executing the historical script 1, and its log contains the duration of calling the associated data table, the duration of calling the associated data table A when the historical script 1 is executed can be determined based on the script execution log information of the historical script, and the same can be determined for other associated data tables. That is: the embodiment of the present invention will determine the duration of calling all the associated data tables when other script files are executed based on the historical script execution diary information. For example, if a script that uses a certain associated data table A in the previous seven days uses 50 core hours of resources, then the estimate of calling the associated data table A when the script file is executed is 50 core hours.

[0111] S120: Count the duration of calling each of the associated data tables in all the associated data tables to obtain a total duration.

[0112] By determining the duration of calling all the associated data tables when other script files are executed based on the historical script execution log information, the duration of calling each of the associated data tables in all the associated data tables can be counted to obtain the total duration, so that the duration of calling each associated data table involved in the script file can be obtained to obtain the total duration.

[0113] S130: Determine the execution time of the script file using the total time.

[0114] S140: Outputting the script file verification result including the data volume, the data status and the execution time.

[0115] The total duration is used to determine the execution duration of the script file, and a script file verification result including the data volume, the data state, and the execution duration is output. It can be seen that in the embodiment of the present invention, the script verification result finally outputted can be as follows: the script reads a total of 150 million data, the final output data volume is less than or equal to 50 million, there is no divergence, no tilt, and the execution time is estimated to be 50 core hours, etc.

[0116] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0117] In one embodiment, a keyword-based script performance verification device is provided, and the script performance verification device corresponds one-to-one to the script performance verification method in the above embodiment. Figure 8 As shown, the script performance verification device includes a script acquisition module 101, a script parsing module 102, a correlation condition determination module 103, a correlation mode determination module 104, a data information determination module 105, a data volume determination module 106 and an output module 107. The functional modules are described in detail as follows:

[0118] The script acquisition module 101 is used to acquire the script file that needs to be verified;

[0119] The script parsing module 102 is used to parse the script file for script keywords to obtain the script keywords in the script file;

[0120] The association condition determination module 103 is used to determine all the association data tables used by the script file according to the script keywords, and determine the association conditions between the tables in all the association data tables;

[0121] An association mode determination module 104, configured to determine the association mode between the data tables in all the associated data tables according to the association condition;

[0122] The data information determination module 105 is used to determine the data information used by the script file according to the associated data table and the associated mode;

[0123] A data volume determination module 106, configured to determine the data volume of target data required to be read when executing the script file according to the data information;

[0124] The output module 107 is used to output the script file verification result including the data volume.

[0125] In one embodiment, the device further comprises a data status determination module;

[0126] The data state determination module is used to determine the data state when the script file is executed according to the association method, and the data state includes a data tilt state and / or a data divergence state;

[0127] The output module is used to output the script file verification result including the data volume and the data status.

[0128] In one implementation, the data status determination module is specifically used to:

[0129] Determine whether there is a Cartesian product relationship between the data tables in all the associated data tables according to the association mode;

[0130] If it is determined that the data tables in all the associated data tables have a Cartesian product relationship, it is determined that data divergence exists when the script file is executed;

[0131] If it is determined that there is no Cartesian product relationship between the data tables in all the associated data tables, it is determined that there is no data divergence when the script file is executed.

[0132] In one implementation, the data status determination module is specifically used to:

[0133] Determine, according to the association method, whether there is an uneven distribution of the data task processing amount in the associated data table when executing the script file, wherein the uneven distribution includes taking the task amount of the first data processing task as a preset integer multiple of the task amount of the second data processing task;

[0134] If it is determined that there is an uneven distribution of the data task processing amount in the associated data table, it is determined that there is data skew when executing the script file;

[0135] If it is determined that there is no uneven distribution of the data task processing amount in the associated data table, it is determined that there is no data skew when executing the script file.

[0136] In one embodiment, the device further includes a log information acquisition module, a call duration determination module, and an execution duration determination module:

[0137] The log information acquisition module is used to obtain historical script execution log information from the script execution log library;

[0138] A calling duration determination module is used to determine the duration of calling the associated data table when other script files are executed according to the historical script execution log information; and to count the duration of calling each associated data table in all the associated data tables to obtain the total duration;

[0139] An execution time determination module, which determines the execution time of executing the script file according to the total time;

[0140] The output module is used to output the script file verification result including the data volume, the data status and the execution time.

[0141] In one implementation, the script parsing module is specifically used to:

[0142] Receiving programming language type indication information from a user, where the programming language type indication information is used to indicate the type of programming language used by the script file;

[0143] Acquire keyword information corresponding to the programming language according to the programming language type indication information;

[0144] The script file is parsed for script keywords according to the keyword information to obtain the script keywords in the script file.

[0145] It can be seen that the embodiment of the present invention provides a keyword-based script performance verification device, which can obtain some execution performance conditions of the script file before the script is executed or run. It solves the problem in the prior art that it is impossible to obtain the performance of the script before the script is executed or run, thereby causing waste of resources and other situations that affect the normal execution of the script. It has a high application scenario.

[0146] For the specific definition of the script performance verification device, please refer to the definition of the script performance verification method above, which will not be repeated here. Each module in the above-mentioned script performance verification device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0147] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a storage medium and an internal memory. The storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a script performance verification method is implemented.

[0148] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0149] Get the script file that needs to be verified;

[0150] Performing script keyword parsing on the script file to obtain script keywords in the script file;

[0151] Determine all associated data tables used by the script file according to the script keywords, and determine the association conditions between the tables in all the associated data tables;

[0152] Determine the association mode between each data table in all the associated data tables according to the association condition;

[0153] Determining the data information used by the script file according to the associated data table and the associated method;

[0154] Determine the amount of target data required to be read when executing the script file according to the data information;

[0155] The output includes the script file verification result of the data volume.

[0156] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0157] Get the script file that needs to be verified;

[0158] Performing script keyword parsing on the script file to obtain script keywords in the script file;

[0159] Determine all associated data tables used by the script file according to the script keywords, and determine the association conditions between the tables in all the associated data tables;

[0160] Determine the association mode between each data table in all the associated data tables according to the association condition;

[0161] Determining the data information used by the script file according to the associated data table and the associated method;

[0162] Determine the amount of target data required to be read when executing the script file according to the data information;

[0163] The output includes the script file verification result of the data volume.

[0164] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0165] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0166] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A keyword-based script performance verification method, characterized in that: include: Get the script file that needs to be verified; Performing script keyword parsing on the script file to obtain script keywords in the script file, wherein the script keywords include associated fields and associated conditions; Determine all associated data tables used by the script file according to the associated fields, and determine the association mode between the tables in all the associated data tables according to the associated conditions, wherein the association mode includes inner join, outer join and full join; Determining the data information used by the script file according to the associated data table and the associated method; Determine the amount of target data required to be read when executing the script file according to the data information; Outputting the script file verification result including the data amount; Wherein, after determining the association mode between the tables in all the associated data tables according to the association condition, the method further includes: Determine a data state when executing the script file according to the association method, wherein the data state includes a data tilt state and / or a data divergence state; The output includes the script file verification result of the data volume, including: Outputting a script file verification result including the data amount and the data status; The data divergence state is determined in the following manner: Determine whether there is a Cartesian product relationship between the data tables in all the associated data tables according to the association mode; If it is determined that the data tables in all the associated data tables have a Cartesian product relationship, it is determined that data divergence exists when the script file is executed; If it is determined that there is no Cartesian product relationship between the data tables in all the associated data tables, it is determined that there is no data divergence when the script file is executed; The data tilt state is determined in the following manner: Determine, according to the association method, whether there is an uneven distribution of the data task processing amount in the associated data table when executing the script file, wherein the uneven distribution includes taking the task amount of the first data processing task as a preset integer multiple of the task amount of the second data processing task; If it is determined that there is an uneven distribution of the data task processing amount in the associated data table, it is determined that there is data skew when executing the script file; If it is determined that there is no uneven distribution of the data task processing amount in the associated data table, it is determined that there is no data skew when executing the script file.

2. The script performance verification method according to claim 1, characterized in that: After determining all associated data tables used by the script file according to the associated fields, the method further includes: Get historical script execution log information from the script execution log library; Determine the duration of calling the associated data table when other script files are executed according to the historical script execution log information; Counting the duration of each associated data table being called in all the associated data tables to obtain a total duration; The total duration is used to determine the execution duration of the script file; The output includes the script file verification result of the data volume and the data status, including: The output includes the script file verification result of the data volume, the data status and the execution time.

3. The script performance verification method according to claim 1, characterized in that: The performing script keyword parsing on the script file to obtain the script keywords in the script file includes: Receiving programming language type indication information from a user, where the programming language type indication information is used to indicate the type of programming language used by the script file; Acquire keyword information corresponding to the programming language according to the programming language type indication information; The script file is parsed for script keywords according to the keyword information to obtain the script keywords in the script file.

4. A script performance verification device based on keywords, characterized in that: include: The script acquisition module is used to obtain the script file that needs to be verified; A script parsing module, used for parsing the script file for script keywords to obtain script keywords in the script file, wherein the script keywords include associated fields and associated conditions; An association condition determination module, used to determine all the association data tables used by the script file according to the association fields, and determine the association mode between the tables in all the association data tables according to the association conditions, wherein the association mode includes inner join, outer join and full join; A data information determination module, used to determine the data information used by the script file according to the associated data table and the associated method; A data volume determination module, used to determine the data volume of target data required to be read when executing the script file according to the data information; An output module, used for outputting a script file verification result including the data volume; Wherein, the device further comprises a data status determination module; The data state determination module is used to determine the data state when the script file is executed according to the association method, and the data state includes a data tilt state and / or a data divergence state; The output module is used to output the script file verification result including the data volume and the data status; The data divergence state is determined in the following manner: Determine whether there is a Cartesian product relationship between the data tables in all the associated data tables according to the association mode; If it is determined that the data tables in all the associated data tables have a Cartesian product relationship, it is determined that data divergence exists when the script file is executed; If it is determined that there is no Cartesian product relationship between the data tables in all the associated data tables, it is determined that there is no data divergence when the script file is executed; The data tilt state is determined in the following manner: Determine, according to the association method, whether there is an uneven distribution of the data task processing amount in the associated data table when executing the script file, wherein the uneven distribution includes taking the task amount of the first data processing task as a preset integer multiple of the task amount of the second data processing task; If it is determined that there is an uneven distribution of the data task processing amount in the associated data table, it is determined that there is data skew when executing the script file; If it is determined that there is no uneven distribution of the data task processing amount in the associated data table, it is determined that there is no data skew when executing the script file.

5. A computer device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the script performance verification method according to any one of claims 1 to 3 are implemented.

6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the script performance verification method as described in any one of claims 1 to 3 are implemented.