Database performance test method and related device
By analyzing and parameterizing historical database transactions, generating synthetic databases for performance testing, the problem of performance testing in the actual database environment in cloud computing scenarios is solved, and the testing efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202310956807.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-28
- Publication Date
- 2025-02-14
AI Technical Summary
In cloud computing scenarios, performance testing cannot be performed in the actual database environment, which makes it an urgent problem to be solved to collect business characteristics and generate similar synthetic loads for database testing.
By analyzing the historical load of the original database, extracting transaction templates, and generating synthetic databases based on these templates for performance testing. The specific steps include: parameterizing historical transactions, extracting library table structure information, building a synthetic database, instantiating transaction templates, and executing transactions in the synthetic database to obtain performance test results.
This method improves the data synthesis efficiency and database performance testing efficiency, while ensuring the similarity between the synthetic data and the original data, thereby improving the accuracy of performance testing.
Smart Images

Figure CN119440972A_ABST
Abstract
Description
Background Art
[0002] With the rapid development of computer technology, in cloud computing scenarios, in order to ensure service stability, performance testing cannot be performed in the actual database environment. Therefore, how to collect business characteristics and generate similar synthetic loads for database testing is an urgent problem to be solved.
[0003] In the related technology, by analyzing the historical load of the collected original database, the transaction templates corresponding to each transaction contained in the historical load are obtained. Each transaction template is obtained by parameterizing each constant in the corresponding transaction. Then, the original database is feature extracted to obtain the library table structure information, and based on the library table structure information, a synthetic database is obtained. After that, each transaction template is instantiated to obtain each synthetic transaction, and each synthetic transaction is executed in the synthetic database to obtain performance test results.
[0004] However, the amount of data stored in the original database may be huge. Therefore, if the synthetic database is directly generated based on the original database, the amount of data synthesis is large and the data synthesis efficiency is low. Summary of the invention
[0005] The embodiments of the present application provide a database performance testing method and related devices to improve data synthesis efficiency, thereby improving the testing efficiency of database performance testing.
[0006] In a first aspect, an embodiment of the present application provides a database performance testing method, including:
[0007] Based on at least one constant contained in each historical transaction within a specified time period in the original database, parameterize each historical transaction to obtain a corresponding transaction template;
[0008] Based on the set target field, extracting the file structure information of each storage file associated with the target field from each obtained transaction template;
[0009] Based on the obtained file structure information, the file generation order between the storage files is obtained, and the value distribution of each attribute contained in each storage file is obtained;
[0010] Based on the file structure information and value distribution corresponding to each of the storage files, combined with the file generation order, a virtual synthetic file corresponding to each of the storage files is constructed, and performance testing is performed based on the constructed virtual synthetic files to obtain performance test results.
[0011] In a second aspect, an embodiment of the present application provides a database performance testing device, including:
[0012] A parameterization unit, configured to perform parameterization processing on each historical transaction within a specified time period in the original database based on at least one constant contained in each historical transaction, so as to obtain a corresponding transaction template;
[0013] A structure extraction unit, configured to extract, based on a set target field, from each acquired transaction template, the file structure information of each storage file associated with the target field;
[0014] A distribution extraction unit, used to obtain the file generation order between the storage files and the value distribution of each attribute contained in each storage file based on the obtained file structure information;
[0015] The testing unit is used to construct virtual synthetic files corresponding to each of the storage files based on the file structure information and value distribution corresponding to each of the storage files in combination with the file generation order, and perform performance testing based on the constructed virtual synthetic files to obtain performance test results.
[0016] As a possible implementation, when the performance test is performed based on each constructed virtual synthetic file and the performance test result is obtained, the testing unit is specifically used to:
[0017] If the performance test is a performance simulation test, then based on the performance constraint parameter set of each historical transaction in the original database, each constructed virtual synthetic file is used to perform a performance test to obtain a performance test result;
[0018] If the performance test is a performance stress test, multiple rounds of performance tests are performed based on the constructed virtual synthetic files to obtain performance test results.
[0019] As a possible implementation, when the performance constraint parameter set of each historical transaction in the original database is used to perform performance testing using each constructed virtual synthetic file and obtaining the performance test result, the testing unit is specifically used to:
[0020] Based on the historical execution results corresponding to each of the transaction templates, each of the transaction templates is instantiated to obtain a corresponding instantiated transaction, and based on the performance constraint parameter set of each historical transaction in the original database, the obtained instantiated transaction and each virtual synthetic file are combined to obtain a performance test result; or,
[0021] Based on the performance constraint parameter set of each historical transaction in the original database, combined with each historical transaction and each constructed virtual synthetic file, a performance test result is obtained.
[0022] As a possible implementation method, multiple rounds of performance tests are performed based on each constructed virtual synthetic file. When the performance test results are obtained, the test unit is specifically used to:
[0023] Based on the number of historical transactions corresponding to each of the transaction templates, the transaction templates are sorted, and according to a set selection ratio and the sorting result, each target template is extracted from the transaction templates, and according to each instantiated transaction obtained by instantiating the target template, multiple rounds of performance testing are performed in combination with each virtual synthetic file to obtain a performance test result; or,
[0024] Based on the target sub-load configured in the configuration file and in combination with the correspondence between the target sub-load and the target template, the target templates corresponding to the target sub-load are obtained from the transaction templates, and according to the instantiated transactions obtained by instantiating the target templates and in combination with the virtual synthetic files, multiple rounds of performance testing are performed to obtain performance test results.
[0025] As a possible implementation, when performing multiple rounds of performance tests based on the constructed virtual synthetic files and obtaining the performance test results, the testing unit is specifically used to:
[0026] Perform a first round of performance testing based on each constructed virtual synthetic file to obtain a first round of reference performance testing results;
[0027] Starting from the second round of performance testing, the current round of performance testing is performed based on the constructed virtual synthetic files to obtain the current performance test results of the current round, and when it is determined that data offset occurs based on the reference performance test results and the current performance test results, data recovery is performed on each virtual synthetic file after the current round of performance testing.
[0028] As a possible implementation, the test unit is also used to:
[0029] Based on the execution start time corresponding to each of the transaction templates, the transaction templates are sorted to obtain a transaction template sequence;
[0030] According to a set time interval, each transaction template in the transaction template sequence is divided to obtain multiple groups of transaction templates, each group of transaction templates includes at least one transaction template;
[0031] Based on the category features corresponding to each of the multiple groups of transaction templates, the multiple groups of transaction templates are clustered to obtain at least one group of merged transaction templates.
[0032] As a possible implementation manner, when clustering the multiple groups of transaction templates based on the category features corresponding to each of the multiple groups of transaction templates to obtain at least one group of merged transaction templates, the testing unit is specifically used to:
[0033] At least one merging process is performed on the multiple groups of transaction templates. In each merging process, the following operations are performed:
[0034] Acquire each current group of transaction templates, and based on the category features corresponding to each of the current groups of transaction templates, determine that there are two groups of transaction templates that meet a preset merging condition among the current groups of transaction templates, and merge the two groups of transaction templates to obtain a new group of transaction templates;
[0035] Based on at least one transaction template contained in each of the two groups of transaction templates, category features corresponding to the new group of transaction templates are obtained.
[0036] As a possible implementation manner, when it is determined that there are two groups of transaction templates that meet the preset merging condition among the current groups of transaction templates based on the category features corresponding to the current groups of transaction templates, the testing unit is specifically used to:
[0037] If the category feature is the template similarity between two groups of transaction templates, then when the template similarity between the two groups of transaction templates is less than a preset similarity threshold, it is determined that there are two groups of transaction templates that meet the preset merging condition in the current groups of transaction templates;
[0038] If the category feature is an evaluation value of the number of executed statements between two groups of transaction templates, then when the difference in the evaluation values of the number of executed statements between the two groups of transaction templates is less than a preset evaluation value threshold, it is determined that among the current groups of transaction templates, there are two groups of transaction templates that meet the preset merging conditions; the execution number evaluation value is used to characterize the number of SQL statements executed per unit time.
[0039] As a possible implementation manner, when extracting the file structure information of each storage file associated with the target field from each obtained transaction template based on the set target field, the structure extraction unit is specifically used to:
[0040] Based on the set target field, extracting the file names contained in each of the obtained transaction templates;
[0041] Based on the obtained file names, file structure query requests are respectively initiated to the original database to obtain file structure information of corresponding storage files.
[0042] As a possible implementation manner, each file structure information includes each attribute included in the corresponding storage file, and obtaining the file generation order between the storage files based on the obtained file structure information includes:
[0043] Determine the file dependency relationship between the stored files based on the attributes contained in the obtained file structure information;
[0044] Based on the file dependency, a file generation order between the storage files is obtained.
[0045] As a possible implementation, when obtaining the numerical distribution of each attribute contained in each storage file based on the obtained file structure information, the distribution extraction unit is specifically used to:
[0046] Based on the set query field, extract at least one joint column from each of the transaction templates, each joint column including: at least one attribute in a storage file queried by the corresponding transaction template;
[0047] Based on the extracted at least one joint column and in combination with the original database, obtaining a numerical range corresponding to each attribute contained in the at least one joint column;
[0048] Based on the at least one joint column, respectively according to the set sampling ratio, a sampling query is performed on the original database to obtain corresponding sampling results, and based on the corresponding sampling results, corresponding sampling statistical information is obtained;
[0049] Based on the sampling statistical information corresponding to each of the at least one joint columns and the obtained value ranges, the value distribution of each attribute contained in each of the storage files is obtained.
[0050] As a possible implementation, when constructing the virtual synthetic files corresponding to the respective storage files based on the file structure information and the value distribution corresponding to the respective storage files and in combination with the file generation order, the test unit is specifically used to:
[0051] According to the file generation order, the virtual synthetic files corresponding to the respective storage files are constructed in sequence, wherein in each construction process, the following operations are performed respectively:
[0052] Determining attributes included in a virtual synthetic file based on file structure information of a storage file corresponding to the virtual synthetic file;
[0053] Based on the attribute types of the attributes contained in the virtual synthetic file and in combination with the data generation strategies corresponding to the attribute types, a value set of the attributes contained in the virtual synthetic file is generated; wherein each data generation strategy is generated based on the numerical distribution of the corresponding attribute.
[0054] As a possible implementation manner, when generating a value set of each attribute included in the virtual synthetic file based on the attribute type of each attribute included in the virtual synthetic file and in combination with a data generation strategy corresponding to the attribute type, the test unit is specifically used to:
[0055] For each attribute included in the virtual synthesis file, the following operations are performed respectively:
[0056] If an attribute is a primary key, each unique value is used as the value set of the attribute;
[0057] If an attribute is a foreign key, then based on the file generation order, a pre-order file of a storage file corresponding to the one virtual synthetic file is determined from the storage files, and based on the value distribution of the one attribute in the pre-order file, a value set of the one attribute is generated;
[0058] If an attribute does not belong to a primary key or a foreign key, a value set of the attribute is generated based on the value distribution of the attribute in the storage file corresponding to the virtual synthetic file.
[0059] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above method.
[0060] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes a computer program. When the computer program is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of the above method.
[0061] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and the computer program is stored in a computer-readable storage medium. The processor of an electronic device reads and executes the computer program from the computer-readable storage medium, so that the electronic device performs the steps of the above method.
[0062] In the implementation of the present application, after obtaining the transaction templates corresponding to each historical transaction within a specified time period in the original database, based on the set target field, the file structure information of each storage file associated with the target field is extracted from each obtained transaction template, and then, based on the obtained file structure information, the file generation order between the storage files is obtained, and the numerical distribution of each attribute contained in each storage file is obtained, and then, based on the file structure information and numerical distribution corresponding to each storage file, combined with the file generation order, a virtual synthetic file is constructed, and performance testing is performed based on the constructed virtual synthetic file to obtain performance test results.
[0063] In this way, since the load within a period of time has local access to library tables and attribute columns, by analyzing and extracting the storage files accessed in historical transactions, the file structure information of the storage files, the value distribution, and the file generation order between the storage files, the necessary data can be constrained when synthesizing data. This not only speeds up the data generation speed and improves the data synthesis efficiency, thereby improving the test efficiency when performing performance testing, but also ensures the similarity between the synthetic data and the original data to a certain extent, thereby improving the data simulation effect and then improving the accuracy of performance testing.
[0064] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0066] Figure 1 A schematic diagram of an application scenario provided in the implementation of this application;
[0067] Figure 2 A schematic diagram of a database performance testing method provided in an embodiment of the present application;
[0068] Figure 3 A schematic diagram of a transaction template provided in the implementation of this application;
[0069] Figure 4 A schematic diagram of the library table access analysis provided in the implementation of this application;
[0070] Figure 5 A schematic diagram of the file structure information and data distribution provided in the implementation of this application;
[0071] Figure 6 A schematic diagram of joint column extraction provided in the implementation of this application;
[0072] Figure 7 A schematic diagram of a DAG provided in the implementation of this application;
[0073] Figure 8 A schematic diagram of the distribution of transaction instances provided in the implementation of this application;
[0074] Fig. 9A schematic diagram of the system architecture provided in the implementation of this application;
[0075] Fig.10 A flowchart of another database performance testing method provided in the implementation of this application;
[0076] Fig.11 A schematic diagram of the structure of a database performance testing device provided in an embodiment of the present application;
[0077] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0078] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the technical solution of the present application, rather than all of the embodiments. Based on the embodiments recorded in the application documents, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the technical solution of the present application.
[0079] First, some concepts involved in the embodiments of the present application are explained.
[0080] SQL parameterization: Parameterize constants such as numbers and strings that appear in an SQL statement, thereby expressing the SQL statement containing actual data as a parameterized SQL template.
[0081] Transaction template: A parameterized transaction obtained by parameterizing all SQL statements of a transaction.
[0082] Joint columns: The column name tuple that appears in the WHERE clause of an SQL statement. Joint columns reflect the relevance of attribute columns from a query perspective.
[0083] Value List: During the parameterized SQL process, the parameterized parts of all SQL contained in each transaction form a Value tuple, and the Value tuples extracted from all transactions with the same transaction template form a Value List.
[0084] TPS: transaction per second, the number of transactions executed per second.
[0085] Cloud technology refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data computing, storage, processing and sharing.
[0086] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The backend services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the rapid development and application of the Internet industry, in the future, each item may have its own identification mark, which needs to be transmitted to the backend system for logical processing. Data of different levels will be processed separately. All kinds of industry data need strong system backing support, which can only be achieved through cloud computing.
[0087] In short, a database can be seen as an electronic filing cabinet - a place where electronic files are stored, and users can add, query, update, delete, and other operations on the data in the files. The so-called "database" is a collection of data that is stored together in a certain way, can be shared with multiple users, has as little redundancy as possible, and is independent of the application.
[0088] A database management system (DBMS) is a computer software system designed for managing databases. It generally has basic functions such as storage, retrieval, security, and backup. Database management systems can be classified according to the database model it supports, such as relational, Extensible Markup Language (XML); or according to the type of computer it supports, such as server clusters, mobile phones; or according to the query language used, such as Structured Query Language (SQL), XQuery; or according to the performance focus, such as maximum scale, maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMS can cross categories, for example, supporting multiple query languages at the same time.
[0089] Cloud computing refers to the delivery and use model of IT infrastructure, which means obtaining required resources through the network in an on-demand and easily scalable manner; in a broad sense, cloud computing refers to the delivery and use model of services, which means obtaining required services through the network in an on-demand and easily scalable manner. This service can be related to IT and software, the Internet, or other services. Cloud computing is the product of the development and integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing.
[0090] With the development of the Internet, real-time data streams, and the diversification of connected devices, as well as the demand for search services, social networks, mobile commerce, and open collaboration, cloud computing has developed rapidly. Different from the previous parallel distributed computing, the emergence of cloud computing will promote revolutionary changes in the entire Internet model and enterprise management model from a conceptual perspective.
[0091] In cloud computing scenarios, performance testing cannot be performed in the actual database environment to ensure service stability. Therefore, how to collect business characteristics and generate similar synthetic loads for database testing is an urgent problem that needs to be solved.
[0092] In the related technology, by analyzing the historical load of the collected original database, the transaction templates corresponding to each transaction contained in the historical load are obtained. Each transaction template is obtained by parameterizing each constant in the corresponding transaction. Then, the original database is feature extracted to obtain the library table structure information, and based on the library table structure information, a synthetic database is obtained. After that, each transaction template is instantiated to obtain each synthetic transaction, and each synthetic transaction is executed in the synthetic database to obtain performance test results.
[0093] However, the amount of data stored in the original database may be huge. Therefore, if the synthetic database is directly generated based on the original database, the amount of data synthesis is large and the data synthesis efficiency is low.
[0094] The relevant data collection and processing in this application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the personal information subject.
[0095] See also Figure 1As shown, it is a schematic diagram of an application scenario provided in an embodiment of the present application. The application scenario includes at least a terminal device 110 and a server 120. The number of terminal devices 110 can be one or more, and the number of servers 120 can also be one or more. The present application does not specifically limit the number of terminal devices 110 and servers 120.
[0096] In the embodiment of the present application, the terminal device 110 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, an Internet of Things device, a smart home appliance, a car terminal, etc., but is not limited thereto.
[0097] Server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0098] The terminal device 110 and the server 120 may be connected directly or indirectly via wired or wireless communication, which is not limited in this application.
[0099] The database performance testing method mentioned in the embodiment of the present application can be applied to the terminal device 110 or the server 120, without limitation. In the following, the application to the server 120 is used as an example for description.
[0100] See also Figure 2 , which is a flow chart of a database performance testing method provided in an embodiment of the present application. The method can be applied to a server. The specific process is as follows:
[0101] S201. Based on at least one constant contained in each historical transaction within a specified time period in an original database, parameterize each historical transaction to obtain a corresponding transaction template.
[0102] In the embodiment of the present application, each historical transaction is composed of one or more SQL statements, and constants such as numbers and strings contained in each SQL statement are converted into parameters, so that an SQL statement containing actual data is represented as a parameterized SQL template.
[0103] See also Figure 3As shown, it is a schematic diagram of a historical transaction provided in the implementation of this application. The historical transaction contains three SQL statements. Among the three SQL statements, SQL statement 1 is used to obtain the identifier (id) and name (name) of each record from each record whose age (age) is less than 30 years old contained in the T1 table, SQL statement 2 is used to obtain each record whose id value is 1024 contained in the T2 table, and SQL statement 2 is used to set the value of the attribute ball of the record whose id value is 1024 in the T3 table to 0. Obviously, the constant contained in SQL statement 1 is the value of age, the constant contained in SQL statement 2 is the value of id, and the constant contained in SQL statement 3 is the value of ball and id respectively. The server replaces the value of age in SQL statement 1 with parameter P1,1, replaces the value of id in SQL statement 2 with parameter P2,1, and replaces the values of ball and id in SQL statement 3 with parameters P3,1 and P3,2 respectively, to obtain the transaction template corresponding to the historical transaction.
[0104] Furthermore, the server may also use a hash algorithm to perform hash calculations on each transaction template to obtain the template fingerprint corresponding to each transaction template. It should be noted that in the embodiments of the present application, the hash algorithm is not limited. For example, still refer to Figure 3 As shown, the server uses each SQL statement after removing the replaced template parameters in the transaction template as the input of the hash function to obtain the template fingerprint 0x7DA30EB5 of the transaction template.
[0105] S202: Based on the set target field, extract the file structure information of each storage file associated with the target field from each obtained transaction template.
[0106] The storage file may refer to a data table stored in a database. For the data table, the target field is set as the From field, and the storage files associated with the target field refer to the storage files pointed to by the From field.
[0107] Specifically, in the embodiment of the present application, when executing S202, library table access analysis and table structure extraction may be performed, which specifically includes the following steps:
[0108] The server extracts the file names contained in each transaction template from each acquired transaction template based on the set target field;
[0109] Based on the obtained file names, the server initiates file structure query requests to the original database to obtain the file structure information of the corresponding storage files.
[0110] In the embodiment of the present application, for each transaction template, the service can perform syntax analysis on at least one SQL contained in the transaction template, extract the file name in the corresponding From clause, and use the extracted at least one file name as the at least one file name contained in the transaction template. Considering that a table alias may be used in SQL, the extracted table alias can be converted into a complete table name, and the complete table name can be used as the file name.
[0111] For example, see Figure 4 As shown, among the three SQL statements included in the transaction template, the file name in the From clause of SQL statement 1 is T1, and the file name in the From clause of SQL statement 2 is T2. Based on the From field, the server extracts the file names T1 and T2 included in the transaction template from the obtained transaction template.
[0112] In the embodiment of the present application, the file structure information includes: each attribute, primary key, data type of each attribute, etc. contained in the corresponding storage file, but is not limited to this. The data type of the attribute includes but is not limited to characters, values, etc.
[0113] The file structure query request can be SHOW CREATE TABLE'xxx', where xxx is the file name (i.e., table name). After the server obtains the file names, it can SHOW CREATE TABLE'T1' and SHOW CREATE TABLE'T2' to the original database respectively to obtain the table creation statements corresponding to T1 and T2, and then obtain the file structure information corresponding to T1 and T2 according to the table creation statements corresponding to T1 and T2.
[0114] See also Figure 5 As shown in the figure, the file structure information of T1 indicates that T1 contains three attributes: name, ball, and triangle. The primary key is name. Name is a character within 20 bits. Ball and triangle are both integers. Name, ball, and triangle cannot be empty values. When inserting data, if the value of name is not set, name is automatically interpolated. If the value of ball and triangle is not set, the default value 0 is used.
[0115] Furthermore, after obtaining each transaction template, the server may also perform joint column extraction. Specifically, the server performs joint column extraction on each obtained transaction template to obtain at least one corresponding joint column.
[0116] The joint column may contain one or more attributes, and the attributes in the joint column are used to represent the data screening range. The joint column may be composed of a column tuple in a WHERE clause (one or more attributes in a WHERE clause may be referred to as a column tuple of the WHERE clause).
[0117] Exemplarily, for each transaction template, the server may perform syntax analysis on at least one SQL statement contained in the transaction template, extract column tuples in the corresponding WHERE clause, and use the extracted at least one column tuple as at least one joint column corresponding to the transaction template.
[0118] It should be noted that, since different storage files may have attributes with the same name, in order to facilitate distinction, in the embodiment of the present application, a table name and an attribute name are used to represent an attribute.
[0119] For example, see Figure 6 As shown, the attributes included in the WHERE clause of SQL statement 1 are T1.age and T1.sex, the attributes included in the WHERE clause of SQL statement 2 are T2.id, and the attributes included in the WHERE clause of SQL statement 3 are T3.id and T3.ball. The server performs syntax analysis on SQL statement 1, extracts the column tuples T1.age and T1.sex in the WHERE clause, performs syntax analysis on SQL statement 2, extracts the column tuple T2.id in the WHERE clause, performs syntax analysis on SQL statement 3, extracts the column tuples T3.id and T3.ball in the WHERE clause, and then uses the extracted three column tuples as the three joint columns corresponding to the transaction template.
[0120] In some implementations, the server may also perform sub-load extraction. Specifically, the server sorts each transaction template based on the execution start time corresponding to each transaction template to obtain a transaction template sequence, and then divides each transaction template in the transaction template sequence according to a set time interval to obtain multiple groups of transaction templates, and then clusters the multiple groups of transaction templates based on the category features corresponding to each of the multiple groups of transaction templates to obtain at least one group of merged transaction templates.
[0121] As a possible situation, if there is only one thread, the server can directly sort each transaction template based on the execution start time corresponding to each transaction template to obtain a transaction template sequence, and then divide each transaction template in the transaction template sequence according to a set time interval to obtain multiple groups of transaction templates, and then cluster the multiple groups of transaction templates based on the category features corresponding to each of the multiple groups of transaction templates to obtain at least one group of merged transaction templates.
[0122] As another possible situation, if there are multiple threads, the server can also first obtain the thread model of each thread. Specifically, the server divides each historical transaction according to the thread identification (such as ID) field in the audit log, and obtains one or more historical transactions corresponding to each thread. Among them, each historical transaction can constitute a transaction sequence, and each historical transaction in the transaction sequence can be sorted according to the processing start time corresponding to each historical transaction. Each thread and its corresponding transaction sequence can be called its corresponding thread model.
[0123] After obtaining the transaction sequence corresponding to each thread, for each thread, the server may obtain the transaction template sequence corresponding to the thread based on the transaction template corresponding to at least one historical transaction included in the transaction subsequence corresponding to each thread.
[0124] For each thread, the server can divide each transaction template in the transaction template sequence corresponding to the thread according to a set time interval to obtain multiple groups of transaction templates corresponding to the thread, wherein each group of transaction templates contains at least one transaction template, and then cluster the multiple groups of transaction templates based on the category features corresponding to each of the multiple groups of transaction templates to obtain at least one group of merged transaction templates.
[0125] As a possible implementation method, based on the category features corresponding to the multiple groups of transaction templates, the multiple groups of transaction templates are clustered to obtain at least one group of merged transaction templates, which may be implemented in but not limited to the following ways:
[0126] The server performs at least one merge process on multiple groups of transaction templates. During each merge process, the following operations are performed:
[0127] Obtaining each current group of transaction templates, and based on the category features corresponding to each current group of transaction templates, determining that there are two groups of transaction templates that meet the preset merging condition among the current groups of transaction templates, merging the two groups of transaction templates to obtain a new group of transaction templates;
[0128] Based on at least one transaction template contained in each of the two groups of transaction templates, category features corresponding to a new group of transaction templates are obtained.
[0129] It should be noted that in an embodiment of the present application, in order to improve the merging efficiency and accuracy, during each merging process, for each two adjacent groups of transaction templates currently present, it can be determined whether the two adjacent groups of transaction templates meet the preset merging conditions, and then the two adjacent groups of transaction templates that meet the preset merging conditions can be merged.
[0130] The arrangement order between each group of transaction templates is determined according to the execution start time corresponding to each transaction template.
[0131] For example, see Figure 6 As shown, W is used to represent the total workload corresponding to a thread. The transaction template sequence corresponding to the total workload is: A, A, B, B, B, C, ..., where letters such as A, B, C represent different transaction templates. The transaction template sequence corresponding to the total workload represents the execution of A, A, B, B, B, C in sequence. Assume that the time interval is set to 25 seconds. First, the server divides the transaction templates in the transaction template sequence according to the set time interval to obtain four groups of transaction templates. The four groups of transaction templates are SW1, SW2, SW3 and SW4. Among them, the transaction template sequence included in SW1 is: A, A, B, B, B, C, etc., the QPS of SW1 is 110, and the time interval is 25s. The transaction template sequence included in SW2 is: A, B, B, C, C, etc., the QPS of SW2 is 100, and the time interval is 25s. The transaction template sequence included in SW3 is: C, D, C, A, B, C, etc., the QPS of SW3 is 40, and the time interval is 25s. The transaction template sequence included in SW4 is: C, D, A, B, B, C, etc., the QPS of SW4 is 150, and the time interval is 25s.
[0132] Afterwards, the server clusters the four groups of transaction templates. Assuming that the current groups of transaction templates are SW1, SW2, SW3 and SW4, based on the category features corresponding to SW1, SW2, SW3 and SW4, when it is determined that SW1 and SW2 meet the preset merging conditions, SW1 and SW2 are merged to obtain a new group of transaction templates SW1&SW2. The QPS of SW1&SW2 is 105, and the time interval is 50s. The transaction template sequence included in SW1&SW2 is: A, A, B, B, B, C, …, A, B, B, C, C, …
[0133] After the first merge process, the current transaction templates are SW1&SW2, SW3 and SW4. Assume that, based on the category features corresponding to SW1&SW2, SW3 and SW4, SW1&SW2 and SW3 meet the preset merge conditions, and merge SW1&SW2 and SW3 to obtain a new set of transaction templates SW1&SW2&SW3. After the second merge process, if there are no two sets of transaction templates that meet the preset merge conditions, the merge is stopped.
[0134] As a possible implementation, when at least one of the following conditions is met, it is determined that the two groups of transaction templates meet the preset merging condition:
[0135] Condition 1: The template similarity between the two groups of transaction templates is less than the preset similarity threshold.
[0136] The template similarity between the two groups of transaction templates may be calculated based on a dynamic time wrapping (DTW) algorithm, but is not limited thereto. The preset similarity threshold may be, but is not limited to, 0.2.
[0137] As a possible implementation method, the server obtains the initial similarity between the two groups of transaction templates based on the template fingerprints contained in each of the two groups of transaction templates, and normalizes the initial similarity based on the number of transaction templates contained in each of the two groups of transaction templates to obtain the template similarity between the two groups of transaction templates.
[0138] For two groups of transaction templates, the template fingerprint sequences of the two groups of transaction templates are represented by x and y respectively, each template fingerprint sequence is composed of the template fingerprints of each transaction template in the group of transaction templates, and the lengths of the two groups of transaction templates are represented by m and n respectively.
[0139] For example, the initial similarity can be calculated using formula (1):
[0140] dtw[i][j]=min(dtw[i-1][j-1],dtw[i][j-1],dtw[i-1][j])+d[i][j] Formula (1)
[0141] Among them, dtw[i][j] represents the initial similarity between two sets of transaction templates. The calculation method of d[i][j] is: if x[i] is equal to y[i], then the value of d[i][j] is 1, otherwise it is 0. After normalization by dividing dtw[m][n] by max(m, n), the template similarity Temp_diff is obtained. min means taking the minimum value, and max means taking the maximum value.
[0142] Condition 2: The difference in the execution quantity evaluation values between the two groups of transaction templates is less than the preset evaluation value threshold. The execution quantity evaluation value is used to represent the number of SQL statements executed per unit time.
[0143] The execution quantity evaluation value may be, but is not limited to, the query rate per second (Query Per Second, QPS), and the preset evaluation value threshold may also be referred to as a preset QPS threshold. QPS is used to characterize the number of SQL statements executed per unit time (such as per second). QPS can be calculated by dividing the total number of SQL statements contained in each transaction template in a corresponding set of transaction templates by the total processing time of each transaction template in a set of transaction templates. The preset QPS threshold may be, but is not limited to, 20. For example, the QPS of W = the number of SQL statements executed by each transaction template in the transaction template sequence corresponding to W (10000) ÷ the total processing time of the transaction template sequence corresponding to W (100s) = 100.
[0144] That is to say, if the category feature is the template similarity between two groups of transaction templates, then when the template similarity between the two groups of transaction templates is less than the preset similarity threshold, the server determines that among the current groups of transaction templates, there are two groups of transaction templates that meet the preset merging conditions; if the category feature is the execution quantity evaluation value between the two groups of transaction templates, then when the difference in the execution quantity evaluation values between the two groups of transaction templates is less than the preset evaluation value threshold, the server determines that among the current groups of transaction templates, there are two groups of transaction templates that meet the preset merging conditions; if the category feature includes the template similarity and execution quantity evaluation value between the two groups of transaction templates, then when the template similarity between the two groups of transaction templates is less than the preset similarity threshold and the difference in the execution quantity evaluation values between the two groups of transaction templates is less than the preset evaluation value threshold, the server determines that among the current groups of transaction templates, there are two groups of transaction templates that meet the preset merging conditions.
[0145] S203: Based on the obtained file structure information, obtain the file generation order between the storage files, and obtain the value distribution of each attribute contained in each storage file.
[0146] In some implementations, when performing library table dependency analysis, each file structure information includes each attribute included in the corresponding storage file, and based on the obtained file structure information, the file generation order between the storage files is obtained, which specifically includes the following steps:
[0147] The server determines the file dependency relationship between the stored files based on the attributes contained in the obtained file structure information;
[0148] The server obtains the file generation order between the storage files based on the file dependency.
[0149] Exemplarily, in an embodiment of the present application, the server can establish a directed acyclic graph (DAG graph) representing the relationships between the storage files through foreign key dependency analysis, and perform topological sorting on the DAG graph to obtain the file generation order between the storage files.
[0150] For example, suppose that table T4 contains three attributes name, ball, triangle, and the primary key is name, and T2 contains three attributes id and name, with the primary key being id and the foreign key being name. Then in the DAG graph, T4 is the predecessor file of T2. Based on the DAG graph, the order of file generation of T4 and T2 is to generate T4 first and then T2.
[0151] In some implementations, when data distribution sampling is performed, based on the obtained file structure information, the value distribution of each attribute contained in each storage file is obtained, including:
[0152] Based on the set query field, at least one joint column is extracted from each transaction template, each joint column containing at least one attribute in a storage file queried by the corresponding transaction template;
[0153] Based on the extracted at least one joint column, combined with the original database, obtaining the value range corresponding to each attribute contained in the at least one joint column;
[0154] Based on at least one joint column, respectively according to a set sampling ratio, a sampling query is performed on the original database to obtain corresponding sampling results, and based on the corresponding sampling results, corresponding sampling statistical information is obtained;
[0155] Based on the sampling statistical information corresponding to each of the at least one joint columns and the obtained value ranges, the value distribution of each attribute contained in each of the storage files is obtained.
[0156] Among them, based on the extracted at least one joint column and combined with the original database, when the numerical range corresponding to each attribute contained in the at least one joint column is obtained, for each joint column, the server can initiate an aggregate query statement to the original database to obtain the numerical range corresponding to each attribute contained in the joint column.
[0157] The value range of an attribute can include any one or more of the attribute's maximum value, minimum value, cardinality, and other evaluation indicators. Cardinality refers to the number of unique values in the attribute. The lower the cardinality, the more repeated elements in the attribute column, and the higher the cardinality, the fewer repeated elements in the attribute column.
[0158] For example, see Figure 5 As shown in the figure, Domain Info is the overall distribution information of the attribute columns of T1. Each row in Domain Info represents the corresponding value range of an attribute. Each category in Domain Info represents a different evaluation index, where Attr. is the attribute column name, NULL. is the number of NULL value tuples, Dom. is the value range of the attribute column, Card. is the cardinality of the attribute column, and Len. is the average length of the attribute column. Taking the name attribute as an example, the number of NULL value tuples of name is 0, the value range is within 2000 (because the data is too long, it is expressed as ... in the figure), the cardinality is 200, and the average length is (4, 10).
[0159] As a possible implementation method, the statistics of the sampling results can be adopted by but not limited to histogram, kernel density estimation, statistical learning method, machine learning algorithm, etc., but not limited to these.
[0160] Take the histogram as an example, see Figure 5For the joint column (ball, triangle) in T1, the server generates a random query SQL for T1 according to the set sampling ratio (1% of the tuples in the sampling table) to perform sampling query on the original database, obtain the sampling results of the joint column (ball, triangle), and based on the sampling results of the joint column (ball, triangle), obtain the sampling statistics of the joint column (ball, triangle). The sampling statistics of the joint column (ball, triangle) are presented in the form of a two-dimensional histogram. The histogram contains 5 high-frequency items and 10 intervals. Each high-frequency item contains a combination of ball and triangle values. The prob. row represents the frequency of the item or interval, and cumu.prob. represents the cumulative frequency of the item or interval. In the figure, each serial number 1-10 is an interval number. The meaning of the interval is that after the high-frequency items are removed, 10 intervals are evenly divided in the two-dimensional space. The division intervals are equal, that is, an equal-width histogram.
[0161] After obtaining the sampling statistical information corresponding to at least one joint column and the obtained numerical ranges, the server obtains the numerical distribution of each attribute contained in each storage file based on the sampling statistical information corresponding to at least one joint column and the obtained numerical ranges. That is, the numerical distribution of each attribute in the storage file includes the numerical range of the attribute and the sampling statistical information of the attribute.
[0162] S204. Based on the file structure information and value distribution corresponding to each storage file and in combination with the file generation order, construct virtual synthetic files corresponding to each storage file, and perform performance tests based on the constructed virtual synthetic files to obtain performance test results.
[0163] Specifically, in the embodiment of the present application, based on the file structure information and value distribution corresponding to each storage file, combined with the file generation order, constructing the virtual synthetic file corresponding to each storage file may include the following steps:
[0164] The server constructs virtual composite files corresponding to each storage file in sequence according to the file generation order, wherein the following operations are performed in each construction process:
[0165] The server determines the attributes included in a virtual synthetic file based on the file structure information of the storage file corresponding to the virtual synthetic file;
[0166] The server generates a value set for each attribute contained in a virtual synthetic file based on the attribute type of each attribute contained in the virtual synthetic file and the data generation strategy corresponding to the attribute type; wherein each data generation strategy is generated based on the numerical distribution of the corresponding attribute.
[0167] Exemplarily, the server may perform a breadth-first search on the DAG graph, record the file nodes at each layer, and the file nodes at the same layer, and thus generate a file generation order.
[0168] See also Figure 7 As shown, it is assumed that the storage file includes Tables 1 to 8. In the DAG graph, Tables 2 and 5 both depend on the generation of Table 1, Table 6 depends on the generation of Table 5, and Table 7 depends on the generation of Table 6. There is no dependency relationship between Table 3 and Table 1, Table 2, Table 5, Table 6, and Table 7. Table 4 depends on the generation of Table 3, and Table 8 depends on the generation of Table 4. Therefore, in the file generation order, Table 1, Table 5, Table 6, and Table 7 are generated in sequence, Table 2 can be generated after Table 1, and Table 3, Table 4, and Table 8 are generated in sequence.
[0169] Assume that the server constructs virtual synthetic files corresponding to each storage file in the order of T1, T2, and T3. First, the server constructs the virtual synthetic file of T1. Specifically, the server determines the attributes contained in the virtual synthetic file of T1 based on the file structure information of T1: id, name, and age. Based on the attribute types of id, name, and age in T1 and the data generation strategies corresponding to the attribute types of id, name, and age, the server assigns values to the id, name, and age columns respectively, and generates the value sets of id, name, and age.
[0170] Secondly, the server constructs a virtual synthetic file of T2. Specifically, the server constructs the file structure information of T2, determines the attribute contained in the virtual synthetic file of T2: id, and assigns values to the id column based on the attribute type of the id in T2 and the data generation strategy corresponding to the attribute type of the id, and generates the value sets of id and ball respectively.
[0171] Finally, the server constructs a virtual synthetic file of T3. Specifically, the server constructs the file structure information of T3, determines the attributes contained in the virtual synthetic file of T3: id, ball, and assigns values to the id and ball columns based on the attribute types of id and ball in T3, as well as the data generation strategies corresponding to the attribute types of id and ball, to generate value sets for id and ball respectively.
[0172] In some implementations, based on the attribute types of the attributes contained in a virtual synthetic file and in combination with the data generation strategy corresponding to the attribute type, a value set of the attributes contained in a virtual synthetic file is generated, specifically including the following steps:
[0173] The server performs the following operations on each attribute contained in a virtual synthesis file:
[0174] If an attribute is a primary key, use unique values as the value set of the attribute;
[0175] If an attribute is a foreign key, a preceding file of a storage file corresponding to a virtual composite file is determined from each storage file based on the file generation order, and a value set of the attribute is generated based on the value distribution of the attribute in the preceding file;
[0176] If an attribute does not belong to a primary key or a foreign key, a value set of the attribute is generated based on the value distribution of the attribute in a storage file corresponding to a virtual synthetic file.
[0177] In some implementations, for situations that do not belong to primary keys or foreign keys, it can also be subdivided into the following situations: if an attribute belongs to a union column, the server can generate a value set for the attribute based on sampling statistical information in the numerical distribution of the attribute in a storage file corresponding to a virtual synthetic file.
[0178] If an attribute belongs to a common column (not a primary key, foreign key or joint column), the server may generate a value set for the attribute according to a value range in a value distribution of the attribute in a storage file corresponding to a virtual composite file.
[0179] In an embodiment of the present application, for the primary key column, the generation module maintains an auto-increment ID counter and outputs the primary key ID for each tuple; for the foreign key column, since the generation strategy ensures that the table corresponding to its dependent primary key has been generated, a key value is randomly selected from the corresponding primary key column of the dependent table to fill it; for the union column, a data point is randomly sampled in the multidimensional histogram of the union column as the filling data of the union column; for the ordinary column, it is randomly generated based on the value range and cardinality information recorded in the Domain Info table.
[0180] In some embodiments, when generating a value set for a common column, different generation strategies can be designed according to the different numeric types. Specifically, for numeric type attributes, their values can be randomly generated within their value range and under the condition of ensuring the cardinality constraint; for date type attributes, a random number is converted into a Unix timestamp, and then the Unix timestamp is converted into data in date format, and the generated data in date format is used as its value; for a string type attribute column, if it belongs to a joint column, a prefix tree is used to generate a string composed of '0' and '1' under the cardinality constraint and the average length constraint as its value. For example, if the cardinality of the attribute column is 5 and the average length is 7, the first four digits of the generated string are 0000, and the last three digits are 000, 001, 010, 011, and 101 respectively; if it does not belong to a joint column, a length is randomly selected within the length range, and a string of a length is randomly selected from the 26-bit alphabet as the generated string.
[0181] In some implementations, the performance test may be a performance simulation test or a performance stress test. Specifically, the performance test is performed based on each constructed virtual synthetic file to obtain the performance test result, which specifically includes the following steps:
[0182] If the performance test is a performance simulation test, the server uses each constructed virtual synthetic file to perform performance testing based on the performance constraint parameter set of each historical transaction in the original database to obtain a performance test result;
[0183] If the performance test is a performance stress test, the server performs multiple rounds of performance tests based on the constructed virtual synthetic files to obtain performance test results.
[0184] The following describes the performance simulation test scenario and the performance stress test scenario respectively.
[0185] The purpose of performance simulation is to simulate a performance curve that is highly similar to the original load. In the performance simulation test scenario, the load for simulation test (i.e., the transaction sequence used for testing) can use the original load sequence (i.e., the transaction sequence composed of various historical transactions) or the instantiated transaction obtained by instantiating each transaction template.
[0186] Specifically, as a possible implementation method, the server can instantiate each transaction template based on the historical execution results corresponding to each transaction template, obtain the corresponding instantiated transaction, and obtain the performance test result based on the obtained instantiated transactions and the constructed virtual synthetic files. As a possible implementation method, the server can also obtain the performance test result based on the historical transactions and the constructed virtual synthetic files.
[0187] Among them, the historical execution results may include one or more of the actual number of returned rows or the number of affected rows after the execution of the corresponding historical transaction. When instantiating, the server can search in the sampling statistics of the joint column (such as the two-dimensional histogram of the joint column) according to the actual number of returned rows or the number of affected rows after the execution of the SQL statement recorded in the audit log, select the value of the tuple that meets the set row number range, and fill it back into the corresponding position of the joint column in the transaction template. The tuple that meets the set row number range can be: the amount of data in the tuple, and the difference with the number of returned rows or the number of affected rows is within 5%. For example, the actual number of returned rows of the SQL statement is 10, and the joint column contained in the server transaction template is (ball, triangle). Search in the histogram of (ball, triangle) and select the value (1,3) of (ball, triangle).
[0188] After the load for simulation test is obtained, the performance test result is obtained based on the performance constraint parameter set of each historical transaction in the original database, combined with each instantiated transaction and each virtual synthetic file.
[0189] In some embodiments, as shown in Table 1, the performance evaluation indicators include but are not limited to one or more of the server central processing unit (CPU) utilization rate, server resident set size (RSS) RSS memory usage, server received traffic, server generated traffic, disk read data volume, disk write data volume, number of running threads, number of slow queries, InnoDB cache hit rate, etc.
[0190] Table 1 Performance evaluation indicators
[0191]
[0192]
[0193] In some implementations, the performance constraint parameter set may include one or more performance constraint parameters, including but not limited to one or more of the number of Transmission Control Protocol (TCP) connections, QPS, etc. of the original load.
[0194] Exemplarily, the server can execute the load according to the number of TCP connections and QPS constraints of the original load. Specifically, the server analyzes the number of threads and thread start time in the audit log, sorts the threads, and then calculates the interval time for different threads to create connections. When performing simulation tests, the TCP connection on the test instance is established according to the same thread creation order and time interval. Then, for each thread in each audit log, the server calculates the QPS of the thread and uses a rate limiter to limit the execution rate of transactions in each test instance to the same as the QPS of the original load.
[0195] In the simulation test, the server can also obtain load simulation similarity based on the performance evaluation indicator set included in the performance test results.
[0196] For example, the load simulation similarity can be obtained by calculating the time series similarity of each performance evaluation index under the original load and the synthetic load. For each performance evaluation index, it can be calculated from two dimensions: shape similarity and value deviation. Among them, the shape similarity can be expressed by the normalized mutual correlation coefficient to represent the shape similarity of the two time series; the value deviation can be expressed by the aligned Euclidean distance.
[0197] The calculation of shape similarity may adopt, but is not limited to, a shape-based distance (SBD) algorithm.
[0198] For example, the shape similarity can be calculated using formula (2) to formula (5):
[0199]
[0200]
[0201]
[0202]
[0203] Among them, the use of and Represents the time series of a performance evaluation indicator under the original load and the synthetic load respectively. and The length of is m, and the For fixed slide The inner product of two vectors after step length k, in formula (3) is the correlation coefficient, the subscript w represents the step length, ranging from 1 to 2m-1, and the formula (4) is the normalized co-correlation coefficient, and in formula (5) is the shape similarity.
[0204] The time series similarity score can be calculated using formula (6):
[0205]
[0206] Wherein, α and β are coefficients for weighing value deviation and shape similarity. Exemplarily, the values of α and β are 0.2 and 0.8, respectively.
[0207] In the performance stress testing scenario, the load for simulation testing can be instantiated based on the TOP transaction templates in each transaction template to obtain each instantiated transaction, or it can be instantiated based on the configured sub-load and the transaction template corresponding to the sub-load.
[0208] Specifically, as a possible implementation method, each transaction template is sorted based on the number of historical transactions corresponding to each transaction template, and according to the set selection ratio and the sorting results, each target template is extracted from each transaction template, and each target template is instantiated to obtain each instantiated transaction.
[0209] That is to say, in the embodiment of the present application, the top TOP transaction templates are instantiated. The motivation for instantiating the TOP template comes from the observation of online instances. Most transactions have the same transaction template, that is, the transaction template distribution has a long-tail distribution feature. Therefore, instantiating the TOP template can accelerate the generation process when the generated load is highly similar to the original load. The distribution characteristics of the number of transaction template instances are as follows: Figure 8 As shown, Figure 8 ND in the formula represents quantity distribution, CFD represents cumulative frequency distribution, and CND represents cumulative quantity distribution. Figure 8 It contains 9 groups of distribution feature graphs. The 3 groups of distribution feature graphs in the first row are the distribution feature graphs corresponding to ND, the 3 groups of distribution feature graphs in the second row are the distribution feature graphs corresponding to CFD, and the 3 groups of distribution feature graphs in the third row are the distribution feature graphs corresponding to CFD. The vertical axis in each group of distribution feature graphs represents the number of transaction template instances. The 3 groups of distribution feature graphs in the first column are the distribution characteristics of the number of transaction template instances when all transaction templates are instantiated. The 3 groups of distribution feature graphs in the second column are the distribution characteristics of the number of transaction template instances when 100 transaction templates are instantiated. The 3 groups of distribution feature graphs in the third column are the distribution characteristics of the number of transaction template instances when 20 transaction templates are instantiated.
[0210] As another possible implementation method, based on the target sub-load configured in the configuration file and the corresponding relationship between the target sub-load and the target template, each target template corresponding to the target sub-load is obtained from each transaction template, and each target template is instantiated to obtain each instantiated transaction.
[0211] The corresponding relationship between the target sub-load and the target template may be determined according to the corresponding relationship between at least one group of merged transaction templates and each sub-load.
[0212] For example, SW1&SW2&SW3 correspond to a group of transaction templates, and SW4 corresponds to another group of transaction templates. Assuming that the target sub-load configured in the configuration file is SW4, based on SW4 and its corresponding target templates, the target templates corresponding to SW4 are obtained from the transaction templates, and each target template is instantiated to obtain each instantiated transaction.
[0213] It should be noted that in the embodiments of the present application, transaction template instantiation may also be performed using other production models, including but not limited to rule-based SQL generation, reinforcement learning-based SQL generation, and the like.
[0214] In the stress testing scenario, considering that each round of testing will cause a certain amount of data offset, when the offset is large, it will affect the stress testing results. Therefore, it is necessary to restore the data at an appropriate time. Based on this, in the embodiment of the present application, multiple rounds of performance testing are performed based on each constructed virtual synthetic file to obtain performance test results, specifically including:
[0215] Perform a first round of performance testing based on each constructed virtual synthetic file to obtain a first round of reference performance testing results;
[0216] Starting from the second round of performance testing, the current round of performance testing is performed based on the constructed virtual synthetic files to obtain the current performance test results of the current round, and when it is determined that data offset occurs based on the reference performance test results and the current performance test results, data recovery is performed on each virtual synthetic file after the current round of performance testing.
[0217] Exemplarily, the performance test results may include the number of rows returned or affected by SELECT statements and DML statements. Of course, the performance test results may also include the number of rows returned or affected by SELECT statements. The performance test results may also include the number of rows returned or affected by DML statements. In the process of determining the occurrence of data drift based on the reference performance test results and the current performance test results, the server may count the number of rows returned or affected by SELECT statements and DML statements (including UPDATE, INSERT, and DELETE) in the current round, and then compare the number of rows returned or affected with the number of rows returned or affected in the reference performance test results obtained in the first stress test. When the difference in the number of rows is greater than the preset row number threshold, it is determined that data drift has occurred.
[0218] In some implementations, data recovery may be performed using at least one of the following:
[0219] The first method: Data recovery flashback (binlog flashback). Specifically, the server analyzes the binary log file (binlog), generates the corresponding reverse SQL statement and executes it. This method is a local recovery method and is suitable for recovery of a small amount of DML statement load or a table with a large amount of data.
[0220] The second method is import tablespace. Specifically, the server replaces each virtual synthetic file after the stress test with the initial database table file (each virtual synthetic file before the stress test) and reconstructs the mapping. This method is a full recovery method and is suitable for recovery of a large number of DML statement loads or tables with a small amount of data.
[0221] In some implementations, the number of DML statements in each round of stress testing and the storage files where data changes occur can be recorded. If the amount of data stored in the storage files where data changes occur exceeds a set data volume threshold (for example, the number of data rows exceeds 10 million) or the number of DML statements is lower than the set DML statement threshold, the first method is used for partial recovery; otherwise, the second method is used directly for full recovery.
[0222] In some embodiments, for scenarios where real data can be used directly, the instance cloning capability can be relied upon to initiate a cloning task from a cold standby node at the start time of the load, and clone the backup to a test environment machine.
[0223] In some embodiments, before the performance test, a test instance is created. Specifically, the configuration specifications of the target instance (e.g., number of CPU cores, memory size, disk capacity, database version) can be queried in the cloud service management platform to create a test instance machine with the same specifications. Then, the created test instance is used to perform performance testing based on the constructed virtual synthetic files to obtain performance test results.
[0224] In some embodiments, SQL precompilation can also be performed. Specifically, each transaction template required for performance testing is precompiled to obtain each transaction template in a precompilable form. For example, the parameter position in the transaction template is replaced with '?' and then input into the database client for precompilation.
[0225] In some embodiments, performance configuration is performed before performance testing. Specifically, in the configuration file, one or more of the expected QPS, number of thread connections, load multiples, target sub-load, and other information during the performance test are configured, so that during the performance test, the test is performed according to the specified performance configuration information. The configuration file can be determined based on the instance configuration information of the specified database instance.
[0226] In some embodiments, since the newly applied test instance machine has not executed any SQL, the cache needs to be preheated. Specifically, the server can randomly select a transaction template to instantiate and execute, wherein the number of instantiated transactions can be 20% of the number of transactions executed during the formal test.
[0227] See also Fig. 9 As shown, it is a schematic diagram of a system architecture provided in an embodiment of the present application.
[0228] The system includes: online environment, service environment and test environment. The online environment stores the specified database instance and the audit log of the database instance within the specified time period. Through the online environment, you can also configure instance configuration information, and then in the test environment, through the test module, apply for a test instance with the same configuration.
[0229] The service environment includes data analysis templates and load analysis templates. The data analysis template is used to query and analyze the database instance's table structure, data distribution, access status, and table dependencies for each historical transaction within a specified time period. The load analysis template is used to pull the audit logs in the database instance within a specified time period for load analysis (transaction parameterization, joint column extraction, thread model, and sub-load extraction). The thread model refers to dividing the transaction sequence by thread based on the thread ID field in the audit log, and sorting all transactions under the same thread ID by start time.
[0230] The test environment includes data generation module, load generation module and test module. The data generation module is used for constraint generation and instance cloning, and the load generation module is used for original transaction playback and transaction template instantiation. Constraint generation refers to building virtual synthetic files corresponding to each storage file based on the file structure information and value distribution corresponding to each storage file, combined with the file generation order. The test module is used to create test instances, SQL precompile, cache preheating, and execution performance configuration.
[0231] The test environment also includes load simulation scenarios and multi-round stress testing scenarios. In the load simulation scenario, performance constraint execution and similarity calculation are performed, and in the multi-round stress testing scenario, data offset detection and data recovery are performed. Among them, performance constraint execution refers to the performance constraint parameter set of each historical transaction in the original database, using each constructed virtual synthetic file to perform performance testing and obtain performance test results, and similarity calculation is used to calculate load simulation similarity.
[0232] See also Fig.10 As shown, it is a schematic diagram of a process flow of a database performance test provided in an embodiment of the present application, and the process includes the following steps:
[0233] First, obtain a specified database instance and a specified time period. The specified database instance can be identified by an ID.
[0234] Secondly, obtain the instance configuration information of the specified database instance, and configure the execution performance of the test instance according to the instance configuration information; pull the audit logs in the database instance within the specified time period, parameterize the historical transactions in the audit logs for the pulled audit logs, obtain the transaction templates, and then extract the corresponding joint columns from the transaction templates, build the thread model, and extract the sub-loads. Further, determine whether to replay the transaction. If the transaction is replayed, then instantiate the transaction template, otherwise use the original transaction, and further perform SQL pre-compilation and cache preheating; extract the file structure information and file generation order of each storage file, and further determine whether to use the original data. If the original data is used, then generate test data by cloning the instance. If the original data is not used, then obtain the value distribution of each storage file through dynamic adoption.
[0235] Next, determine whether to perform simulation testing. If simulation testing is performed, then perform performance testing based on performance constraints and calculate the simulation performance similarity. If simulation testing is not performed, then perform performance stress testing, perform multiple rounds of performance testing based on test data, obtain performance test results, and perform data offset detection after each round of stress testing, and perform data recovery when necessary.
[0236] The present application is described below in conjunction with specific embodiments.
[0237] (1) Database major version upgrade verification: When a database version upgrade is required, a playback test of the original load can be performed on a high-version test environment, and the performance test results can be compared with the original results. Based on the comparison results, it can be determined whether serious performance problems or faults (BUGs) will occur after the version upgrade.
[0238] Specifically, when the database version is upgraded, a synthetic database can be constructed based on each historical transaction in the specified time period in the database under the low-version test environment. The synthetic database contains the constructed virtual synthetic files, and a performance simulation test is performed based on each historical transaction and the synthetic database under the high-version test environment to obtain the performance test results. The performance test results may include one or more performance evaluation indicators. Based on the time series similarity of each performance evaluation indicator, the load simulation similarity is obtained, and then based on the load simulation similarity, it is judged whether there will be serious performance problems or failures after the version upgrade.
[0239] (2) Simulation testing before launching or upgrading business functions in applications: When it is necessary to launch or upgrade business functions, the business to be launched or upgraded can be called to perform a playback test of the original load, and the performance test results can be compared with the original results. Based on the comparison results, it can be determined whether there are performance problems or failures in the business functions.
[0240] (3) Application-oriented intelligent parameter tuning: The intelligent parameter tuning service is applied to specific applications. Through multiple rounds of stress testing, corresponding performance test results can be obtained in each round of stress testing. Based on the performance test results of each round, the target parameters that affect the performance of the specific application can be determined from the candidate parameters of the application, thereby providing more personalized parameter configuration for the specific application and improving performance.
[0241] (4) More efficient index recommendation: Applied to the index recommendation service, the corresponding performance test results can be obtained during each round of stress testing. Based on the performance test results of each round, the index that affects the data query performance can be determined from each index, thereby speeding up the recommendation process and improving the quality of the recommendation results.
[0242] Based on the same inventive concept, the present application embodiment provides a database performance testing device. Fig.11 As shown, it is a schematic diagram of the structure of a database performance testing device 1100, which may include:
[0243] The parameterization unit 1101 is used to perform parameterization processing on each historical transaction within a specified time period in the original database based on at least one constant contained in each historical transaction, so as to obtain a corresponding transaction template;
[0244] The structure extraction unit 1102 is used to extract the file structure information of each storage file associated with the target field from each obtained transaction template based on the set target field;
[0245] The distribution extraction unit 1103 is used to obtain the file generation order between the storage files and the value distribution of each attribute contained in each storage file based on the obtained file structure information;
[0246] The testing unit 1104 is used to construct virtual synthetic files corresponding to each of the storage files based on the file structure information and value distribution corresponding to each of the storage files and in combination with the file generation order, and perform performance testing based on the constructed virtual synthetic files to obtain performance test results.
[0247] As a possible implementation, when the performance test is performed based on each constructed virtual synthetic file and the performance test result is obtained, the testing unit 1104 is specifically used to:
[0248] If the performance test is a performance simulation test, then based on the performance constraint parameter set of each historical transaction in the original database, each constructed virtual synthetic file is used to perform a performance test to obtain a performance test result;
[0249] If the performance test is a performance stress test, multiple rounds of performance tests are performed based on the constructed virtual synthetic files to obtain performance test results.
[0250] As a possible implementation, when the performance constraint parameter set of each historical transaction in the original database is used to perform performance testing using each constructed virtual synthetic file and obtaining the performance test result, the testing unit 1104 is specifically used to:
[0251] Based on the historical execution results corresponding to each of the transaction templates, each of the transaction templates is instantiated to obtain a corresponding instantiated transaction, and based on the performance constraint parameter set of each historical transaction in the original database, the obtained instantiated transaction and each virtual synthetic file are combined to obtain a performance test result; or,
[0252] Based on the performance constraint parameter set of each historical transaction in the original database, combined with each historical transaction and each constructed virtual synthetic file, a performance test result is obtained.
[0253] As a possible implementation, multiple rounds of performance tests are performed based on each constructed virtual synthetic file. When the performance test results are obtained, the testing unit 1104 is specifically used to:
[0254] Based on the number of historical transactions corresponding to each of the transaction templates, the transaction templates are sorted, and according to a set selection ratio and the sorting result, each target template is extracted from the transaction templates, and according to each instantiated transaction obtained by instantiating the target template, multiple rounds of performance testing are performed in combination with each virtual synthetic file to obtain a performance test result; or,
[0255] Based on the target sub-load configured in the configuration file and in combination with the correspondence between the target sub-load and the target template, the target templates corresponding to the target sub-load are obtained from the transaction templates, and according to the instantiated transactions obtained by instantiating the target templates and in combination with the virtual synthetic files, multiple rounds of performance testing are performed to obtain performance test results.
[0256] As a possible implementation, when performing multiple rounds of performance tests based on the constructed virtual synthetic files and obtaining the performance test results, the testing unit 1104 is specifically used to:
[0257] Perform a first round of performance testing based on each constructed virtual synthetic file to obtain a first round of reference performance testing results;
[0258] Starting from the second round of performance testing, the current round of performance testing is performed based on the constructed virtual synthetic files to obtain the current performance test results of the current round, and when it is determined that data offset occurs based on the reference performance test results and the current performance test results, data recovery is performed on each virtual synthetic file after the current round of performance testing.
[0259] As a possible implementation manner, the testing unit 1104 is further configured to:
[0260] Based on the execution start time corresponding to each of the transaction templates, the transaction templates are sorted to obtain a transaction template sequence;
[0261] According to a set time interval, each transaction template in the transaction template sequence is divided to obtain multiple groups of transaction templates, each group of transaction templates includes at least one transaction template;
[0262] Based on the category features corresponding to each of the multiple groups of transaction templates, the multiple groups of transaction templates are clustered to obtain at least one group of merged transaction templates.
[0263] As a possible implementation manner, when clustering the multiple groups of transaction templates based on the category features corresponding to each of the multiple groups of transaction templates to obtain at least one group of merged transaction templates, the testing unit 1104 is specifically used to:
[0264] At least one merging process is performed on the multiple groups of transaction templates. In each merging process, the following operations are performed:
[0265] Acquire each current group of transaction templates, and based on the category features corresponding to each of the current groups of transaction templates, determine that there are two groups of transaction templates that meet a preset merging condition among the current groups of transaction templates, and merge the two groups of transaction templates to obtain a new group of transaction templates;
[0266] Based on at least one transaction template contained in each of the two groups of transaction templates, category features corresponding to the new group of transaction templates are obtained.
[0267] As a possible implementation manner, when it is determined that there are two groups of transaction templates that meet the preset merging condition among the current groups of transaction templates based on the category features corresponding to the current groups of transaction templates, the testing unit 1104 is specifically configured to:
[0268] If the category feature is the template similarity between two groups of transaction templates, then when the template similarity between the two groups of transaction templates is less than a preset similarity threshold, it is determined that there are two groups of transaction templates that meet the preset merging condition in the current groups of transaction templates;
[0269] If the category feature is an evaluation value of the number of executed statements between two groups of transaction templates, then when the difference in the evaluation value of the number of executed statements between the two groups of transaction templates is less than a preset evaluation value threshold, it is determined that among the current groups of transaction templates, there are two groups of transaction templates that meet the preset merging conditions; the execution quantity evaluation value is used to characterize the number of structured query language SQL statements executed per unit time.
[0270] As a possible implementation, when extracting the file structure information of each storage file associated with the target field from each acquired transaction template based on the set target field, the structure extraction unit 1102 is specifically used to:
[0271] Based on the set target field, extracting the file names contained in each of the obtained transaction templates;
[0272] Based on the obtained file names, file structure query requests are respectively initiated to the original database to obtain file structure information of corresponding storage files.
[0273] As a possible implementation manner, each file structure information includes each attribute included in the corresponding storage file, and obtaining the file generation order between the storage files based on the obtained file structure information includes:
[0274] Determine the file dependency relationship between the stored files based on the attributes contained in the obtained file structure information;
[0275] Based on the file dependency, a file generation order between the storage files is obtained.
[0276] As a possible implementation, when obtaining the numerical distribution of each attribute contained in each storage file based on the obtained file structure information, the distribution extraction unit 1103 is specifically used to:
[0277] Based on the set query field, extract at least one joint column from each of the transaction templates, each joint column including: at least one attribute in a storage file queried by the corresponding transaction template;
[0278] Based on the extracted at least one joint column and in combination with the original database, obtaining a numerical range corresponding to each attribute contained in the at least one joint column;
[0279] Based on the at least one joint column, respectively according to the set sampling ratio, a sampling query is performed on the original database to obtain corresponding sampling results, and based on the corresponding sampling results, corresponding sampling statistical information is obtained;
[0280] Based on the sampling statistical information corresponding to each of the at least one joint columns and the obtained value ranges, the value distribution of each attribute contained in each of the storage files is obtained.
[0281] As a possible implementation, when constructing the virtual synthetic files corresponding to the respective storage files based on the file structure information and the value distribution corresponding to the respective storage files and in combination with the file generation order, the testing unit 1104 is specifically used to:
[0282] According to the file generation order, the virtual synthetic files corresponding to the respective storage files are constructed in sequence, wherein in each construction process, the following operations are performed respectively:
[0283] Determining attributes included in a virtual synthetic file based on file structure information of a storage file corresponding to the virtual synthetic file;
[0284] Based on the attribute types of the attributes contained in the virtual synthetic file and in combination with the data generation strategies corresponding to the attribute types, a value set of the attributes contained in the virtual synthetic file is generated; wherein each data generation strategy is generated based on the numerical distribution of the corresponding attribute.
[0285] As a possible implementation manner, when generating a value set of each attribute included in the virtual synthetic file based on the attribute type of each attribute included in the virtual synthetic file and in combination with a data generation strategy corresponding to the attribute type, the testing unit 1104 is specifically used to:
[0286] For each attribute included in the virtual synthesis file, the following operations are performed respectively:
[0287] If an attribute is a primary key, each unique value is used as the value set of the attribute;
[0288] If an attribute is a foreign key, then based on the file generation order, a pre-order file of a storage file corresponding to the one virtual synthetic file is determined from the storage files, and based on the value distribution of the one attribute in the pre-order file, a value set of the one attribute is generated;
[0289] If an attribute does not belong to a primary key or a foreign key, a value set of the attribute is generated based on the value distribution of the attribute in the storage file corresponding to the virtual synthetic file.
[0290] For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing this application, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.
[0291] Regarding the device in the above embodiment, the specific manner in which each unit executes the request has been described in detail in the embodiment of the method, and will not be elaborated here.
[0292] In an embodiment of the present application, by analyzing and extracting storage files accessed in historical transactions, file structure information of storage files, value distribution, and the file generation order between storage files, necessary data can be constrained and generated during data synthesis, thereby speeding up data generation, improving data synthesis efficiency, and further improving the test efficiency of database performance testing.
[0293] Furthermore, different generation strategies are set for simulation scenarios and stress testing scenarios to meet different test requirements and improve test efficiency. In particular, in the stress testing scenario, a technical solution for data offset detection is proposed, and a data recovery strategy is designed, which can automatically perform multiple rounds of stress testing, speed up data recovery waiting time, and reduce disk read and write losses of test equipment.
[0294] Furthermore, considering that different users use different database specification parameter configurations in a cloud database environment, it is difficult to ensure that performance testing is performed in the same software and hardware configuration environment as the user. In the embodiment of the present application, a machine that is consistent with the user's specifications can be automatically applied for performance testing, and cache preheating and precompilation can be automatically performed to ensure consistency with the user's machine environment, thereby achieving performance testing for online transaction processing (OLTP) loads in a cloud environment.
[0295] Furthermore, different types of sub-load sequences can be classified from the overall load through sub-load extraction technology, and sub-load assembly and execution performance configuration can be used to flexibly generate test loads of different specifications.
[0296] Those skilled in the art will appreciate that various aspects of the present application may be implemented as a system, method or program product. Therefore, various aspects of the present application may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to as "circuit", "module" or "system" herein.
[0297] Based on the same inventive concept, the embodiment of the present application also provides an electronic device. In one embodiment, the electronic device can be a server or a terminal device. Fig.12 As shown, it is a schematic diagram of the structure of a possible electronic device provided in an embodiment of the present application, Fig.12 In the embodiment, the electronic device 1200 includes: a processor 1210 and a memory 1220.
[0298] The memory 1220 stores a computer program that can be executed by the processor 1210 , and the processor 1210 can execute the steps of the above-mentioned database performance testing method by executing the instructions stored in the memory 1220 .
[0299] The memory 1220 may be a volatile memory, such as a random-access memory (RAM); the memory 1220 may also be a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 1220 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1220 may also be a combination of the above memories.
[0300] The processor 1210 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 1210 is configured to implement the above database performance testing method when executing the computer program stored in the memory 1220 .
[0301] In some embodiments, the processor 1210 and the memory 1220 may be implemented on the same chip. In some embodiments, they may also be implemented on separate chips.
[0302] The specific connection medium between the processor 1210 and the memory 1220 is not limited in the embodiment of the present application. In the embodiment of the present application, the processor 1210 and the memory 1220 are connected via a bus as an example. Fig.12 The connections between the other components are only for illustration and are not intended to be limiting. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of description, Fig.12 The diagram shows that only one thick line is used, but this does not mean that there is only one bus or one type of bus.
[0303] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, which includes a computer program. When the computer program is run on an electronic device, the computer program is used to enable the electronic device to perform the steps of the above-mentioned database performance testing method. In some possible implementations, various aspects of the database performance testing method provided by the present application can also be implemented in the form of a program product, which includes a computer program. When the program product is run on an electronic device, the computer program is used to enable the electronic device to perform the steps in the above-mentioned database performance testing method. For example, the electronic device can perform the following steps: Figure 2 Follow the steps shown in .
[0304] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a RAM, a ROM, an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (Compact Disk Read Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0305] The program product of the embodiment of the present application may adopt a CD-ROM and include a computer program, and can be run on an electronic device. However, the program product of the present application is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a computer program, which may be used by or in combination with a command execution system, apparatus or device.
[0306] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein a readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a computer program for use by or in conjunction with a command execution system, apparatus, or device.
[0307] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0308] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A database performance testing method, characterized in that: include: Based on at least one constant contained in each historical transaction within a specified time period in the original database, parameterize each historical transaction to obtain a corresponding transaction template; Based on the set target field, extracting the file structure information of each storage file associated with the target field from each obtained transaction template; Based on the obtained file structure information, the file generation order between the storage files is obtained, and the value distribution of each attribute contained in each storage file is obtained; Based on the file structure information and value distribution corresponding to each of the storage files, combined with the file generation order, a virtual synthetic file corresponding to each of the storage files is constructed, and performance testing is performed based on the constructed virtual synthetic files to obtain performance test results.
2. The method according to claim 1, characterized in that The performance test is performed based on each constructed virtual synthetic file to obtain the performance test result, including: If the performance test is a performance simulation test, then based on the performance constraint parameter set of each historical transaction in the original database, each constructed virtual synthetic file is used to perform a performance test to obtain a performance test result; If the performance test is a performance stress test, multiple rounds of performance tests are performed based on the constructed virtual synthetic files to obtain performance test results.
3. The method according to claim 2, characterized in that The performance constraint parameter set based on each historical transaction in the original database is used to perform performance testing using each constructed virtual synthetic file to obtain performance test results, including: Based on the historical execution results corresponding to each of the transaction templates, each of the transaction templates is instantiated to obtain a corresponding instantiated transaction, and based on the performance constraint parameter set of each historical transaction in the original database, the obtained instantiated transaction and each virtual synthetic file are combined to obtain a performance test result; or, Based on the performance constraint parameter set of each historical transaction in the original database, combined with each historical transaction and each constructed virtual synthetic file, a performance test result is obtained.
4. The method according to claim 2, characterized in that Perform multiple rounds of performance tests based on the constructed virtual synthetic files to obtain performance test results, including: Based on the number of historical transactions corresponding to each of the transaction templates, the transaction templates are sorted, and according to a set selection ratio and the sorting result, each target template is extracted from the transaction templates, and according to each instantiated transaction obtained by instantiating the target template, multiple rounds of performance testing are performed in combination with each virtual synthetic file to obtain a performance test result; or, Based on the target sub-load configured in the configuration file and in combination with the correspondence between the target sub-load and the target template, the target templates corresponding to the target sub-load are obtained from the transaction templates, and according to the instantiated transactions obtained by instantiating the target templates and in combination with the virtual synthetic files, multiple rounds of performance testing are performed to obtain performance test results.
5. The method according to claim 2, characterized in that The multiple rounds of performance tests are performed based on the constructed virtual synthetic files to obtain performance test results, including: Perform a first round of performance testing based on each constructed virtual synthetic file to obtain a first round of reference performance testing results; Starting from the second round of performance testing, the current round of performance testing is performed based on the constructed virtual synthetic files to obtain the current performance test results of the current round, and when it is determined that data offset occurs based on the reference performance test results and the current performance test results, data recovery is performed on each virtual synthetic file after the current round of performance testing.
6. The method according to claim 4, characterized in that Before obtaining the target templates corresponding to the target subload from the transaction templates based on the target subload configured in the configuration file and in combination with the corresponding relationship between the target subload and the target templates, the method further includes: Based on the execution start time corresponding to each of the transaction templates, the transaction templates are sorted to obtain a transaction template sequence; According to a set time interval, each transaction template in the transaction template sequence is divided to obtain multiple groups of transaction templates, each group of transaction templates includes at least one transaction template; Based on the category features corresponding to each of the multiple groups of transaction templates, the multiple groups of transaction templates are clustered to obtain at least one group of merged transaction templates.
7. The method according to claim 6, characterized in that The clustering of the multiple groups of transaction templates based on the category features corresponding to each of the multiple groups of transaction templates to obtain at least one group of merged transaction templates includes: At least one merging process is performed on the multiple groups of transaction templates. In each merging process, the following operations are performed: Acquire each current group of transaction templates, and based on the category features corresponding to each of the current groups of transaction templates, determine that there are two groups of transaction templates that meet a preset merging condition among the current groups of transaction templates, and merge the two groups of transaction templates to obtain a new group of transaction templates; Based on at least one transaction template contained in each of the two groups of transaction templates, category features corresponding to the new group of transaction templates are obtained.
8. The method according to claim 7, characterized in that The determining, based on the category features corresponding to the respective groups of current transaction templates, that there are two groups of transaction templates that meet the preset merging condition among the current groups of transaction templates includes: If the category feature is the template similarity between two groups of transaction templates, then when the template similarity between the two groups of transaction templates is less than a preset similarity threshold, it is determined that there are two groups of transaction templates that meet the preset merging condition in the current groups of transaction templates; If the category feature is an evaluation value of the number of executed statements between two groups of transaction templates, then when the difference in the evaluation value of the number of executed statements between the two groups of transaction templates is less than a preset evaluation value threshold, it is determined that among the current groups of transaction templates, there are two groups of transaction templates that meet the preset merging conditions; the execution quantity evaluation value is used to characterize the number of structured query language SQL statements executed per unit time.
9. The method according to any one of claims 1 to 8, characterized in that The method of extracting the file structure information of each storage file associated with the target field from each obtained transaction template based on the set target field includes: Based on the set target field, extracting the file names contained in each of the obtained transaction templates; Based on the obtained file names, file structure query requests are respectively initiated to the original database to obtain file structure information of corresponding storage files.
10. The method according to any one of claims 1 to 8, characterized in that Each file structure information includes each attribute included in the corresponding storage file, and obtaining the file generation order between the storage files based on the obtained file structure information includes: Determine the file dependency relationship between the stored files based on the attributes contained in the obtained file structure information; Based on the file dependency, a file generation order between the storage files is obtained.
11. The method according to any one of claims 1 to 8, characterized in that The obtaining of the value distribution of each attribute contained in each storage file based on the obtained file structure information includes: Based on the set query field, extract at least one joint column from each of the transaction templates, each joint column including: at least one attribute in a storage file queried by the corresponding transaction template; Based on the extracted at least one joint column and in combination with the original database, obtaining a numerical range corresponding to each attribute contained in the at least one joint column; Based on the at least one joint column, respectively according to the set sampling ratio, a sampling query is performed on the original database to obtain corresponding sampling results, and based on the corresponding sampling results, corresponding sampling statistical information is obtained; Based on the sampling statistical information corresponding to each of the at least one joint columns and the obtained value ranges, the value distribution of each attribute contained in each of the storage files is obtained.
12. The method according to any one of claims 1 to 8, characterized in that The constructing of virtual synthetic files corresponding to each of the storage files based on the file structure information and value distribution corresponding to each of the storage files and in combination with the file generation order includes: According to the file generation order, the virtual synthetic files corresponding to the respective storage files are constructed in sequence, wherein in each construction process, the following operations are performed respectively: Determining attributes included in a virtual synthetic file based on file structure information of a storage file corresponding to the virtual synthetic file; Based on the attribute types of the attributes contained in the virtual synthetic file and in combination with the data generation strategies corresponding to the attribute types, a value set of the attributes contained in the virtual synthetic file is generated; wherein each data generation strategy is generated based on the numerical distribution of the corresponding attribute.
13. The method according to claim 12, characterized in that The generating of the value set of each attribute contained in the virtual synthetic file based on the attribute type of each attribute contained in the virtual synthetic file and in combination with the data generation strategy corresponding to the attribute type includes: For each attribute included in the virtual synthesis file, the following operations are performed respectively: If an attribute is a primary key, each unique value is used as the value set of the attribute; If an attribute is a foreign key, then based on the file generation order, a pre-order file of a storage file corresponding to the one virtual synthetic file is determined from the storage files, and based on the value distribution of the one attribute in the pre-order file, a value set of the one attribute is generated; If an attribute does not belong to a primary key or a foreign key, a value set of the attribute is generated based on the value distribution of the attribute in the storage file corresponding to the virtual synthetic file.
14. The method according to any one of claims 1 to 8, characterized in that Also includes: According to the configuration specification of the target instance, create a test instance with the same specification as the target instance; Based on the constructed virtual synthetic files, performance tests are performed to obtain performance test results, including: The test instance is adopted to perform performance testing based on each constructed virtual synthetic file to obtain a performance testing result.
15. A database performance testing device, characterized in that: include: A parameterization unit, configured to perform parameterization processing on each historical transaction within a specified time period in the original database based on at least one constant contained in each historical transaction, so as to obtain a corresponding transaction template; A structure extraction unit, configured to extract, based on a set target field, from each acquired transaction template, the file structure information of each storage file associated with the target field; A distribution extraction unit, used to obtain the file generation order between the storage files and the value distribution of each attribute contained in each storage file based on the obtained file structure information; The testing unit is used to construct virtual synthetic files corresponding to each of the storage files based on the file structure information and value distribution corresponding to each of the storage files in combination with the file generation order, and perform performance testing based on the constructed virtual synthetic files to obtain performance test results.
16. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any one of the methods of claims 1 to 14.
17. A computer-readable storage medium, characterized in that: The method comprises a computer program. When the computer program is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of any one of the methods of claims 1 to 14.
18. A computer program product, characterized in that It includes a computer program, which is stored in a computer-readable storage medium. The processor of the electronic device reads and executes the computer program from the computer-readable storage medium, so that the electronic device executes the steps of any method described in claims 1 to 14.