Database performance test method and device, equipment and storage medium

By determining the query method based on the database storage structure and performing performance testing, the problem that existing tools cannot support memory distributed databases is solved, and testing efficiency and accuracy are improved.

CN118916256AInactive Publication Date: 2024-11-08TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411391417.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-08
Publication Date
2024-11-08
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing database performance testing tools cannot effectively support the performance testing of in-memory distributed databases because their query methods and read parameters differ from in-memory structured databases lead to low matching, reducing testing efficiency.

Method used

Determine the corresponding query method based on the storage structure of the target database, and conduct query performance testing through the test tool to obtain query performance results to ensure that the test tool and the database are highly matched.

Benefits of technology

The performance testing efficiency of memory distributed databases and memory structured databases is improved, and the applicability and accuracy of the test tools are improved by matching the database storage structure and query methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916256A_ABST
    Figure CN118916256A_ABST
Patent Text Reader

Abstract

The invention provides a database performance testing method and device, equipment and a storage medium, and can be applied to the technical field of database testing. The method comprises the steps that a test task for a target database is obtained, and the test task comprises to-be-queried data information and test execution parameters; determining a target query mode corresponding to a storage structure according to the storage structure of the target database; and calling a test tool, and according to the to-be-queried data information and the test execution parameters, carrying out query performance test on the target database by utilizing the target query mode to obtain a query performance result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database testing, and in particular to a database performance testing method, device, equipment and storage medium. Background Art

[0002] In-memory structured databases store data in the form of a table structure of rows and columns and read data using the structured query language, while in-memory distributed databases store data in a key-value pair structure and do not support reading data using the structured query language. Therefore, the query methods and reading parameters set by existing performance testing tools for in-memory structured databases generally cannot support performance testing of in-memory distributed databases.

[0003] Due to differences in database storage structure and reading methods, the matching degree of testing tools is low, which reduces the efficiency of database performance testing. Summary of the invention

[0004] In view of the above problems, the present invention provides a database performance testing method, device, equipment and storage medium.

[0005] According to a first aspect of the present invention, there is provided a database performance testing method, comprising:

[0006] Obtain a test task for a target database, wherein the test task includes data information to be queried and test execution parameters; determine a target query method corresponding to the storage structure according to the storage structure of the target database; call a test tool, and perform a query performance test on the target database using the target query method according to the data information to be queried and the test execution parameters to obtain a query performance result.

[0007] Optionally, according to the storage structure of the target database, a target query method corresponding to the storage structure is determined, including:

[0008] When the storage structure of the target database is a key-value pair storage structure, the target query method is determined to be an attribute value query method; when the storage structure of the target database is a table storage structure, the target query method is determined to be a table query method.

[0009] Optionally, the test execution parameters include target database connection interface parameters and thread parameters; calling the test tool, and performing a query performance test on the target database using a target query method according to the data information to be queried and the test execution parameters, to obtain a query performance result, including:

[0010] The test tool is called to establish at least one thread according to the thread parameters, wherein the thread is used to execute the operation of querying the data to be queried from the target database; according to the target database connection interface parameters, at least one thread is connected to the target database; at least one thread is executed, and according to the data information to be queried, a query performance test is performed on the target database using a target query method to obtain a query performance result.

[0011] Optionally, the test execution parameters also include preset thread splitting rule parameters; the database performance testing method also includes:

[0012] Determine the sub-data information to be queried corresponding to each thread according to the number of data information to be queried, the number of at least one thread, and preset thread splitting rule parameters;

[0013] Execute at least one thread, and perform a query performance test on a target database using a target query method according to the data information to be queried, and obtain query performance results including:

[0014] For each thread in at least one thread, the thread is executed, and according to the information of the sub-data to be queried corresponding to the thread, the sub-data to be queried is queried from the target database using a target query method to perform a query performance test on the target database to obtain a query performance sub-result; and a query performance result is generated according to the query performance sub-result corresponding to each of the at least one thread.

[0015] Optionally, the query performance sub-result includes a throughput performance test sub-result; according to the information of the sub-data to be queried corresponding to the thread, the sub-data to be queried is queried from the target database using a target query method to perform a query performance test on the target database, and the query performance sub-result includes:

[0016] In the process of querying the sub-data to be queried from the target database by using the target query method, the monitoring program is used to count the query request times executed by the thread and the data volume of the sub-data to be queried, and the throughput performance test sub-result corresponding to the thread is obtained.

[0017] Optionally, the query performance sub-result also includes an average query duration test sub-result; and according to the information of the sub-data to be queried corresponding to the thread, the sub-data to be queried is queried from the target database using a target query method to perform a query performance test on the target database, and the query performance sub-result obtained also includes:

[0018] In the process of querying the sub-data to be queried from the target database using the target query method, the monitoring program is used to count the number of query requests executed by the thread; for each query request executed by the thread, the query request sending time and the response return time are counted to obtain the query duration corresponding to each query request; based on the number of query requests of the thread and the query duration corresponding to each query request, the average query duration test sub-result corresponding to the thread is obtained.

[0019] Optionally, when the target query mode is a table query mode, the test execution parameters also include driver parameters and operation tool interface parameters. The test tool is called to perform a query performance test on the target database using the target query mode according to the data information to be queried and the test execution parameters. The query performance results obtained include:

[0020] The test tool establishes a connection with the operation tool according to the operation tool interface parameters; the operation tool is initialized using the driver parameters, and the initialized operation tool is used to execute a table query method compiled using a structured query language; the test tool calls the operation tool, and performs a query performance test on the target database using a table query method according to the data information to be queried and the test execution parameters, and obtains a query performance result.

[0021] A second aspect of the present invention provides a database performance testing device, comprising:

[0022] An acquisition module is used to acquire a test task for a target database, wherein the test task includes data information to be queried and test execution parameters;

[0023] A determination module, used to determine a target query method corresponding to the storage structure according to the storage structure of the target database; and

[0024] The test module is used to call the test tool, and perform query performance test on the target database using the target query method according to the data information to be queried and the test execution parameters to obtain the query performance results.

[0025] The third aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above-mentioned database performance testing method.

[0026] The fourth aspect of the present invention further provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the above-mentioned database performance testing method.

[0027] According to the database performance testing method, device, equipment and storage medium provided by the present invention, the target query mode corresponding to the storage structure is determined according to the storage structure of the target database; the test tool is called, and the target query mode is used to perform query performance testing on the target database according to the data information to be queried and the test execution parameters, and the query performance results are obtained. Since the corresponding target query mode is set according to the storage structure of the target database, and the test execution parameters that can be supported by the test tool are configured in combination with the distribution characteristics of the target database, the test tool performs query performance testing on the target database according to the data information to be queried and the test execution parameters, and the query performance results are obtained. The test tool with high matching degree improves the test efficiency of the in-memory distributed database and the in-memory structured database. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:

[0029] Figure 1 An application scenario of a database performance testing method according to an embodiment of the present invention is shown;

[0030] Figure 2 A flowchart of a database performance testing method according to an embodiment of the present invention is shown;

[0031] Figure 3 A flowchart of generating query performance results according to an embodiment of the present invention is shown;

[0032] Figure 4 It shows a structural block diagram of a database performance testing device according to an embodiment of the present invention;

[0033] Figure 5 A block diagram of an electronic device suitable for implementing a database performance testing method according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0034] Below, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of concepts of the present invention.

[0035] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the existence of features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0036] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0037] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0038] In the process of implementing the present invention, it is found that the memory-type structured database stores data in the form of a table structure of rows and columns and reads data in a structured query language, while the memory-type distributed database stores data in a key-value pair structure and does not support the structured query language to read data. Therefore, the query method and reading parameters set by the existing performance testing tools for memory-type structured databases generally cannot support the performance testing of memory-type distributed databases. Due to differences in database storage structure and reading methods, the matching degree of the test tools is low, thereby reducing the efficiency of database performance testing.

[0039] In view of this, an embodiment of the present invention provides a database performance testing method, device, equipment and storage medium. The method includes: obtaining a test task for a target database, wherein the test task includes data information to be queried and test execution parameters; determining a target query method corresponding to the storage structure according to the storage structure of the target database; calling a test tool, and performing a query performance test on the target database using the target query method according to the data information to be queried and the test execution parameters, to obtain a query performance result.

[0040] In the technical solution of the present invention, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0041] Figure 1 An application scenario of the database performance testing method according to an embodiment of the present invention is shown.

[0042] like Figure 1 As shown, the business system architecture 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104 and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0043] The user may use at least one of the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).

[0044] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0045] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.

[0046] It should be noted that the database performance testing method provided in the embodiment of the present invention can generally be executed by the server 105. Accordingly, the database performance testing device provided in the embodiment of the present invention can generally be set in the server 105. The database performance testing method provided in the embodiment of the present invention can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the database performance testing device provided in the embodiment of the present invention can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.

[0047] Alternatively, the database performance testing method provided in the embodiment of the present invention may also be executed by the first terminal device 101, the second terminal device 102 or the third terminal device 103, or may also be executed by other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103. Accordingly, the database performance testing apparatus provided in the embodiment of the present invention may also be arranged in the first terminal device 101, the second terminal device 102 or the third terminal device 103, or may be arranged in other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103.

[0048] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0049] It should be noted that the sequence numbers of the operations in the following method are only used as representations of the operations for the purpose of description, and should not be regarded as representing the execution order of the operations. Unless explicitly stated, the method does not need to be executed completely in the order shown.

[0050] Figure 2 A flowchart of a database performance testing method according to an embodiment of the present invention is shown.

[0051] like Figure 2 As shown, the method 200 includes operations S210 to S230.

[0052] In operation S210, a test task for a target database is obtained.

[0053] Optionally, the target database is deployed on a server, and the server obtains a test task in response to receiving a test request from a client. The target database may be an in-memory distributed database or an in-memory structured database, and does not support Structured Query Language (SQL). In-memory structured databases support Structured Query Language. The test task represents a task for testing the performance of the target database.

[0054] Optionally, the test task includes data information to be queried and test execution parameters.

[0055] Optionally, the data information to be queried may include attribute information to be queried and the file address of the data to be queried. For example, the attribute information to be queried may be the age, gender and other attributes of Zhang San.

[0056] Optionally, the test execution parameters are used to configure the execution rules, interfaces and other information required to execute the test task.

[0057] For example, execution rules such as execution time, number of loops, and returned attributes can set specific attributes to be returned for each query request or return all attributes. The number of loops can be set to 1.

[0058] In operation S220, according to the storage structure of the target database, a target query method corresponding to the storage structure is determined.

[0059] Optionally, the storage structure of the target database represents the physical structure and logical structure of the target database storing the data set, and data is queried from the target database according to a target query method corresponding to the storage structure.

[0060] Optionally, the target query method can be used to call the stored procedure and query language supported by the target database to implement the query operation of the target database. For example, the attribute value query method is used for the storage structure of the memory-based distributed database.

[0061] In operation S230, the test tool is called to perform a query performance test on the target database using a target query method according to the data information to be queried and the test execution parameters, and obtain a query performance result.

[0062] Optionally, before testing, configure the test environment and install the test tool on the server. For example, copy the test tool to any directory file, instantiate the operation interface class, and then specify the operation type by passing parameters. The test tool can support test execution parameters to facilitate query performance testing of the target database.

[0063] For example, the test tool may be an in-memory distributed database benchmark tool (XDM Benchmark). Since the test tool may support structured query language, query performance testing of in-memory structured databases may also be performed.

[0064] Optionally, the server calls the test tool to query the target database using a predetermined target query method according to the data information to be queried and the test execution parameters, and obtains data query results and statistical results corresponding to the query performance indicators, thereby obtaining query performance results.

[0065] Optionally, the query performance result represents the execution efficiency of the query operation executed by the target database, for example, query response time, query response speed, amount of data processed per unit time, etc.

[0066] Optionally, since a corresponding target query method is set according to the storage structure of the target database, and test execution parameters that can be supported by the test tool are configured in combination with the distribution characteristics of the target database, the test tool can perform query performance testing on the target database using the target query method based on the data information to be queried and the test execution parameters to obtain query performance results. Test tools with a high degree of matching improve the testing efficiency of in-memory distributed databases and in-memory structured databases.

[0067] Optionally, according to the storage structure of the target database, a target query method corresponding to the storage structure is determined, including:

[0068] When the storage structure of the target database is a key-value pair storage structure, the target query method is determined to be an attribute value query method; when the storage structure of the target database is a table storage structure, the target query method is determined to be a table query method.

[0069] Optionally, the data in the key-value pair storage structure is stored in the form of multiple key-value pairs, and the keys associated with the key of the root node are stored adjacently in the target database. The key-value form refers to the mapping structure from key to attribute value. The key is the unique keyword for finding the data address, and the attribute value is the content of the data storage. For example, the key value: ("001", "Zhang San"), the key is "001", and the attribute value is "Zhang San".

[0070] Optionally, the target query method corresponding to the key-value pair storage structure is an attribute value query method. For example, for the key-value pair storage structure of a memory-type distributed database, the attribute value query method can be set to: "attribute name = attribute value or parameter file".

[0071] For example, the attribute value query method can be: "sn=0A2D67E459F9EXXX".

[0072] Optionally, multiple attribute values ​​can be stored in a parameter file. For a test task that queries multiple attribute values, the parameters of the target query method can be set in the form of a parameter file.

[0073] Optionally, data in a table storage structure is stored in the form of rows and columns. The primary key in each table can consist of multiple columns. Each row represents a record, and each column represents a field.

[0074] Optionally, the target query mode corresponding to the table storage structure is a table query mode. The table query mode may be a single row query, a range query, or the like.

[0075] For example, for a table storage structure of an in-memory structured database that supports Structured Query Language, the table query method can be set to: "field name = single value or file path of a parameterized file." A parameterized file can store multiple single values.

[0076] For example, the table query method is: "sn=0001 or sn=file: / PF_1.csv".

[0077] Optionally, before executing the test, a corresponding target query mode is set according to the storage structure of the target database, so as to support the test tool to perform query performance testing on the target database.

[0078] Figure 3 A flow chart of generating query performance results according to an embodiment of the present invention is shown.

[0079] like Figure 3 As shown, the test tool is called, and query performance test is performed on the target database using the target query method according to the data information to be queried and the test execution parameters to obtain the query performance result, including steps S310 to S330.

[0080] In step S310, the test tool is called to create at least one thread according to the thread parameters.

[0081] Optionally, the thread is used to execute an operation of querying the data to be queried from the target database.

[0082] Optionally, the test execution parameters include target database connection interface parameters and thread parameters.

[0083] Optionally, setting thread parameters may include setting the number of threads, thread return attributes, thread run times, thread interface, and other information.

[0084] Optionally, the number of threads represents the number of concurrent operation threads, and can be set according to performance requirements. For example, the number of threads is set to 4.

[0085] Optionally, the thread return attribute represents the attribute returned after the thread executes the query operation. For example, each query operation can be set to return a pre-specified portion of attributes or each query can be set to return all attributes by default.

[0086] Optionally, each thread automatically ends after running to a preset number of times. For example, the total number of times the thread runs can be set to 200,000 times.

[0087] Optionally, the thread interface is used to bind the thread to the database. The test tool supports thread parameters, and the test tool is called to create at least one thread according to the thread parameters.

[0088] In step S320, at least one thread is connected to the target database according to the target database connection interface parameters.

[0089] Optionally, setting the target database connection interface parameters may include setting the target database address, target database port, target database name, database connection and closing time, target database distribution characteristics and other information.

[0090] Optionally, the target database may include multiple database shards, and according to the node distribution characteristics in the target database, a cluster node or a single data node connected to the multiple database shards may be set during testing.

[0091] For example, if the target database distribution characteristic is set to true, it indicates that the current test connection is to a cluster node, and false indicates that the current test connection is to a data node.

[0092] Optionally, in the case of testing the connection to a cluster node, that is, there is no need to query the data to be queried from multiple database shards separately, the target database address is set to the address of the cluster node, and the target database port is set to the port of the cluster node; in the case of testing the connection to a data node, that is, the target database does not need to set up multiple database shards, the target database address is set to the address of the data node, and the target database port is set to the port of the data node.

[0093] For example, when the database connection and closing time is set to true, the detailed target database connection and closing time will be output, and when it is set to false, no output will be made; the target database connection timeout can be set to 10 seconds. If the connection to the target database fails after more than 10 seconds, the test will be exited.

[0094] Optionally, the test tool supports target database connection interface parameters. After calling the test tool to establish concurrent threads, the target database binding class is instantiated, and then at least one thread is connected to the target database according to the target database connection interface parameters and stored in the connection pool.

[0095] In step S330, at least one thread is executed to perform a query performance test on the target database using a target query method according to the data information to be queried, and obtain a query performance result.

[0096] For example, the target database is a memory-based distributed database, and the data information to be queried includes query information related to "Zhang San" and "Li Si" and the file address of the data to be queried. Two concurrent threads for querying "Zhang San" and "Li Si" are called from the connection pool, and the test tool executes the two threads at the same time. According to the data information to be queried, the query performance test of the memory-based distributed database is performed using the attribute value query method. After each thread loops to the set operation time or number of runs, the target database connection is closed to obtain the query performance results.

[0097] Optionally, the test execution parameters also include preset thread splitting rule parameters.

[0098] Optionally, the preset thread splitting rule parameters represent the rules for each thread to read the data to be queried, and the setting of the preset thread splitting rule parameters requires that the total number of runs of all threads or the amount of data to be queried is greater than or equal to the number of threads and can be divided by the number of threads.

[0099] Optionally, the database performance testing method further includes: determining the sub-data information to be queried corresponding to each thread according to the amount of data information to be queried, the amount of at least one thread and preset thread splitting rule parameters.

[0100] Optionally, the preset thread splitting rule parameter needs to be set in combination with the total number of thread runs. If the preset thread splitting rule is set to true, it means that each thread divides the data in the data information to be queried evenly and executes them in parallel. If it is set to false, it means that each thread executes the data in the data information to be queried from beginning to end.

[0101] Optionally, the preset thread splitting rule parameter is set to true, and the total number of runs is set to a value. Then the amount of data of the sub-data information to be queried that each thread needs to execute is: the number of data information to be queried / the number of threads, and the number of runs of each thread is: the total number of runs / the number of data information to be queried.

[0102] For example, if the preset thread splitting rule parameter is set to true, the number of threads is 200, the total number of runs is 100,000, and the number of data information to be queried is 100,000, then each thread needs to read 500 sub-data information to be queried, and the test ends after the concurrent run is completed; if the number of threads is 200, the total number of runs is 200,000, and the number of data information to be queried is 100,000, then each thread needs to read 500 sub-data information to be queried, each thread executes twice, and the concurrent run test ends.

[0103] Optionally, if the preset thread splitting rule parameter is set to true and the total number of runs is not set, the amount of data of the sub-data information to be queried that each thread needs to execute is: the number of data information to be queried / the number of threads. If the number of runs for each thread is not set, the test program can execute the total number of runs of all threads or end the test after the set test time is reached.

[0104] Optionally, if the preset thread splitting rule parameter is set to false, each thread needs to read all the data information to be queried, and the test program can end the test after reaching the set test time.

[0105] Optionally, executing at least one thread, and performing a query performance test on a target database using a target query method according to the data information to be queried, to obtain a query performance result including:

[0106] For each thread in at least one thread, the thread is executed, and according to the information of the sub-data to be queried corresponding to the thread, the sub-data to be queried is queried from the target database using a target query method to perform a query performance test on the target database to obtain a query performance sub-result; and a query performance result is generated according to the query performance sub-result corresponding to each of the at least one thread.

[0107] For example, if the target database is an in-memory distributed database, the test tool executes each thread and performs query performance testing on the in-memory distributed database using attribute value query based on the sub-data information to be queried corresponding to the thread. Each thread loops and executes to the set operation time or number of runs before closing the target database connection. The returned query performance indicators are counted to obtain the query performance sub-results corresponding to each thread.

[0108] Optionally, statistics are collected on the query performance sub-results of each thread to obtain the query performance results of the target database.

[0109] Optionally, the query performance sub-result includes a throughput performance test sub-result.

[0110] Optionally, the throughput performance test sub-result represents the amount of data to be queried that is successfully processed by the tested target database on the network per unit time, in bytes per second.

[0111] Optionally, according to the information of the sub-data to be queried corresponding to the thread, the sub-data to be queried is queried from the target database using a target query method to perform a query performance test on the target database, and the query performance sub-results obtained include:

[0112] In the process of querying the sub-data to be queried from the target database by using the target query method, the monitoring program is used to count the query request times executed by the thread and the data volume of the sub-data to be queried, and the throughput performance test sub-result corresponding to the thread is obtained.

[0113] Optionally, the main thread monitors and counts the number of query requests of each thread and the amount of sub-data to be queried through a monitoring program, and calculates the number of query requests and the number of data returned by the received query requests to obtain a throughput performance test sub-result corresponding to the thread.

[0114] Optionally, the query performance sub-result also includes an average query duration test sub-result.

[0115] Optionally, the average query duration test sub-result represents the average duration of the entire process from a thread sending at least one query request to a target database to respond to and process the query request and then to returning a query result.

[0116] Optionally, according to the sub-data information to be queried corresponding to the thread, querying the sub-data to be queried from the target database using a target query method to perform a query performance test on the target database to obtain a query performance sub-result, further comprising:

[0117] In the process of querying the sub-data to be queried from the target database using the target query method, the number of query requests executed by the thread is counted using a monitoring program; for each query request executed by the thread, the query request sending time and the response returning time are counted to obtain the query duration corresponding to each query request; based on the number of query requests of the thread and the query duration corresponding to each query request, the average query duration test sub-result corresponding to the thread is obtained.

[0118] Optionally, the main thread monitors the query request times of each thread through a monitoring program, counts the query request sending time and response return time, and obtains the query duration corresponding to each query request. The query duration can be calculated by subtracting the sending time from the response return time.

[0119] Optionally, the query request sending time represents the time when the thread sends the query request, and the response return time represents the time when the target database responds to the query request and returns the query result to the thread.

[0120] Optionally, each thread may send multiple query requests, and an average query duration test sub-result corresponding to each thread is obtained according to the counted number of query requests and the query duration corresponding to each query request.

[0121] Optionally, the preset printing parameters print the average query duration test sub-result of each thread.

[0122] Optionally, when the target query mode is a table query mode, the test execution parameters also include driver parameters and operation tool interface parameters. The test tool is called to perform a query performance test on the target database using the target query mode according to the data information to be queried and the test execution parameters. The query performance results obtained include:

[0123] The test tool establishes a connection with the operation tool according to the operation tool interface parameters; the operation tool is initialized using the driver parameters, and the initialized operation tool is used to execute a table query method compiled using a structured query language; the test tool calls the operation tool, and performs a query performance test on the target database using a table query method according to the data information to be queried and the test execution parameters, and obtains a query performance result.

[0124] Optionally, when the target database is an in-memory structured database, the target query mode is a table query mode. The test execution parameters also include driver parameters and operation tool interface parameters. For example, the driver parameters are driver parameters, and the operation tool interface parameters are prepareStatement interface parameters.

[0125] Optionally, the operation tool can be Java DataBase Connectivity, which is used to support access to the target database in a pre-compiled structured query language. The test tool establishes a connection with the operation tool according to the operation tool interface parameters to perform concurrent query operations at a specified time; the operation tool is initialized using the driver parameters, and the initialized operation tool is used to execute the table query method compiled in the structured query language.

[0126] Optionally, each thread obtains a connection with a target database from a driver parameter, and then performs a query performance test on the target database using a table query method according to the data information to be queried and the test execution parameters to obtain a query performance result.

[0127] For example, the test execution parameters may also include information such as the number of threads being 200, the test time being 900 seconds, the table name of the data information to be queried being test, the user name and password of the target database, and the like.

[0128] Based on the above database performance testing method, the present invention also provides a database performance testing device. Figure 4 The device is described in detail.

[0129] Figure 4 A structural block diagram of a database performance testing device according to an embodiment of the present invention is shown.

[0130] like Figure 4 As shown, the database performance testing device 400 of this embodiment includes an acquisition module 410 , a determination module 420 and a testing module 430 .

[0131] The acquisition module 410 is used to acquire a test task for the target database, wherein the test task includes the data information to be queried and the test execution parameters. In one embodiment, the acquisition module 410 can be used to execute the operation S210 described above, which will not be described in detail here.

[0132] The determination module 420 is used to determine the target query mode corresponding to the storage structure according to the storage structure of the target database. In one embodiment, the determination module 420 can be used to perform the operation S220 described above, which will not be described in detail here.

[0133] The test module 430 is used to call the test tool, and perform a query performance test on the target database using a target query method according to the data information to be queried and the test execution parameters to obtain a query performance result. In one embodiment, the test module 430 can be used to perform the operation S230 described above, which will not be repeated here.

[0134] Optionally, the determination module 420 includes a first determination submodule and a second determination submodule.

[0135] The first determination submodule is used to determine that the target query mode is an attribute value query mode when the storage structure of the target database is a key-value pair storage structure.

[0136] The second determination submodule is used to determine that the target query mode is a table query mode when the storage structure of the target database is a table storage structure.

[0137] Optionally, the test module 430 includes a first test submodule, a second test submodule and a third test submodule.

[0138] The first test submodule is used to call the test tool and establish at least one thread according to the thread parameters, wherein the thread is used to execute the operation of querying the data to be queried from the target database.

[0139] The second test submodule is used to establish a connection between at least one thread and the target database according to the target database connection interface parameters.

[0140] The third test submodule is used to execute at least one thread, and perform a query performance test on the target database using a target query method according to the data information to be queried, to obtain a query performance result.

[0141] Optionally, the database performance testing device 400 also includes a generation module.

[0142] The generating module is used to determine the sub-data information to be queried corresponding to each thread according to the number of data information to be queried, the number of at least one thread and preset thread splitting rule parameters.

[0143] Optionally, the third test submodule includes a first test unit and a second test unit.

[0144] The first test unit is used to execute the thread for each thread in at least one thread, and query the sub-data to be queried from the target database using a target query method according to the sub-data information to be queried corresponding to the thread, so as to perform a query performance test on the target database and obtain a query performance sub-result.

[0145] The second testing unit is used to generate a query performance result according to the query performance sub-results corresponding to at least one thread.

[0146] Optionally, the first test unit includes a first test sub-unit.

[0147] The first test sub-unit is used to use a monitoring program to count the number of query requests executed by the thread and the amount of data of the sub-data to be queried during the process of querying the sub-data to be queried from the target database using the target query method, so as to obtain a throughput performance test sub-result corresponding to the thread.

[0148] Optionally, the first test unit further includes a second test sub-unit, a third test sub-unit and a fourth test sub-unit.

[0149] The second test sub-unit is used to use a monitoring program to count the number of query requests executed by the thread during the process of querying the sub-data to be queried from the target database using the target query method.

[0150] The third test sub-unit is used to collect statistics on the sending time and response return time of each query request executed by the thread, so as to obtain the query duration corresponding to each query request.

[0151] The fourth test subunit is used to obtain an average query duration test sub-result corresponding to the thread according to the number of query requests of the thread and the query duration corresponding to each query request.

[0152] Optionally, the test module 430 further includes a fourth test submodule, a fifth test submodule and a sixth test submodule.

[0153] The fourth testing submodule is used for the testing tool to establish a connection with the operating tool according to the operating tool interface parameters.

[0154] The fifth test submodule is used to initialize the operation tool using the driving parameters, and the initialized operation tool is used to execute the table query method compiled by the structured query language.

[0155] The sixth test submodule is used for the test tool to call the operation tool, and to perform a query performance test on the target database using a table query method according to the data information to be queried and the test execution parameters, so as to obtain a query performance result.

[0156] Optionally, any multiple modules among the acquisition module 410, the determination module 420 and the test module 430 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. Optionally, at least one of the acquisition module 410, the determination module 420 and the test module 430 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, at least one of the acquisition module 410, the determination module 420 and the test module 430 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.

[0157] Figure 5 A block diagram of an electronic device suitable for implementing a database performance testing method according to an embodiment of the present invention is shown.

[0158] Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0159] like Figure 5 As shown, the computer electronic device 500 according to an embodiment of the present invention includes a processor 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage part 509 to the random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include an on-board memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.

[0160] In RAM 503, various programs and data required for the operation of electronic device 500 are stored. Processor 501, ROM 502 and RAM 503 are connected to each other via bus 504. Processor 501 performs various operations of the method flow according to the embodiment of the present invention by executing the program in ROM 502 and / or RAM 503. It should be noted that the program can also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 can also perform various operations of the method flow according to the embodiment of the present invention by executing the program stored in one or more memories.

[0161] Optionally, the electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to the bus 504. The electronic device 500 may further include one or more of the following components connected to the input / output (I / O) interface 505: an input portion 506 including a keyboard, a mouse, etc.; an output portion 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 508 including a hard disk, etc.; and a communication portion 509 including a network interface card such as a LAN card, a modem, etc. The communication portion 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage portion 508 as needed.

[0162] Optionally, the method flow according to the embodiment of the present invention can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above-mentioned functions defined in the system of the embodiment of the present invention are executed. Optionally, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.

[0163] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the database performance testing method according to the embodiment of the present invention is implemented.

[0164] Optionally, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.

[0165] For example, optionally, the computer-readable storage medium may include the ROM 502 and / or the RAM 503 described above and / or one or more memories other than the ROM 502 and the RAM 503 .

[0166] An embodiment of the present invention also includes a computer program product, which includes a computer program, which contains program code for executing the method provided by the embodiment of the present invention. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the database performance testing method provided by the embodiment of the present invention.

[0167] When the computer program is executed by the processor 501, the above functions defined in the system / device of the embodiment of the present invention are performed. Optionally, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0168] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 509, and / or installed from the removable medium 511. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0169] Optionally, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages, specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, such as Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).

[0170] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments and / or claims of the present invention can be combined and / or combined in various ways, even if such a combination or combination is not explicitly recorded in the present invention. In particular, without departing from the spirit and teaching of the present invention, the features described in the various embodiments and / or claims of the present invention may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present invention.

[0171] The embodiments of the present invention are described above. However, these embodiments are only for the purpose of illustration, and are not intended to limit the scope of the present invention. Although each embodiment is described above, it does not mean that the measures in each embodiment cannot be used in combination. The scope of the present invention is defined by the attached claims and their equivalents. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.

Claims

1. A database performance testing method, characterized in that: The method comprises: Acquire a test task for a target database, wherein the test task includes data information to be queried and test execution parameters; According to the storage structure of the target database, determining a target query mode corresponding to the storage structure; The test tool is called, and query performance test is performed on the target database using the target query method according to the data information to be queried and the test execution parameters to obtain query performance results.

2. The method according to claim 1, characterized in that Determining a target query method corresponding to the storage structure according to the storage structure of the target database includes: In the case where the storage structure of the target database is a key-value pair storage structure, determining that the target query mode is an attribute value query mode; When the storage structure of the target database is a table storage structure, the target query mode is determined to be a table query mode.

3. The method according to claim 2, characterized in that The test execution parameters include target database connection interface parameters and thread parameters; Calling a test tool, and performing a query performance test on the target database using the target query method according to the data information to be queried and the test execution parameters, to obtain a query performance result, including: Calling a test tool to establish at least one thread according to the thread parameter, wherein the thread is used to execute an operation of querying the target database for the data to be queried; Establishing a connection between the at least one thread and the target database according to the target database connection interface parameters; The at least one thread is executed, and query performance test is performed on the target database using the target query method according to the data information to be queried, to obtain a query performance result.

4. The method according to claim 3, characterized in that The test execution parameters also include preset thread splitting rule parameters; the method also includes: Determine the sub-data information to be queried corresponding to each of the threads according to the number of the data information to be queried, the number of the at least one thread, and the preset thread splitting rule parameter; The executing of the at least one thread, performing a query performance test on the target database using the target query method according to the data information to be queried, and obtaining a query performance result includes: For each thread of the at least one thread, the thread is executed, and according to the sub-data information to be queried corresponding to the thread, the sub-data to be queried is queried from the target database using the target query method, so as to perform a query performance test on the target database and obtain a query performance sub-result; The query performance result is generated according to the query performance sub-results corresponding to each of the at least one thread.

5. The method according to claim 4, characterized in that The query performance sub-result includes a throughput performance test sub-result; According to the sub-data information to be queried corresponding to the thread, the sub-data to be queried is queried from the target database using the target query method to perform a query performance test on the target database, and the query performance sub-results obtained include: In the process of querying the sub-data to be queried from the target database using the target query method, a monitoring program is used to count the number of query requests executed by the thread and the amount of data of the sub-data to be queried, so as to obtain the throughput performance test sub-result corresponding to the thread.

6. The method according to claim 4, characterized in that The query performance sub-result also includes an average query duration test sub-result; According to the sub-data information to be queried corresponding to the thread, the sub-data to be queried is queried from the target database using the target query mode to perform a query performance test on the target database to obtain a query performance sub-result, further comprising: In the process of querying the sub-data to be queried from the target database by using the target query method, using a monitoring program to count the number of query requests executed by the thread; For each query request executed by the thread, statistics are collected on the sending time and the response returning time of the query request to obtain the query duration corresponding to each query request; The average query duration test sub-result corresponding to the thread is obtained according to the number of query requests of the thread and the query duration corresponding to each query request.

7. The method according to claim 2, characterized in that When the target query mode is a table query mode, the test execution parameters also include drive parameters and operation tool interface parameters. The calling test tool performs a query performance test on the target database using the target query method according to the data information to be queried and the test execution parameters, and obtains the query performance result including: The testing tool establishes a connection with the operating tool according to the operating tool interface parameters; Initializing the operation tool using the driving parameters, wherein the initialized operation tool is used to execute a table query method compiled using a structured query language; The testing tool calls the operating tool, and performs a query performance test on the target database using the table query method according to the data information to be queried and the test execution parameters, to obtain a query performance result.

8. A database performance testing device, characterized in that: The device comprises: An acquisition module, used to acquire a test task for a target database, wherein the test task includes data information to be queried and test execution parameters; A determination module, configured to determine a target query mode corresponding to the storage structure according to the storage structure of the target database; and The test module is used to call the test tool, and perform a query performance test on the target database using the target query method according to the data information to be queried and the test execution parameters to obtain a query performance result.

9. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more instructions, Wherein, when the one or more instructions are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Executable instructions are stored thereon, and when the instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Database performance test system

    CN103425683A

  • Service data query platform configuration method and device, computer equipment and medium

    CN112163131A

  • Data query method and device, electronic equipment and machine readable storage medium

    CN113094387A

  • Database performance test method and device, equipment and medium

    CN113505073A