Distributed database testing method and device
By generating a test request set in a distributed database and calculating synchronization delay parameters, it solves the problem of users choosing an appropriate database, improves test efficiency and pertinence, and meets the needs of different scenarios.
Patent Information
- Application Number
- CN202410823513.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-08
AI Technical Summary
It is difficult for users to choose a suitable distributed database. The performance and functions of each database are different, resulting in low testing efficiency and difficulty in meeting the needs of different scenarios.
By generating a test request set and submitting it to a distributed database, the storage unit of the transaction engine and analysis engine is used to query and poll data, calculate the synchronization delay parameters, filter the delay parameters based on the target operation type, and generate highly targeted test results.
It improves the efficiency and reliability of distributed database testing and can provide test results that meet preset requirements for different scenarios and operation types.
Smart Images

Figure CN118747152A_ABST
Abstract
Description
Technical Field
[0001] This document relates to the field of data processing technology, and in particular to a testing method and device for a distributed database. Background Art
[0002] With the development of Internet technology and the continuous improvement of software and hardware technology, databases have become an indispensable component in more and more scenarios. Databases can be used to store and organize data so that technical personnel can better manage and use data. Distributed databases have become the first choice for more and more users to deploy software and hardware environments due to their high consistency, high availability and fault tolerance. With the emergence of more and more distributed databases, the performance and main functions of each distributed database are also different. Users are beginning to find it difficult to choose a distributed database, which has become a major concern at present. Summary of the invention
[0003] One or more embodiments of the present specification provide a distributed database testing method, including: generating a test request set according to a test configuration and submitting it to a distributed database, so as to perform test processing of the test request in the distributed database. Querying the first data processed according to the sampling test request in the storage unit of the transaction engine of the distributed database, and polling the second data processed according to the sampling test request in the storage unit of the analysis engine of the distributed database. If the second data polled is the same as the first data, the synchronization delay parameter of the sampling test request is calculated based on the polling time of the second data and the query time of the first data. Delay parameter screening is performed based on the target operation type recorded in the test configuration, and the test result of the distributed database is generated according to the screening result.
[0004] One or more embodiments of the present specification provide a testing device for a distributed database, including: a test request set generation module, configured to generate a test request set according to a test configuration and submit it to a distributed database, so as to perform test processing of the test request in the distributed database. A data query module, configured to query the storage unit of the transaction engine of the distributed database for first data processed according to the sampled test request, and to poll the storage unit of the analysis engine of the distributed database for second data processed according to the sampled test request. If the second data polled is the same as the first data, a delay parameter calculation module is run, and the delay parameter calculation module is configured to calculate the synchronization delay parameter of the sampled test request based on the polling time of the second data and the query time of the first data. A test result generation module, configured to perform delay parameter screening based on the target operation type recorded in the test configuration, and generate the test result of the distributed database according to the screening result.
[0005] One or more embodiments of the present specification provide a test device for a distributed database, comprising: a processor; and a memory configured to store computer-executable instructions, wherein the processor executes the computer-executable instructions to implement the following process: generating a test request set according to a test configuration and submitting it to a distributed database to perform test processing of the test request in the distributed database. Querying the first data processed according to the sampling test request in the storage unit of the transaction engine of the distributed database, and polling the second data processed according to the sampling test request in the storage unit of the analysis engine of the distributed database. If the second data polled is the same as the first data, the synchronization delay parameter of the sampling test request is calculated based on the polling time of the second data and the query time of the first data. Delay parameter screening is performed based on the target operation type recorded in the test configuration, and the test result of the distributed database is generated according to the screening result.
[0006] One or more embodiments of the present specification provide a computer-readable storage medium for storing computer-executable instructions, which implement the following process when executed: Generate a test request set according to a test configuration and submit it to a distributed database to perform test processing on the test request in the distributed database. Query the first data processed according to the sampling test request in the storage unit of the transaction engine of the distributed database, and poll the second data processed according to the sampling test request in the storage unit of the analysis engine of the distributed database. If the second data polled is the same as the first data, calculate the synchronization delay parameter of the sampling test request based on the polling time of the second data and the query time of the first data. Perform delay parameter screening based on the target operation type recorded in the test configuration, and generate the test result of the distributed database based on the screening result. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] In order to more clearly illustrate one or more embodiments of the present specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.
[0008] Figure 1 A schematic diagram of an implementation environment for a distributed database testing method provided in one or more embodiments of this specification;
[0009] Figure 2 A processing flow chart of a distributed database testing method provided in one or more embodiments of this specification;
[0010] Figure 3 A schematic diagram of a configuration file of a test configuration provided for one or more embodiments of this specification;
[0011] Figure 4 A processing flow chart of a distributed database testing method applied to a database testing scenario provided by one or more embodiments of this specification;
[0012] Figure 5 A schematic diagram of an embodiment of a distributed database testing device provided by one or more embodiments of this specification;
[0013] Figure 6 A schematic diagram of the structure of a distributed database testing device provided in one or more embodiments of this specification. DETAILED DESCRIPTION
[0014] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0015] The distributed database testing method provided by one or more embodiments of this embodiment can be applied to the implementation environment of distributed database testing. Figure 1 The implementation environment at least includes a test server 101, which can be one or more servers, a server cluster consisting of several servers, or a cloud server of a cloud computing platform. The test server 101 is used to generate a test request set according to the test configuration and submit it to the distributed database 102. During the test of the distributed database 102, the synchronization delay parameters of the transaction engine 103 and the analysis engine 104 of the distributed database 102 are calculated when the data is the same, and the test results of the distributed database 102 are generated according to the screened synchronization delay parameters. The test server 101 and the distributed database 102 can be connected by multi-threading.
[0016] The implementation environment also includes at least a distributed database 102, in which a transaction engine 103 and an analysis engine 104 are deployed, as well as a storage unit 105 of the transaction engine 103 and a storage unit 106 of the analysis engine 104. The distributed database 102 is used to perform test processing of each test request in the test request set submitted by the test server 101. In addition, the storage unit 105 of the transaction engine 103 and the storage unit 106 of the analysis engine 104 can also be a shared storage pool. During the operation of the distributed database 102, the data stored in the shared storage pool can be directly converted between row storage and column storage as needed, or a specific algorithm can be implemented to simulate the effect of column storage for the data stored in the row storage. Correspondingly, the data stored in the column storage can also be simulated as the effect of row storage to meet the data processing requirements of the transaction engine 103 and the analysis engine 104.
[0017] In this implementation environment, the test server 101 generates a test request set according to the test configuration and submits it to the distributed database 102. The distributed database 102 performs test processing on each test request in the test request set. During the test, the test server 101 queries the distributed database 102 for the first data processed according to the sampled test request in the storage unit 105 of the transaction engine 103, and polls the distributed database 102 for the second data processed according to the sampled test request in the storage unit 106 of the analysis engine 104. If the polled second data is the same as the first data, the synchronization delay parameter of the sampled test request is calculated based on the polling time of the second data and the query time of the first data, the delay parameter is screened based on the target operation type recorded in the test configuration, and the test result of the distributed database 102 is generated according to the screening result, so as to achieve the test analysis result of the database according to the operation type, and set up a sampling test to improve the test efficiency.
[0018] One or more embodiments of a distributed database testing method provided in this specification are as follows:
[0019] Reference Figure 2 The distributed database testing method provided in this embodiment specifically includes steps S202 to S208.
[0020] Step S202: Generate a test request set according to the test configuration and submit it to the distributed database, so as to perform test processing of the test request in the distributed database.
[0021] In actual applications, different organizations have different data processing scenarios and require different distributed database performance. For example, small and medium-sized organizations have a small amount of data and a small amount of concurrent data, and do not have high performance requirements for distributed databases. Alternatively, some organizations have high requirements for the real-time nature of database data and high requirements for the synchronization performance of add, delete, and modify operations between engines. To address this, this embodiment edits the test configuration for testing before the database testing process, that is, the configuration file for testing, and performs sampling tests on test requests based on the content recorded in the configuration file, thereby improving the test efficiency, screening the test results based on the content recorded in the configuration file, and implementing performance testing in different scenarios, so as to conduct more targeted testing of distributed databases.
[0022] In this embodiment, the test configuration is a configuration file that records multiple test processing parameters. The distributed database test can be performed by reading the parameters recorded in the configuration file, such as Figure 3 As shown, the configuration file of the test configuration can be divided into three parts according to the functions corresponding to each parameter: basic test configuration, test request set configuration and data query configuration. The following is a specific description of these three configurations.
[0023] (1) Test basic configuration
[0024] This part of the configuration file mainly records the basic information of the database test, which may include the test duration, the type of database tested, and the frequency of data processing. For example, the test duration is 1500 seconds and the number of transactions per second is 10,000.
[0025] (2) Test request set configuration
[0026] The configuration file in this part mainly records the generation parameters of the test request set, which may include capacity parameters, number of import threads, and type of database under test. For example, if the capacity parameter is 100G and the number of import threads is 50, it means that the size of the test request set is 100G, and the test request set is imported into the distributed database through 50 threads.
[0027] (3) Data query configuration
[0028] The configuration file in this part mainly records the data query configuration of the storage unit of the transaction engine and analysis engine of the distributed database during the test. Specifically, it may include the target operation type, data query times, data query frequency, number of query threads, etc. For example: the target operation type is AD Hoc Insert (single increase), the data query times is 10%, the data cross frequency is 25%, and the number of query threads is 10, indicating that only 10% of the test requests in the test request set are sampled to obtain sampled test requests, and one out of every four test requests is selected as a sampled test request (25%), and 10 threads are used in parallel to query the data processed by the database according to the sampled test request, and after calculating the synchronization delay parameters of the sampled test request, the synchronization delay parameters of the "increase" data operation are screened out to generate the test results.
[0029] In specific implementation, a test request set is generated according to the parameters of the test request set configuration record in the test configuration and submitted to the distributed database; after receiving the test request set, the distributed database performs test processing on multiple test requests included in the test request set.
[0030] During the specific execution process, the capacity parameter of the test request set configuration part in the configuration file of the test configuration can be read to select test data of corresponding capacity in the test data pool, multiple test requests are generated according to the test data and a test request set is constructed, the number of import threads of the test request set configuration part is read, and the test request set is imported into the distributed database in parallel through multiple threads. In an optional implementation manner provided by this embodiment, a test request set is generated according to the test configuration and submitted to the distributed database, including:
[0031] Selecting test data of corresponding capacity from the test data pool according to the capacity parameters recorded in the test configuration;
[0032] generating a plurality of test requests according to the test data and the operation type of the test data, and constructing the test request set based on each test request;
[0033] The test request set is imported into the distributed database according to the number of import threads recorded in the test configuration.
[0034] Specifically, read the capacity parameters of the test request set configuration part in the configuration file of the test configuration, select test data with a capacity size corresponding to the capacity parameters in the preset test data pool, generate multiple test requests according to each test data and the operation type corresponding to the test data, build a test request set based on each test request, read the number of import threads recorded in the test request set configuration record, import the test request set into the distributed database by multi-threaded parallel import, so as to perform test processing of the test request in the distributed database.
[0035] In this embodiment, the test request refers to the request processed by the distributed database during the test process. Specifically, the test request includes processing data and operation data. For example, if the content of the test request is to change a certain data 0 in the database to data 1, the processing data is 1 and the operation data is "change". Among them, the test data pool can be a pre-built data pool composed of multiple test data. Specifically, it can be a test data pool built based on a benchmark test standard, such as a benchmark test data pool provided by TPC (Transaction Processing Performance Council).
[0036] During the specific test process, the distributed database may perform test processing according to the parameters of the test basic configuration part in the configuration file of the test configuration. Specifically, before the test processing, the parameters of the test basic configuration may be obtained to perform the test processing. In an optional implementation manner provided by this embodiment, before performing the test processing operation of the test request, the distributed database further includes:
[0037] Obtaining the data test frequency recorded in the test configuration, and determining the number of request processing per unit time according to the data test frequency;
[0038] The test time recorded in the test configuration is extracted to determine that the test is completed after detecting that the request processing time matches the test time.
[0039] For example, when a distributed database is tested using the TPC-C benchmark test method, the number of transactions per second in the test basic configuration part of the test configuration configuration file is obtained: 10,000, indicating that the distributed database processes 10,000 test requests per second during the test, and the test time 1,500 seconds recorded in the test basic configuration is obtained, indicating that the distributed database needs to be tested for 1,500 seconds at a frequency of 10,000 test requests per second.
[0040] In the test processing process of the distributed database, the processing process for the sampling test request is also the same as that of the other test requests. The following takes the processing process of a sampling test request in the distributed database as an example to illustrate the test processing. The processing process of the other test requests and the sampling test request in the distributed database takes the test processing process of the following sampling test request as an example. This embodiment will not be repeated here. In an optional implementation manner provided by this embodiment, the distributed database performs test processing of the sampling test request in the following manner:
[0041] The transaction engine processes the data in the storage unit of the transaction engine according to the processing data and the operation data included in the sampling test request according to the operation data to obtain the first data;
[0042] The sampling test request is synchronized to the analysis engine, and the analysis engine processes the data in the storage unit of the analysis engine according to the processing data and the operation data to obtain the second data.
[0043] Specifically, after receiving the sampling test request, the distributed database first extracts the processing data and operation data contained in the sampling test request, synchronizes the processing data and operation data to the transaction engine, and processes the data in the storage unit of the transaction engine according to the operation data through the transaction engine to obtain the first data. The transaction engine synchronizes the sampling test request to the analysis engine, and the analysis engine processes the data in the storage unit of the analysis engine according to the processing data and operation data to obtain the second data.
[0044] In this embodiment, the sampled test request is sampled from the candidate test requests in the test request set according to the parameters of the data query configuration in the configuration file of the test configuration. The specific request contains the same content as the above test request. The above test request is taken as an example, and this embodiment will not be repeated here.
[0045] In the specific sampling process, the sampling test request in the test request set can be determined according to the number of data queries and / or the data query frequency of the data query configuration part in the configuration file of the test configuration. Specifically, the sampling frequency can be determined according to the data query frequency, and the total number of sampling test requests can be determined according to the number of data queries. In an optional implementation manner provided by this embodiment, the sampling test request is determined in the following manner:
[0046] Extracting the number of data queries and / or the data query frequency recorded in the test configuration;
[0047] The candidate test requests in the test request set are marked based on the number of data queries and / or the data query frequency, and the marked test requests are used as the sampled test requests.
[0048] For example, if the number of data queries is 10%, the data query frequency is 25%, and there are 10,000 candidate test requests in the test request set, then one sampled test request is marked in every 4 candidate test requests, and a total of 1,000 sampled test requests are marked.
[0049] In addition, the sampling method of the sampling test request can also be based on one of the data query times and the data query frequency. For example: based on the data query times, the test requests that meet the data query times can be selected in the test data set in sequence as the sampling test requests. For example: sampling selection can be performed in the test data set based on the data query frequency, and the number of sampling test requests can be determined according to the sampling results.
[0050] It should be noted that, during the testing process of the sampling test request provided above, the storage unit of the transaction engine and the storage unit of the analysis engine may be independent of each other; in addition, the transaction engine and the analysis engine may also share a storage unit, and the data in the shared storage unit may be transformed into storage forms according to the needs of the transaction engine and the analysis engine, such as row storage and column storage. In this regard, the distributed database may synchronize the sampling test request to the transaction engine, and the transaction engine performs data operations on the data in the shared storage unit according to the processing data and operation data contained in the sampling test request, and synchronizes the sampling test request to the analysis engine, and the analysis engine reads the data after the operation in the shared storage unit as the second data.
[0051] In addition, the test processing for the distributed database can also be performed when the distributed database is in a real traffic environment, that is: the synchronization delay of the transaction engine and the analysis engine can also be calculated when the distributed database processes real data, then: step S202 can be deleted; correspondingly, the sampling test request can be obtained through the sampling algorithm in the real request processing.
[0052] Step S204, querying the first data processed according to the sampling test request in the storage unit of the transaction engine of the distributed database, and polling the second data processed according to the sampling test request in the storage unit of the analysis engine of the distributed database.
[0053] Before the distributed database performs the test processing process, this embodiment first selects a sampled test request from the test request set by sampling to improve the availability of the test results and the test efficiency. When the distributed database performs the sampled test request, the storage unit of the transaction engine queries the first data processed according to the sampled test request, and the storage unit of the analysis engine polls the second data processed according to the sampled test request to determine the synchronization delay of the sampled test request between the two engines.
[0054] In specific implementation, the storage unit of the transaction engine of the distributed database queries the first data processed by the distributed database according to the sampling test request, and based on the first data, the analysis engine of the distributed database polls the second data processed by the distributed database according to the sampling test request. If the polled second data is the same as the first data, the polling is terminated and step S206 is executed. If the polled second data is different from the first data, the polling is continued until the second data is the same as the first data and the polling is terminated. Optionally, if the polled second data is the same as the first data, it is determined that the polling is terminated.
[0055] During the specific execution process, the storage unit of the transaction engine and the storage unit of the analysis engine may be independent of each other, or they may share a storage unit. In this regard, only the storage area and / or storage location of the data processed by the distributed database according to the sampling test request may be concerned, that is, only the data read by the transaction engine and the analysis engine may be concerned to avoid the impact of the storage deployment mode of the distributed database on the test. In an optional implementation mode provided by this embodiment, querying the first data processed according to the sampling test request in the storage unit of the transaction engine of the distributed database includes:
[0056] Connecting the distributed database according to the number of query threads recorded in the test configuration to perform data query on the distributed database in parallel through multiple threads;
[0057] After detecting that the test request processed by the distributed database is the sampling test request, the storage area of the data processed by the transaction engine according to the sampling test request is determined, and the first data stored in the storage area is queried.
[0058] Specifically, the number of query threads in the data query configuration part of the configuration file of the test configuration is read, so as to connect to the database through multiple threads to perform data query in parallel. Each thread can independently perform data query for the first data and / or the second data. After detecting that the test request processed by the distributed database is a sampling test request, that is, after the transaction engine completes processing the sampling test request, it determines the storage area of the data processed by the distributed database in the transaction engine according to the sampling test request, and queries the first data stored in the storage area.
[0059] For example, a sampling test request modifies the data in the first row of data table A. After detecting the sampling test request, the transaction engine determines the data in the first row of data table A read by the transaction engine, and determines the changed row of data as the first data.
[0060] In the specific execution process, the second data of the analysis engine is obtained by polling. Specifically, the storage data of the storage location after the sampling test request is processed and read by the analysis engine can also be queried. When the storage data is inconsistent with the first data, the query of the storage data continues, that is, polling the storage data, and stopping the polling when the storage data is the same as the first data, and taking the storage data that is the same as the first data as the second data. In an optional implementation manner provided by this embodiment, the second data processed by the sampling test request is polled in the storage unit of the analysis engine, including:
[0061] Determine a storage location of data processed according to the sampling test request, and perform polling processing of the storage data of the storage location using the first data as a reference;
[0062] After detecting that the polled stored data is identical to the first data, it is determined that the polling is completed and the stored data identical to the first data is used as the second data.
[0063] It should be noted that, in the case where multiple threads connect to the database to query the first data and / or the second data, each thread can execute step S204 separately, and step S204 can be regarded as the execution process of the data query task. When the thread is detected to be idle, the task is issued to the idle thread to query the first data and / or the second data. Specifically, the corresponding data query task can be generated according to the test configuration, and each task contains the information required for the execution of the task, such as data distribution, data size, etc. The generated task is written into the task pool. When there is a task in the task pool, the task is taken out from the task pool by the task executor and executed until all the tasks in the task pool are completed, that is, the sampling test request is processed by the distributed database. In the case of considering step S204 as a data query task, the task of processing the sampling test request can also be regarded as a synchronization delay parameter calculation task, that is, the number of data queries can be regarded as the crossover amount of the synchronization delay parameter calculation task and the remaining tasks, and the data query frequency can be regarded as the crossover frequency of the synchronization delay parameter calculation task and the remaining tasks, so as to improve the reliability and efficiency of the test by sampling.
[0064] It is particularly important to note that the execution process of step S204 can be looped until the sampling test request is processed and the loop is exited to execute step S206. Specifically, after each loop is completed, the indicators generated by the completion of each task can be collected through the data collector, such as: delay time, number of polling times, and operation type of the sampling test request.
[0065] Step S206: Calculate the synchronization delay parameter of the sampling test request based on the polling time of the second data and the query time of the first data.
[0066] In the specific implementation, after the second data processed by the distributed database according to each sampling test request is the same as the first data, the query time of the first data, the polling time of the second data and the number of polling times corresponding to each sampling test request are counted, and the synchronization delay parameters of each sampling test request are calculated based on the polling time of the second data and the query time of the first data to generate test results.
[0067] In this embodiment, the synchronization delay parameter refers to the synchronization delay in the storage unit of the transaction engine and analysis engine of the distributed database for data processed according to the sampling test request during the test of the distributed database. Specifically, the synchronization delay parameter may include the synchronization delay time, the number of polling times of the second data, and the request type of the sampling test request (the operation type of the operation data).
[0068] In a specific execution process, the query time of the first data may be used as a reference to calculate the synchronization delay time between the polling time of the second data and the query time of the first data, and the synchronization delay time, the polling number of the second data, and the request type of the sampling test request may be used as synchronization delay parameters. In an optional implementation manner provided in this embodiment, the synchronization delay parameter of the sampling test request is calculated, including:
[0069] Taking the query time of the first data as a reference, calculating the synchronization delay time of the total query time of the second data and the query time of the first data;
[0070] The synchronization delay time, the number of polling times for the second data, and the request type of the sampling test request are used as the synchronization delay parameters.
[0071] For example, if the first data is queried at 00:00:00, the time when the second data is the same as the first data is 00:00:02, and polling is performed 5 times, then the synchronization delay time between the second data and the first data is 2s, the number of polling times is 5, and the synchronization delay time 2s, the number of polling times 5 and the request type of the sampling test request are used as synchronization delay parameters.
[0072] Step S208: performing delay parameter screening based on the target operation type recorded in the test configuration, and generating a test result of the distributed database according to the screening result.
[0073] This embodiment uses the operation type parameters of the data query configuration part in the test configuration configuration file to screen the synchronization delay parameters of the operation types that the database administrator is concerned about in the synchronization delay parameters and generate test results. By configuring the operation type parameters, test processing of different test scenarios is implemented to provide the database administrator with test results that meet preset requirements.
[0074] In this embodiment, the target operation type is a parameter recorded in the data query configuration part of the configuration file of the test configuration before the test processing of the distributed database, which is used to set the test scenario. Specifically, the target operation type can be one or more of the four types of "add", "delete", "modify" and "query", or the target operation type can also be one of the three types of AD Hoc Insert (single addition), AD Hoc Update (single update) and Batch Query (batch query).
[0075] In specific implementation, delay parameter screening is performed on multiple synchronization delay parameters according to the target operation type recorded in the data query configuration file of the test configuration, and the test result of the distributed database is generated according to the synchronization delay parameter corresponding to the target operation type obtained by screening.
[0076] In the specific screening process, the request type of each sampled test request can be extracted, the target request type matching the target operation type is selected from the request type, and the synchronization delay parameter to which the target request type belongs is screened out from the synchronization delay parameter as the screening result, wherein the data operation type included in the sampled test request can be referred to as the request type. In an optional implementation manner provided in this embodiment, delay parameter screening is performed based on the target operation type recorded in the test configuration, including:
[0077] Extracting the request type included in the synchronization delay parameter, and selecting a target request type matching the target operation type from the request types;
[0078] The synchronization delay parameter corresponding to the target request type is filtered out as the filtering result.
[0079] For example, if the target operation type is AD Hoc Update, the request type of each sample test request is extracted, the target request type matching "change" is selected in the request type, and the synchronization delay parameter corresponding to the request type is filtered out as the filtering result.
[0080] In the specific test result generation process, statistical processing can be performed on the multiple synchronization delay parameters obtained by screening to obtain statistical results of the test processing of the distributed database, and each statistical sub-result in the statistical result is written into a template of the test result to obtain the test result, so as to send the test result to the test requester, for example, the test result is sent to the database administrator. In an optional implementation manner provided by this embodiment, the test result of the distributed database is generated according to the screening result, including:
[0081] Performing statistical processing on the synchronization delay parameters obtained through screening to obtain statistical results;
[0082] The statistical result is written into the test result template of the distributed database to obtain the test result, so as to send it to the test requester.
[0083] For example, statistical processing is performed on the screened synchronization delay parameters to obtain statistical results such as the average delay time, average polling times, maximum delay time, maximum polling times, variance, etc. when the second data and the first data are the same, and the sub-results of the statistical results are written into the test result template to obtain the test results, and the test results are sent to the database administrator.
[0084] In summary, the present embodiment provides one or more distributed database testing methods. During the distributed database testing process, a test request set is generated according to the test configuration and submitted to the distributed database to perform test processing of the test request in the distributed database, the first data processed according to the sampling test request is queried in the storage unit of the transaction engine of the distributed database, and the second data processed according to the sampling test request is polled in the storage unit of the analysis engine of the distributed database. If the second data polled is the same as the first data, the synchronization delay parameter of the sampling test request is calculated based on the polling time of the second data and the query time of the first data, the delay parameter is screened based on the target operation type recorded in the test configuration, and the test result of the distributed database is generated according to the screening result. The test result required by the test requester can be generated through the configuration of the target operation type.
[0085] Before testing, you can also sample the test request set according to the data query data and / or data query times recorded in the test configuration to obtain a sampled test request, thereby improving the test efficiency and reliability of the distributed database through sampling testing.
[0086] The following takes the application of a distributed database testing method provided in this embodiment in a database testing scenario as an example, combined with Figure 4 The distributed database testing method provided in this embodiment is further described. The distributed database testing method applied to the database testing scenario specifically includes the following steps.
[0087] Step S402: selecting test data of corresponding capacity from a test data pool according to the capacity parameters recorded in the test configuration.
[0088] Step S404: generate multiple test requests according to the test data and the operation type of the test data, and construct a test request set based on each test request.
[0089] Step S406 , importing the test request set into the distributed database according to the number of import threads recorded in the test configuration, so as to perform test processing of the test request in the distributed database.
[0090] Step S408: connecting to the distributed database according to the number of query threads recorded in the test configuration, so as to perform data query of the distributed database in parallel through multiple threads.
[0091] Step S410, after detecting that the test request processed by the distributed database is a sampling test request, determine the storage area of the data processed by the transaction engine according to the sampling test request, and query the first data stored in the storage area.
[0092] Step S412, determining the storage location of the data processed by the analysis engine according to the sampling test request, and performing polling processing on the storage data at the storage location.
[0093] Optionally, the sampled test request is obtained by extracting the number of data queries and / or the data query frequency recorded in the test configuration, and sampling and marking the candidate test requests in the test request set according to the number of data queries and / or the data query frequency.
[0094] Step S414: after detecting that the polled stored data is identical to the first data, determining that the polling is completed and using the stored data identical to the first data as the second data.
[0095] Step S416, calculating the synchronization delay parameter of each sampling test request based on the polling time of the second data and the query time of the first data, and the polling times of the second data.
[0096] Step S418, performing delay parameter screening based on the target operation type recorded in the test configuration, and generating a test result of the distributed database according to the screening result.
[0097] It should be noted that steps S410 to S414 may be executed in a loop in multiple threads until the distributed database completes processing of all sampling test requests, and after the test processing is completed, the loop is exited to execute step S416.
[0098] An embodiment of a distributed database testing device provided in this specification is as follows:
[0099] In the above-mentioned embodiment, a distributed database testing method is provided, and correspondingly, a distributed database testing device is also provided, which will be described below with reference to the accompanying drawings.
[0100] Reference Figure 5 , which shows a schematic diagram of an embodiment of a distributed database testing device provided in this embodiment.
[0101] Since the device embodiment corresponds to the method embodiment, the description is relatively simple, and the relevant parts can refer to the corresponding description of the method embodiment provided above. The device embodiment described below is only illustrative.
[0102] This embodiment provides a distributed database testing device, including:
[0103] A test request set generation module 502 is configured to generate a test request set according to the test configuration and submit it to the distributed database so as to perform test processing of the test request in the distributed database;
[0104] A data query module 504 is configured to query the storage unit of the transaction engine of the distributed database for the first data processed according to the sampling test request, and to poll the storage unit of the analysis engine of the distributed database for the second data processed according to the sampling test request;
[0105] If the second data polled is the same as the first data, the delay parameter calculation module 506 is run, and the delay parameter calculation module 506 is configured to calculate the synchronization delay parameter of the sampling test request based on the polling time of the second data and the query time of the first data;
[0106] The test result generating module 508 is configured to perform delay parameter screening based on the target operation type recorded in the test configuration, and generate the test result of the distributed database according to the screening result.
[0107] An embodiment of a distributed database test device provided in this specification is as follows:
[0108] Corresponding to the distributed database testing method described above, based on the same technical concept, one or more embodiments of this specification also provide a distributed database testing device, which is used to execute the distributed database testing method provided above. Figure 6 A schematic diagram of the structure of a distributed database testing device provided in one or more embodiments of this specification.
[0109] This embodiment provides a distributed database testing device, including:
[0110] like Figure 6As shown, the test equipment of the distributed database may have relatively large differences due to different configurations or performances, and may include one or more processors 601 and memory 602, and one or more storage applications or data may be stored in the memory 602. Among them, the memory 602 may be a short-term storage or a persistent storage. The application stored in the memory 602 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the test equipment of the distributed database. Further, the processor 601 may be configured to communicate with the memory 602, and execute a series of computer executable instructions in the memory 602 on the test equipment of the distributed database. The test equipment of the distributed database may also include one or more power supplies 603, one or more wired or wireless network interfaces 604, one or more input / output interfaces 605, and one or more keyboards 606.
[0111] In a specific embodiment, a test device for a distributed database includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the test device for the distributed database, and the one or more programs are configured to be executed by one or more processors, including computer executable instructions for performing the following:
[0112] Generate a test request set according to the test configuration and submit it to the distributed database to perform test processing of the test request in the distributed database;
[0113] querying the first data processed according to the sampling test request in the storage unit of the transaction engine of the distributed database, and polling the second data processed according to the sampling test request in the storage unit of the analysis engine of the distributed database;
[0114] If the second data polled is the same as the first data, calculating the synchronization delay parameter of the sampling test request based on the polling time of the second data and the query time of the first data;
[0115] Delay parameter screening is performed based on the target operation type recorded in the test configuration, and a test result of the distributed database is generated according to the screening result.
[0116] An embodiment of a computer-readable storage medium provided in this specification is as follows:
[0117] Corresponding to the distributed database testing method described above, based on the same technical concept, one or more embodiments of this specification also provide a computer-readable storage medium.
[0118] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions, and the computer-executable instructions implement the following process when executed:
[0119] Generate a test request set according to the test configuration and submit it to the distributed database to perform test processing of the test request in the distributed database;
[0120] querying the first data processed according to the sampling test request in the storage unit of the transaction engine of the distributed database, and polling the second data processed according to the sampling test request in the storage unit of the analysis engine of the distributed database;
[0121] If the second data polled is the same as the first data, calculating the synchronization delay parameter of the sampling test request based on the polling time of the second data and the query time of the first data;
[0122] Delay parameter screening is performed based on the target operation type recorded in the test configuration, and a test result of the distributed database is generated according to the screening result.
[0123] It should be noted that the embodiment of the computer-readable storage medium in this specification and the embodiment of the testing method of the distributed database in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the aforementioned corresponding method, and the repeated parts will not be repeated.
[0124] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referenced to each other. Each embodiment focuses on the differences from other embodiments. For example, the device embodiment, equipment embodiment and storage medium embodiment are similar to the method embodiment, so the description is relatively simple. To read the relevant content in the device embodiment, equipment embodiment and storage medium embodiment, please refer to the partial description of the method embodiment.
[0125] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0126] In the 1940s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to circuit structures such as diodes, transistors, switches, etc.) or software improvements (improvements to method flows). However, with the development of technology, many of today's method flow improvements can be regarded as direct improvements to hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0127] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F420. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0128] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0129] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0130] It should be understood by those skilled in the art that one or more embodiments of this specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0131] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0132] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0133] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0134] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0135] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0136] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0137] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0138] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0139] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.
Claims
1. A distributed database testing method, comprising: Generate a test request set according to the test configuration and submit it to the distributed database to perform test processing of the test request in the distributed database; querying the first data processed according to the sampling test request in the storage unit of the transaction engine of the distributed database, and polling the second data processed according to the sampling test request in the storage unit of the analysis engine of the distributed database; If the second data polled is the same as the first data, calculating the synchronization delay parameter of the sampling test request based on the polling time of the second data and the query time of the first data; Delay parameter screening is performed based on the target operation type recorded in the test configuration, and a test result of the distributed database is generated according to the screening result.
2. The distributed database testing method according to claim 1, wherein generating a test request set according to the test configuration and submitting the test request set to the distributed database comprises: Selecting test data of corresponding capacity from the test data pool according to the capacity parameters recorded in the test configuration; generating a plurality of test requests according to the test data and the operation type of the test data, and constructing the test request set based on each test request; The test request set is imported into the distributed database according to the number of import threads recorded in the test configuration.
3. The distributed database testing method according to claim 1, before performing the test processing operation of the test request, further comprising: Obtaining the data test frequency recorded in the test configuration, and determining the number of request processing per unit time according to the data test frequency; The test time recorded in the test configuration is extracted to determine that the test is completed after detecting that the request processing time matches the test time.
4. According to the distributed database testing method of claim 1, the distributed database performs the test processing of the sampling test request in the following manner: The transaction engine processes the data in the storage unit of the transaction engine according to the processing data and the operation data included in the sampling test request according to the operation data to obtain the first data; The sampling test request is synchronized to the analysis engine, and the analysis engine processes the data in the storage unit of the analysis engine according to the processing data and the operation data to obtain the second data.
5. According to the distributed database testing method of claim 1, the sampling test request is determined in the following manner: Extracting the number of data queries and / or the data query frequency recorded in the test configuration; The candidate test requests in the test request set are marked based on the number of data queries and / or the data query frequency, and the marked test requests are used as the sampled test requests.
6. The distributed database testing method according to claim 1, wherein the querying of the storage unit of the transaction engine of the distributed database for the first data processed according to the sampling test request comprises: Connecting the distributed database according to the number of query threads recorded in the test configuration to perform data query on the distributed database in parallel through multiple threads; After detecting that the test request processed by the distributed database is the sampling test request, the storage area of the data processed by the transaction engine according to the sampling test request is determined, and the first data stored in the storage area is queried.
7. The distributed database testing method according to claim 6, wherein the polling of the second data processed according to the sampling test request by the storage unit of the analysis engine of the distributed database comprises: Determine a storage location of data processed according to the sampling test request, and perform polling processing of the storage data at the storage location; The stored data obtained through polling is used as the second data.
8. The distributed database testing method according to claim 7, wherein the step of calculating the synchronization delay parameter of the sample test request comprises: Taking the query time of the first data as a reference, calculating the synchronization delay time of the total query time of the second data and the query time of the first data; The synchronization delay time, the number of polling times for the second data, and the request type of the sampling test request are used as the synchronization delay parameters.
9. The distributed database testing method according to claim 1, wherein the delay parameter screening based on the target operation type recorded in the test configuration comprises: Extracting the request type included in the synchronization delay parameter, and selecting a target request type matching the target operation type from the request types; The synchronization delay parameter corresponding to the target request type is filtered out as the filtering result.
10. The distributed database testing method according to claim 1, wherein generating the distributed database test result according to the screening result comprises: Performing statistical processing on the synchronization delay parameters obtained through screening to obtain statistical results; The statistical result is written into the test result template of the distributed database to obtain the test result, so as to send it to the test requester.
11. A distributed database testing device, comprising: A test request set generation module is configured to generate a test request set according to the test configuration and submit it to the distributed database so as to perform test processing of the test request in the distributed database; A data query module, configured to query a storage unit of a transaction engine of the distributed database for first data processed according to a sampling test request, and to poll a storage unit of an analysis engine of the distributed database for second data processed according to the sampling test request; If the second data polled is the same as the first data, running a delay parameter calculation module, wherein the delay parameter calculation module is configured to calculate a synchronization delay parameter of the sampling test request based on a polling time of the second data and a query time of the first data; The test result generating module is configured to perform delay parameter screening based on the target operation type recorded in the test configuration, and generate the test result of the distributed database according to the screening result.
12. A distributed database testing device, comprising: processor; and a memory configured to store computer executable instructions, wherein the processor executes the computer executable instructions to implement the following process: Generate a test request set according to the test configuration and submit it to the distributed database to perform test processing of the test request in the distributed database; querying the first data processed according to the sampling test request in the storage unit of the transaction engine of the distributed database, and polling the second data processed according to the sampling test request in the storage unit of the analysis engine of the distributed database; If the second data polled is the same as the first data, calculating the synchronization delay parameter of the sampling test request based on the polling time of the second data and the query time of the first data; Delay parameter screening is performed based on the target operation type recorded in the test configuration, and a test result of the distributed database is generated according to the screening result.
13. A computer-readable storage medium for storing computer-executable instructions, wherein the computer-executable instructions implement the steps of the method of claim 1 when executed.
