Distributed database stability testing method and device, electronic device and storage medium
By setting the expected pressure fluctuation mode and simulated abnormal interference in the distributed database stability test, the problems of low testing efficiency and insufficient coverage in the existing technology are solved, and more efficient and comprehensive database stability testing is achieved.
Patent Information
- Application Number
- CN202411641384.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-11-18
AI Technical Summary
When conducting distributed database stability testing, the testing process is low and the test coverage is not large enough, making it difficult to effectively ensure the stability of distributed databases.
By setting the expected pressure fluctuation mode, including multiple transformer modes and constant voltage modes, the test cases are called to perform tests and simulate abnormal interference in different pressure modes during the test, including abnormal interference in disk, memory, network and software services.
It improves the efficiency and coverage of database stability testing, makes the test scenario closer to the actual usage scenario, and can more comprehensively evaluate the performance and stability of the database.
Smart Images

Figure CN119149438B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of database testing, and in particular to a distributed database stability testing method and device, electronic equipment and storage medium. Background Art
[0002] In the field of database software systems, with the widespread application of distributed databases by users, the stability issues of distributed databases in various complex scenarios have begun to emerge. With the running time, the concurrency of user application scenarios, the continuous growth of data, and the multi-node deployment characteristics of distributed databases, the stability of distributed databases is difficult to guarantee.
[0003] When conducting stability testing, there will be problems such as low test efficiency and insufficient test coverage. Summary of the invention
[0004] In view of the above problems, the present invention provides a distributed database stability testing method, apparatus, device and storage medium.
[0005] According to a first aspect of the present invention, a distributed database stability testing method is provided, comprising the following operations: setting an expected pressure fluctuation pattern for characterizing expected pressure changes over time, wherein the expected pressure fluctuation pattern includes a plurality of variable pressure patterns and a plurality of constant pressure patterns; calling a test case to execute the test, and making the actual pressure fluctuation pattern during the actual test conform to the expected pressure fluctuation pattern; performing a first abnormal interference in a first test phase in which the actual pressure fluctuation pattern during the actual test conforms to the constant pressure pattern; performing a second abnormal interference in a second test phase in which the actual pressure fluctuation pattern during the actual test conforms to the variable pressure pattern.
[0006] According to an embodiment of the present invention, the types of the first abnormal interference and the second abnormal interference both include disk abnormal interference, memory abnormal interference, network abnormal interference and software service abnormal interference.
[0007] According to an embodiment of the present invention, in the first abnormal interference, the number of disk abnormal interferences is increased; in the second abnormal interference, the number of memory abnormal interferences or network abnormal interferences is increased.
[0008] According to an embodiment of the present invention, the quantity distribution of each type of abnormal interference in the first abnormal interference and the second abnormal interference is respectively set according to preset conditions, wherein the preset conditions are set according to the historical records of abnormalities occurring during the operation of the database.
[0009] According to an embodiment of the present invention, a method for setting an expected pressure fluctuation mode includes: setting multiple pressure fluctuation peaks corresponding to multiple pressure change modes; wherein the pressure peak value of each pressure fluctuation peak is randomly obtained within a custom peak range; and the step length of each pressure fluctuation peak is randomly obtained within a custom peak time range. According to an embodiment of the present invention, the method of calling a test case is distributed scheduling or centralized scheduling; the pressure change of the pressure change mode is generated by changing the scheduling method of calling the test case and changing the number of calling the test case.
[0010] According to an embodiment of the present invention, each test case is a plurality of operations executed in a chain, and the plurality of operations include creation of database objects, loading of data, addition, deletion, modification and query of data, and deletion and cleanup of data objects.
[0011] The second aspect of the present invention provides a distributed database stability testing device including: a setting module, used to set an expected pressure fluctuation pattern for characterizing the expected pressure change over time, wherein the expected pressure fluctuation pattern includes a plurality of variable pressure modes and a plurality of constant pressure modes; a testing module, used to call the test case to perform the test, and make the actual pressure fluctuation pattern during the actual test period conform to the expected pressure fluctuation pattern; a first interference module, used to perform a first abnormal interference in the first test phase when the actual pressure fluctuation pattern during the actual test period conforms to the constant pressure mode; a second interference module, used to perform a second abnormal interference in the second test phase when the actual pressure fluctuation pattern during the actual test period conforms to the variable pressure mode.
[0012] The third aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more computer programs, and when the one or more processors execute the one or more computer programs, the steps of the above-mentioned distributed database stability testing method are implemented.
[0013] The fourth aspect of the present invention further provides a computer-readable storage medium on which a computer program or instruction is stored. When the computer program or instruction is executed by a processor, the steps of the above-mentioned distributed database stability testing method are implemented.
[0014] According to an embodiment of the present invention, by pre-setting a plurality of constant pressure modes and a plurality of variable pressure modes for database stability testing, the periodic pressure changes of the database during use can be simulated, and the pressure fluctuation mode can be set according to the version update cycle of the database, during which different interference items are added, so that different interference item adding strategies are adopted in the variable pressure mode and the constant pressure mode, respectively, which is closer to the possible items and frequency of abnormal situations in the actual database usage scenario, thereby improving the efficiency and coverage of the database stability test. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above contents and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:
[0016] Figure 1 The application scenario of the distributed database stability testing method according to an embodiment of the present invention is shown;
[0017] Figure 2 A flow chart of a distributed database stability testing method according to an embodiment of the present invention is shown;
[0018] Figure 3 A flow chart showing a method for testing database stability by setting multiple pressure fluctuation peaks according to an embodiment of the present invention is shown;
[0019] Figure 4 A schematic diagram of a time axis of multiple pressure fluctuation peaks according to an embodiment of the present invention is shown;
[0020] Figure 5 It shows a structural block diagram of a distributed database stability testing device according to an embodiment of the present invention;
[0021] Figure 6 A block diagram of an electronic device for distributed database stability testing according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0022] Below, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of concepts of the present invention.
[0023] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0024] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0025] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0026] In the technical solution of the present invention, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0027] It should be noted that the distributed database stability testing method and device, electronic device and storage medium of the embodiments of the present invention can be applied to the fields of big data technology, database technology and database testing technology, and can also be used in any field other than the fields of big data technology, database technology and database testing technology. The embodiments of the present invention do not limit the application fields of the above-mentioned distributed database stability testing method and device, electronic device and storage medium.
[0028] An embodiment of the present invention provides a distributed database stability testing method, including the following operations: setting an expected pressure fluctuation pattern for characterizing expected pressure changes over time, wherein the expected pressure fluctuation pattern includes multiple variable pressure patterns and multiple constant pressure patterns; calling a test case to execute the test, and making the actual pressure fluctuation pattern during the actual test conform to the expected pressure fluctuation pattern; performing a first abnormal interference in the first test phase when the actual pressure fluctuation pattern conforms to the constant pressure pattern during the actual test; and performing a second abnormal interference in the second test phase when the actual pressure fluctuation pattern conforms to the variable pressure pattern during the actual test.
[0029] Figure 1 The application scenario of the distributed database stability testing method according to an embodiment of the present invention is shown.
[0030] like Figure 1As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0031] The user may use at least one of the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0032] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0033] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0034] It should be noted that the distributed database stability testing method provided in the embodiment of the present invention can generally be executed by the server 105. Accordingly, the distributed database stability testing device provided in the embodiment of the present invention can generally be set in the server 105. The distributed database stability testing method provided in the embodiment of the present invention can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the distributed database stability testing device provided in the embodiment of the present invention can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0035] It should be understood that Figure 1The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0036] The following will be based on Figure 1 The scene described by Figure 2~Figure 4 The database automated functional testing method according to the embodiment of the present invention is described in detail.
[0037] Figure 2 A flow chart of a distributed database stability testing method according to an embodiment of the present invention is shown.
[0038] like Figure 2 As shown, the method includes operations S201 to S204.
[0039] In operation S201, an expected pressure fluctuation pattern for characterizing expected pressure changes over time is set, wherein the expected pressure fluctuation pattern includes a plurality of variable pressure patterns and a plurality of constant pressure patterns.
[0040] In operation S202 , the test case is called to execute the test, and the actual pressure fluctuation pattern during the actual test is made to conform to the expected pressure fluctuation pattern.
[0041] In operation S203, during the first test phase in which the actual pressure fluctuation pattern conforms to the constant pressure pattern in the actual test period, a first abnormal disturbance is performed.
[0042] In operation S204, during the actual test period, during a second test phase in which the actual pressure fluctuation pattern conforms to the pressure variation pattern, a second abnormal disturbance is performed.
[0043] According to an embodiment of the present invention, before operation S201, the test environment should simulate the production environment as much as possible, including server configuration, operating system, database version, data set size, etc.
[0044] According to an embodiment of the present invention, in operation S201~operation S202, the pressure of the database can be defined as different usage rates of the central processing unit (CPU), that is, 0~100%. In some embodiments of the present invention, a pressure peak value of the CPU usage rate can be preset, such as a maximum pressure of 80%; a minimum pressure value can also be defined, that is, the lowest usage pressure, such as 5%, so that the database is always in a state of pressure operation during the test.
[0045] According to an embodiment of the present invention, in operation S201, before the database stability test, the user sets the pressure fluctuation mode according to the test requirements, such as according to the actual application scenario of the database. For example, the version cycle of the target database is one week, i.e. seven days. During the daytime of each day of the seven days, the database usage pressure is relatively high, presenting a peak state. Then the fluctuation pressure model can be set to seven small cycles. The pressure fluctuation in each cycle first rises and then falls, and then presents a stable constant pressure state, which corresponds to the late night in the actual application scenario.
[0046] According to an embodiment of the present invention, in operation S201, multiple constant pressure modes and variable pressure modes can be set in the pressure fluctuation mode. The constant pressure mode can simulate the scenario where the database is used less in actual application or the user usage changes less. In the stress test, the simulated database load is kept at a fixed level and does not change with time or other factors. It is suitable for simulating those application scenarios where the usage is relatively stable and does not change much, for example, some background processing tasks or night batch processing jobs, and the database access mode of these tasks is usually relatively consistent. The variable pressure mode is further subdivided into two modes: boost and buck. The boost mode refers to gradually increasing the simulated database load until a preset maximum value is reached, simulating the situation where the number of users or usage is gradually increasing, such as promotional activities, holiday traffic peaks, etc.; the buck mode refers to gradually reducing the simulated database load until a preset minimum value is reached or stopped, simulating the situation where the number of users or usage is gradually decreasing, such as the decline in traffic after the end of the promotion. The constant pressure and variable pressure modes can be combined to simulate more complex usage scenarios, such as first conducting a constant pressure test for a period of time, and then switching to boost or buck mode to more comprehensively evaluate the performance of the database. Combined with the cycle setting, the pressure fluctuation changes of the database within a version cycle can be simulated, and the problems exposed when the database runs continuously for a long time can be examined. For example, the stability problem of a database will not be reflected in the detection for 7 days, but when the database runs continuously for 30 days, problems may be exposed. By simulating the usage scenarios as much as possible and setting the expected pressure fluctuation mode in combination with the data update version cycle, the performance of the database can be evaluated more comprehensively.
[0047] According to an embodiment of the present invention, in operation S202, the actual test pressure is increased by continuously calling preset test cases for testing, and when the preset fluctuation mode value is reached at each time point, the test case is stopped from being called. For example, if the preset pressure fluctuation mode is in a constant pressure mode during the 0th to 1st hour, then the test case needs to be called during this period to maintain a relatively stable test pressure. If the database pressure reaches a peak value during the 1st to 2nd hour, then the test case needs to be continuously called to increase the actual test pressure to meet the preset pressure, and the actual pressure fluctuation mode is made consistent with the expected pressure fluctuation mode by increasing and calling and reducing the test case.
[0048] In operation S203, during the first test phase in which the actual pressure fluctuation pattern conforms to the constant pressure pattern in the actual test period, a first abnormal disturbance is performed.
[0049] In operation S204, during the actual test period, during a second test phase in which the actual pressure fluctuation pattern conforms to the pressure variation pattern, a second abnormal disturbance is performed.
[0050] According to an embodiment of the present invention, in operations S203 to S204, various problems may occur during the actual use of the database, such as network fluctuations, memory anomalies, disk anomalies, or software service anomalies, and the ability of the database to handle these actual uncontrollable and random problems is an important indicator for examining the stability of the database. Therefore, during the database stability test, various abnormal interferences are added to simulate the situation in which the database faces various random and uncontrollable abnormal problems during actual use, making the database stability test more comprehensive and closer to the actual use scenario of the database. At different stress stages, all types of exceptions must be tested to achieve a wider data testing coverage effect, and the number of exception types at different stages must be adjusted. This is because in the actual operation of the database, the probability of exceptions occurring at each stage is different and is affected by certain factors. For example, in the simulated daytime business peak stage, the network is more congested, and the number of users is increasing. The probability of various network exceptions will increase accordingly, which will be higher than the probability of network exceptions occurring during the constant voltage stage late at night. Therefore, the test can be performed by increasing the interference of network exceptions during the voltage transformation stage to improve the efficiency of database stability testing and be closer to actual application scenarios, provide more comprehensive risk warnings for subsequent use of the database after testing, and solve corresponding problems during the testing process to avoid such problems during database use and increase testing efficiency.
[0051] According to an embodiment of the present invention, in operation S203, during the constant voltage stage, the database faces various abnormal problems. In order to make the stability test of the database closer to the actual usage scenario, a first abnormal interference for the constant voltage stage is set, and targeted settings are made according to the abnormal conditions that occur during the constant voltage stage when the actual database is used. At the same time, the first abnormal interference also includes all interference items in the preset interference, but the number of abnormalities is increased for the high-frequency abnormalities in the constant voltage stage. This not only tests the processing capacity of the database for all abnormal types occurring in the constant voltage stage, but also can test the processing capacity of the database when high-frequency abnormalities occur.
[0052] According to an embodiment of the present invention, in operation S204, during the transformation stage, the database faces various abnormal problems. In order to make the stability test of the database closer to the actual use scenario, a second abnormal interference for the transformation stage is set, and targeted settings are made according to the abnormal conditions that occur during the transformation stage when the actual database is used. At the same time, the second abnormal interference also includes all interference items in the preset interference. The number of abnormal types can be reduced through the historical data of abnormal occurrences, avoiding inefficiency caused by complicated testing processes. Not only can the processing capacity of the database of all abnormal types occurring in the transformation stage be tested, but also the processing capacity of the database when abnormalities occur can be tested in a targeted manner.
[0053] In some embodiments of the present invention, in operation S204, the second abnormal interference can also be set according to the boost stage and the decompression stage of the voltage transformation mode, and targeted abnormal settings can be made according to the abnormal situations that are likely to occur when the database pressure increases during actual use. The number of high-frequency abnormal items in the actual boost stage is increased accordingly. Similarly, corresponding targeted settings are also made in the decompression stage, so that the test of the database is closer to the actual use scenario, the stability investigation of the database is more comprehensive and has a wider coverage, and as many hidden problems as possible are exposed in the test to increase the efficiency of the stability test.
[0054] According to an embodiment of the present invention, a user sets an expected pressure fluctuation pattern according to actual application requirements, and simulates the pressure changes of an actual application database for testing through customized settings of a constant pressure mode and a variable pressure mode; at the same time, through personalized settings of the first abnormal interference and the second abnormal interference, different interference modes are set for the constant pressure stage and the variable pressure stage, and the first abnormality and the second abnormality interference are set for the abnormal type frequencies of different pressure modes, which not only makes the test scenario closer to the actual use scenario of the database, but also increases the coverage of the database stability test, while improving the efficiency of the database test.
[0055] According to an embodiment of the present invention, the types of the first abnormal interference and the second abnormal interference both include disk abnormal interference, memory abnormal interference, network abnormal interference and software service abnormal interference.
[0056] According to the embodiments of the present invention, different from the traditional random exception issuance method which can only randomly test a certain abnormal situation corresponding to a certain stage of the database, the first abnormal interference and the second abnormal interference of the present invention both include all preset abnormal interference types, which can make the test coverage of the database reach a wider range. In actual use, various types of abnormalities may appear in various stages, so all types of abnormalities must be issued at least once in each stage, which can ensure that the test coverage of the database is wider and various possibilities are tested.
[0057] According to an embodiment of the present invention, disk abnormal interference may include disk input and output (I / O) performance problems, disk response time becomes longer, resulting in database operation delays; insufficient disk space: when disk space is insufficient, the database may not be able to write new data or logs; disk hardware failure, disk connection problems, etc. may cause disk access failures, all of which can be tested as disk abnormal interference. Memory abnormal interference may include memory leaks, which may cause a decrease in available memory over time, affecting database performance; memory overflow, when the database workload exceeds the physical memory capacity, may cause frequent page swaps (swap), reducing performance; memory access conflicts, in a multi-tasking environment, memory access conflicts may cause insufficient memory allocation for database processes, all of which can be tested as memory abnormal interference. Network abnormal interference may include network delays, increased network delays will affect remote connections and data transmission of the database; network congestion, excessive network traffic, resulting in packet loss or delay; network hardware failures, switch, router or network card failures, may cause network connection interruptions; network security issues, network attacks or configuration errors, may cause service interruptions or data leaks, all of which can be tested as disk abnormal interference. Abnormal interference to software services may include database configuration errors. Incorrect database configuration may lead to performance degradation or unstable service; operating system problems. Operating system errors or improper resource management may affect database services; application errors. Errors or logical errors in applications may cause database operation failures; third-party service failures. Failures of dependent third-party services such as the domain name system or network time protocol may affect the normal operation of the database. All of these can be tested as abnormal interference to software services.
[0058] According to an embodiment of the present invention, in the first abnormal interference, the number of disk abnormal interferences is increased; in the second abnormal interference, the number of memory abnormal interferences or network abnormal interferences is increased.
[0059] According to the embodiment of the present invention, the constant voltage stage is generally based on the late night in the actual application scenario, when the database load is low and the number of users is relatively small and in a relatively stable state. Although user requests may decrease during the constant voltage stage, the health of the disk will not change over time. If there is a potential hardware problem with the disk, it may fail at any time. Therefore, the number of abnormal disk interferences during the constant voltage stage can be increased to increase the efficiency of database testing.
[0060] According to an embodiment of the present invention, the voltage transformation stage is generally based on the daytime peak period in the actual application scenario. The database load is high and the number of users increases. The database may process more queries and transactions during the peak period, requiring more memory resources. If the memory is insufficient or there is a memory leak, it may cause memory overflow, frequent switching or service crash and other memory anomalies; during the peak period, due to the increase in user requests, network traffic may increase, resulting in network congestion, delays or packet loss and other network anomalies. If the network bandwidth is insufficient or improperly configured, network problems may be more prominent. Therefore, the number of memory anomaly interference or network anomaly interference in the voltage transformation stage can be increased to increase the efficiency of database testing.
[0061] According to an embodiment of the present invention, the quantity distribution of each type of abnormal interference in the first abnormal interference and the second abnormal interference is respectively set according to preset conditions, wherein the preset conditions are set according to the historical records of abnormalities occurring during the operation of the database.
[0062] According to an embodiment of the present invention, the number of abnormal interferences during the test can also be set according to the abnormal situations that have occurred in the actual operation history records of the database. For example, if the network environment of the database to be tested is unstable at night, then when the first interference includes all types of abnormal interference, the number of abnormal network interferences is increased to be closer to the actual application scenario.
[0063] Figure 3 A flowchart of a database stability test for setting multiple pressure fluctuation peaks according to an embodiment of the present invention is shown. Figure 4 A schematic diagram of a time axis of multiple pressure fluctuation peaks according to an embodiment of the present invention is shown.
[0064] like Figure 3 As shown, this embodiment includes the following operations S301 to S304.
[0065] In operation S301, an expected pressure fluctuation pattern is set to characterize the expected pressure change over time, wherein the expected pressure fluctuation pattern includes multiple pressure fluctuation peaks; wherein the pressure peak value of each pressure fluctuation peak is randomly obtained within a custom peak range; and the step size of each pressure fluctuation peak is randomly obtained within a custom peak time range.
[0066] In operation S302 , the test case is called to execute the test, and the actual pressure fluctuation pattern during the actual test is made to conform to the expected pressure fluctuation pattern.
[0067] In operation S303 , a first abnormal disturbance is performed during a first test phase in which an actual pressure fluctuation pattern conforms to a constant pressure pattern during an actual test.
[0068] In operation S304, during the actual test period, during a second test phase in which the actual pressure fluctuation pattern conforms to the pressure variation pattern, a second abnormal disturbance is performed.
[0069] According to an embodiment of the present invention, in operation S301, the stability test running time can be determined according to the version release cycle, such as the test time is 3*24 hours, wherein the pressure stage is divided into a constant pressure stage and a variable pressure stage, and the pressure change of one day according to the real user usage scenario is defined as a fluctuation cycle, similar to a normal distribution curve, with a pressure increase stage, a pressure reduction stage and a constant pressure stage as a peak. When setting the preset pressure fluctuation mode, set a custom peak range and a custom peak time, such as setting the custom range of the peak to 50%~80% of the central processing unit (CPU) usage rate, that is, the highest value of the peak is randomly obtained within this range, such as the first peak peak is 60%, the second peak peak is 75%, and so on; the custom peak time is expressed as a step length of a peak, such as setting the custom peak time range to 10 minutes~30 minutes, that is, the step length of the peak is randomly obtained within this range, such as the step length corresponding to the first peak of 60% is randomly obtained as 12 minutes, and the step length corresponding to the second peak of 75% is randomly obtained as 22 minutes.
[0070] In some specific embodiments of the present invention, for example, the test time is 3*24 hours, simulating a real business scenario of 5 days, thereby generating a pressure fluctuation time axis and generating 5 fluctuation peaks, but the peaks and waveforms will be different according to the pressure value and pressure time randomly obtained each time. The generated expected pressure fluctuation pattern schematic diagram is as follows Figure 4 shown.
[0071] According to an embodiment of the present invention, a preset pressure fluctuation mode is set according to the test time. When the database is actually used, although 30 identical peaks can be set to simulate a pressure change test with a cycle of one month, the actual pressure is not the same every day, and the pressure duration is also different. Therefore, the peak value can be randomly selected when generating the fluctuation timeline, and the duration of the peak pressure stage is randomly obtained within a fixed time range. The random combination of the two factors will make the pressure fluctuation generated each time more likely to be different, thereby increasing the coverage of different pressure factors.
[0072] According to an embodiment of the present invention, the method of calling test cases is distributed scheduling or centralized scheduling; the pressure change of the voltage-changing mode is generated by changing the scheduling method of calling test cases and changing the number of called test cases.
[0073] According to an embodiment of the present invention, the two scheduling methods can quickly achieve the expected pressure changes, thereby improving the efficiency of pressure changes and providing support for simulating real pressure changes in a short time. In addition, due to the differences in scheduling methods and pressures, the set of use cases executed concurrently each time will also be different, further enriching the test scenarios.
[0074] In some embodiments of the present invention, the actual test pressure is increased in a short time by increasing the number of test cases and adopting a centralized scheduling method; the actual test pressure is reduced in a short time by reducing the number of test cases and adopting a distributed scheduling method.
[0075] According to an embodiment of the present invention, each test case is a plurality of operations executed in a chain, and the plurality of operations include creation of database objects, loading of data, addition, deletion, modification and query of data, and deletion or cleanup of data objects.
[0076] According to an embodiment of the present invention, test cases should be collected before testing, and the test cases should cover all functional items supported by the database as much as possible. Typical test cases in the regression test case library or user scenarios can be selected, and each test case needs to be chained according to the four steps of database object creation, data loading, data addition, deletion, modification and query operations, and data object deletion or cleaning. When reading the test case, the type of operation can be known according to the test case text name or the test case directory. By chaining the test cases, a comprehensive, systematic and efficient database testing process can be constructed to ensure that the quality and performance of the database system meet the expected requirements.
[0077] In some specific embodiments of the present invention, the issuance of abnormal interference can be fully realized not only in the constant voltage stage and the voltage transformation stage, but also in the specific operations of the four chain operations of the test case. In the creation operation of the database objects in all test cases, it must be ensured that the disk abnormal interference, memory abnormal interference, network abnormal interference and software service abnormal interference are all issued once.
[0078] Figure 5 The structure block diagram of the distributed database stability testing device according to an embodiment of the present invention is schematically shown.
[0079] like Figure 5 As shown, the database automated functional testing device 500 of this embodiment includes a setting module 510 , a testing module 520 , a first interference module 530 and a second interference module 540 .
[0080] The setting module 510 is used to set an expected pressure fluctuation mode for characterizing the expected pressure change over time, wherein the expected pressure fluctuation mode includes multiple variable pressure modes and multiple constant pressure modes. In one embodiment, the setting module 510 can be used to perform the operation S201 described above, which will not be repeated here.
[0081] The test module 520 is used to call the test case to perform the test and make the actual pressure fluctuation pattern during the actual test conform to the expected pressure fluctuation pattern. In one embodiment, the test module 520 can be used to perform the operation S202 described above, which will not be repeated here.
[0082] The first interference module 530 is used to perform a first abnormal interference in the first test phase when the actual pressure fluctuation pattern conforms to the constant pressure pattern during the actual test period. In one embodiment, the first interference module 530 can be used to perform the operation S203 described above, which will not be described in detail here.
[0083] The second interference module 540 is used to perform a second abnormal interference in the second test phase when the actual pressure fluctuation pattern conforms to the pressure change pattern during the actual test period. In one embodiment, the second interference module 540 can be used to perform the operation S204 described above, which will not be described in detail here.
[0084] According to an embodiment of the present invention, at least one of the setting module 510, the test module 520, the first interference module 530 and the second interference module 540 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or may be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or by any one of the three implementation methods of software, hardware and firmware or by a proper combination of any of them. Alternatively, at least one of the setting module 510, the test module 520, the first interference module 530 and the second interference module 540 may be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function may be executed.
[0085] According to an embodiment of the present invention, a user sets an expected pressure fluctuation pattern according to actual application requirements, and simulates the pressure changes of an actual application database for testing through customized settings of a constant pressure mode and a variable pressure mode; at the same time, through personalized settings of the first abnormal interference and the second abnormal interference, different interference modes are set for the constant pressure stage and the variable pressure stage, and the first abnormality and the second abnormality interference are set for the abnormal type frequencies of different pressure modes, which not only makes the test scenario closer to the actual use scenario of the database, but also increases the coverage of the database stability test, while improving the efficiency of the database test.
[0086] Figure 6 A block diagram of an electronic device for a database automated functional testing method according to an embodiment of the present invention is schematically shown.
[0087] like Figure 6As shown, the electronic device 600 according to an embodiment of the present invention includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 to a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include an onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.
[0088] In RAM 603, various programs and data required for the operation of electronic device 600 are stored. Processor 601, ROM 602 and RAM 603 are connected to each other via bus 604. Processor 601 performs various operations of the method flow according to the embodiment of the present invention by executing the program in ROM 602 and / or RAM 603. It should be noted that the program can also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 can also perform various operations of the method flow according to the embodiment of the present invention by executing the program stored in the one or more memories.
[0089] According to an embodiment of the present invention, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to the bus 604. The electronic device 600 may further include one or more of the following components connected to the input / output (I / O) interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 608 including a hard disk, etc.; and a communication portion 609 including a network interface card such as a network (LAN) card, a modem, etc. The communication portion 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage portion 608 as needed.
[0090] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present invention is implemented.
[0091] According to an embodiment of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present invention, the computer-readable storage medium may include the ROM 602 and / or RAM 603 described above and / or one or more memories other than ROM 602 and RAM 603.
[0092] The embodiment of the present invention also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the above method provided by the embodiment of the present invention.
[0093] The computer program executes the above functions defined in the system / device of the embodiment of the present invention when it is executed by the processor 601. According to the embodiment of the present invention, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0094] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 609, and / or installed from a removable medium 611. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0095] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above functions defined in the system of the embodiment of the present invention are performed. According to the embodiment of the present invention, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0096] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0097] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0098] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present invention may be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present invention. In particular, without departing from the spirit and teachings of the present invention, the features described in the various embodiments of the present invention may be combined and / or combined in various ways. All of these combinations and / or combinations fall within the scope of the present invention.
[0099] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A distributed database stability testing method, characterized in that: The following operations are included: An expected pressure fluctuation mode is set to characterize the expected pressure change over time, wherein the expected pressure fluctuation mode includes multiple variable pressure modes and multiple constant pressure modes; wherein the constant pressure mode is to keep the database load at a fixed level, and the variable pressure mode is divided into two modes: boost mode and buck mode, wherein the boost mode is to gradually increase the simulated database load until a preset maximum value is reached, and the buck mode is to gradually reduce the simulated database load until a preset minimum value is reached or the load stops; Calling the test case to execute the test, and making the actual pressure fluctuation pattern during the actual test period conform to the expected pressure fluctuation pattern; Performing a first abnormal disturbance during a first test phase in which the actual pressure fluctuation pattern conforms to the constant pressure pattern during the actual test period; Performing a second abnormal interference during a second test phase in which the actual pressure fluctuation pattern conforms to the pressure variation pattern during the actual test period; The types of the first abnormal interference and the second abnormal interference both include disk abnormal interference, memory abnormal interference, network abnormal interference and software service abnormal interference.
2. The method according to claim 1, characterized in that In the first abnormal interference, increasing the number of the disk abnormal interference; In the second abnormal interference, the number of the memory abnormal interference or the network abnormal interference is increased.
3. The method according to claim 2, characterized in that Also includes: The quantity distribution of each type of abnormal interference in the first abnormal interference and the second abnormal interference is respectively set according to preset conditions, wherein the preset conditions are set according to the historical records of abnormalities occurring during the operation of the database.
4. The method according to claim 1, characterized in that: The method for setting the expected pressure fluctuation mode comprises: A plurality of pressure fluctuation peaks corresponding to the plurality of pressure change modes are set; wherein, The peak pressure value of each pressure fluctuation peak is randomly obtained within the custom peak range; The step size of each pressure fluctuation peak is randomly obtained within the custom peak time range.
5. The method according to claim 1, characterized in that The scheduling mode for calling test cases is distributed scheduling or centralized scheduling; The pressure change of the variable pressure mode is generated by changing the scheduling method of calling the test case and changing the calling number of the calling test case.
6. The method according to claim 1, characterized in that Each of the test cases is a plurality of operations executed in a chain, and the plurality of operations include creation of database objects, loading of data, addition, deletion, modification and query of data, and deletion and cleanup of data objects.
7. A distributed database stability testing device, characterized in that: include: A setting module, used to set an expected pressure fluctuation mode for characterizing expected pressure changes over time, wherein the expected pressure fluctuation mode includes multiple variable pressure modes and multiple constant pressure modes; wherein the constant pressure mode is to keep the database load at a fixed level, and the variable pressure mode is divided into two modes: boost mode and buck mode, wherein the boost mode is to gradually increase the simulated database load until a preset maximum value is reached, and the buck mode is to gradually reduce the simulated database load until a preset minimum value is reached or the load stops; A test module, used for calling a test case to execute a test, and making an actual pressure fluctuation pattern during an actual test period conform to the expected pressure fluctuation pattern; A first interference module, configured to perform a first abnormal interference during a first test phase in which the actual pressure fluctuation pattern meets the constant pressure pattern during the actual test period; A second interference module, configured to perform a second abnormal interference during a second test phase in which the actual pressure fluctuation pattern meets the pressure variation pattern during the actual test period; and The types of the first abnormal interference and the second abnormal interference both include disk abnormal interference, memory abnormal interference, network abnormal interference and software service abnormal interference.
8. An electronic device, comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Database pressure test method and device, electronic equipment and readable storage medium
CN116431452A
Automatic pressure testing method, device and equipment and readable storage medium
CN118312440A