Database performance test method, system, medium and equipment

The method and system automate database performance testing by generating a target test plan, creating threads, and collecting indicators to quickly and accurately determine performance, overcoming the inefficiencies of manual testing.

CN119127634APending Publication Date: 2024-12-13TONGFANG KNOWLEDGE NETWORK DIGITAL PUBLISHING TECHNOLOGY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410995151.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

Existing database performance testing methods are time-consuming and prone to errors due to manual configuration and operation, lacking automation and accuracy.

Method used

A method and system that automatically generates a target test plan with concurrent requests, creates threads for database communication, executes test statements, and collects performance indicators to determine database performance accurately and quickly.

Benefits of technology

Reduces testing time and ensures accuracy by simulating user access requests, collecting indicators, and determining performance efficiently, addressing the limitations of manual and error-prone methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127634A_ABST
    Figure CN119127634A_ABST
Patent Text Reader

Abstract

The invention discloses a database performance test method, system medium and equipment, and the method comprises the steps: pre-generating a target test scheme for performance test based on a preset performance test requirement, the target test scheme comprising a target test script and the number of concurrent requests; in response to the performance test request, creating a plurality of target threads in communication connection with the to-be-tested database based on the number of concurrent requests in the target test scheme; based on a target test script in a target test scheme, respectively executing a test statement in the target test script through each target thread so as to send a plurality of access requests to a to-be-tested database; collecting database indexes and performance indexes when the to-be-tested database processes the access requests, determining the performance of the to-be-tested database at least based on the database indexes and the performance indexes, and obtaining a performance test result. According to the method, the database test time can be shortened, and meanwhile, the accuracy of a test result is ensured.
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 detection, and in particular to a database performance testing method, system, medium and equipment. Background Art

[0002] As an IT infrastructure, the database is a very important part of the new infrastructure and the information innovation ecosystem. With the continuous updating and development of the database, various data testing tools have emerged.

[0003] Existing database performance testing tools mainly rely on manual writing of test plans and configuration of performance parameters, and perform performance testing and recording in rounds. The operation is complicated, tedious, time-consuming and prone to errors.

[0004] Therefore, there is an urgent need for a database performance testing method to solve the problem that database testing in the prior art is time-consuming and error-prone. Summary of the invention

[0005] In view of this, the present invention provides a database performance testing method, system, medium and device, the main purpose of which is to solve the problem that the current database testing is time-consuming and prone to errors.

[0006] To solve the above problems, the present application provides a database performance testing method, including:

[0007] Based on the predetermined performance test requirements, a target test plan for performing the performance test is generated in advance, wherein the target test plan includes a target test script and the number of concurrent requests;

[0008] In response to the performance test request, based on the number of concurrent requests in the target test solution, create a number of target threads for communicating with the database to be tested;

[0009] Based on the target test script in the target test scheme, the test statements in the target test script are respectively executed by each target thread to send a number of access requests to the database to be tested;

[0010] The database index and the performance index when the database to be tested processes each access request are collected, so as to determine the performance of the database to be tested based at least on the database index and the performance index, and obtain a performance test result.

[0011] Optionally, the pre-generating a target test scheme for performing a performance test based on a predetermined performance test requirement specifically includes:

[0012] Based on the predetermined performance test requirements, the test statements are pre-edited using the performance script editor to generate a target test script;

[0013] The target test scenario is generated based on the target test script and the predetermined number of concurrent requests.

[0014] Optionally, the target test scheme also includes a target parameter configuration file; before creating a plurality of target threads for communicating with the database to be tested, the method further includes:

[0015] Based on the target parameter configuration file in the target test solution, target parameters are configured for the database to be tested and the server to be tested corresponding to the database to be tested, so as to initialize the test environment for the database to be tested and the server to be tested.

[0016] Optionally, before initializing the test environment, the method further includes:

[0017] Pre-configuring target parameters of the database to be tested and target parameters of the server to be tested based on the pre-configured device according to the predetermined performance test requirements;

[0018] Based on each of the target parameters, the target parameter configuration file is generated.

[0019] Optionally, the target test scheme also includes timing information;

[0020] The target test script in the target test scheme is based on the target test script, and the test statements in the target test script are respectively executed by each target thread to send a plurality of access requests to the database to be tested, specifically including:

[0021] Based on the target test script and timing information in the target test solution, each thread executes the test statements in the target test script according to the timing information to simulate the operation of a user sending several access requests to the database under test.

[0022] Optionally, when the database to be tested processes each of the access requests, the method further includes: collecting system resource indicators;

[0023] The step of determining the performance of the database to be tested at least based on the database indicator and the performance indicator to obtain the performance test result specifically includes:

[0024] Based on the database index, the performance index and the system resource index, the application performance satisfaction index corresponding to each index is calculated respectively, so as to determine the performance of the database to be tested based on each application performance satisfaction index and obtain the performance test result.

[0025] Optionally, the performance indicators include any one or more of the following: number of messages processed per second TPS, query rate per second QPS, and response time;

[0026] The database indicators include internal operation data of the database;

[0027] The system resource indicators include any one or more of the following: memory occupancy rate, processor utilization rate, and disk transfer rate.

[0028] To solve the above problems, the present application provides a database performance testing system, including:

[0029] A test pre-manager, for pre-generating a target test plan for performing a performance test based on predetermined performance test requirements, wherein the target test plan includes a target test script and a number of concurrent requests;

[0030] A load generator, for creating, in response to a performance test request, a number of target threads for communicating with a database to be tested based on the number of concurrent requests in the target test scheme;

[0031] The load generator is further configured to execute test statements in the target test script through each target thread based on the target test script in the target test scheme, so as to send a number of access requests to the database to be tested;

[0032] The indicator monitor is used to collect database indicators and performance indicators when the database to be tested processes each access request, so as to determine the performance of the database to be tested based on at least the database indicators and the performance indicators to obtain a performance test result.

[0033] To solve the above problems, the present application provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above database performance testing methods are implemented.

[0034] To solve the above problems, the present application provides an electronic device, comprising at least a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above-mentioned database performance testing methods when executing the computer program on the memory.

[0035] The database performance testing method, system, medium and device in the present application can generate a target test plan in advance, and then respond to the performance test request, so as to automatically obtain the number of concurrent requests based on the target test plan, and automatically create a corresponding number of target threads according to the number of concurrent requests. Subsequently, the test script in the target test plan can be quickly and accurately executed based on the target thread, so as to accurately simulate the operation of the user sending a number of access requests to the database to be tested, forming a continuous database load, and finally the database indicators and performance indicators of the database to be tested under the load can be collected, so as to quickly determine the performance of the database to be tested, reduce the time consumed by the database test, and ensure the accuracy of the test results.

[0036] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0038] Figure 1 This is a flow chart of a database performance testing method according to an embodiment of the present application;

[0039] Figure 2 This is a structural block diagram of a database performance testing system according to another embodiment of the present application;

[0040] Figure 3 This is a structural block diagram of an electronic device according to another embodiment of the present application. DETAILED DESCRIPTION

[0041] Various aspects and features of the present application are described herein with reference to the accompanying drawings.

[0042] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.

[0043] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0044] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.

[0045] It should also be understood that although the present application has been described with reference to some specific examples, those skilled in the art will be able to readily implement many other equivalent forms of the present application.

[0046] The above and other aspects, features and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.

[0047] Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments applied for are merely examples of the present application, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that obscure the present application. Therefore, the specific structural and functional details applied for herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present application in a variety of ways with substantially any suitable detailed structure.

[0048] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present application.

[0049] The present application embodiment provides a database performance testing method, which can be specifically applied to electronic devices such as terminals and servers to be tested, such as Figure 1 As shown, the method in this embodiment includes the following steps:

[0050] Step S101, based on a predetermined performance test requirement, pre-generate a target test plan for performing a performance test, wherein the target test plan includes a target test script and a number of concurrent requests;

[0051] In this step, the test pre-manager can be used to pre-generate a target test plan for performance testing. Specifically, the target test plan may include a test script corresponding to each round of testing and the number of concurrent requests, where the number of concurrent requests can also be understood as the number of concurrent users.

[0052] Step S102, in response to the performance test request, based on the number of concurrent requests in the target test solution, creating a number of target threads for communicating with the database to be tested;

[0053] The test request in this step can specifically be an operation action for a predetermined virtual button. That is, when the staff clicks the predetermined operation button, a performance test request can be generated based on the operation action and responded to, so as to automatically obtain the number of users from the target test plan and create a corresponding number of target threads based on the number of concurrent users, laying the foundation for the subsequent execution of the test script based on the target thread.

[0054] Step S103, based on the target test script in the target test scheme, executing the test statements in the target test script through each target thread respectively, so as to send a number of access requests to the database to be tested;

[0055] The test statements in this step may be native SQL statements and API functions, for example.

[0056] Step S104, collecting database indicators and performance indicators when the database to be tested processes each access request, so as to determine the performance of the database to be tested based at least on the database indicators and the performance indicators, and obtain a performance test result.

[0057] In this step, a separate thread may be created for each indicator in advance, and a connection may be established with the database to be tested through TCP remote communication, so as to collect the corresponding indicators of the database to be tested.

[0058] The database performance testing method in this embodiment, by pre-generating a target test scheme, can respond to the performance test request later, automatically obtain the number of concurrent requests based on the target test scheme, and automatically create a corresponding number of target threads according to the number of concurrent requests, and then quickly and accurately execute the test script in the target test scheme based on the target thread, so as to accurately simulate the operation of the user sending several access requests to the database to be tested, forming a continuous database load, and finally the database index and performance index of the database to be tested under load can be collected, so as to quickly determine the performance of the database to be tested, reduce the time-consuming database test, and ensure the accuracy of the test results. In addition, the present application also solves the problem that the existing test tools are based on web or api-based performance testing tools, and these tools are implemented through jdbc standard requests when used for database performance testing. For databases written in non-java statements, it is difficult to do root cause analysis of performance problems at the bottom of the database. Therefore, the method in the present application can realize the testing of the bottom performance of databases written in non-java statements.

[0059] Another embodiment of the present application provides a database performance testing method. In this embodiment, when generating a target test plan for performance testing, that is, when executing step S101, the specific process is as follows: based on the predetermined performance test requirements, use the performance script editor to pre-edit the test statement to generate a target test script; specifically, the native SQL statement and API function can be edited to generate a target test script, or the performance script editor can be used to pre-create an SQL lexical analyzer instance and a C++ lexical analyzer instance to respectively implement performance script writing for editing native SQL statements and API functions. Then, based on the target test script and the predetermined number of concurrent requests, the target test plan is generated.

[0060] Specifically, the target test scheme in this embodiment also includes: a target parameter configuration file, which is used to initialize the test environment for the database to be tested and the server to be tested corresponding to the database to be tested, wherein the server to be tested specifically refers to the server on which the database to be tested is deployed. In the specific implementation process of this embodiment, the target parameters of the database to be tested and the target parameters of the server to be tested can be pre-configured based on the pre-configurator according to the predetermined performance test requirements; based on each of the target parameters, the target parameter configuration file is generated; when generating the target test scheme, the target test scheme can be generated by a test scheme generator based on the target test script corresponding to each round of testing, the number of concurrent requests corresponding to each round of testing, and the target parameter configuration file corresponding to each round of testing.

[0061] In this embodiment, after generating a target test scheme including a target test script, the number of concurrent requests, and a target parameter configuration file, it is possible to configure target parameters for the database to be tested and the server to be tested corresponding to the database to be tested based on the target parameter configuration file in the target test scheme in response to a performance test request, so as to initialize the test environment for the database to be tested and the server to be tested. Then, it is possible to further create several target threads for communicating with the database to be tested based on the number of concurrent requests in the target test scheme; and based on the target test script in the target test scheme, execute the test statements in the target test script through each of the target threads to send several access requests to the database to be tested, and then collect the database indicators and performance indicators of the database to be tested when processing each of the access requests, so as to determine the performance of the database to be tested based at least on the database indicators and the performance indicators, and obtain the performance test results.

[0062] In this embodiment, since the target test scheme may contain multiple rounds of tests corresponding to each round of tests, the number of concurrent requests corresponding to each round of tests, and the target parameter configuration file corresponding to each round of tests, the target parameter configuration file corresponding to the current round of tests can be obtained when the test environment is initialized, and then the sampler in the load generator is used to configure the corresponding parameters of the database to be tested and the server to be tested according to the target parameter configuration file to initialize the test environment for the database to be tested and the server to be tested. Then, the number of non-users corresponding to the current round of tests can be further obtained, and a number of target threads can be created based on the thread group in the load generator, and a communication connection can be established with the database to be tested; then, the target test script corresponding to the current round of tests can be obtained, and the test statements in the target test script can be executed by each of the target threads to send a number of access requests to the database to be tested, so as to simulate the behavior of users accessing the database to be tested, thereby forming a continuous load on the database to be tested, which is convenient for the subsequent collection of corresponding indicators of the database to be tested, so as to quickly and accurately determine the performance of the database to be tested.

[0063] During the specific implementation of this embodiment, the target test scheme also includes timing information, that is, timing information / test time interval corresponding to each test statement in the target test script of each round of testing; based on the target test script in the target test scheme, each target thread executes the test statements in the target test script respectively to send a number of access requests to the database under test, specifically including: based on the target test script and timing information in the target test scheme, each thread executes the test statements in the target test script respectively according to the timing information to simulate the user's operation of sending a number of access requests to the database under test, that is, to implement waiting between executing multiple operations to simulate the user's thinking time.

[0064] In the specific implementation process of this embodiment, when collecting database indicators and performance indicators, system resource indicators can also be collected. The performance of the database to be tested is determined at least based on the database indicators and the performance indicators to obtain the performance test results, that is, when executing step S104, it specifically includes: based on the database indicators, performance indicators and the system resource indicators, the application performance satisfaction index corresponding to each indicator is calculated respectively, so as to determine the performance of the database to be tested based on each application performance satisfaction index, and obtain the performance test results. Specifically, the Apdex standard algorithm can be used to calculate the application performance satisfaction index corresponding to each indicator, that is, to calculate and obtain the Apdex index corresponding to each indicator. The Apdex index is a value between 0 and 1, which is used to quantify the performance of the application. Among them, in this embodiment, the performance indicators include any one or more of the following: the number of messages processed per second TPS, the query rate per second QPS and the response time; the database indicators include the internal operation data of the database; the system resource indicators include any one or more of the following: memory occupancy, processor utilization, disk transfer rate.

[0065] In this embodiment, when calculating the application performance satisfaction index of each indicator, that is, calculating the Apdex index, the user's acceptable indicator satisfaction threshold, tolerance threshold and disappointment threshold can be set in advance according to the performance test requirements. Taking the response time as an example, the user's acceptable response time satisfaction threshold and response time tolerance threshold can be set according to the performance test requirements. Then, based on the satisfaction threshold and the tolerance threshold, the number of satisfactory times that the response time during the sampling period meets the satisfactory requirements and the tolerable number of times that the response time meets the tolerable requirements are determined respectively. Then, based on the number of times the response time meets the satisfactory requirements and the number of times the response time meets the tolerable requirements, the predetermined application performance satisfaction index calculation formula is used to calculate the application performance satisfaction index / Apdex index corresponding to the response time. The application performance satisfaction index / Apdex index calculation formula is as follows:

[0066] Apdex performance index = (satisfactory times + 0.5*tolerable times) / total times.

[0067] After calculating and obtaining the Apdex performance index corresponding to each indicator, that is, calculating the Apdex resource utilization index, Apdex database operation index and other Apdex performance indexes, the performance of the server to be tested can be comprehensively determined according to the Apdex performance index corresponding to each indicator. Specifically, the corresponding weight can be configured for each indicator in advance, and then the Apdex performance index of each indicator is summed according to the corresponding weight, that is, the Apdex performance index of each indicator is multiplied by the respective weight, and then added, so as to obtain the final Apdex performance index sum. In this embodiment, by adopting the above-mentioned method to determine the final Apdex performance index sum, the calculated Apdex performance index sum can be made more reasonable and accurate, and the performance of the database to be tested can be quickly and accurately determined based on the Apdex performance index sum. Specifically, performance levels such as "very good", "general" and "poor" can be pre-set according to actual needs, and then the corresponding relationship between each performance level and the Apdex performance index sum is established, so that the performance level of the database to be tested can be quickly determined based on the calculated Apdex performance index sum.

[0068] The database performance testing method in this embodiment solves the time-consuming and inaccurate performance testing of large databases in high-concurrency, large-data-volume, and distributed application scenarios, realizes the intelligent generation of test plans, and drives the automated execution of database performance testing, thereby improving the efficiency and accuracy of database performance testing.

[0069] It solves the problem that database performance testing cannot quickly perform performance testing from the underlying native SQL and API requests, implements native SQL statements and API function call requests and performance stress testing, and can separately analyze the performance of each layer of the database server, C++ client interface, and JAVA interface, and can quickly locate the root cause of performance problems.

[0070] This application can provide flexible and diverse indicator monitoring and analysis display, aggregate performance evaluation indicators according to the Apdex standard, and automatically generate standard test reports. The present invention provides a comprehensive and efficient solution for database performance testing, does not require the use of multiple special tools, simplifies the test process, reduces the test complexity, and provides a reliable test method for the performance testing of self-developed database products.

[0071] Another embodiment of the present application provides a database performance testing system, such as Figure 2 As shown, including:

[0072] A test pre-manager, for pre-generating a target test plan for performing a performance test based on predetermined performance test requirements, wherein the target test plan includes a target test script and a number of concurrent requests;

[0073] A load generator, for creating, in response to a performance test request, a number of target threads for communicating with a database to be tested based on the number of concurrent requests in the target test scheme;

[0074] The load generator is further configured to execute test statements in the target test script through each target thread based on the target test script in the target test scheme, so as to send a number of access requests to the database to be tested;

[0075] An indicator monitor, used to collect database indicators and performance indicators when the database to be tested processes each access request;

[0076] A test result generator is used to determine the performance of the database to be tested based at least on the database indicator and the performance indicator to obtain a performance test result.

[0077] In the specific implementation process of this embodiment, the test pre-manager specifically includes a performance script editor and a test plan generator; the performance script editor is used to: pre-edit test statements in response to user editing operations based on predetermined performance test requirements to generate a target test script;

[0078] The test plan generator is used to generate the target test plan based on the target test script and the predetermined number of concurrent requests. Specifically, the target test plan can be generated in XML format.

[0079] In the specific implementation process of this embodiment, the load generator includes a sampler and a thread group, and the target test scheme also includes a target parameter configuration file; before creating a number of target threads for communicating with the database to be tested, the sampler is also used to:

[0080] Based on the target parameter configuration file in the target test scheme, target parameters are configured for the database to be tested and the server to be tested corresponding to the database to be tested, so as to initialize the test environment for the database to be tested and the server to be tested. The thread group is specifically used to: based on the number of concurrent requests / number of concurrent users in the target test scheme, create a number of target threads for communicating with the database to be tested.

[0081] In the specific implementation process of this embodiment, the test front-end manager also includes a front-end configurator; the front-end configurator is used to: pre-configure the target parameters of the database to be tested and the target parameters of the server to be tested based on the predetermined performance test requirements according to the front-end configurator; and generate the target parameter configuration file based on each of the target parameters.

[0082] In the specific implementation process of this embodiment, the load generator also includes a timer, and the target test scheme also includes timing information;

[0083] The timer is used to: set a waiting time based on the timing information;

[0084] The sampler is used to: based on the target test script in the target test scheme, execute the test statements in the target test script through each thread according to the waiting time set by the timer to simulate the operation of the user sending several access requests to the database to be tested.

[0085] In the specific implementation process of this embodiment, the indicator monitor specifically includes: a performance indicator monitor and a database indicator monitor;

[0086] The performance indicator monitor is used to: collect the performance indicator of the database to be tested when processing each access request;

[0087] The database indicator monitor is used to collect database indicators when the database to be tested processes each access request;

[0088] The indicator monitor also includes a system resource monitor, and the system resource monitor is used to: collect system resource indicators when the database to be tested processes each access request;

[0089] The test result generator is used to calculate the application performance satisfaction index corresponding to each indicator based on the database indicator, performance indicator and system resource indicator, so as to determine the performance of the database to be tested based on each application performance satisfaction index and obtain the performance test result.

[0090] In the specific implementation process of this embodiment, the performance indicators include any one or more of the following: the number of messages processed per second TPS, the query rate per second QPS and the response time; the database indicators include the internal operation data of the database; the system resource indicators include any one or more of the following: memory occupancy rate, processor utilization rate, disk transfer rate.

[0091] The database performance testing system in the present application generates a target test plan in advance, and can subsequently respond to performance test requests to automatically obtain the number of concurrent requests / concurrent users based on the target test plan, and automatically create a corresponding number of target threads based on the number of concurrent requests / concurrent users. Subsequently, the test scripts in the target test plan can be quickly and accurately executed based on the target threads, thereby accurately simulating the operation of users sending several access requests to the database to be tested, forming a continuous database load, and finally collecting database indicators and performance indicators of the database to be tested under load, thereby quickly determining the performance of the database to be tested, reducing the time spent on database testing, and ensuring the accuracy of the test results.

[0092] That is to say, the database performance testing system in this embodiment specifically includes four parts: a test pre-manager, a load generator, a resource monitor, and a test result generator.

[0093] Among them, the test front-end manager is used to configure the database and server parameters through the front-end configurator, obtain the target parameter configuration file, use the script editor to implement native SQL statements and API function call requests to generate the target test script, and generate the target test plan based on the target parameter configuration file and the target test script.

[0094] The load generator is used to automatically call thread groups and timers according to the target test plan, complete the automatic setting of the number of concurrent users in each round and the execution behavior of each thread, and execute SQL or API requests in the sampler to simulate user behavior, thereby forming a continuous database load.

[0095] Resource monitor, which collects the indicators of each database node and system resource monitoring data through TCP protocol, and displays and analyzes them;

[0096] The test result generator calculates each important indicator according to the Apdex standard to obtain the respective performance evaluation indicators, and then obtains the comprehensive performance indicators, summarizes all collected data and running performance indicator data, compiles charts according to the rules, and generates a performance test report.

[0097] Specifically, the load generator includes a thread group, a sampler and a timer.

[0098] The thread group is used to simulate user behavior and control the number of concurrent users / concurrent requests. In other words, the thread group is used to create multiple threads according to the number of threads / concurrent requests in each round of performance test scenarios in the test plan, and concurrently connect to the database to facilitate the subsequent execution of corresponding test statements, so as to simulate the behavior of multiple users logging into the database at the same time to read and write.

[0099] Samplers are used to support database native SQL requests and API requests, and can send different types of requests to the server according to different set parameters. In other words, samplers are used to parse keywords and parameter values ​​of SQL statements and C++ statements, and send native SQL requests and API requests to the server through the database interface according to different instruction types.

[0100] The timer is used to set the waiting time before the operation to simulate the time interval between user operations. In other words, the timer is used to read the timing information of each round of performance test scenarios in the test plan, and through the system's built-in timer, the waiting time between executing multiple operations is realized to simulate the user's thinking time.

[0101] Specifically, the test pre-manager includes a pre-configurator, a performance script editor, and a test plan generator. The pre-configurator is used to configure database and server parameters to obtain a target parameter configuration file, so that the target parameter configuration file can be used to restart the database and clean up the server cache.

[0102] The performance script editor is used to implement native SQL statements and API function editing, and to perform request calls and debugging, and complete performance script writing to generate a target test script corresponding to each round of testing. In this embodiment, the performance script editor can be specifically used to create an SQL lexical analyzer instance and a C++ lexical analyzer instance to respectively implement performance script writing for editing native SQL statements and API functions.

[0103] The test plan generator is used to formulate the relevant grammatical rules required for the performance test plan, and generate the target test plan according to the grammatical rules based on the target parameter configuration file and the target test script. In this embodiment, the test plan generator can provide concise grammatical rules for writing the pre-parameter configuration, script file call, thread parameters, timing information and other information of each round of performance test scenario, and write the above information into an XML file to generate a target test plan.

[0104] Specifically, the indicator monitor includes: a performance indicator monitor, a database indicator monitor, and a system resource monitor. The performance indicator monitor is responsible for collecting performance indicators such as TPS (system throughput / number of messages processed per second), QPS (query rate per second), response time, etc. and displaying them in real time; the database indicator monitor is used to execute predetermined indicator collection statements / SQL statements, collect performance indicators through indicator collection statements, so as to collect database internal operation data on demand and display them in real time. The system resource monitor is responsible for collecting system resource data such as processor CPU, memory, disk I / O, etc. and displaying them in real time.

[0105] The indicator monitor in this embodiment can create a separate thread for each indicator monitor, establish a connection with the other end / (database and server) through TCP remote communication, collect corresponding indicators and report them to the test result generator.

[0106] The test result generator specifically includes a data analyzer and a test report generator. The data analyzer is used to calculate the application performance satisfaction index corresponding to each indicator based on the database indicator, performance indicator and the system resource indicator, so as to determine the performance of the database to be tested based on each application performance satisfaction index and obtain the performance test result; specifically, the data analyzer can calculate the application performance satisfaction index corresponding to each indicator based on the database indicator, performance indicator and the system resource indicator using the Apdex standard, and then respectively aggregate the performance indicator, database indicator and system resource indicator to calculate the total performance evaluation indicator, and then obtain the comprehensive performance score. The test report generator is used to summarize all collected data and running performance indicator data, compile charts according to rules, and generate performance test reports.

[0107] The database performance testing system in this embodiment solves the time-consuming and inaccurate performance testing of large databases in high-concurrency, large-data-volume, and distributed application scenarios, realizes the intelligent generation of test plans, and drives the automated execution of database performance testing, thereby improving the efficiency and accuracy of database performance testing.

[0108] It solves the problem that database performance testing cannot quickly perform performance testing from the underlying native SQL and API requests, implements native SQL statements and API function call requests and performance stress testing, and can separately analyze the performance of each layer of the database server, C++ client interface, and JAVA interface, and can quickly locate the root cause of performance problems.

[0109] This application can provide flexible and diverse indicator monitoring and analysis display, aggregate performance evaluation indicators according to the Apdex standard, and automatically generate standard test reports. The present invention provides a comprehensive and efficient solution for database performance testing, does not require the use of multiple special tools, simplifies the test process, reduces the test complexity, and provides a reliable test method for the performance testing of self-developed database products.

[0110] Another embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the following method steps are implemented:

[0111] Step 1: Based on the predetermined performance test requirements, a target test plan for performing the performance test is generated in advance, wherein the target test plan includes a target test script and the number of concurrent requests;

[0112] Step 2: In response to the performance test request, based on the number of concurrent requests in the target test solution, create a number of target threads for communicating with the database to be tested;

[0113] Step 3: Based on the target test script in the target test scheme, the test statements in the target test script are respectively executed by each target thread to send a number of access requests to the database to be tested;

[0114] Step 4: Collect database indicators and performance indicators when the database to be tested processes each access request, so as to determine the performance of the database to be tested based at least on the database indicators and the performance indicators, and obtain a performance test result.

[0115] The specific implementation process of the above method steps can refer to the embodiments of any of the above database performance testing methods, and this embodiment will not be repeated here.

[0116] The storage medium in the present application can respond to performance test requests later by pre-generating a target test plan, so as to automatically obtain the number of concurrent requests based on the target test plan, and automatically create a corresponding number of target threads according to the number of concurrent requests. Subsequently, the test scripts in the target test plan can be quickly and accurately executed based on the target threads, thereby accurately simulating the operation of users sending several access requests to the database to be tested, forming a continuous database load, and finally collecting the database indicators and performance indicators of the database to be tested under load, so as to quickly determine the performance of the database to be tested, reduce the time consumed by database testing, and ensure the accuracy of the test results.

[0117] Another embodiment of the present application provides an electronic device, such as Figure 3 As shown, at least a memory 1 and a processor 2 are included, the memory 1 stores a computer program, and the processor 2 implements the following method steps when executing the computer program on the memory 1:

[0118] Step 1: Based on the predetermined performance test requirements, a target test plan for performing the performance test is generated in advance, wherein the target test plan includes a target test script and the number of concurrent requests;

[0119] Step 2: In response to the performance test request, based on the number of concurrent requests in the target test solution, create a number of target threads for communicating with the database to be tested;

[0120] Step 3: Based on the target test script in the target test scheme, the test statements in the target test script are respectively executed by each target thread to send a number of access requests to the database to be tested;

[0121] Step 4: Collect database indicators and performance indicators when the database to be tested processes each access request, so as to determine the performance of the database to be tested based at least on the database indicators and the performance indicators, and obtain a performance test result.

[0122] The specific implementation process of the above method steps can refer to the embodiments of any of the above database performance testing methods, and this embodiment will not be repeated here.

[0123] The storage medium in the present application can respond to performance test requests later by pre-generating a target test plan, so as to automatically obtain the number of concurrent requests based on the target test plan, and automatically create a corresponding number of target threads according to the number of concurrent requests. Subsequently, the test scripts in the target test plan can be quickly and accurately executed based on the target threads, thereby accurately simulating the operation of users sending several access requests to the database to be tested, forming a continuous database load, and finally collecting the database indicators and performance indicators of the database to be tested under load, so as to quickly determine the performance of the database to be tested, reduce the time consumed by database testing, and ensure the accuracy of the test results.

[0124] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.

Claims

1. A database performance testing method, characterized in that: include: Based on the predetermined performance test requirements, a target test plan for performing the performance test is generated in advance, wherein the target test plan includes a target test script and the number of concurrent requests; In response to the performance test request, based on the number of concurrent requests in the target test solution, create a number of target threads for communicating with the database to be tested; Based on the target test script in the target test scheme, the test statements in the target test script are respectively executed by each target thread to send a number of access requests to the database to be tested; The database index and the performance index when the database to be tested processes each access request are collected, so as to determine the performance of the database to be tested based at least on the database index and the performance index, and obtain a performance test result.

2. The method according to claim 1, characterized in that The pre-generating a target test scheme for performing the performance test based on the predetermined performance test requirements specifically includes: Based on the predetermined performance test requirements, the test statements are pre-edited using the performance script editor to generate a target test script; The target test scenario is generated based on the target test script and the predetermined number of concurrent requests.

3. The method according to claim 1, characterized in that The target test scheme also includes a target parameter configuration file; Before creating a plurality of target threads for communicating with the database to be tested, the method further includes: Based on the target parameter configuration file in the target test solution, target parameters are configured for the database to be tested and the server to be tested corresponding to the database to be tested, so as to initialize the test environment for the database to be tested and the server to be tested.

4. The method according to claim 3, characterized in that Before initializing the test environment, the method further includes: Pre-configuring target parameters of the database to be tested and target parameters of the server to be tested based on the pre-configured device according to the predetermined performance test requirements; Based on each of the target parameters, the target parameter configuration file is generated.

5. The method according to claim 1, characterized in that The target test scheme also includes timing information; The target test script in the target test scheme is based on the target test script, and the test statements in the target test script are respectively executed by each target thread to send a plurality of access requests to the database to be tested, specifically including: Based on the target test script and timing information in the target test solution, each thread executes the test statements in the target test script according to the timing information to simulate the operation of a user sending several access requests to the database under test.

6. The method according to claim 1, characterized in that When the database to be tested processes each of the access requests, the method further includes: collecting system resource indicators; The step of determining the performance of the database to be tested at least based on the database indicator and the performance indicator to obtain the performance test result specifically includes: Based on the database index, the performance index and the system resource index, the application performance satisfaction index corresponding to each index is calculated respectively, so as to determine the performance of the database to be tested based on each application performance satisfaction index and obtain the performance test result.

7. The method according to claim 1, characterized in that The performance indicators include any one or more of the following: number of messages processed per second TPS, query rate per second QPS and response time; The database indicators include internal operation data of the database; The system resource indicators include any one or more of the following: memory occupancy rate, processor utilization rate, and disk transfer rate.

8. A database performance testing system, characterized in that: include: A test pre-manager, for pre-generating a target test plan for performance testing based on predetermined performance test requirements, wherein the target test plan includes a target test script and a number of concurrent requests; A load generator, for creating, in response to a performance test request, a number of target threads for communicating with a database to be tested based on the number of concurrent requests in the target test scheme; The load generator is further configured to execute test statements in the target test script through each target thread based on the target test script in the target test scheme, so as to send a number of access requests to the database to be tested; The indicator monitor is used to collect database indicators and performance indicators when the database to be tested processes each access request, so as to determine the performance of the database to be tested based on at least the database indicators and the performance indicators to obtain a performance test result.

9. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the database performance testing method according to any one of claims 1 to 7 are implemented.

10. An electronic device, characterized in that: The method at least comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the database performance testing method described in any one of claims 1 to 7 when executing the computer program on the memory.

Citation Information

Patent Citations

  • Method and device for testing performance of database

    CN105389401A

  • Database testing method and device

    CN111143196A

  • Database performance test method and device and storage medium

    CN115729791A

  • Evaluation method and device for database performance test and storage medium

    CN116166513A

  • Database performance test method and device, electronic equipment and storage medium

    CN116204410A