Server performance test method, device, equipment, medium and program product
By determining the cache replacement data volume based on the server's historical search record and cache capacity in the software system performance test, and performing normal distribution probability extraction, the problem of large amount of test data preparation is solved, and the test mimicry and reliability are improved.
Patent Information
- Application Number
- CN202411893557.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-05-09
AI Technical Summary
In software system performance testing, the workload of preparing test data is high and existing methods lead to a data set, affecting the test effect.
The cache replacement data amount is determined based on the historical search record and data cache capacity of the server being tested, the test data group is divided, and the test data is extracted from each group based on the normal distribution probability for performance testing.
It ensures that the server's disk read and write is fully tested, avoids test results deviations caused by the test data set, and improves the test mimicry and reliability.
Smart Images

Figure CN119961115A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of software testing technology or the field of financial technology, and more specifically to a server performance testing method, device, equipment, medium and program product. Background Art
[0002] During the software system performance testing process, the preparation of test data is a very systematic and labor-intensive task. Before executing the performance test, it is generally necessary to prepare basic data to simulate the performance of the system for a period of time after it goes online.
[0003] In the related art, the preparation of the base data often involves extracting all table records of consecutive pages from the table. Such an operation will lead to data concentration, which is different from the actual test situation and thus leads to poor test results. On the other hand, during the software testing process, insufficient test data will lead to insufficient performance testing. Summary of the invention
[0004] In view of the above problems, the present disclosure provides a server performance testing method, apparatus, device, medium and program product.
[0005] According to the first aspect of the present disclosure, a server performance testing method is provided, comprising: determining a cache replacement data volume for test data based on a historical search record of a server under test and a data cache capacity of the server under test, wherein the data cache capacity is n, the cache replacement data volume is 2n, and n is a positive integer greater than 0; dividing the test data into m test data groups based on a preset number of groups, and m is a positive integer greater than 0; extracting data from each of the test data groups based on a preset normal distribution probability to obtain 2n first target test data, and the preset normal distribution probability includes a preset extraction probability for each test data group; and performing a performance test on the server under test using the first target test data to obtain a first test result.
[0006] According to an embodiment of the present disclosure, the above-mentioned first target test data includes a data identifier, the above-mentioned test data is stored in a first data table, the above-mentioned data identifier is the primary key of the above-mentioned first data table, and the above-mentioned method also includes: using a preset script, extracting target additional test data corresponding to the above-mentioned data identifier from a second data table based on the above-mentioned identification data, and the above-mentioned second data table stores additional test data corresponding to the above-mentioned primary key; obtaining second target test data based on the above-mentioned target additional test data and the above-mentioned first target test data; and using the above-mentioned second target test data to test the server under test to obtain a second test result.
[0007] According to an embodiment of the present disclosure, the above-mentioned determination of the cache replacement data amount for the test data based on the historical search records of the server under test and the data cache capacity of the server under test includes: obtaining the historical search records of the first data table and the second data table and the data cache capacity of the server; determining, based on the above-mentioned historical search records, for a single test data, the number of call tables, the average amount of data to be loaded during the search of the call tables, and the amount of cache required for loading data during the search of the call tables; determining the above-mentioned cache replacement data amount based on the above-mentioned number of call tables, the above-mentioned average data amount, the above-mentioned amount of cache required for loading data, and the above-mentioned cache capacity.
[0008] According to an embodiment of the present disclosure, the cache replacement data amount is determined based on the number of call tables, the average data amount, the cache amount required for loading data and the cache capacity, including: obtaining the required cache amount for a single table for a single test data based on the cache amount required for loading data and the average data amount; determining the total required cache for a single test data based on the number of call tables and the cache amount required for the single table; determining the cache replacement data amount based on the cache capacity and the total required cache.
[0009] According to an embodiment of the present disclosure, the above-mentioned data extraction is performed from each of the above-mentioned test data groups based on a preset normal distribution probability to obtain 2n first target test data, including: generating a random seed number based on time; utilizing a preset random extraction algorithm to randomly extract from the above-mentioned i-th test data group based on the above-mentioned random seed number to obtain the i-th group of sub-target test data; and obtaining the above-mentioned first target test data based on all sub-target test data.
[0010] According to an embodiment of the present disclosure, the above-mentioned preset script includes a second data table name corresponding to the above-mentioned second data table, and the above-mentioned use of the preset script to extract additional test data corresponding to the above-mentioned data identifier from the second data table based on the above-mentioned identification data includes: constructing a data query statement based on the above-mentioned data table name and the above-mentioned identification data; extracting additional test data corresponding to the above-mentioned data identifier from the above-mentioned second data table based on the above-mentioned data query statement.
[0011] According to an embodiment of the present disclosure, the above-mentioned preset random sampling algorithm includes: any one of a simple random sampling algorithm, a stratified random sampling algorithm, and a systematic random sampling algorithm.
[0012] The second aspect of the present disclosure provides a server performance testing device, including: a cache replacement data amount determination module, which determines the cache replacement data amount for test data based on the historical search records of the server under test and the data cache capacity of the server under test, wherein the data cache capacity is n, the cache replacement data amount is 2n, and n is a positive integer greater than 0; a division module, which is used to divide the test data into m test data groups based on a preset number of groups, and m is a positive integer greater than 0; a data extraction module, which is used to extract data from each of the test data groups based on a preset normal distribution probability to obtain 2n first target test data, and the preset normal distribution probability includes a preset extraction probability for each test data group; a performance testing module, which is used to perform a performance test on the server under test using the first target test data to obtain a first test result.
[0013] According to an embodiment of the present disclosure, the above-mentioned first target test data includes a data identifier, the above-mentioned test data is stored in a first data table, the above-mentioned data identifier is the primary key of the above-mentioned first data table, and the above-mentioned device also includes: a script extraction module, which is used to use a preset script to extract target additional test data corresponding to the above-mentioned data identifier from a second data table based on the above-mentioned identification data, and the above-mentioned second data table stores additional test data corresponding to the above-mentioned primary key; a second target test data acquisition module, which is used to obtain second target test data based on the above-mentioned target additional test data and the above-mentioned first target test data; a second test module, which is used to test the server under test using the above-mentioned second target test data to obtain a second test result.
[0014] According to an embodiment of the present disclosure, the cache replacement data amount determination module includes: an acquisition submodule, used to acquire the historical search records of the first data table and the second data table and the data cache capacity of the server; a determination submodule, used to determine the number of call tables for a single test data, the average amount of data that needs to be loaded during the search for the call table, and the amount of cache required for loading data during the search for the call table based on the historical search records; a cache replacement data amount determination submodule, used to determine the cache replacement data amount based on the number of call tables, the average data amount, the amount of cache required for loading the data, and the cache capacity.
[0015] According to an embodiment of the present disclosure, the above-mentioned determination submodule includes: a single-table cache amount determination unit, which is used to obtain the single-table required cache amount for a single test data based on the above-mentioned cache amount required for loading data and the above-mentioned average data amount; a total required cache determination unit, which is used to determine the total required cache for a single test data based on the above-mentioned number of call tables and the above-mentioned single-table required cache amount; a cache replacement data amount determination unit, which is used to determine the cache replacement data amount based on the above-mentioned cache capacity and the above-mentioned total required cache.
[0016] According to an embodiment of the present disclosure, the above-mentioned data extraction module includes: a generation submodule, used to generate a random seed number based on time; a random extraction submodule, used to use a preset random extraction algorithm to randomly extract from the above-mentioned i-th test data group based on the above-mentioned random seed number to obtain the i-th group of sub-target test data; a target test data determination submodule, used to obtain the above-mentioned first target test data based on all sub-target test data.
[0017] According to an embodiment of the present disclosure, the above-mentioned preset script includes a second data table name corresponding to the above-mentioned second data table, and the above-mentioned script extraction module includes: a query statement construction submodule, used to construct a data query statement based on the above-mentioned data table name and the above-mentioned identification data; an extraction submodule, used to extract additional test data corresponding to the above-mentioned data identification from the above-mentioned second data table based on the above-mentioned data query statement.
[0018] According to an embodiment of the present disclosure, the preset random sampling algorithm in the above-mentioned random sampling submodule includes: any one of a simple random sampling algorithm, a stratified random sampling algorithm, and a systematic random sampling algorithm.
[0019] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0020] The fourth aspect of the present disclosure further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the above computer program or instructions are executed by a processor.
[0021] The fifth aspect of the present disclosure further provides a computer program product, including a computer program or instructions, which implement the steps of the above method when the above computer program or instructions are executed by a processor.
[0022] According to the embodiments of the present disclosure, through the historical search records and data cache capacity of the server under test, the amount of cache replacement data required to fill the data cache capacity can be inferred based on the historical search records, thereby ensuring that sufficient performance testing of the server's disk reading and writing is carried out, and by grouping the test data to extract test data that conforms to the normal distribution probability, and then performing performance testing based on the test data, it is possible to prevent test data concentration, avoid test results being affected by the concentrated distribution of test data, ensure the realism of the test, and improve the reliability of the test results. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0024] Figure 1 A diagram schematically shows an application scenario of a server performance testing method and device according to an embodiment of the present disclosure;
[0025] Figure 2 A flow chart schematically shows a server performance testing method according to an embodiment of the present disclosure;
[0026] Figure 3 A schematic diagram of the steps of running a preset script according to an embodiment of the present disclosure is shown schematically;
[0027] Figure 4 A structural block diagram of a server performance testing device according to an embodiment of the present disclosure is schematically shown; and
[0028] Figure 5 A block diagram of an electronic device suitable for implementing a server performance testing method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0029] Hereinafter, embodiments of the present disclosure 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 disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. 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 the concepts of the present disclosure.
[0030] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. 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.
[0031] 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.
[0032] 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.).
[0033] It should be noted that the server performance testing method, apparatus, equipment, medium and program product disclosed in the present invention can be used in the field of financial technology, and can also be used in any field other than the field of financial technology. The present disclosure does not limit the application field of the server performance testing method, apparatus, equipment, medium and program product.
[0034] In the technical solution of the present disclosure, 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 relevant laws, regulations and standards, 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.
[0035] In the scenario of using personal information for automated decision-making, the methods, devices, and systems provided by the embodiments of the present disclosure provide users with corresponding operation portals for users to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered. The expression "automated decision-making" here refers to the activity of automatically analyzing and evaluating a person's behavioral habits, interests and hobbies, or economic, health, credit status, etc. through computer programs, and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by people who specialize in a certain field, have specialized experience, knowledge and skills, and have reached a certain level of professionalism.
[0036] During the performance test of software systems, the preparation of test data is a very systematic and labor-intensive task. When simulating performance tests, it is necessary to consider adding a certain amount of data to simulate the performance of the system after it goes online for a period of time. This part of data is called the bottom data. During the testing phase, the bottom data is usually prepared by manually creating or importing production environment data in batches. In addition, performance testing needs to simulate the real load conditions of different virtual users, so a large amount of data needs to be prepared for different user input information. Since accessing data in the cache does not require disk read and write operations and is faster, cache is often used to improve the efficiency of data read and write. When the cache is full of data, the server will clear the data that has not been used for a long time from the cache to free up cache space. However, if the amount of data for the performance test is insufficient, the cache will always be idle, the test data will always be in the cache, the test will generate less read and write, and the performance test will not be sufficient; on the other hand, the smallest unit of disk read and write is a page, and each page contains several rows of table records. If data is extracted directly from the table, all table records in consecutive pages will be directly extracted, resulting in data concentration, which is different from the actual test situation.
[0037] In view of this, an embodiment of the present disclosure provides a server performance testing method, the method comprising: determining the cache replacement data volume for test data based on the historical search records of the server under test and the data cache capacity of the server under test, wherein the data cache capacity is n, the cache replacement data volume is 2n, and n is a positive integer greater than 0; dividing the test data into m test data groups based on a preset number of groups, where m is a positive integer greater than 0; extracting data from each test data group based on a preset normal distribution probability to obtain 2n first target test data, the preset normal distribution probability including a preset extraction probability for each test data group; performing a performance test on the server under test using the first target test data to obtain a first test result.
[0038] Figure 1 The application scenario diagram of the server performance testing method and device according to the embodiments of the present disclosure is schematically shown.
[0039] like Figure 1 As 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.
[0040] The user can use 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 can 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).
[0041] 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.
[0042] 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.
[0043] It should be noted that the server performance testing method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the server performance testing device provided in the embodiment of the present disclosure can generally be set in the server 105. The server performance testing method provided in the embodiment of the present disclosure 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 server performance testing device provided in the embodiment of the present disclosure 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.
[0044] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0045] The following will be based on Figure 1 The scene described by Figure 2~Figure 3 The server performance testing method of the disclosed embodiment is described in detail.
[0046] Figure 2 The flowchart of the server performance testing method according to the embodiment of the present disclosure is schematically shown.
[0047] like Figure 2 As shown, the server performance testing method of this embodiment includes operations S210 to S240.
[0048] In operation S210 , a cache replacement data amount for test data is determined based on a historical search record of the server under test and a data cache capacity of the server under test.
[0049] The data cache capacity is n, the cache replacement data volume is 2n, and n is a positive integer greater than 0.
[0050] According to the embodiment of the present disclosure, the above-mentioned data cache capacity is the amount of test data required to fill the cache, and the cache replacement data amount is 2n to ensure that the first n test data in the cache can be replaced out of the cache. The cache replacement data amount is the minimum amount of data required to generate sufficient disk reads and writes.
[0051] In operation S220, the test data is divided into m test data groups based on a preset number of groups.
[0052] Wherein, m is a positive integer greater than 0.
[0053] In operation S230, data is extracted from each test data group based on a preset normal distribution probability to obtain 2n first target test data.
[0054] The preset normal distribution probability includes a preset extraction probability for each test data group.
[0055] According to the embodiment of the present disclosure, the above m can be, for example, 30, or other positive integers, and the present disclosure does not impose any limitation on this.
[0056] The following Table 1 schematically shows a preset normal distribution probability table according to an embodiment of the present disclosure.
[0057] Table 1
[0058]
[0059] As shown in Table 1, x1, x2, ... 30 Indicates the preset extraction probability corresponding to the test data group, and the preset normal distribution probability satisfies For example, when the cache replacement data volume is 10,000, 796 test data should be extracted from the first test data group, 790 test data should be extracted from the second test data group, and so on to obtain the first target test data.
[0060] In operation S240, a performance test is performed on the server under test using the first target test data to obtain a first test result.
[0061] According to the embodiments of the present disclosure, through the historical search records and data cache capacity of the server under test, the amount of cache replacement data required to fill the data cache capacity can be inferred based on the historical search records, thereby ensuring that sufficient performance testing of the server's disk reading and writing is carried out, and by grouping the test data to extract test data that conforms to the normal distribution probability, and then performing performance testing based on the test data, it is possible to prevent test data concentration, avoid test results being affected by the concentrated distribution of test data, ensure the realism of the test, and improve the reliability of the test results.
[0062] According to an embodiment of the present disclosure, the above-mentioned first target test data includes a data identifier, the test data is stored in a first data table, and the data identifier is the primary key of the first data table. The method also includes: using a preset script to extract target additional test data corresponding to the data identifier from a second data table based on the identification data, and the second data table stores additional test data corresponding to the primary key; obtaining second target test data based on the target additional test data and the first target test data; and using the second target test data to test the server under test to obtain a second test result.
[0063] According to an embodiment of the present disclosure, the above-mentioned preset script corresponds to the second data table name, and using the preset script, additional test data corresponding to the data identifier is extracted from the second data table based on the identification data, including: constructing a data query statement based on the data table name and the identification data; extracting additional test data corresponding to the data identifier from the second data table based on the data query statement.
[0064] According to an embodiment of the present disclosure, multiple data table names can be stored in the above-mentioned preset script, and the correspondence between data identifiers and data table names can be pre-set in the script. The above-mentioned construction of data query statements and extraction of additional test data in the data table can be completed through the relay in the preset script.
[0065] Figure 3 A schematic diagram of the preset script running steps according to an embodiment of the present disclosure is schematically shown.
[0066] like Figure 3 As shown, the preset script running steps include operation S310 to operation S350.
[0067] In operation S310, a data identifier is obtained.
[0068] In operation S320, a servomotor is acquired.
[0069] In operation S330, additional test data is obtained by query.
[0070] Exemplarily, for the first target test data of "no: 001, name: A; no: 002, name: B", the data identifiers are "001" and "002", and the preset script stores the correspondence between the data identifier and the data table name "001: Table1; 002: Table2", then the data query statement can be constructed as "SELECT * From Table1 where no= '001'", that is, all data numbered "001" are queried from the table "Table1", and the additional test data obtained is "age: 22". The corresponding second target test data can be, for example, "no: 001, name: A, age: 22; no: 002, name: B", and accordingly, for the data identifier "002", the data query statement can be constructed as "SELECT * From Table2 where no= '002'". That is, query all data numbered "002" from the table "Table2" and obtain the additional test data "height: 172". At this time, the second target test data is "no: 001, name: A, age: 22; no: 002, name: B, height: 172".
[0071] In operation S340, it is determined whether there is a next servomotor.
[0072] According to the embodiment of the present disclosure, after obtaining the data identifier S310, multiple relays can be constructed according to the relationship between the data identifier and the data table name. If there is no relay, it is determined whether there is a next data identifier. If there is a relay, it returns to perform the above operation S320.
[0073] In operation S350, it is determined whether there is a next data identifier.
[0074] According to an embodiment of the present disclosure, when there is no next data identifier in the first target test data, the operation of acquiring the additional test data is terminated, and when there is a data identifier, the operation returns to execute the above operation S310.
[0075] According to an embodiment of the present disclosure, by extracting additional test data through a preset script, a complete data query can be split into multiple sub-queries, reducing the complexity of the query statement, thereby improving the efficiency of obtaining test data. Furthermore, by configuring the data table name in the preset script, the speed of extracting additional test data by the preset script can be accelerated.
[0076] According to an embodiment of the present disclosure, the above-mentioned method of determining the cache replacement data amount for test data based on the historical search records of the server under test and the data cache capacity of the server under test includes: obtaining the historical search records of the first data table and the second data table and the data cache capacity of the server; determining the number of call tables for a single test data, the average amount of data to be loaded during the search of the call table, and the cache amount required for loading data during the search of the call table based on the historical search records; determining the cache replacement data amount based on the number of call tables, the average data amount, the cache amount required for loading data, and the cache capacity.
[0077] According to an embodiment of the present disclosure, the above-mentioned historical search record may be a historical performance test record, and the above-mentioned data cache capacity may be an upper limit of the cache space.
[0078] According to an embodiment of the present disclosure, the above-mentioned number of call tables is the average number of tables that need to be searched to obtain one test data determined based on historical search records; the above-mentioned average data volume is the average number of data in a table that needs to be searched to obtain one test data determined based on historical search records; the above-mentioned cache volume required for loading data tables is the average cache space determined for each data table that needs to be loaded based on historical search records.
[0079] According to an embodiment of the present disclosure, the above-mentioned determination of the cache replacement data amount based on the required cache capacity, the number of calling tables, the average data amount, the cache amount required for loading data and the cache capacity includes: obtaining the required cache amount for a single table for a single test data based on the cache amount required for loading data and the average data amount; determining the total required cache for a single test data based on the number of calling tables and the cache amount required for a single table; determining the cache replacement data amount based on the cache capacity and the total required cache.
[0080] The total required buffer can be obtained by the following formula (1).
[0081] (1)
[0082] Where m represents the total demand buffer, c i m i Indicates the cache size required for a single table, c i Indicates obtaining the average number of records (the above average data volume) that need to be loaded into the i-th table for one test data table, m i It represents the cache space required by the ith table (the cache amount required for loading the data table mentioned above), and x represents the number of calling tables.
[0083] The cache replacement data volume can be obtained by the following formula (2).
[0084] (2)
[0085] Among them, M represents the cache capacity and m represents the total required cache.
[0086] According to the embodiments of the present disclosure, the number of call tables for a single test data, the average amount of data required to be loaded during the search for the call table, and the amount of cache required for loading data during the search for the call table are accurately determined through historical search records. The required cache amount for a single table is determined based on the cache amount required for loading data and the average amount of data. The total required cache is determined based on the cache required for a single table and the number of call tables. Finally, the amount of cache replacement data that can meet the full reading and writing of the disk is determined based on the total required cache and cache capacity, thereby ensuring that the server disk is fully read and written.
[0087] According to an embodiment of the present disclosure, the above-mentioned data extraction from each test data group based on a preset normal distribution probability to obtain 2n first target test data includes: generating a random seed number based on time; using a preset random extraction algorithm to randomly extract from the i-th test data group based on the random seed number to obtain the i-th group of sub-target test data; and obtaining the first target test data based on all sub-target test data.
[0088] According to an embodiment of the present disclosure, the above-mentioned preset random sampling algorithm may be, for example, a simple random sampling algorithm, a stratified random sampling algorithm, a systematic random sampling algorithm or other random sampling algorithms.
[0089] According to an embodiment of the present disclosure, a random seed number may be generated according to time, and this seed number is used to ensure repeatability during the random extraction process.
[0090] Based on the above server performance testing method, the present disclosure also provides a server performance testing device. Figure 4 The device is described in detail.
[0091] Figure 4 The structural block diagram of a server performance testing device according to an embodiment of the present disclosure is schematically shown.
[0092] like Figure 4 As shown, the server performance testing device 400 of this embodiment includes a cache replacement data amount determination module 410 , a partitioning module 420 , a data extraction module 430 and a performance testing module 440 .
[0093] The cache replacement data amount determination module 410 is used to determine the cache replacement data amount for the test data based on the historical search records of the tested server and the data cache capacity of the tested server, where the data cache capacity is n, the cache replacement data amount is 2n, and n is a positive integer greater than 0. In one embodiment, the cache replacement data amount determination module 410 can be used to perform the operation S210 described above, which will not be repeated here.
[0094] The partitioning module 420 is used to partition the test data into m test data groups based on a preset number of groups, where m is a positive integer greater than 0. In one embodiment, the partitioning module 420 can be used to perform the operation S220 described above, which will not be described in detail herein.
[0095] The data extraction module 430 is used to extract data from each test data group based on a preset normal distribution probability to obtain 2n first target test data, where the preset normal distribution probability includes a preset extraction probability for each test data group. In one embodiment, the data extraction module 430 can be used to perform the operation S230 described above, which will not be repeated here.
[0096] The performance testing module 440 is used to perform a performance test on the tested server using the first target test data to obtain a first test result. In one embodiment, the performance testing module 440 can be used to perform the operation S240 described above, which will not be described in detail here.
[0097] According to an embodiment of the present disclosure, the above-mentioned first target test data includes a data identifier, the above-mentioned test data is stored in a first data table, the above-mentioned data identifier is the primary key of the above-mentioned first data table, and the above-mentioned device also includes: a script extraction module, which is used to use a preset script to extract target additional test data corresponding to the above-mentioned data identifier from a second data table based on the above-mentioned identification data, and the above-mentioned second data table stores additional test data corresponding to the above-mentioned primary key; a second target test data acquisition module, which is used to obtain second target test data based on the above-mentioned target additional test data and the above-mentioned first target test data; a second test module, which is used to test the server under test using the above-mentioned second target test data to obtain a second test result.
[0098] According to an embodiment of the present disclosure, the cache replacement data amount determination module includes: an acquisition submodule, used to acquire the historical search records of the first data table and the second data table and the data cache capacity of the server; a determination submodule, used to determine the number of call tables for a single test data, the average amount of data that needs to be loaded during the search for the call table, and the amount of cache required for loading data during the search for the call table based on the historical search records; a cache replacement data amount determination submodule, used to determine the cache replacement data amount based on the number of call tables, the average data amount, the amount of cache required for loading the data, and the cache capacity.
[0099] According to an embodiment of the present disclosure, the above-mentioned determination submodule includes: a single-table cache amount determination unit, which is used to obtain the single-table required cache amount for a single test data based on the above-mentioned cache amount required for loading data and the above-mentioned average data amount; a total required cache determination unit, which is used to determine the total required cache for a single test data based on the above-mentioned number of call tables and the above-mentioned single-table required cache amount; a cache replacement data amount determination unit, which is used to determine the cache replacement data amount based on the above-mentioned cache capacity and the above-mentioned total required cache.
[0100] According to an embodiment of the present disclosure, the above-mentioned data extraction module includes: a generation submodule, used to generate a random seed number based on time; a random extraction submodule, used to use a preset random extraction algorithm to randomly extract from the above-mentioned i-th test data group based on the above-mentioned random seed number to obtain the i-th group of sub-target test data; a target test data determination submodule, used to obtain the above-mentioned first target test data based on all sub-target test data.
[0101] According to an embodiment of the present disclosure, the above-mentioned preset script includes a second data table name corresponding to the above-mentioned second data table, and the above-mentioned script extraction module includes: a query statement construction submodule, used to construct a data query statement based on the above-mentioned data table name and the above-mentioned identification data; an extraction submodule, used to extract additional test data corresponding to the above-mentioned data identification from the above-mentioned second data table based on the above-mentioned data query statement.
[0102] According to an embodiment of the present disclosure, the preset random sampling algorithm in the above-mentioned random sampling submodule includes: any one of a simple random sampling algorithm, a stratified random sampling algorithm, and a systematic random sampling algorithm.
[0103] According to an embodiment of the present disclosure, any multiple modules of the cache replacement data amount determination module 410, the partition module 420, the data extraction module 430 and the performance test module 440 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the cache replacement data amount determination module 410, the partition module 420, the data extraction module 430 and the performance test module 440 can 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 can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in a suitable combination of any of them. Alternatively, at least one of the cache replacement data amount determination module 410, the partitioning module 420, the data extraction module 430 and the performance testing module 440 may be at least partially implemented as a computer program module, which may perform corresponding functions when executed.
[0104] Figure 5 A block diagram of an electronic device suitable for implementing a server performance testing method according to an embodiment of the present disclosure is schematically shown.
[0105] like Figure 5 As shown, the electronic device 500 according to an embodiment of the present disclosure includes a processor 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 to a random access memory (RAM) 503. The processor 501 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 501 may also include an onboard memory for caching purposes. The processor 501 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 disclosure.
[0106] In RAM 503, various programs and data required for the operation of electronic device 500 are stored. Processor 501, ROM 502 and RAM 503 are connected to each other via bus 504. Processor 501 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 502 and / or RAM 503. It should be noted that the program can also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0107] According to an embodiment of the present disclosure, the electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to the bus 504. The electronic device 500 may further include one or more of the following components connected to the input / output (I / O) interface 505: an input portion 506 including a keyboard, a mouse, etc.; an output portion 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 508 including a hard disk, etc.; and a communication portion 509 including a network interface card such as a LAN card, a modem, etc. The communication portion 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage portion 508 as needed.
[0108] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; 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 disclosure is implemented.
[0109] According to an embodiment of the present disclosure, 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 disclosure, a 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 disclosure, the computer-readable storage medium may include the ROM 502 and / or RAM 503 described above and / or one or more memories other than ROM 502 and RAM 503.
[0110] The embodiment of the present disclosure 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 server performance testing method provided by the embodiment of the present disclosure.
[0111] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 501. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0112] 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 509, and / or installed from the removable medium 511. 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.
[0113] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0114] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure 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 (for example, using an Internet service provider to connect through the Internet).
[0115] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. 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.
[0116] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0117] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A server performance testing method, characterized in that: The method comprises: Determine the cache replacement data volume for the test data based on the historical search records of the tested server and the data cache capacity of the tested server, wherein the data cache capacity is n, the cache replacement data volume is 2n, and n is a positive integer greater than 0; Based on a preset number of groups, the test data is divided into m test data groups, where m is a positive integer greater than 0; Extracting data from each of the test data groups based on a preset normal distribution probability to obtain 2n first target test data, wherein the preset normal distribution probability includes a preset extraction probability for each of the test data groups; A performance test is performed on the server under test using the first target test data to obtain a first test result.
2. The method according to claim 1, characterized in that The first target test data includes a data identifier, the test data is stored in a first data table, the data identifier is a primary key of the first data table, and the method further includes: Using a preset script, based on the identification data, extracting target additional test data corresponding to the data identifier from a second data table, wherein the second data table stores the additional test data corresponding to the primary key; Obtain second target test data based on the target additional test data and the first target test data; The server under test is tested using the second target test data to obtain a second test result.
3. The method according to claim 1, characterized in that The step of determining the cache replacement data amount for the test data based on the historical search record of the tested server and the data cache capacity of the tested server includes: Acquire historical search records of the first data table and the second data table and data cache capacity of the server; Determine the number of call tables for a single test data, the average amount of data to be loaded during the search for the call tables, and the amount of cache required for loading data during the search for the call tables based on the historical search records; The cache replacement data amount is determined based on the number of call tables, the average data amount, the cache amount required for the loaded data, and the cache capacity.
4. The method according to claim 3, characterized in that The determining the cache replacement data amount based on the number of call tables, the average data amount, the cache amount required for loading data, and the cache capacity includes: Obtaining a required cache amount for a single table of single test data based on the required cache amount for the loaded data and the average data amount; Determine the total required cache for a single test data based on the number of call tables and the required cache amount of the single table; A cache replacement data amount is determined based on the cache capacity and the total cache requirement.
5. The method according to claim 1, characterized in that The step of extracting data from each of the test data groups based on a preset normal distribution probability to obtain 2n first target test data includes: Generate a random seed number based on time; Using a preset random sampling algorithm, randomly sampling is performed from the i-th test data group based on the random seed number to obtain the i-th group of sub-target test data; The first target test data is obtained based on all sub-target test data.
6. The method according to claim 2, characterized in that The preset script includes a second data table name corresponding to the second data table, and the using of the preset script to extract the additional test data corresponding to the data identifier from the second data table based on the identifier data includes: Constructing a data query statement based on the data table name and the identification data; Additional test data corresponding to the data identifier is extracted from the second data table based on the data query statement.
7. The method according to claim 5, characterized in that The preset random extraction algorithm includes: Any of the simple random sampling algorithms, stratified random sampling algorithms, and systematic random sampling algorithms.
8. A server performance testing device, characterized in that: The device comprises: A cache replacement data amount determination module, used to determine the cache replacement data amount for the test data based on the historical search records of the tested server and the data cache capacity of the tested server, wherein the data cache capacity is n, the cache replacement data amount is 2n, and n is a positive integer greater than 0; A division module, used for dividing the test data into m test data groups based on a preset number of groups, where m is a positive integer greater than 0; A data extraction module, configured to extract data from each of the test data groups based on a preset normal distribution probability to obtain 2n first target test data, wherein the preset normal distribution probability includes a preset extraction probability for each test data group; The performance testing module is used to perform a performance test on the server under test using the first target test data to obtain a first test result.
9. 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 7.
10. 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 7 are implemented.