A data testing method, apparatus, computer equipment, and storage medium

By acquiring the tasks to be tested and using a monitoring analyzer and test resource pool to perform database stress testing, the problem of traditional testing methods being incompatible with multiple databases is solved. This enables stability testing and performance evaluation of the database, improving the efficiency and reliability of the system.

CN119003364BActive Publication Date: 2025-10-31PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411175955.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2025-10-31
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

Traditional database stability testing methods are incompatible with multiple mainstream databases and cannot monitor anomalies and errors in different database products, resulting in unreliable and non-reusable tests.

Method used

The system acquires the task to be tested, parses the business load type through the monitoring analyzer to obtain business monitoring indicators, performs stress testing using the test resource pool, and parses the target test results through a sliding window to output data test reports.

Benefits of technology

It enables stability testing of various business databases without requiring manual customization. It can reflect the responsiveness and processing capacity of the database under different load conditions in real time, promptly identify performance bottlenecks and anomalies, optimize database configuration and business logic, and improve system efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003364B_ABST
    Figure CN119003364B_ABST
Patent Text Reader

Abstract

This application belongs to the field of database testing and relates to a data testing method. The method includes acquiring a task to be tested, importing the task into a preset database test model, analyzing the business load type through a monitoring analyzer to obtain business monitoring indicators, performing stress testing on the business database through a test resource pool to obtain target test results, performing sliding window parsing on the target test results based on the business monitoring indicators, and outputting a data test report. This application also provides a data testing device, computer equipment, and storage medium. This application can achieve stability testing for various business databases without requiring manual customization for specific databases. It reflects the responsiveness and processing capacity of the business database under different load conditions in real time, promptly identifies performance bottlenecks and potential anomalies, and helps technical teams optimize database configuration and business logic, improving the overall efficiency and reliability of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database testing technology, and in particular to data testing methods, apparatus, computer equipment and storage media. Background Technology

[0002] As the foundational software for underlying data storage, database products are one of the most important components in any business system. In addition to fulfilling the function of business data storage, another very important aspect of database products is their stability. To ensure the stability of database products, enterprises must conduct thorough and comprehensive stability tests on the database regularly.

[0003] Traditional database stability testing methods are unsystematic and require manually applying SQL statements to create stress on the database, or using 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 conduct, non-reusable, and the tests themselves unreliable. Summary of the Invention

[0005] The purpose of this application is to provide a data testing method, apparatus, computer equipment, and storage medium to solve the technical problems that traditional testing methods and tools are incompatible with multiple mainstream databases and cannot monitor anomalies and errors generated by different database products.

[0006] To address the aforementioned technical problems, this application provides a data testing method, employing the following technical solution:

[0007] Obtain the task to be tested, which consists of a business load type and a business database;

[0008] The task to be tested is imported into a preset database test model, which includes a test resource pool and a monitoring analyzer.

[0009] The monitoring analyzer parses the service load type to obtain service monitoring metrics;

[0010] The business database is stress-tested using the test resource pool to obtain the target test results.

[0011] Based on the aforementioned business monitoring metrics, the target test results are parsed using a sliding window, and a data test report is output.

[0012] Furthermore, the step of obtaining the task to be tested, which consists of a business load type and a business database, specifically includes:

[0013] Obtain the object to be processed, which includes the data source identifier code and business logs;

[0014] The data source identifier is parsed using regular expressions to obtain the port number and communication protocol;

[0015] The service database is determined based on the port number and communication protocol;

[0016] Parse the business logs to obtain the target business with the highest request-response ratio in the business logs, and use the type of the target business as the business 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 the preset database test model, the method further includes:

[0019] The task to be tested is imported into a first message queue, which can hold a number of the tasks to be tested.

[0020] The first message queue is monitored through the task worker process;

[0021] If the number of tasks to be tested in the first message queue reaches the capacity limit of the first message queue, then the task to be tested is marked as a waiting task.

[0022] If the number of tasks to be tested in the first message queue has not reached the capacity limit of the first message queue, then the tasks to be tested will be imported into the preset database test model according to the first-in-first-out principle.

[0023] Furthermore, the monitoring analyzer includes several sets of monitoring metrics. The step of parsing the service load type through the monitoring analyzer to obtain the service monitoring metrics specifically includes:

[0024] The monitoring analyzer parses the service load type to obtain the load characteristics of the service load type;

[0025] The monitoring metrics are obtained by matching the load characteristics of the business load type with the monitoring metric set.

[0026] Furthermore, the test resource pool includes several test hosts, and the step of performing stress testing on the business database through the test resource pool to obtain the target test results specifically includes:

[0027] Test data is generated based on the aforementioned business load type;

[0028] Check the resource status of the test resource pool, including the idle host status and the fully loaded host status;

[0029] If the resource status of the test resource pool is an idle host status, then the connection address and port number of the business database are imported into the test host, and the test host is locked.

[0030] The test data is imported into the test host for stress testing, with the target test result.

[0031] If the resource status of the test resource pool is a fully loaded host state, the service database is stored in the second message queue to wait until the resource status of the test resource pool is an idle host state.

[0032] Furthermore, the step of parsing the target test results based on the business monitoring metrics using a sliding window and outputting a data test report specifically includes:

[0033] Get the parameters of the sliding window;

[0034] Generate a target sliding window based on the sliding window parameters;

[0035] The target test results are calculated based on the business monitoring metrics to obtain test performance metrics;

[0036] The test performance metrics are updated using the target sliding window to obtain the target performance metrics;

[0037] Based on the target performance indicators, the target test results are analyzed to obtain the data test report. The data analysis includes trend analysis, anomaly detection analysis, and correlation analysis.

[0038] Furthermore, the sliding window parameters include the sliding step size, and the step of updating the test performance index through the target sliding window to obtain the target performance index specifically includes:

[0039] The test performance metrics are collected 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 index.

[0041] To address the aforementioned technical problems, this application also provides a data testing device, which employs the following technical solution:

[0042] The acquisition module is used to acquire the task to be tested, which consists of a business load type and a business database.

[0043] The import module is used to import the task to be tested into a preset database test model, which includes a test resource pool and a monitoring analyzer.

[0044] The parsing module is used to parse the service load type through the monitoring analyzer to obtain service monitoring metrics;

[0045] The testing module is used to perform stress tests on the business database through the test resource pool and obtain the target test results;

[0046] The sliding window parsing module is used to perform sliding window parsing on the target test results based on the business monitoring indicators and output a data test report.

[0047] To address the aforementioned technical problems, this application also provides a computer device that employs 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 executes the computer-readable instructions to implement the steps of the data testing method.

[0049] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:

[0050] A computer-readable storage medium, characterized in that the computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the data testing method.

[0051] Compared with the prior art, the embodiments of this application have the following main advantages:

[0052] This application embodiment acquires the task to be tested, imports it into a preset database test model, analyzes the business load type using 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, and performs sliding window analysis on the target test results based on the business monitoring indicators to output data test reports. By importing the task to be tested into the database test model, stability testing for various business databases can be achieved without the need for manual customization for 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 capacity of the business database under different load conditions in real time. The sliding window technology is used to perform fine-grained performance evaluation of the test results, which can promptly identify performance bottlenecks and potential anomalies, thereby helping the technical team to optimize database configuration and business logic, and improve the overall efficiency and reliability of the system. Attached Figure Description

[0053] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0054] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;

[0055] Figure 2 This is a flowchart of one embodiment of the data testing method according to this application;

[0056] Figure 3 This is a schematic diagram of the structure of one embodiment of the data testing apparatus according to this application;

[0057] Figure 4 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation

[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.

[0059] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0060] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.

[0061] like Figure 1As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0062] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.

[0063] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers.

[0064] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.

[0065] It should be noted that the data testing method provided in the embodiments of this application is generally executed by a server / terminal device, and correspondingly, 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 shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0067] Continue to refer to Figure 2 A flowchart of an embodiment of a data testing method according to this application is shown. The data testing method includes the following steps:

[0068] Step S201: Obtain the task to be tested.

[0069] In this embodiment, the above-described data testing method can be deployed in a data testing platform. This platform can be built using a server or server cluster. The platform also has a visual front-end page for database administrators to perform operations such as uploading, downloading, viewing, and saving. The server or server cluster can be any electronic device with functions such as text recognition, text processing, data transmission, and data storage. The electronic device on which the data testing method runs (e.g., Figure 1 The server / terminal device shown can receive the test task via wired or wireless connection. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G / 5G connections, WiFi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (ultra wideband) connections, and other currently known or future-developed wireless connection methods.

[0070] In this embodiment, the task to be tested can be a stability test task for an existing database, or a deployment and test task for a new database type and version. When the task to be tested is a deployment and test task for a new database type and version, the user can choose the database type and version himself, and the data testing platform will automatically deploy the database product and perform stability testing.

[0071] Specifically, the above-mentioned test task consists of a business load type and a business database. The business load type can be a type of workload required to make requests and operate on the business database in a real business environment. The business load type can include TPC-C and TPC-H. TPC-C can be an online transaction processing business load type, which mainly simulates transaction processing in an e-commerce environment, such as order entry and payment processing. TPC-H can be an online analytical processing business load type, which is mainly used for query processing in a data warehouse, involving complex queries and large data volume processing.

[0072] The aforementioned business database can be the database system to be tested, an existing database, or a newly deployed database product, such as mainstream databases like Oracle Database, MySQL, Microsoft SQL Server, and IBM DB2.

[0073] Specifically, the detailed implementation process of obtaining the task to be tested will be described in further detail in the subsequent specific embodiments of this application, and will not be elaborated on here.

[0074] Step S202: Import the task to be tested into the preset database test model.

[0075] In this embodiment, the aforementioned preset database test model can be a comprehensive test model based on data testing frameworks such as Locust, JMeter, and Gatling, and including multiple components. Specifically, the aforementioned preset database test model includes a test resource pool and a monitoring analyzer;

[0076] The aforementioned test resource pool can be a resource pool for managing and allocating business database tests, such as servers, virtual machines, containers, etc. It can be used to control the testing process of business databases in an isolated environment. The aforementioned test resource pool can include Docker, Kubernetes containers, and cloud servers provided by vendors such as AWS, Azure, and Google Cloud Platform.

[0077] The aforementioned monitoring analyzer can be used to collect and analyze the performance data of the business database during the testing process. The monitoring analyzer can be a data monitoring tool such as New Relic, AppDynamics, and Datadog.

[0078] Step S203: The business load type is analyzed by the monitoring analyzer to obtain business monitoring indicators.

[0079] In this embodiment, the aforementioned business monitoring metrics can be used to evaluate the performance and reliability of the business database under actual operating conditions. These business monitoring metrics may include response time, throughput, resource utilization, error rate, concurrency performance, number of connections, cache hit rate, data replication latency, transaction log growth rate, and system stability, among other metrics.

[0080] Specifically, the detailed implementation process of parsing the business load type through the monitoring analyzer to obtain business monitoring indicators will be described in further detail in subsequent specific embodiments of this application, and will not be elaborated on here.

[0081] Step S204: Perform stress testing on the business database using the test resource pool to obtain the target test results.

[0082] In this embodiment, the target test results can be a performance metric dataset obtained after stress testing of the business database. Specifically, the performance metric dataset may include response time and throughput, stability reports, error and exception records, system resource consumption, and stress test data. By analyzing the target test results, database administrators can understand the behavior of the current business database under actual workloads, thereby making necessary adjustments and optimizations, determining the optimal configuration of the current business database, and ensuring the efficient and stable operation of the database system.

[0083] Specifically, the detailed implementation process of stress testing the business database through the test resource pool to obtain the target test results will be described in further detail in subsequent specific embodiments of this application, and will not be elaborated on here.

[0084] Step S205: Perform sliding window parsing on the target test results based on business monitoring indicators and output a data test report.

[0085] In this embodiment, the aforementioned data test report can be used to summarize and analyze the test results of the aforementioned business database in detail, providing the technical team with clear and easy-to-understand information to evaluate the performance and stability of the database. Specifically, the aforementioned data test report may include resource usage details, anomaly and error analysis, stability assessment, stress test results, optimization suggestions, and trend and comparative analysis results. It can be configured on the aforementioned data test platform using reporting automation tools such as Crystal Reports or SQL Server Reporting Services (SSRS), and after the test, the aforementioned data test report can be forwarded to the database administrator via subscription.

[0086] Specifically, the detailed implementation process of parsing the target test results using a sliding window based on the business monitoring indicators and outputting data test reports will be further described in subsequent specific embodiments of this application, and will not be elaborated on here.

[0087] This application acquires the tasks to be tested, imports them into a pre-defined database test model, analyzes the business load type using a monitoring analyzer to obtain business monitoring metrics, performs stress testing on the business database through a test resource pool, obtains target test results, and uses a sliding window to analyze the target test results based on the business monitoring metrics, outputting data test reports. By importing the tasks to be tested into the database test model, stability testing for various business databases can be achieved without requiring manual customization for 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 capacity of the business database under different load conditions in real time. The sliding window technology is used to perform fine-grained performance evaluation of the test results, which can promptly identify 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 alternative implementations, step S201 includes the following steps:

[0089] Get the object to be processed;

[0090] The port number and communication protocol are obtained by parsing the data source identifier code using regular expressions.

[0091] The service database is determined based on the port number and communication protocol;

[0092] Parse the business logs to identify the target business with the highest request-response ratio, and use the type of the target business as the business load type.

[0093] By integrating the business load type and the business database, the task to be tested is obtained.

[0094] In this embodiment, the object to be processed can be an existing database or a newly deployed database product, such as mainstream databases like Oracle Database, MySQL, Microsoft SQL Server, and IBM DB2. Specifically, the object to be processed includes a data source identifier (DSN) and business logs. The DSN can be a parameter used to define and access a specific database instance, and may include database connection IP, port number, username, password, database name, and communication protocol. The business logs can be historical log records generated by the business database during operation, and may include historical logs such as transaction logs, query logs, and performance logs.

[0095] In one possible embodiment, the database administrator can select the object to be processed on the front-end page of the aforementioned data testing platform using methods including but not limited to dragging and clicking. The object to be processed can be saved in the form of an icon on the front-end page of the data testing platform. Then, the data source identifier code is parsed using regular expressions to obtain the port number and communication protocol. For example, the data source identifier code is as follows:

[0096] tcp: / / username:password@hostname:3306 / databasename;

[0097] The regular expression for this can be: ·(\w+): / / [^:]+:[^@]+@[^:]+:(\d+) / .* where \w+ matches the protocol type and \d+ is the port number. This extracts 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 current business database type is a MySQL database.

[0098] In one possible implementation, key information such as request type, timestamp, and response time can be extracted by parsing the start time, end time, type, and result of each request recorded in the business logs. Then, the request response time for each business type is statistically analyzed to calculate the average response time and request completion rate. Next, it is analyzed which business type has the highest request response ratio, that is, which business processes the most requests per unit time with the highest efficiency. This type is identified as the main business load type for further performance and stability testing. Finally, the business load type and business database are integrated and packaged to obtain the test task.

[0099] This application effectively improves the accuracy and efficiency of testing by automatically analyzing data source identifiers and business logs. It ensures that testing activities can specifically optimize the performance and stability of the database. Automated test preparation and execution reduce the need for manual intervention, lower the error rate, and accelerate the testing cycle, making the database system more reliable and meeting the needs of efficient and dynamic business.

[0100] In some alternative implementations, the following steps are included before step S202:

[0101] Import the task to be tested into the first message queue;

[0102] The first message queue is monitored through the task's worker process;

[0103] If the number of tasks to be tested in the first message queue reaches the capacity limit of the first message queue, then the tasks to be tested will be marked as waiting tasks.

[0104] If the number of tasks to be tested in the first message queue has not reached the capacity limit of the first message queue, then the tasks to be tested will be 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 standard message queue software such as RabbitMQ, Apache Kafka, or AWS SQS (Simple Queue Service).

[0106] In this embodiment, the aforementioned task worker process can be a component responsible for monitoring message queues, retrieving and executing tasks. Specifically, schedulers such as Docker Swarm, Nomad, or Kubernetes can be used to dynamically allocate resources and manage task execution for the task worker process.

[0107] In one possible embodiment, before importing the task to be tested into the preset database test model, the task to be tested needs to be imported into the task queue (first message queue) to continue waiting. The task queue is monitored by the Kubernetes cluster (task worker process). If the number of tasks to be tested in the task queue reaches the upper limit of the task queue, the task to be tested is marked as a waiting task. If the number of tasks to be tested in the task queue does not reach the upper 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 achieves efficient task processing, optimized resource allocation, and ensures stable operation of the system even when it reaches its capacity limit by importing and managing the tasks to be tested into the first message queue, as well as effectively monitoring and scheduling the task work process. This improves the overall test automation and system responsiveness.

[0109] In some alternative implementations, step S203 includes the following steps:

[0110] The monitoring analyzer parses the business load type to obtain the load characteristics of the business load type;

[0111] The monitoring metric set is matched with the load characteristics of the business load type to obtain the business monitoring metrics.

[0112] In this embodiment, the aforementioned load characteristics can be the usage patterns and behavioral characteristics of the business database on system resources when running business operations. Specifically, the aforementioned load characteristics can include characteristics such as request frequency, data transfer volume, runtime CPU and memory usage, and the number of concurrent users.

[0113] In this embodiment, the monitoring analyzer includes several sets of monitoring metrics. Specifically, the monitoring metric set can be necessary test metrics for the business database stored in the monitoring analyzer. These necessary test metrics can include performance metrics, resource usage metrics, capacity metrics, and stability metrics, etc. The monitoring metric set can include the aforementioned business monitoring metrics. Based on the load characteristics of the business load type, the monitoring analyzer can select a suitable monitoring metric set as the business monitoring metrics to comprehensively evaluate and monitor database performance.

[0114] In one possible implementation, after obtaining the load characteristics, key performance indicators that reflect these load characteristics can be matched from the aforementioned monitoring indicator set. For example, for databases with high query loads, query response time and queries per second (QPS) can be matched; for write-intensive applications, transaction commit latency, transactions per second (TPS), and disk write operations can be matched; for services requiring high availability, system availability, fault recovery time, and error rate can be matched, and these key performance indicators can be used as the aforementioned business monitoring indicators.

[0115] This application enables highly customized performance monitoring by using a monitoring analyzer to parse business load types and match appropriate monitoring metric sets based on their load characteristics. It can more effectively identify and resolve performance bottlenecks, optimize system configuration, improve application performance, and ultimately ensure the efficient and stable operation of the business.

[0116] In some alternative 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, then import the connection address and port number of the business database into the test host and lock the test host.

[0120] Import the test data into the test host for stress testing, and obtain the target test results.

[0121] If the test resource pool is in a fully loaded host state, the business database will be stored in the second message queue and wait until the test resource pool is in an idle host state.

[0122] In this embodiment, the second message queue can be standard message queue software such as RabbitMQ, Apache Kafka, or AWS SQS (Simple Queue Service).

[0123] In one possible implementation, when the business load type is TPC-C, custom script data generation tools such as Apache JMeter and TPC Benchmark can be used to create test scripts (test data) to simulate transaction processing in an e-commerce environment. Resource management and monitoring tools such as Kubernetes and Docker Swarm can then be used to check resource utilization and 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, the test host is locked, and the test script is imported into the test host for stress testing to obtain metrics such as throughput, response time, execution time, CPU utilization, memory utilization, and disk I / O (i.e., the target test results mentioned above). If the resource status of the test resource pool is a fully loaded host state, the business database is stored in a second message queue to wait until the resource status of the test resource pool becomes an idle host state.

[0124] This application effectively improves the automation level and resource utilization efficiency of testing by dynamically monitoring and managing test resources. It ensures that tests are executed only when resources are sufficient, avoiding resource contention and overload issues, and ensuring the reliability and accuracy of tests. At the same time, by using a second message queue to manage overloaded tasks, it ensures the orderly execution of test tasks and prevents test interruptions due to insufficient resources, thereby maximizing the effectiveness of test resources and the continuity of the test process.

[0125] In some alternative implementations, step S205 includes the following steps:

[0126] Get the parameters of the sliding window;

[0127] Generate the target sliding window based on the sliding window parameters;

[0128] The test performance metrics are obtained by calculating the target test results based on the business monitoring metrics.

[0129] The target performance metrics are obtained by updating the test performance metrics through a target sliding window;

[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 the window size and the sliding step size. Specifically, the window size defines the range of time series data to be analyzed, and the step size defines the interval at which the window moves.

[0132] In one possible embodiment, a sliding window with a size of 5 minutes and a step size of 1 minute is selected as the sliding window parameter for real-time monitoring of database performance. A sliding window for managing time series data (i.e., the target sliding window mentioned above) is constructed using Python's pandas library. Business monitoring metrics data, such as throughput and response time, are collected during the sliding window period. The average query response time and transactions per second (i.e., the test performance metrics mentioned above) are calculated within each window. The window data is updated every minute, and the average response time and number of transactions (i.e., the target performance metrics mentioned above) are recalculated. The recalculated average response time and number of transactions are recorded in the data test report. By performing trend analysis, anomaly detection analysis, and correlation analysis on the target test results, a detailed data test report is generated, ending with the final target performance metrics in the sliding window. The data test report includes charts and trend analysis of key performance metrics.

[0133] The trend analysis mentioned above can be done by using charts to show the changes in target performance indicators over time, helping to identify long-term trends or cyclical patterns; the anomaly detection analysis mentioned above can be done by using statistical methods such as standard deviation and IQR to identify outliers in target performance indicators; the correlation analysis mentioned above can be done by analyzing the correlation between target performance indicators and target test results, such as the relationship between CPU utilization and response time, to determine the root cause of performance bottlenecks.

[0134] This application uses a sliding window parsing method to achieve continuous performance monitoring and data analysis, enabling immediate detection and rapid response to performance issues. The sliding window provides a dynamic performance view that reflects changes in system performance over time, helping administrators and developers understand the database's performance under actual workloads.

[0135] In some alternative implementations, the step "updating the test performance metrics through a target sliding window to obtain the target performance metrics" includes the following steps:

[0136] The test performance metrics are collected 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 size, the target sliding window moves forward, a new test performance indicator is added as the target performance indicator, and the earliest test performance indicator of the window is removed.

[0139] This application uses a target sliding window to collect and update test performance metrics, ensuring that performance data is always up-to-date and reflects recent performance trends. This allows administrators to make quick and effective decisions based on the latest performance trends, promptly identify and resolve potential performance issues, thereby optimizing system operation and improving user experience.

[0140] It should be emphasized that, to further ensure the privacy and security of the aforementioned data test report information, this data test report information can also be stored in a blockchain node.

[0141] The blockchain referred to in this application is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.

[0142] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0143] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware with computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).

[0144] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0145] Further reference Figure 3 As a response to the above Figure 2 To implement the method shown, this application provides an embodiment of a data testing device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this 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. Wherein:

[0147] Acquisition module 301 is used to acquire the task to be tested, which consists of a business load type and a business database;

[0148] Import module 302 is used to import the task to be tested into a preset database test model, the preset database test model including 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] Test module 304 is used to perform stress tests on the business database through the test resource pool and obtain target test results;

[0151] The sliding window parsing module 305 is used to perform sliding window parsing on the target test results based on the business monitoring indicators and output a data test report.

[0152] The acquisition module 301 includes:

[0153] The first acquisition submodule is used to acquire the object to be processed, which includes the data source identifier code and business logs;

[0154] The first parsing submodule is used to parse the data source identifier code using regular expressions to obtain the port number and communication protocol;

[0155] The first determining submodule is used to determine the service database based on the port number and communication protocol;

[0156] The second parsing submodule is used to parse the business logs, obtain the target business with the highest request-response ratio in the business logs, and use the type of the target business as the business 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] Prior to the import module 302, the following is included:

[0159] The first import module is used to import the task to be tested into the first message queue, which can hold a number of the tasks to be tested.

[0160] The monitoring module is used to monitor the first message queue through the task worker process;

[0161] The marking module is used to mark the task to be tested as a waiting task if the number of tasks to be tested in the first message queue reaches the capacity limit of the first message queue.

[0162] The second import module is used to import the task to be tested into a preset database test model according to the first-in-first-out principle if the task to be tested in the first message queue has not reached the capacity limit of the first message queue.

[0163] The parsing module 303 includes:

[0164] The third parsing submodule is used to parse the service load type through the monitoring analyzer to obtain the load characteristics of the service load type;

[0165] The matching submodule is used to match the monitoring metric set based on the load characteristics of the business load type to obtain the business monitoring metrics.

[0166] The test module 304 includes:

[0167] The first generation submodule is used to generate test data based on the business load type;

[0168] The inspection submodule is used to inspect the resource status of the test resource pool, including the idle host status and the fully loaded host status.

[0169] The first judgment submodule is used to import the connection address and port number of the business database into the test host and lock the test host if the resource status of the test resource pool is an idle host status.

[0170] The stress testing submodule is used to import the test data into the test host for stress testing, with the target test result.

[0171] The second judgment submodule is used to store the business database in the second message queue and wait until the resource status of the test resource pool is an idle host state if the resource status of the test resource pool is a full host state.

[0172] The sliding window parsing module 305 includes:

[0173] The second acquisition submodule is used to acquire sliding window parameters;

[0174] The second generation submodule is used to generate a target sliding window based on the sliding window parameters;

[0175] The calculation submodule is used to calculate the target test results based on the business monitoring indicators to obtain test performance indicators;

[0176] The update submodule is used to update the test performance index through the target sliding window to obtain the target performance index;

[0177] The fourth parsing submodule is used to perform data parsing on the target test results based on the target performance indicators to obtain the data test report. The data parsing includes trend analysis, anomaly detection analysis, and correlation analysis.

[0178] The update submodule includes:

[0179] The collection unit is used to collect the test performance indicators 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 index.

[0181] In this embodiment, the task to be tested is acquired and imported into a preset database test model. The business load type is analyzed by a monitoring analyzer to obtain business monitoring indicators. Stress testing is performed on the business database through a test resource pool to obtain target test results. Based on the business monitoring indicators, a sliding window is used to analyze the target test results and output a data test report. By importing the task to be tested into the database test model, stability testing for various business databases can be achieved without the need for manual customization for specific databases. The monitoring analyzer accurately analyzes the characteristics of the business load, and targeted stress testing is performed through the test resource pool. This can reflect the responsiveness and processing capacity of the business database under different load conditions in real time. The sliding window technology is used to perform fine-grained performance evaluation of the test results, which can promptly identify performance bottlenecks and potential anomalies. This helps 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-mentioned units or modules correspond one-to-one with the steps of the data testing method in the above-described embodiments, and will not be repeated here.

[0183] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. 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 via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing 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 (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0185] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.

[0186] The memory 41 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), 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, magnetic disk, optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 4. Of course, the memory 41 may also include both the internal storage unit and its external storage device of the computer device 4. In this embodiment, the memory 41 is typically used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions for data testing methods. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or will be output.

[0187] In some embodiments, the processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to execute computer-readable instructions stored in the memory 41 or to process data, for example, to execute computer-readable instructions for the data testing method.

[0188] The network interface 43 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 4 and other electronic devices.

[0189] This embodiment provides a computer device that acquires a task to be tested, imports it 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, obtains target test results, performs sliding window analysis on the target test results based on the business monitoring indicators, and outputs data test reports. By importing the task to be tested into the database test model, stability testing for various business databases can be achieved without the need for manual customization for 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 capacity of the business database under different load conditions in real time. The sliding window technology is used to perform fine-grained performance evaluation of the test results, which can promptly identify 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.

[0190] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the data testing method described above.

[0191] This embodiment provides a computer-readable storage medium that acquires a test task, imports it into a preset database test model, analyzes the business load type using a monitoring analyzer to obtain business monitoring indicators, performs stress testing on the business database using 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 data test reports. By importing the test task into the database test model, stability testing for various business databases can be achieved without requiring manual customization for 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 capacity of the business database under different load conditions in real time. The sliding window technology is used to perform fine-grained performance evaluation of the test results, which can promptly identify 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.

[0192] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0193] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.

Claims

1. A data testing method, characterized in that, Includes the following steps: Obtain the task to be tested, which consists of a business load type and a business database; The task to be tested is imported into a preset database test model, which includes a test resource pool and a monitoring analyzer. The monitoring analyzer parses the service load type to obtain service monitoring metrics; The business database is stress-tested using the test resource pool to obtain the target test results. Based on the aforementioned business monitoring metrics, the target test results are parsed using a sliding window, and a data test report is output. The step of obtaining the task to be tested, which consists of a business load type and a business database, specifically includes: Obtain the object to be processed, which includes the data source identifier code and business logs; The data source identifier is parsed using regular expressions to obtain the port number and communication protocol; The service database is determined based on the port number and communication protocol; Parse the business logs to obtain the target business with the highest request-response ratio in the business logs, and use the type of the target business as the business load type; The business load type and the business database are integrated to obtain the task to be tested; The test resource pool includes several test hosts. The step of performing stress testing on the business database through the test resource pool to obtain the target test results specifically includes: Test data is generated based on the aforementioned business load type; Check the resource status of the test resource pool, including the idle host status and the fully loaded host status; If the resource status of the test resource pool is an idle host status, then the connection address and port number of the business database are imported into the test host, and the test host is locked. The test data is imported into the test host for stress testing, with the target test result. If the resource status of the test resource pool is a full host state, 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 state. The step of parsing the target test results using a sliding window based on the business monitoring metrics and outputting a data test report specifically includes: Get the parameters of the sliding window; Generate a target sliding window based on the sliding window parameters; The target test results are calculated based on the business monitoring metrics to obtain test performance metrics; The test performance metrics are updated using the target sliding window to obtain the target performance metrics; Based on the target performance indicators, the target test results are analyzed to obtain the data test report. The data analysis includes trend analysis, anomaly detection analysis, and correlation analysis.

2. 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: The task to be tested is imported into a first message queue, which can hold a number of the tasks to be tested. The first message queue is monitored through the task worker process; If the number of tasks to be tested in the first message queue reaches the capacity limit of the first message queue, then the task to be tested is marked as a waiting task. If the number of tasks to be tested in the first message queue has not reached the capacity limit of the first message queue, then the tasks to be tested will be imported into the preset database test model according to the first-in-first-out principle.

3. The data testing method according to claim 1, characterized in that, The monitoring analyzer contains several sets of monitoring metrics. The step of parsing the service load type through the monitoring analyzer to obtain the service monitoring metrics specifically includes: The monitoring analyzer parses the service load type to obtain the load characteristics of the service load type; The monitoring metrics are obtained by matching the load characteristics of the business load type with the monitoring metric set.

4. The data testing method according to claim 1, characterized in that, The sliding window parameters include the sliding step size. The step of updating the test performance index through the target sliding window to obtain the target performance index specifically includes: The test performance metrics are collected through the target sliding window; The target sliding window is moved and updated based on the sliding step size to obtain the target performance index.

5. A data testing device, characterized in that, include: The acquisition module is used to acquire the task to be tested, which consists of a business load type and a business database. The import module is used to import the task to be tested into a preset database test model, which includes a test resource pool and a monitoring analyzer. The parsing module is used to parse the service load type through the monitoring analyzer to obtain service monitoring metrics; The testing module is used to perform stress tests on the business database through the test resource pool and obtain the target test results; The sliding window parsing module is used to perform sliding window parsing on the target test results based on the business monitoring indicators and output a data test report. The acquisition module includes: The first acquisition submodule is used to acquire the object to be processed, which includes the data source identifier code and business logs; The first parsing submodule is used to parse the data source identifier code using regular expressions to obtain the port number and communication protocol; The first determining submodule is used to determine the service database based on the port number and communication protocol; The second parsing submodule is used to parse the business logs, obtain the target business with the highest request-response ratio in the business logs, and use the type of the target business as the business load type. An integration submodule is used to integrate the business load type and the business database to obtain the task to be tested; The test module includes: The first generation submodule is used to generate test data based on the business load type; The inspection submodule is used to inspect the resource status of the test resource pool, including the idle host status and the fully loaded host status. The first judgment submodule is used to import the connection address and port number of the business database into the test host and lock the test host if the resource status of the test resource pool is an idle host status. The stress testing submodule is used to import the test data into the test host for stress testing, with the target test result. The second judgment submodule is used to store the business database in the second message queue and wait until the resource status of the test resource pool is an idle host state if the resource status of the test resource pool is a full host state. The sliding window parsing module includes: The second acquisition submodule is used to acquire sliding window parameters; The second generation submodule is used to generate a target sliding window based on the sliding window parameters; The calculation submodule is used to calculate the target test results based on the business monitoring indicators to obtain test performance indicators; The update submodule is used to update the test performance index through the target sliding window to obtain the target performance index; The fourth parsing submodule is used to perform data parsing on the target test results based on the target performance indicators to obtain the data test report. The data parsing includes trend analysis, anomaly detection analysis, and correlation analysis.

6. A computer device, characterized in that, The device includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the data testing method as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the data testing method as described in any one of claims 1 to 4.

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