Data testing method and device, computer equipment and storage medium
By importing database test model and sliding window analysis technology, the problem that traditional testing methods cannot be compatible with multiple databases is solved, stability testing and performance evaluation of multiple databases is achieved, and the accuracy and efficiency of the test are improved.
Patent Information
- Application Number
- CN202411175955.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-08-23
AI Technical Summary
Traditional database stability testing methods are not compatible with multiple mainstream databases, and cannot monitor database exceptions and errors, resulting in unreliable and unreusable tests.
By obtaining the tasks to be tested, importing the preset database test model, using the monitoring analyzer to analyze the business load type, obtaining business monitoring indicators, and conducting stress tests through the test resource pool to obtain the target test results, and analyzing the output data test report based on the sliding window , realize stability testing of multiple databases.
It realizes stability testing of multiple business databases, without manual customization, can reflect the database's responsiveness and processing capabilities under different load conditions in real time, promptly detect performance bottlenecks and exceptions, help optimize database configuration and business logic, and improve System efficiency and reliability.
Smart Images

Figure CN119003364A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of database testing, and in particular to a data testing method, apparatus, computer equipment and storage medium. Background Art
[0002] As the basic software for underlying data storage, database products are one of the most important components in any business system. In addition to meeting the function of business data storage, another very important aspect is the stability of database products. In order to ensure the stability of database products, enterprises must regularly conduct comprehensive stability tests on the database.
[0003] Traditional database stability testing methods are not systematic and require manual use of SQL statements to add, delete, modify and query to provide stress to the database, or use some commercially available tools to provide stress scenarios.
[0004] However, traditional testing methods and tools are not compatible with multiple mainstream databases, and cannot monitor anomalies and errors in different database products themselves. This makes stability testing difficult to carry out and non-reusable, and the test itself is unreliable. Summary of the invention
[0005] The purpose of the embodiments of the present application is to propose a data testing method, apparatus, computer equipment and storage medium to solve the technical problems that traditional testing methods and tools are not compatible with multiple mainstream databases and cannot monitor anomalies and errors generated by different database products.
[0006] In order to solve the above technical problems, the present application embodiment provides a data testing method, which adopts the following technical solution:
[0007] Acquire a task to be tested, wherein the task to be tested consists of a business load type and a business database;
[0008] Importing the task to be tested into a preset database test model, wherein the preset database test model includes a test resource pool and a monitoring analyzer;
[0009] Analyzing the service load type by the monitoring analyzer to obtain service monitoring indicators;
[0010] Performing stress testing on the business database through the test resource pool to obtain target test results;
[0011] Based on the business monitoring indicators, the target test results are analyzed in a sliding window and a data test report is output.
[0012] Further, the step of obtaining the task to be tested, wherein the task to be tested is composed of a business load type and a business database, specifically includes:
[0013] Obtaining an object to be processed, wherein the object to be processed includes a data source identification code and a business log;
[0014] Parsing the data source identification code by regular expression to obtain the port number and communication protocol;
[0015] Determining the service database based on the port number and the communication protocol;
[0016] Parse the service log to obtain the target service with the highest request-response ratio in the service log, and use the type of the target service as the service load type;
[0017] The business load type and the business database are integrated to obtain the task to be tested.
[0018] Furthermore, before the step of importing the task to be tested into a preset database test model, it also includes:
[0019] Importing the task to be tested into a first message queue, where the first message queue can accommodate a number of the tasks to be tested;
[0020] Monitoring the first message queue through a task work process;
[0021] If the tasks to be tested in the first message queue reach the capacity upper limit of the first message queue, marking the tasks to be tested as waiting tasks;
[0022] If the tasks to be tested in the first message queue do not reach the capacity upper limit of the first message queue, the tasks to be tested are imported into a preset database test model according to the first-in-first-out principle.
[0023] Furthermore, the monitoring analyzer includes several sets of monitoring indicator sets, and the step of parsing the service load type through the monitoring analyzer to obtain the service monitoring indicator specifically includes:
[0024] Analyzing the service load type by the monitoring analyzer to obtain the load characteristics of the service load type;
[0025] The monitoring indicator set is matched based on the load characteristics of the business load type to obtain the business monitoring indicator.
[0026] Furthermore, the test resource pool includes a plurality of test hosts, and the step of performing stress testing on the business database through the test resource pool to obtain a target test result specifically includes:
[0027] generating test data based on the service load type;
[0028] Checking the resource status of the test resource pool, wherein the resource status includes an idle host status and a fully loaded host status;
[0029] If the resource status of the test resource pool is an idle host status, the connection address and port number of the service database are imported into the test host, and the test host is locked;
[0030] Importing the test data into the test host to perform stress testing and target test results;
[0031] If the resource status of the test resource pool is a fully loaded host status, the service database is stored in a second message queue for waiting until the resource status of the test resource pool is an idle host status.
[0032] Furthermore, the step of performing sliding window analysis on the target test result based on the business monitoring indicator and outputting a data test report specifically includes:
[0033] Get sliding window parameters;
[0034] generating a target sliding window based on the sliding window parameters;
[0035] Calculate the target test result based on the business monitoring indicator to obtain a test performance indicator;
[0036] The test performance indicator is updated through the target sliding window to obtain a target performance indicator;
[0037] The target test result is subjected to data analysis based on the target performance indicator to obtain the data test report, wherein the data analysis includes trend analysis, anomaly detection analysis and correlation analysis.
[0038] Further, the sliding window parameter includes a sliding step size, and the step of updating the test performance indicator through the target sliding window to obtain the target performance indicator specifically includes:
[0039] Collecting the test performance indicator through the target sliding window;
[0040] The target sliding window is moved and updated based on the sliding step size to obtain the target performance indicator.
[0041] In order to solve the above technical problems, the embodiment of the present application further provides a data testing device, which adopts the following technical solution:
[0042] An acquisition module, used for acquiring a task to be tested, wherein the task to be tested consists of a business load type and a business database;
[0043] An import module, used for importing the task to be tested into a preset database test model, wherein the preset database test model includes a test resource pool and a monitoring analyzer;
[0044] A parsing module, used to parse the service load type through the monitoring analyzer to obtain service monitoring indicators;
[0045] A testing module, used to perform a stress test on the business database through the test resource pool to obtain a target test result;
[0046] The sliding window analysis module is used to perform sliding window analysis on the target test results based on the business monitoring indicators and output a data test report.
[0047] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0048] A computer device, characterized in that it includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the data testing method when executing the computer-readable instructions.
[0049] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0050] A computer-readable storage medium, characterized in that computer-readable instructions are stored on the computer-readable storage medium, and the computer-readable instructions implement the steps of the data testing method when executed by a processor.
[0051] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0052] The embodiment of the present application obtains the task to be tested, imports the task to be tested into a preset database test model, parses the business load type through a monitoring analyzer to obtain business monitoring indicators, performs stress testing on the business database through a test resource pool to obtain target test results, performs sliding window analysis on the target test results based on the business monitoring indicators, and outputs a data test report. By importing the task to be tested into the database test model, stability testing of various business databases is achieved without the need for manual customized modifications to specific databases. The monitoring analyzer accurately analyzes the characteristics of the business load, and the test resource pool performs targeted stress testing, which can reflect the responsiveness and processing capabilities of the business database under different load conditions in real time. The sliding window technology is used to perform fine-grained performance evaluation on the test results, so that performance bottlenecks and potential anomalies can be discovered in a timely manner, thereby helping the technical team optimize database configuration and business logic and improve the overall efficiency and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0054] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0055] Figure 2 is a flow chart of an embodiment of a data testing method according to the present application;
[0056] Figure 3 is a structural schematic diagram of an embodiment of a data testing device according to the present application;
[0057] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION
[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0059] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0060] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0061] like Figure 1As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables.
[0062] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0063] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers and desktop computers, etc.
[0064] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0065] It should be noted that the data testing method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the data testing device is generally set in the server / terminal device.
[0066] 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 the implementation requirements.
[0067] Continue to refer Figure 2 , shows a flow chart of an embodiment of a data testing method according to the present application. The data testing method comprises the following steps:
[0068] Step S201, obtaining a task to be tested.
[0069] In this embodiment, the data testing method can be deployed in a data testing platform. The data testing platform can be constructed by a server or a server cluster. The data testing platform also has a visual front-end page for database administrators to upload, download, view, save and other operations. The server or server cluster can be any electronic device with functions such as text recognition, text processing, data transmission, and data storage. The data testing method runs on the electronic device (for example, Figure 1 The server / terminal device shown in the figure can receive the task to be tested through a wired connection or a wireless connection. It should be noted that the above wireless connection method may include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.
[0070] In this embodiment, the above-mentioned task to be tested can be a stability test task for an existing database, or it can be a deployment and testing task for a new database type and version. When the task to be tested is the above-mentioned deployment and testing task for a new database type and version, the user can select the database type and version by himself, and the above-mentioned data testing platform will automatically deploy the database product and perform stability testing.
[0071] Specifically, the task to be tested is composed of a business load type and a business database. The business load type may be a workload type required for requesting and operating a business database in a simulated real business environment. The business load type may include TPC-C and TPC-H. The TPC-C may be a business load type for online transaction processing, mainly simulating transaction processing in an e-commerce environment, such as order entry, payment processing, etc. The TPC-H may be a business load type for online analytical processing, mainly used for query processing of data warehouses, involving complex queries, large data volume processing, etc.
[0072] The business database mentioned above may be a database system to be tested, and may be an existing database or a newly deployed database product, such as mainstream databases such as Oracle Database, MySQL, Microsoft SQL Server, and IBM DB2.
[0073] Specifically, regarding the specific implementation process of obtaining the task to be tested, this application will provide further detailed descriptions in subsequent specific embodiments, and will not be elaborated on here.
[0074] Step S202: import the task to be tested into a preset database test model.
[0075] In this embodiment, the preset database test model can be a comprehensive test model based on data test frameworks such as Locust, JMeter and Gatling, including multiple components. Specifically, the preset database test model includes a test resource pool and a monitoring analyzer;
[0076] The above-mentioned test resource pool can be a resource pool for managing and allocating business database tests, such as servers, virtual machines, containers, etc., which can be used to control the testing process of the business database in an isolated environment. The above-mentioned test resource pool can include Docker, Kubernetes containers and cloud servers provided by suppliers such as AWS, Azure, and Google Cloud Platform.
[0077] The monitoring analyzer can be used to collect and analyze performance data of the business database during the testing process of the business database. The monitoring analyzer can be a data monitoring tool such as New Relic, AppDynamics, and Datadog.
[0078] Step S203: parse the service load type through the monitoring analyzer to obtain service monitoring indicators.
[0079] In this embodiment, the above-mentioned business monitoring indicators can be used to evaluate the performance and reliability of the business database under actual operating conditions. The above-mentioned business monitoring indicators may include response time, throughput, resource utilization, error rate, concurrency performance, number of connections, cache hit rate, data replication delay, transaction log growth rate, and system stability and other indicator data.
[0080] Specifically, regarding the specific implementation process of parsing the business load type through the monitoring analyzer to obtain the business monitoring indicators, this application will provide further detailed descriptions in subsequent specific embodiments, and will not be elaborated on here.
[0081] Step S204: perform stress testing on the business database through the test resource pool to obtain target test results.
[0082] In this embodiment, the target test result can be a performance indicator data set obtained after the business database has been stress tested. Specifically, the performance indicator data set can include response time and throughput, stability reports, error and exception records, system resource consumption, and stress test data. By analyzing the target test results, it can help database administrators understand the behavior of the current business database under actual workloads, so as to make necessary adjustments and optimizations, determine the optimal configuration of the current business database, and ensure efficient and stable operation of the database system.
[0083] Specifically, regarding the specific implementation process of stress testing the business database through the test resource pool to obtain the target test results, this application will provide further detailed descriptions in subsequent specific embodiments and will not be elaborated on here.
[0084] Step S205: Perform sliding window analysis on the target test results based on the business monitoring indicators and output a data test report.
[0085] In this embodiment, the data test report can be used to summarize and analyze the test results of the business database in detail, and provide the technical team with clear and easy-to-understand information to evaluate the performance and stability of the database. Specifically, the data test report can include the resource usage details, exception and error analysis, stability evaluation, stress test results, optimization suggestions, and trend and comparison analysis of this test. After the test is completed, the data test report can be forwarded to the database administrator in the form of subscription by configuring report automation tools such as Crystal Reports or SQL Server Reporting Services (SSRS) on the data test platform.
[0086] Specifically, regarding the specific implementation process of performing sliding window analysis on the target test results based on business monitoring indicators and outputting data test reports, this application will provide further detailed descriptions of this in subsequent specific embodiments, and will not be elaborated on here.
[0087] The present application obtains the task to be tested, imports the task to be tested into a preset database test model, parses the business load type through a monitoring analyzer, obtains business monitoring indicators, performs stress testing on the business database through a test resource pool, obtains target test results, performs sliding window analysis on the target test results based on the business monitoring indicators, and outputs a data test report. By importing the task to be tested into the database test model, stability testing of a variety of business databases is achieved without the need for manual customized modifications to specific databases. The monitoring analyzer accurately analyzes the characteristics of the business load, and the test resource pool performs targeted stress testing, which can reflect the responsiveness and processing capabilities of the business database under different load conditions in real time. The sliding window technology is used to perform fine-grained performance evaluation on the test results, which can promptly discover performance bottlenecks and potential anomalies, thereby helping the technical team optimize database configuration and business logic and improve the overall efficiency and reliability of the system.
[0088] In some optional implementations, step S201 includes the following steps:
[0089] Get the object to be processed;
[0090] Parse the data source identification code through regular expressions to obtain the port number and communication protocol;
[0091] Determining a service database based on the port number and the communication protocol;
[0092] Parse the service log to obtain the target service with the highest request-response ratio in the service log, and use the type of the target service as the service load type;
[0093] Integrate the business load type and business database to obtain the task to be tested.
[0094] In this embodiment, the above-mentioned object to be processed may be an existing database or a newly deployed database product, such as mainstream databases such as Oracle Database, MySQL, Microsoft SQL Server, and IBM DB2. Specifically, the above-mentioned object to be processed includes a data source identification code and a business log, wherein the above-mentioned data source identification code (DSN) may be a parameter for defining and accessing a specific database instance, and the above-mentioned data source identification code may include database connection IP, port number, user name, password, database name, and communication protocol, etc. The above-mentioned business log may be a historical log record generated by the business database during operation, and the above-mentioned business log may include historical logs such as transaction logs, query logs, and performance logs.
[0095] In a possible embodiment, the database administrator can select the above-mentioned objects to be processed on the front-end page of the above-mentioned data testing platform by means including but not limited to dragging, clicking, etc. The above-mentioned objects to be processed can be saved in the front-end page of the above-mentioned data testing platform in the form of icons, and then the data source identification code is parsed by means of regular expressions to obtain the port number and communication protocol. For example, the data source identification code is as follows:
[0096] tcp: / / username:password@hostname:3306 / databasename;
[0097] In this regard, the regular expression can be: (\w+): / / [^:]+:[^@]+@[^:]+:(\d+) / .*, where \w+ matches the protocol type and \d+ is the port number, thereby extracting the port number and communication protocol. Since different database systems use different default ports and protocols, the business database can be determined based on the port number and communication protocol. For example, if the parsed protocol is TCP and the port number is 3306, it can usually be determined that the type of the current business database is a MySQL database.
[0098] In a possible embodiment, by parsing the start time, end time, type and result of each request recorded in the business log, key information such as request type, timestamp, response time, etc. can be extracted, and then the request response time of each business type can be counted, and the average response time and request completion rate can be calculated. Then, it is analyzed which business type has the highest request-response ratio, that is, which business processes the most requests per unit time and is most efficient. It is determined as the main business load type for further performance and stability testing, and finally the business load type and business database are integrated and packaged to obtain the task to be tested.
[0099] This application effectively improves the accuracy and efficiency of testing by automatically analyzing data source identification codes and business logs, ensuring that testing activities can optimize the performance and stability of the database in a targeted manner. Automated test preparation and execution reduce the need for manual intervention, reduce error rates, speed up the testing cycle, make the database system more reliable, and meet efficient and dynamic business needs.
[0100] In some optional implementations, before step S202, the following steps are included:
[0101] Import the task to be tested into the first message queue;
[0102] Monitoring the first message queue through the task work process;
[0103] If the tasks to be tested in the first message queue reach the capacity upper limit of the first message queue, the tasks to be tested are marked as waiting tasks;
[0104] If the tasks to be tested in the first message queue do not reach the capacity upper limit of the first message queue, the tasks to be tested are imported into the preset database test model according to the first-in-first-out principle.
[0105] In this embodiment, the first message queue can be used to receive and store the tasks to be tested, and distribute the tasks to be tested according to a certain strategy (such as first-in-first-out). Specifically, the first message queue can be a standard message queue software such as RabbitMQ, Apache Kafka or AWS SQS (Simple Queue Service).
[0106] In this embodiment, the task work process may be a component responsible for monitoring the message queue, extracting and executing tasks. Specifically, a scheduler such as Docker Swarm, Nomad or Kubernetes may be used to dynamically allocate resources and manage task execution functions of the task work process.
[0107] In a possible embodiment, before importing the task to be tested into a preset database test model, it is necessary to import the task to be tested into a task queue (first message queue) to continue waiting, and monitor the task queue through the Kubernetes cluster (task worker process). If the task to be tested in the task queue reaches the upper capacity limit of the task queue, the task to be tested is marked as a waiting task. If the task to be tested in the task queue does not reach the upper capacity limit of the task queue, the task to be tested is imported into the preset database test model according to the first-in-first-out principle.
[0108] This application can achieve efficient task processing, optimize resource allocation, and ensure that the system can still run stably when reaching its capacity limit, thereby improving the overall test automation and system responsiveness by importing and managing the tasks to be tested into the first message queue, as well as effectively monitoring and scheduling the task work progress.
[0109] In some optional implementations, step S203 includes the following steps:
[0110] Analyze the service load type through the monitoring analyzer to obtain the load characteristics of the service load type;
[0111] The monitoring indicator set is matched based on the load characteristics of the business load type to obtain the business monitoring indicator.
[0112] In this embodiment, the load characteristics may be the usage pattern and behavior characteristics of the system resources of the service database when running the service. Specifically, the load characteristics may include request frequency, data transmission volume, CPU and memory usage during operation, and number of concurrent users.
[0113] In this embodiment, the monitoring analyzer includes several sets of monitoring indicator sets. Specifically, the monitoring indicator set may be necessary test indicators for the business database stored in the monitoring analyzer, and the necessary test indicators may include performance indicators, resource usage indicators, capacity indicators, stability indicators and other indicators, wherein the monitoring indicator set may include the business monitoring indicators, and according to the load characteristics of the business load type, the monitoring analyzer may select a suitable monitoring indicator set as the business monitoring indicator, so as to comprehensively evaluate and monitor the database performance.
[0114] In a possible embodiment, after the load characteristics are obtained, the key performance indicators that can reflect the load characteristics can be matched in the above monitoring indicator set according to the load characteristics. For example, for a database with a high query load, the query response time and the number of queries per second (QPS) are matched; for write-intensive applications, the transaction commit delay, the number of transactions per second (TPS) and the disk write operation are matched; for services that require high availability, the system availability, the fault recovery time and the error rate are matched, and the above key performance indicators are used as the above business monitoring indicators.
[0115] This application can achieve highly customized performance monitoring by using a monitoring analyzer to parse business load types and match appropriate monitoring indicator sets based on their load characteristics, more effectively identify and resolve performance bottlenecks, optimize system configuration, improve application performance, and ultimately ensure efficient and stable operation of the business.
[0116] In some optional implementations, step S204 includes the following steps:
[0117] Generate test data based on business load type;
[0118] Check the resource status of the test resource pool;
[0119] If the resource status of the test resource pool is an idle host status, the connection address and port number of the business database are imported into the test host, and the test host is locked;
[0120] Importing the test data into the test host to perform stress testing and target test results;
[0121] If the resource status of the test resource pool is a fully loaded host status, the service database is stored in the second message queue for waiting until the resource status of the test resource pool is an idle host status.
[0122] In this embodiment, the second message queue may be standard message queue software such as RabbitMQ, Apache Kafka or AWS SQS (Simple Queue Service).
[0123] In a possible embodiment, when the business load type is TPC-C, a custom script data generation tool such as Apache JMeter and TPC Benchmark can be used to create a test script (test data) to simulate transaction processing in an e-commerce environment, and then resource management and monitoring tools such as Kubernetes and Docker Swarm are used to view resource utilization and check the resource status of the test resource pool. If the resource status of the test resource pool is an idle host state, the connection address and port number of the business database are imported into the test host, and the test host is locked, and the test script is imported into the test host for stress testing to obtain indicators such as throughput, response time, execution time, CPU usage, memory usage, and disk I / O (i.e., the above-mentioned target test results). If the resource status of the test resource pool is a fully loaded host state, the business database is stored in the second message queue for waiting until the resource status of the test resource pool is an idle host state.
[0124] The present application effectively improves the degree of test automation and resource utilization efficiency by dynamically monitoring and managing test resources, ensures that tests are performed only when resources are sufficient, avoids resource contention and overload problems, and ensures the reliability and accuracy of tests. At the same time, by using a second message queue to manage overloaded tasks, the orderly execution of test tasks is guaranteed, and test interruptions due to insufficient resources will not occur, thereby maximizing the effectiveness of test resources and the continuity of the test process.
[0125] In some optional implementations, step S205 includes the following steps:
[0126] Get sliding window parameters;
[0127] Generate a target sliding window based on the sliding window parameters;
[0128] Calculate the target test result based on the business monitoring indicator to obtain a test performance indicator;
[0129] The test performance index is updated through the target sliding window to obtain the target performance index;
[0130] The target test results are analyzed based on the target performance indicators to obtain a data test report.
[0131] In this embodiment, the sliding window parameters may include a window size and a sliding step size. Specifically, the window size defines the range of the time series data to be analyzed, and the step size defines the interval of the window movement.
[0132] In a possible embodiment, a window size of 5 minutes and a step size of 1 minute are selected as sliding window parameters for real-time monitoring of database performance. A sliding window for managing time series data (i.e., the above-mentioned target sliding window) is constructed by using Python's pandas library. Business monitoring indicator data such as throughput, response time, etc. within the sliding window period are collected, and the average query response time and the number of transactions per second in each window (i.e., the above-mentioned test performance indicator) are calculated. The window data is updated once a minute, and the average response time and the number of transactions (i.e., the above-mentioned target performance indicator) are recalculated. At the same time, the recalculated average response time and the number of transactions are recorded in a data test report. Trend analysis, anomaly detection analysis, and correlation analysis are performed on the target test results, and a detailed data test report is generated at the end with the final target performance indicator in the sliding window. The above-mentioned data test report contains charts and trend analysis of key performance indicators.
[0133] The above trend analysis can be to use charts to show the changes of target performance indicators over time, to help identify long-term trends or periodic patterns; the above anomaly detection analysis can be to use statistical methods such as standard deviation, IQR, etc. to identify outliers in the target performance indicators; the above association analysis can be to analyze the correlation between the target performance indicators and the target test results, such as the relationship between CPU usage and response time, to determine the root cause of the performance bottleneck.
[0134] This application implements continuous performance monitoring and data analysis through sliding window analysis, which can instantly discover performance problems and respond quickly. The sliding window provides a dynamic performance view that can reflect changes in system performance over time, helping administrators and developers understand the performance of the database under actual workloads.
[0135] In some optional implementations, the step of “updating the test performance indicator through the target sliding window to obtain the target performance indicator” includes the following steps:
[0136] Collecting the test performance indicators through a target sliding window;
[0137] The target sliding window is moved and updated based on the sliding step size to obtain the target performance index.
[0138] In this embodiment, after reaching the specified sliding step length, the target sliding window moves forward, a new test performance indicator is added as the target performance indicator, and the earliest test performance indicator in the window is removed.
[0139] This application uses a target sliding window to collect and update test performance indicators, ensuring that performance data is always up-to-date and reflects recent performance trends, allowing administrators to make quick and effective decisions based on the latest performance trends, identify and resolve potential performance issues in a timely manner, and thus optimize system operation and improve user experience.
[0140] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned data test report information, the above-mentioned data test report information can also be stored in a node of a blockchain.
[0141] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0142] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0143] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0144] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0145] Further references Figure 3 , as a response to the above Figure 2 In order to realize the method shown in the figure, the present application provides an embodiment of a data testing device, and the device embodiment is Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0146] like Figure 3 As shown, the data testing device 300 described in this embodiment includes: an acquisition module 301, an import module 302, a parsing module 303, a testing module 304 and a sliding window parsing module 305. Among them:
[0147] An acquisition module 301 is used to acquire a task to be tested, wherein the task to be tested consists of a business load type and a business database;
[0148] An import module 302 is used to import the task to be tested into a preset database test model, wherein the preset database test model includes a test resource pool and a monitoring analyzer;
[0149] The parsing module 303 is used to parse the service load type through the monitoring analyzer to obtain service monitoring indicators;
[0150] The testing module 304 is used to perform a stress test on the business database through the test resource pool to obtain a target test result;
[0151] The sliding window analysis module 305 is used to perform sliding window analysis on the target test result based on the business monitoring indicator and output a data test report.
[0152] The acquisition module 301 includes:
[0153] A first acquisition submodule is used to acquire an object to be processed, wherein the object to be processed includes a data source identification code and a business log;
[0154] A first parsing submodule, used to parse the data source identification code through a regular expression to obtain a port number and a communication protocol;
[0155] A first determination submodule, configured to determine the service database based on the port number and the communication protocol;
[0156] A second parsing submodule is used to parse the service log, obtain the target service with the highest request-response ratio in the service log, and use the type of the target service as the service load type;
[0157] The integration submodule is used to integrate the business load type and the business database to obtain the task to be tested.
[0158] Before the import module 302, it includes:
[0159] A first importing module, used for importing the task to be tested into a first message queue, wherein the first message queue can accommodate a plurality of the tasks to be tested;
[0160] A monitoring module, used to monitor the first message queue through a task work process;
[0161] a marking module, configured to mark the task to be tested as a waiting task if the task to be tested in the first message queue reaches the upper capacity limit of the first message queue;
[0162] The second import module is used to import the tasks to be tested into a preset database test model according to the first-in-first-out principle if the tasks to be tested in the first message queue do not reach the capacity upper limit of the first message queue.
[0163] The analysis module 303 includes:
[0164] A third parsing submodule, configured to parse the service load type through the monitoring analyzer to obtain a load characteristic of the service load type;
[0165] A matching submodule is used to match the monitoring indicator set based on the load characteristics of the business load type to obtain the business monitoring indicator.
[0166] The testing module 304 includes:
[0167] A first generating submodule, configured to generate test data based on the service load type;
[0168] A checking submodule, used for checking the resource status of the test resource pool, wherein the resource status includes an idle host status and a fully loaded host status;
[0169] A first judgment submodule is used for importing the connection address and port number of the service database into the test host and locking the test host if the resource status of the test resource pool is an idle host status;
[0170] A stress test submodule, used to import the test data into the test host for stress testing and target test results;
[0171] The second judgment submodule is used for storing the service database in a second message queue for waiting if the resource status of the test resource pool is a fully loaded host status, until the resource status of the test resource pool is an idle host status.
[0172] The sliding window parsing module 305 includes:
[0173] The second acquisition submodule is used to acquire sliding window parameters;
[0174] A second generating submodule, configured to generate a target sliding window based on the sliding window parameters;
[0175] A calculation submodule, used to calculate the target test result based on the business monitoring indicator to obtain a test performance indicator;
[0176] An updating submodule, used to update the test performance indicator through the target sliding window to obtain a target performance indicator;
[0177] The fourth analysis submodule is used to perform data analysis on the target test result based on the target performance indicator to obtain the data test report, wherein the data analysis includes trend analysis, anomaly detection analysis and correlation analysis.
[0178] The updating submodule comprises:
[0179] A collecting unit, configured to collect the test performance indicator through the target sliding window;
[0180] A moving unit is used to move and update the target sliding window based on the sliding step size to obtain the target performance indicator.
[0181] In this embodiment, by obtaining the task to be tested, the task to be tested is imported into a preset database test model, the business load type is parsed through the monitoring analyzer to obtain the business monitoring index, the business database is stress tested through the test resource pool to obtain the target test result, the target test result is analyzed through a sliding window based on the business monitoring index, and a data test report is output. By importing the task to be tested into the database test model, stability testing of various business databases is achieved without the need for manual customized modifications to specific databases. The characteristics of the business load are accurately parsed through the monitoring analyzer, and targeted stress testing is performed through the test resource pool. The responsiveness and processing capacity of the business database under different load conditions can be reflected in real time. The sliding window technology is used to perform fine-grained performance evaluation of the test results, which can timely discover performance bottlenecks and potential anomalies, thereby helping the technical team optimize database configuration and business logic and improve the overall efficiency and reliability of the system.
[0182] In this embodiment, the operations performed by the above units or modules correspond one-to-one to the steps of the data testing method in the above implementation mode, which will not be repeated here.
[0183] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0184] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components 41-43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0185] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0186] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk equipped on the computer device 4, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of data testing methods, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.
[0187] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run computer-readable instructions stored in the memory 41 or process data, such as computer-readable instructions for running the data testing method.
[0188] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.
[0189] The present embodiment provides a computer device, which obtains a task to be tested, imports the task to be tested into a preset database test model, analyzes the business load type through a monitoring analyzer to obtain business monitoring indicators, performs stress testing on the business database through a test resource pool to obtain a target test result, performs sliding window analysis on the target test result based on the business monitoring indicator, and outputs a data test report. By importing the task to be tested into the database test model, stability testing of various business databases is achieved without the need for manual customized modifications to specific databases. The characteristics of the business load are accurately analyzed through a monitoring analyzer, and targeted stress testing is performed through a test resource pool. The responsiveness and processing capacity of the business database under different load conditions can be reflected in real time. The sliding window technology is used to perform fine-grained performance evaluation on the test results, so that performance bottlenecks and potential anomalies can be discovered in a timely manner, thereby helping the technical team optimize database configuration and business logic and improve the overall efficiency and reliability of the system.
[0190] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the data testing method as described above.
[0191] The present embodiment provides a computer-readable storage medium, which obtains a task to be tested, imports the task to be tested into a preset database test model, parses the business load type through a monitoring analyzer to obtain business monitoring indicators, performs stress testing on the business database through a test resource pool to obtain a target test result, performs sliding window analysis on the target test result based on the business monitoring indicator, and outputs a data test report. By importing the task to be tested into the database test model, stability testing of various business databases is achieved without the need for manual customized modifications to specific databases. The characteristics of the business load are accurately parsed through a monitoring analyzer, and targeted stress testing is performed through a test resource pool. The responsiveness and processing capacity of the business database under different load conditions can be reflected in real time. Fine-grained performance evaluation of the test results is performed using sliding window technology, so that performance bottlenecks and potential anomalies can be discovered in a timely manner, thereby helping the technical team optimize database configuration and business logic and improve the overall efficiency and reliability of the system.
[0192] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0193] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. A data testing method, characterized in that: The steps include: Acquire a task to be tested, wherein the task to be tested consists of a business load type and a business database; Importing the task to be tested into a preset database test model, wherein the preset database test model includes a test resource pool and a monitoring analyzer; Analyzing the service load type by the monitoring analyzer to obtain service monitoring indicators; Performing stress testing on the business database through the test resource pool to obtain target test results; Based on the business monitoring indicators, the target test results are analyzed in a sliding window and a data test report is output.
2. The data testing method according to claim 1, characterized in that: The step of obtaining the task to be tested, wherein the task to be tested is composed of a business load type and a business database, specifically includes: Obtaining an object to be processed, wherein the object to be processed includes a data source identification code and a business log; Parsing the data source identification code by regular expression to obtain the port number and communication protocol; Determining the service database based on the port number and the communication protocol; Parse the service log to obtain the target service with the highest request-response ratio in the service log, and use the type of the target service as the service load type; The business load type and the business database are integrated to obtain the task to be tested.
3. The data testing method according to claim 1, characterized in that: Before the step of importing the task to be tested into a preset database test model, the method further includes: Importing the task to be tested into a first message queue, where the first message queue can accommodate a number of the tasks to be tested; Monitoring the first message queue through a task work process; If the tasks to be tested in the first message queue reach the capacity upper limit of the first message queue, marking the tasks to be tested as waiting tasks; If the tasks to be tested in the first message queue do not reach the capacity upper limit of the first message queue, the tasks to be tested are imported into a preset database test model according to the first-in-first-out principle.
4. The data testing method according to claim 1, characterized in that: The monitoring analyzer includes several sets of monitoring indicator sets, and the step of parsing the service load type through the monitoring analyzer to obtain the service monitoring indicator specifically includes: Analyzing the service load type by the monitoring analyzer to obtain the load characteristics of the service load type; The monitoring indicator set is matched based on the load characteristics of the business load type to obtain the business monitoring indicator.
5. The data testing method according to claim 1, characterized in that: The test resource pool includes a plurality of test hosts, and the step of performing a stress test on the business database through the test resource pool to obtain a target test result specifically includes: generating test data based on the service load type; Checking the resource status of the test resource pool, wherein the resource status includes an idle host status and a fully loaded host status; If the resource status of the test resource pool is an idle host status, the connection address and port number of the service database are imported into the test host, and the test host is locked; Importing the test data into the test host to perform stress testing and target test results; If the resource status of the test resource pool is a fully loaded host status, the service database is stored in a second message queue for waiting until the resource status of the test resource pool is an idle host status.
6. The data testing method according to claim 1, characterized in that: The step of performing sliding window analysis on the target test result based on the business monitoring indicator and outputting a data test report specifically includes: Get sliding window parameters; generating a target sliding window based on the sliding window parameters; Calculate the target test result based on the business monitoring indicator to obtain a test performance indicator; The test performance indicator is updated through the target sliding window to obtain a target performance indicator; The target test result is subjected to data analysis based on the target performance indicator to obtain the data test report, wherein the data analysis includes trend analysis, anomaly detection analysis and correlation analysis.
7. The data testing method according to claim 6, characterized in that: The sliding window parameters include a sliding step size, and the step of updating the test performance indicator through the target sliding window to obtain the target performance indicator specifically includes: Collecting the test performance indicator through the target sliding window; The target sliding window is moved and updated based on the sliding step size to obtain the target performance indicator.
8. A data testing device, characterized in that: include: An acquisition module, used for acquiring a task to be tested, wherein the task to be tested consists of a business load type and a business database; An import module, used for importing the task to be tested into a preset database test model, wherein the preset database test model includes a test resource pool and a monitoring analyzer; A parsing module, used to parse the service load type through the monitoring analyzer to obtain service monitoring indicators; A testing module, used to perform a stress test on the business database through the test resource pool to obtain a target test result; The sliding window analysis module is used to perform sliding window analysis on the target test results based on the business monitoring indicators and output a data test report.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the data testing method according to any one of claims 1 to 7 when executing the computer-readable instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the data testing method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Database performance bottleneck positioning analysis method, device and system and storage medium
CN113886205A
Method and device for testing performance of analytical database
CN116204396A
Database performance testing utilizing a virtual database and redirected test commands
GB201918033D0
System for providing performance testing information to users
US20100251032A1
