Data Processing Method, Device, Electronic Device and Storage Medium
By generating test requests that replicate the usage ratios of processing branches, the method ensures accurate performance testing of data service endpoints, addressing the discrepancy between test and live environments and optimizing endpoint performance.
Patent Information
- Application Number
- CN202211476105.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-23
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2042-11-23
AI Technical Summary
During the interaction between the application and the data server, the difference between the pressure in the test environment and the pressure in the online environment leads to inconsistent processing time of the data server, affecting the user experience.
By generating the corresponding relationship between the branch identification, request parameter set and the total number of usages of the processing branch, a test request is generated to match the ratio of usages of the processing branch, and stress testing is performed to make the test environment similar to the pressure of the online environment.
It realizes the pressure of accurately simulating the online environment in the test environment, ensuring the consistent processing time of the data server, and improving the user experience.
Smart Images

Figure CN115757152B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular, to a data processing method, apparatus, electronic device, and storage medium. Background Art
[0002] With the rapid development of technology, application programs are becoming increasingly important in users' lives and work. To meet users' needs, developers of manufacturers can develop application programs, or, according to actual needs, update the developed application programs to obtain new versions of application programs, etc., for users to use the application programs. For example, develop application programs with specific functions, or add specific functions to the developed application programs to obtain new versions of application programs for users to use specific functions based on the application programs. Summary of the Invention
[0003] This application discloses a data processing method, apparatus, electronic device, and storage medium.
[0004] In a first aspect, this application discloses a data processing method applied to a test server, and the method includes:
[0005] Receiving a plurality of online requests forwarded by a data server, where the plurality of online requests are sent by an external party to the data server;
[0006] For any one of the plurality of online requests, invoking a processing function including a plurality of processing branches in the test server for processing the online request, extracting request parameters in the online request, using the processing function and the request parameters to process the online request, and determining a processing branch used when processing the online request among the plurality of processing branches;
[0007] According to the request parameters in each of the plurality of online requests and the branch identifiers of the processing branches respectively used when processing each of the online requests, generating a first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used, so that for any one of the plurality of processing branches, the test server searches in the first correspondence relationship for the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the branch identifier of the processing branch is used; generating a test request corresponding to the processing branch at least according to the found set of request parameters and the found total number of times the processing branch is used, where the test request includes the request parameters in the found set of request parameters; where the ratio between the request quantities of the test requests respectively corresponding to the generated respective processing branches matches the ratio between the total number of times the respective processing branches are used in the first correspondence relationship; and then performing a stress test on the data server according to the test requests respectively corresponding to the respective processing branches.
[0008] In an alternative implementation, generating a first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used according to the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request includes:
[0009] For any one of the multiple online requests, in the first correspondence relationship, look up the corresponding entry including the branch identifier of the processing branch used when processing the online request;
[0010] When the corresponding entry including the branch identifier of the processing branch used when processing the online request is found in the first correspondence relationship, if the set of request parameters in the corresponding entry includes the request parameters in the online request, increase the total number of times used in the corresponding entry; or, if the set of request parameters in the corresponding entry does not include the request parameters in the online request, add the request parameters in the online request to the set of request parameters in the corresponding entry, and increase the total number of times used in the corresponding entry;
[0011] Or,
[0012] When the corresponding entry including the branch identifier of the processing branch used when processing the online request is not found in the first correspondence relationship, generate a set of request parameters including the request parameters in the online request, set an initial value for the number of times, and form a corresponding entry with the branch identifier of the processing branch used when processing the online request, the generated set of request parameters, and the initial value for the number of times, and store it in the first correspondence relationship.
[0013] In an alternative implementation, the method further includes:
[0014] For any one of the multiple processing branches, determine the online requests processed using the processing branch among the multiple online requests;
[0015] Among the request parameters in the determined online requests, count the actual number of each request parameter;
[0016] Generate a second correspondence relationship among the branch identifier of the processing branch, each request parameter, and the actual number according to the branch identifier of the processing branch, each request parameter, and the actual number of each request parameter.
[0017] In an alternative implementation, the method further includes:
[0018] Send the processing result obtained by processing the online request using the processing function and the request parameters to the data server, so that the data server forwards the processing result to the outside.
[0019] In a second aspect, the present application discloses a data processing method applied to a data server, and the method includes:
[0020] Receive multiple online requests sent from the outside;
[0021] Forward the multiple online requests to the test server, so that for any one of the multiple online requests, the test server retrieves a processing function including multiple processing branches in the test server for processing the online request, extracts the request parameters in the online request, processes the online request using the processing function and the request parameters, and determines the processing branch used when processing the online request among the multiple processing branches; generate a first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used according to the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request; further, for any one of the multiple processing branches, the test server looks up the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the branch identifier of the processing branch is used in the first correspondence relationship; generate a test request corresponding to the processing branch at least according to the retrieved set of request parameters and the retrieved total number of times of use, where the test request includes the request parameters in the retrieved set of request parameters; where the ratio between the request quantities of the test requests respectively corresponding to the generated processing branches matches the ratio between the total number of times of use of the respective processing branches in the first correspondence relationship; then perform a stress test on the data server according to the test requests respectively corresponding to the respective processing branches.
[0022] In an optional implementation manner, the method further includes:
[0023] Receive the processing result obtained by processing the online request using the processing function and the request parameters returned by the test server;
[0024] Forward the processing result to the outside.
[0025] In a third aspect, the present application discloses a data processing method applied to a test server, and the method includes:
[0026] Obtain the first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used. The first correspondence relationship is generated by the test server based on the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request. The multiple online requests are sent externally to the data server and forwarded by the data server to the test server. And for any one of the multiple online requests, the request parameters in the online request are extracted by the test server from the online request, and the processing branch used when processing the online request is determined among the multiple processing branches in the case of using the processing function including multiple processing branches in the retrieved test server for processing the online request and using the processing function and the extracted request parameters in the online request to process the online request.
[0027] For any one of the multiple processing branches, look up the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the branch identifier of the processing branch is used in the first correspondence relationship. Generate a test request corresponding to the processing branch based at least on the retrieved set of request parameters and the retrieved total number of times the branch is used. The test request includes the request parameters in the retrieved set of request parameters.
[0028] Among them, the ratio between the request quantities of the test requests respectively corresponding to the generated processing branches matches the ratio between the total number of times each processing branch is used in the first correspondence relationship.
[0029] Conduct a stress test on the data server according to the test requests respectively corresponding to each processing branch.
[0030] In an optional implementation manner, the generating a test request corresponding to the processing branch based at least on the retrieved set of request parameters and the retrieved total number of times the branch is used includes:
[0031] Obtain the second correspondence relationship among the branch identifier of the processing branch, the request parameters, and the actual quantity. The second correspondence relationship is generated based on the processing branch, each request parameter in the online requests processed by using the processing branch among the multiple online requests, and the actual quantity of each request parameter.
[0032] For any one of the request parameters in the retrieved set of request parameters, look up the actual quantity corresponding to the request parameter in the second correspondence relationship.
[0033] Generate a test request corresponding to the processing branch including the request parameter based on the retrieved total number of times the branch is used and the retrieved actual quantity.
[0034] Among them, the ratio between the number of requests of the test requests corresponding to the processing branches, each of which includes the request parameters found in the set of request parameters, is matched with the ratio between the actual quantities corresponding to the request parameters found in the set of request parameters in the second correspondence.
[0035] In a fourth aspect, the present application discloses a data processing device applied to a test server, the device includes:
[0036] A first receiving module, configured to receive a plurality of online requests forwarded by a data server, where the plurality of online requests are sent by an external party to the data server;
[0037] A first determining module, configured to, for any one of the plurality of online requests, retrieve a processing function including a plurality of processing branches in the test server for processing the online request, extract request parameters in the online request, process the online request using the processing function and the request parameters, and determine a processing branch used when processing the online request among the plurality of processing branches;
[0038] A first generating module, configured to generate a first correspondence among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used according to the request parameters in each of the plurality of online requests and the branch identifier of the processing branch used when processing each of the online requests, so that for any one of the plurality of processing branches, the test server searches for the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the branch identifier of the processing branch is used in the first correspondence; at least generate a test request corresponding to the processing branch according to the found set of request parameters and the found total number of times of use, where the test request includes the request parameters in the found set of request parameters; among them, the ratio between the number of requests of the test requests respectively corresponding to each processing branch is matched with the ratio between the total number of times of use of each processing branch in the first correspondence; then perform a stress test on the data server according to the test requests respectively corresponding to each processing branch.
[0039] In an optional implementation manner, the first generating module includes:
[0040] A first searching unit, configured to, for any one of the plurality of online requests, search for a corresponding entry including the branch identifier of the processing branch used when processing the online request in the first correspondence;
[0041] An increment unit is used to, when a corresponding table entry including a branch identifier of a processing branch used when processing the online request is found in the first corresponding relationship, if the request parameter set in the corresponding table entry includes the request parameter in the online request, increment the total usage times in the corresponding table entry; or, if the request parameter set in the corresponding table entry does not include the request parameter in the online request, add the request parameter in the online request to the request parameter set in the corresponding table entry, and increment the total usage times in the corresponding table entry;
[0042] Or,
[0043] A storage unit is used to, when a corresponding table entry including a branch identifier of a processing branch used when processing the online request is not found in the first corresponding relationship, generate a request parameter set including the request parameter in the online request, set an initial value for the number of times, form a corresponding table entry with the branch identifier of the processing branch used when processing the online request, the generated request parameter set, and the initial value for the number of times, and store it in the first corresponding relationship.
[0044] In an optional implementation manner, the device further includes:
[0045] A second determination module is used to, for any one of the multiple processing branches, determine the online requests processed using the processing branch among the multiple online requests;
[0046] A statistics module is used to count the actual quantity of each request parameter among the request parameters in each determined online request;
[0047] A second generation module is used to generate a second corresponding relationship among the branch identifier of the processing branch, the request parameters, and the actual quantity according to the branch identifier of the processing branch, each request parameter, and the actual quantity of each request parameter.
[0048] In an optional implementation manner, the device further includes:
[0049] A sending module is used to send the processing result obtained by processing the online request using the processing function and the request parameters to the data server, so that the data server forwards the processing result to the outside.
[0050] In a fifth aspect, the present application discloses a data processing device applied to a data server, and the device includes:
[0051] A second receiving module is used to receive multiple online requests sent from the outside;
[0052] A sending module, configured to forward the multiple online requests to a test server, so that for any one of the multiple online requests, the test server retrieves a processing function including multiple processing branches in the test server for processing the online request, extracts request parameters in the online request, processes the online request by using the processing function and the request parameters, and determines a processing branch used when processing the online request among the multiple processing branches; generate a first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used according to the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request; further enabling the test server to look up the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the branch identifier of the processing branch is used in the first correspondence relationship for any one of the multiple processing branches; generate a test request corresponding to the processing branch at least according to the retrieved set of request parameters and the retrieved total number of times, where the test request includes the request parameters in the retrieved set of request parameters; where the ratio between the numbers of the test requests respectively corresponding to the generated processing branches matches the ratio between the total numbers of times the respective processing branches are used in the first correspondence relationship; and then perform a stress test on the data server according to the test requests respectively corresponding to the processing branches.
[0053] In an optional implementation manner, the device further includes:
[0054] A third receiving module, configured to receive a processing result obtained by processing the online request by using the processing function and the request parameters and returned by the test server;
[0055] A forwarding module, configured to forward the processing result to the outside.
[0056] In a sixth aspect, the present application discloses a data processing device applied to a test server, and the device includes:
[0057] An acquisition module is configured to acquire a first correspondence relationship among a branch identifier of a processing branch, a set of request parameters, and the total number of times of use of the processing branch. The first correspondence relationship is generated by the test server according to the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request. The multiple online requests are sent externally to the data server and forwarded by the data server to the test server. For any one of the multiple online requests, the request parameters in the online request are extracted by the test server from the online request, and the processing branch used when processing the online request is determined among the multiple processing branches in the case of using the processing function including multiple processing branches in the retrieved test server for processing the online request and using the processing function and the extracted request parameters in the online request to process the online request.
[0058] A third generation module is configured to, for any one of the multiple processing branches, search in the first correspondence relationship for the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times of use corresponding to the branch identifier of the processing branch. Generate a test request corresponding to the processing branch at least according to the retrieved set of request parameters and the retrieved total number of times of use. The test request includes the request parameters in the retrieved set of request parameters.
[0059] Wherein, the ratio between the request quantities of the test requests respectively corresponding to the generated respective processing branches matches the ratio between the total number of times of use of the respective processing branches in the first correspondence relationship.
[0060] A test module is configured to perform a stress test on the data server according to the test requests respectively corresponding to the respective processing branches.
[0061] In an optional implementation manner, the third generation module includes:
[0062] An acquisition unit is configured to acquire a second correspondence relationship among the branch identifier of the processing branch, the request parameters, and the actual quantity. The second correspondence relationship is generated according to the processing branch, each of the request parameters in the online requests processed by using the processing branch among the multiple online requests, and the actual quantity of each request parameter.
[0063] A second search unit is configured to, for any one of the request parameters in the retrieved set of request parameters, search in the second correspondence relationship for the actual quantity corresponding to the request parameter.
[0064] A generation unit is configured to generate a test request corresponding to the processing branch including the request parameter according to the retrieved total number of times of use and the retrieved actual quantity.
[0065] Among them, the ratio between the number of requests of the test requests corresponding to the processing branch, each of which includes each request parameter in the found request parameter set, matches the ratio between the actual quantities corresponding to each request parameter in the found request parameter set in the second correspondence.
[0066] In a seventh aspect, the present application discloses an electronic device, which includes: a processor; a memory for storing instructions executable by the processor; wherein, the processor is configured to execute the data processing method as described in any aspect.
[0067] In an eighth aspect, the present application discloses a non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the data processing method as described in any aspect.
[0068] In a ninth aspect, the present application discloses a computer program product, when the instructions in the computer program product are executed by a processor of an electronic device, enabling the electronic device to execute the data processing method as described in any aspect.
[0069] The technical solution provided by the present application may include the following beneficial effects:
[0070] In the present application, the data server receives a plurality of online requests sent externally. The data server forwards the plurality of online requests to the test server. The test server receives the plurality of online requests forwarded by the data server. For any one of the plurality of online requests, the test server retrieves a processing function including a plurality of processing branches in the test server for processing the online request, extracts the request parameters in the online request, uses the processing function and the request parameters to process the online request, and determines the processing branch used when processing the online request among the plurality of processing branches. The test server generates a first correspondence among the branch identifier of the processing branch, the request parameter set, and the total number of times the processing branch is used according to the request parameters in each of the plurality of online requests and the branch identifiers of the processing branches respectively used when processing each of the plurality of online requests.
[0071] Furthermore, the test server can obtain the first corresponding relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used. For any one of the multiple processing branches, in the first corresponding relationship, find the set of request parameters corresponding to the branch identifier of this processing branch and the total number of times used corresponding to the branch identifier of this processing branch. Generate a test request corresponding to this processing branch based at least on the found set of request parameters and the found total number of times used. The test request includes the request parameters in the found set of request parameters. Perform a stress test on the data server according to the test requests corresponding to each processing branch respectively.
[0072] In this way, the usage frequency ratio among the various processing branches in the processing functions used by the data server to process a large number of online requests can be obtained. And based on the usage frequency ratio among the various processing branches in the processing function, generate test requests and use the generated test requests to perform a stress test on the data server, so that the usage frequency ratio among the various processing branches in the processing functions used by the data server to process a large number of test requests is the same as or similar to the usage frequency ratio among the various processing branches in the processing functions used by the data server to process a large number of online requests. Furthermore, it can be made that the pressure on the data server in the test environment is the same as or similar to the pressure on the data server in the online environment. In this way, the time consumed in the process of the data server processing a large number of test requests may be the same as or similar to the online situation, that is, it can be realized to perform a test on the data server that conforms to the online situation. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 is a structural block diagram of a data processing system of the present application.
[0074] Figure 2 is a step flowchart of a data processing method of the present application.
[0075] Figure 3 is a step flowchart of a data processing method of the present application.
[0076] Figure 4 is a step flowchart of a data processing method of the present application.
[0077] Figure 5 is a step flowchart of a data processing method of the present application.
[0078] Figure 6 is a structural block diagram of a data processing device of the present application.
[0079] Figure 7 is a structural block diagram of a data processing device of the present application.
[0080] Figure 8 It is a structural block diagram of a data processing device according to the present application.
[0081] Figure 9 It is a block diagram of an electronic device according to the present application.
[0082] Figure 10 It is a block diagram of an electronic device according to the present application. Specific embodiments
[0083] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0084] Among them, in the process of users using application programs, application programs often perform data interaction with the data servers corresponding to the application programs. If the number of application programs that simultaneously perform data interaction with the data servers corresponding to the application programs is very large, the pressure faced by the data servers corresponding to the application programs will be very great.
[0085] In order to cope with the pressure on the data servers corresponding to the application programs, the data servers corresponding to the application programs can be subjected to stress testing to discover the operation bottlenecks of the data servers corresponding to the application programs and to test the ability of the data servers corresponding to the application programs to cope with pressure, etc. After that, the performance of the data servers corresponding to the application programs can be optimized so that the data servers corresponding to the application programs can cope with the required pressure and avoid crashing when facing large traffic pressure, etc.
[0086] Among them, in one way, in order to perform stress testing on the data servers corresponding to the application programs, developers can hand over the developed application programs to testers so that the testers can perform stress testing on the data servers corresponding to the application programs based on the application programs. For example, the testers can control the interaction between the application programs and the data servers corresponding to the application programs to achieve stress testing on the data servers corresponding to the application programs based on the application programs.
[0087] Among them, in the scenario where the application programs interact with the data servers corresponding to the application programs, it is usually the application programs that send requests to the data servers corresponding to the application programs. The data servers corresponding to the application programs receive the requests, process the requests, obtain the processing results, and then can return the processing results to the application programs. The application programs can receive the processing results.
[0088] In this way, testers can install the application in a large number of test devices and control the application installed in the large number of test devices to send test requests to the data server corresponding to the application centrally. In this way, the data server corresponding to the application will receive a large number of test requests centrally, process the large number of test requests, obtain the processing results corresponding to each test request respectively, and then return the processing results corresponding to each test request to each test device.
[0089] After that, testers can count the test situation of the data server corresponding to the application processing a large number of test requests to obtain the stress test result of the data server corresponding to the application.
[0090] When the stress test result of the data server corresponding to the application indicates that the data server corresponding to the application can handle the required stress, the application can be launched later.
[0091] Among them, after the application is launched, a large number of users can use the application to interact with the data server corresponding to the application. For example, a large number of users can use the application to send online requests to the data server corresponding to the application, and the data server corresponding to the application can process the online requests sent by the application of a large number of users.
[0092] And after the data server corresponding to the application processes the online requests sent by the application of a large number of users, the inventor collects and analyzes the online situation of the data server corresponding to the application processing the online requests sent by the application of a large number of users, and finds that: in the process of the data server corresponding to the application processing the online requests sent by the application of a large number of users, sometimes the data server corresponding to the application will crash.
[0093] That is to say, the data server corresponding to the application will not crash when processing a large number of test requests, while the data server corresponding to the application will crash when processing the online requests sent by the application of a large number of users. It can be seen that: the online situation of the data server corresponding to the application processing the online requests sent by the application of a large number of users is different from the test situation of the data server corresponding to the application processing a large number of test requests.
[0094] For example, the stress of the data server corresponding to the application in the test environment is different from the stress of the data server corresponding to the application in the online environment. For example, sometimes the stress of the data server corresponding to the application in the test environment is less than the stress of the data server corresponding to the application in the online environment.
[0095] For example, the time consumed in the process of the data server corresponding to the application handling online requests sent by a large number of users is different from the time consumed in the process of the data server corresponding to the application handling a large number of test requests.
[0096] For example, sometimes the time consumed in the process of the data server corresponding to the application handling a large number of test requests is relatively small, not exceeding the required time, and the processing efficiency is relatively high, and it often does not crash. It can be seen that the test situation shows that the data server corresponding to the application has a relatively high ability to handle pressure. However, the time consumed in the process of the data server corresponding to the application handling a large number of online requests is relatively long, exceeding the required time, and the processing efficiency is relatively low, and it may even crash. It can be seen that the online situation shows that the data server corresponding to the application has a relatively low ability to handle pressure.
[0097] Among them, if the situation of "the time consumed in the process of the data server corresponding to the application handling a large number of online requests is relatively long, exceeding the required time, and the processing efficiency is relatively low" occurs, it will reduce the experience of a large number of users using the application.
[0098] In view of this, on this basis, the need to improve the experience of a large number of users using the application is proposed.
[0099] Among them, in order to achieve the purpose of improving the experience of a large number of users using the application, in one way, the time consumed in the process of the data server corresponding to the application handling a large number of online requests can be reduced, for example, reduced to be lower than the required time, so as to improve the processing efficiency.
[0100] In order to achieve the purpose of "reducing the time consumed in the process of the data server corresponding to the application handling a large number of online requests, for example, reducing it to the required time, so as to improve the processing efficiency", when the data server corresponding to the application is subjected to a stress test based on the application in advance, it is necessary to accurately measure the time consumed in the process of the data server corresponding to the application handling a large number of test requests, and in the case of exceeding the required time, optimize the performance of the data server corresponding to the application, etc., so as to improve the processing efficiency of the data server corresponding to the application.
[0101] It can be seen that there are at least two key points involved in improving the processing efficiency of the data server corresponding to the application:
[0102] One key point includes: accurately measuring the time consumed in the process of the data server corresponding to the application handling a large number of test requests.
[0103] Another key point includes: optimizing the performance of the data server corresponding to the application.
[0104] Among them, the inventor found that the key point of "accurately measuring the time consumed in the process of the data server corresponding to the application program to process a large number of test requests" among the two key points is very important.
[0105] Thus, in order to accurately measure the time consumed in the process of the data server corresponding to the application program to process a large number of test requests, the inventor conducted a statistical analysis on the reason why "the pressure on the data server corresponding to the application program in the test environment is different from the pressure on the data server corresponding to the application program in the online environment" and found that:
[0106] In the scenario where the data server corresponding to the application program processes the requests sent by the application program, the data server corresponding to the application program often selects a processing function from multiple processing functions pre-set in the data server corresponding to the application program and uses the selected processing function to process the requests sent by the application program.
[0107] After the inventor conducted a statistical analysis on the processing functions pre-set in the data server corresponding to the application program, it was found that: some processing functions often have multiple processing branches, and the specific processing methods of different processing branches are different. When using a processing function to process the requests sent by the application program, it is often one of the multiple processing branches in the processing function that is used to process the requests sent by the application program.
[0108] Furthermore, the inventor separately conducted statistical classification on the processing functions used by the data server corresponding to the application program to process test requests and the processing functions used to process online requests, and thus obtained the test requests and online requests processed by each processing function respectively.
[0109] Among them, for any one processing function, the inventor counted the processing branches in the processing function used when using this processing function to process test requests, and counted the processing branches in the processing function used when using this processing function to process online requests, and found that the processing branches in the processing function used when using this processing function to process test requests are not exactly the same as the processing branches in the processing function used when using this processing function to process online requests. That is to say, there are differences between the processing branches in the processing function used when using this processing function to process test requests and the processing branches in the processing function used when using this processing function to process online requests.
[0110] In addition, the inventor also found that: the time consumed in the process of using different processing branches in this processing function to process requests is also different.
[0111] This leads to: the pressure on the data server corresponding to the application program in the test environment is different from the pressure on the data server corresponding to the application program in the online environment.
[0112] For example, the time taken for the data server corresponding to the application to process a large number of test requests is different from the time taken for the data server corresponding to the application to process online requests sent by a large number of users for the application.
[0113] Moreover, in some cases, "the processing branch of the processing function used when processing test requests with this processing function" is different from "the processing branch of the processing function used when processing online requests with this processing function". For "the processing branch of the processing function used when processing test requests with this processing function", the time taken to process test requests using this processing branch is often shorter. Additionally, for "the processing branch of the processing function used when processing online requests with this processing function", the time taken to process online requests using this processing branch is often longer.
[0114] This will result in: the pressure on the data server corresponding to the application in the test environment is less than the pressure on the data server corresponding to the application in the online environment, which in turn leads to: the time taken for the data server corresponding to the application to process online requests sent by a large number of users for the application is longer than the time taken for the data server corresponding to the application to process a large number of test requests.
[0115] For this reason, in order to accurately measure the time taken for the data server corresponding to the application to process a large number of test requests, it is necessary to make the pressure on the data server corresponding to the application in the test environment the same as or similar to the pressure on the data server corresponding to the application in the online environment. In this way, the time taken for the data server corresponding to the application to process a large number of test requests may be the same as or similar to the online situation, that is, it may be accurate.
[0116] In order to make the pressure on the data server corresponding to the application in the test environment the same as or similar to the pressure on the data server corresponding to the application in the online environment, in one approach, the processing branch in the processing function used by the data server corresponding to the application to process online requests can be referred to for processing test requests.
[0117] For example, with reference to the usage frequency ratio among the respective processing branches in the processing functions used by the data server corresponding to the reference application to handle a large number of online requests, test requests are generated and the generated test requests are used to perform a stress test on the data server corresponding to the application, so that the usage frequency ratio among the respective processing branches in the processing functions used by the data server corresponding to the application to handle a large number of test requests is the same as or similar to the usage frequency ratio among the respective processing branches in the processing functions used by the data server corresponding to the application to handle a large number of online requests, etc.
[0118] Specifically, referring to Figure 1 , which shows a structural block diagram of a data processing system of the present application. The processing system includes a test server 01 and a data server 02.
[0119] The data server includes the server corresponding to the application.
[0120] The application can perform data interaction with the data server. For example, in the scenario where the application interacts with the data server corresponding to the application, the application can send a request to the data server. The data server receives the request, processes the request, obtains a processing result, and then can return the processing result to the application. The application can receive the processing result.
[0121] The test server is communicatively connected to the data server. The test server can be a server managed by testers, etc.
[0122] Referring to Figure 2 , which shows a step flowchart of a data processing method of the present application. This method is applied to Figure 1 the data processing system shown, and this method can specifically include the following steps:
[0123] In step S101, the data server receives multiple online requests sent externally.
[0124] After the application goes online, a large number of users can install the application on their own terminals and use the application. During the process of using the application, it is often necessary for the application to interact with the data server. For example, the application can send an online request to the data server to request the data server to process the online request. The data server can receive the online request and process the online request to obtain a processing result.
[0125] The multiple online requests can be sent by different users using their respective applications to the data server, etc.
[0126] The external of the present application can include the scope of a large number of users who use the application, etc.
[0127] Online requests may include HTTP (Hyper Text Transfer Protocol) requests, TCP (Transmission Control Protocol) requests, UDP (User Datagram Protocol) requests, etc.
[0128] In step S102, the data server forwards multiple online requests to the test server.
[0129] In an embodiment of the present application, one of the objectives of the present application is to perform a stress test on the data server. When performing a stress test on the data server, it needs to be initiated by the test server. Thus, after the data server receives multiple online requests, regardless of whether the data server needs to separately process each of the multiple online requests to obtain the processing results of each online request and return the processing results of each online request to the outside, the data server can forward the multiple online requests to the test server, so that the test server can determine the usage ratio between each processing branch in the processing functions used by the data server to process the online requests sent by the application programs of a large number of users according to the multiple online requests, and then generate a test request with reference to the usage ratio and use the generated test request to perform a stress test on the data server corresponding to the application program. For specific details, please refer to the subsequent description and will not be elaborated here.
[0130] In step S103, the test server receives the multiple online requests forwarded by the data server.
[0131] In step S104, for any one of the multiple online requests, the test server retrieves the processing function including multiple processing branches in the test server for processing this online request, extracts the request parameters in this online request, uses this processing function and these request parameters to process this online request, and determines the processing branch used when processing this online request among the multiple processing branches.
[0132] In the present application, for any one of the multiple online requests, this online request includes at least request parameters and a function interface, and the request parameters and the function interface are located in different fields of the online request respectively.
[0133] The function interfaces of different processing functions are different. The function interface is used to retrieve the processing function, and the function interface may include an API (Application Programming Interface), etc.
[0134] All processing functions that may be used when processing requests sent by the application are pre-set in the data server. Similarly, all processing functions that may be used when processing requests sent by the application are also pre-set in the test server. That is, the processing functions set in the data server are the same as those set in the test server.
[0135] Among them, at least some of the processing functions have multiple processing branches. When processing a request through a processing function, usually only one processing branch processing function is used, etc.
[0136] Among them, the test server can extract request parameters from the field for storing request parameters in the online request, and in addition, can also extract function interfaces from the field for storing function interfaces in the online request.
[0137] Then, the processing function corresponding to the function interface is retrieved from the multiple processing functions pre-set in the test server, which is the processing function including multiple processing branches for processing the online request in the test server.
[0138] After that, the test server can use the processing function and the request parameters to process the online request. For example, the request parameters are passed to the processing function to use the processing function to process the online request and obtain a processing result.
[0139] In addition, it is also possible to determine the processing branch used when processing the online request among the multiple processing branches in the processing function.
[0140] Among them, in this application, every time the test server executes an action, the stack information corresponding to the action will be recorded. In this way, during the process of using the processing function to process the online request, the stack information related to "using the processing function to process the online request" will be recorded, and the stack information includes at least the branch identifier of the processing branch used when processing the online request, etc.
[0141] In this way, the processing branch used when processing the online request can be determined according to the branch identifier recorded in the stack information.
[0142] Among them, the branch identifiers of different branches are different.
[0143] In step S105, the test server generates a first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used according to the request parameters in each online request among multiple online requests and the branch identifier of the processing branch used when processing each online request.
[0144] In the present application, for any one of multiple online requests, the test server at this time has the request parameters in the online request and the branch identifier of the processing branch used when the test server processes the online request.
[0145] In this way, the test server can create a first correspondence relationship (which may be empty and without content at this time). The first correspondence relationship is used to record corresponding table entries. One corresponding table entry can record three related data. For example, it includes the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used, etc.
[0146] Among them, the test server can search for the corresponding table entry including the branch identifier of the processing branch used when processing the online request in the first correspondence relationship.
[0147] In one embodiment, when a corresponding table entry including the branch identifier of the processing branch used when processing the online request is found in the first correspondence relationship, if the set of request parameters in the corresponding table entry includes the request parameters in the online request, the total number of times of use in the corresponding table entry can be increased. Or, if the set of request parameters in the corresponding table entry does not include the request parameters in the online request, the request parameters in the online request can be added to the set of request parameters in the corresponding table entry, and the total number of times of use in the corresponding table entry can be increased.
[0148] Or, when a corresponding table entry including the branch identifier of the processing branch used when processing the online request is not found in the first correspondence relationship, a set of request parameters including the request parameters in the online request can be generated, the initial value of the number of times can be set, and then the branch identifier of the processing branch used when processing the online request, the generated set of request parameters, and the initial value of the number of times are combined into a corresponding table entry and stored in the first correspondence relationship.
[0149] In this way, the first correspondence relationship has substantial content, that is, the first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used is realized.
[0150] After that, the first correspondence relationship can be stored in the test server for later use.
[0151] In this application, the data server receives multiple online requests sent externally. The data server forwards the multiple online requests to the test server. The test server receives the multiple online requests forwarded by the data server. For any one of the multiple online requests, the test server retrieves a processing function including multiple processing branches in the test server for processing the online request, extracts the request parameters in the online request, uses the processing function and the request parameters to process the online request, and determines the processing branch used when processing the online request among the multiple processing branches. The test server generates a first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used according to the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request.
[0152] Furthermore, the test server can obtain the first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used. For any one of the multiple processing branches, in the first correspondence relationship, find the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the processing branch is used corresponding to the branch identifier of the processing branch. Generate a test request corresponding to the processing branch at least according to the retrieved set of request parameters and the retrieved total number of times the processing branch is used. The test request includes the request parameters in the retrieved set of request parameters. Perform a stress test on the data server according to the test requests corresponding to each processing branch.
[0153] In this way, the usage frequency ratio among the various processing branches in the processing functions respectively used by the data server to process a large number of online requests can be obtained, and test requests are generated according to the usage frequency ratio among the various processing branches in the processing function, and the generated test requests are used to perform a stress test on the data server, so that the usage frequency ratio among the various processing branches in the processing functions respectively used by the data server to process a large number of test requests is the same as or similar to the usage frequency ratio among the various processing branches in the processing functions respectively used by the data server to process a large number of online requests. Furthermore, the stress on the data server in the test environment can be made the same as or similar to the stress on the data server in the online environment. In this way, the time consumed in the process of the data server processing a large number of test requests may be the same as or similar to the online situation, that is, a test that conforms to the online situation for the data server can be realized.
[0154] Among them, in the case of obtaining the first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of uses of the processing branch, the usage frequency ratio among the respective processing branches in the processing functions used for the online requests sent by the application programs for a large number of users can be obtained. In this way, the test requests can be generated with reference to the usage frequency ratio, and the generated test requests can be used to perform a stress test on the data server corresponding to the application program.
[0155] For example, referring to Figure 3 , a step flowchart of a data processing method according to the present application is shown. This method is applied to Figure 1 the test server shown, and this method may specifically include the following steps:
[0156] In step S201, obtain the first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of uses of the processing branch.
[0157] In the present application, the first correspondence relationship is generated by the test server according to the request parameters in each of the multiple online requests and the branch identifiers of the processing branches used when processing each of the online requests (the specific generation process can refer to the embodiment shown in Figure 2 , which will not be elaborated here). The multiple online requests are sent externally to the data server and are forwarded by the data server to the test server. And for any one of the multiple online requests, the request parameters in the online request are extracted by the test server from the online request, and the processing branch used when processing the online request is determined among the multiple processing branches in the case of using the processing function including multiple processing branches in the retrieved test server for processing the online request and the request parameters in the extracted online request to process the online request.
[0158] The scenario of the embodiment of the present application is to perform a stress test on the data server with the aid of the first correspondence relationship after generating the first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of uses of the processing branch.
[0159] In the present application, for the test server, after generating the first correspondence relationship, it can automatically start to perform a stress test on the data server with the aid of the first correspondence relationship. For example, it can automatically start to execute step S201.
[0160] Alternatively, after generating the first corresponding relationship, it can output a prompt message. After the tester sees this prompt message, they can learn that the test server has generated the first corresponding relationship. In this way, there are conditions for performing a stress test on the data server with the help of the first corresponding relationship. Thus, when the tester needs to start a stress test on the data server, the tester can input a test operation in the test server. When the test server receives the test operation, it then performs a stress test on the data server with the help of the first corresponding relationship. For example, it starts to execute step S201 again.
[0161] In step S202, for any one of the multiple processing branches, find the set of request parameters corresponding to the branch identifier of this processing branch and the total number of uses corresponding to the branch identifier of this processing branch in the first corresponding relationship. Generate a test request corresponding to this processing branch at least based on the found set of request parameters and the found total number of uses. The test request includes the request parameters in the found set of request parameters.
[0162] Among them, the ratio between the number of test requests corresponding to each generated processing branch is matched with the ratio between the total number of uses of each processing branch in the first corresponding relationship. Matching can be understood as being the same or similar, etc.
[0163] In this application, for any one of the multiple processing branches, the ratio between the number of test requests corresponding to this processing branch that needs to be generated and the total number of uses corresponding to the branch identifier of this processing branch in the first corresponding relationship can be set in advance.
[0164] Among them, the total number of uses corresponding to the branch identifier of this processing branch in the first corresponding relationship can be obtained from the first corresponding relationship. This ratio can be set by the tester or automatically set by the test server according to the actual situation (in one example, this ratio can be 1 or 2 or 3, etc., and can be specifically determined according to the actual situation. This application does not limit this). In this way, the number of test requests corresponding to this processing branch that needs to be generated can be obtained.
[0165] Then generate this number of test requests corresponding to this processing branch. Each test request corresponding to this processing branch includes one request parameter in the found set of request parameters.
[0166] The same applies to each of the other processing branches among the multiple processing branches.
[0167] Among them, for any two of the multiple processing branches, the ratio of "the number of test requests corresponding to one processing branch to be generated to the total number of uses corresponding to the branch identifier of this processing branch in the first correspondence" is the same as the ratio of "the number of test requests corresponding to another processing branch to be generated to the total number of uses corresponding to the branch identifier of the other processing branch in the first correspondence". The same applies to every other two of the multiple processing branches.
[0168] In step S203, a stress test is performed on the data server according to the test requests corresponding to each processing branch.
[0169] For example, the test requests corresponding to each processing branch can be sent to the data server concurrently and centrally, so that the data server can receive the test requests corresponding to each processing branch concurrently and centrally, and process the test requests corresponding to each processing branch concurrently and centrally. Then, the tester can count the test situation of the data server's processing of a large number of test requests to obtain the stress test result of the data server corresponding to the application program.
[0170] In this application, the first correspondence among the branch identifier of the processing branch, the set of request parameters, and the total number of uses of the processing branch is obtained. For any one of the multiple processing branches, the set of request parameters corresponding to the branch identifier of this processing branch and the total number of uses corresponding to the branch identifier of this processing branch are found in the first correspondence. At least based on the found set of request parameters and the found total number of uses, a test request corresponding to this processing branch is generated, and the request parameters in the found set of request parameters are included in the test request. A stress test is performed on the data server according to the test requests corresponding to each processing branch.
[0171] Through this application, the usage ratio among the processing branches in the processing functions used by the data server to process a large number of online requests can be obtained, and test requests are generated according to the usage ratio among the processing branches in the processing function, and the generated test requests are used to perform a stress test on the data server, so that the usage ratio among the processing branches in the processing functions used by the data server to process a large number of test requests is the same as or similar to the usage ratio among the processing branches in the processing functions used by the data server to process a large number of online requests. Furthermore, the stress on the data server in the test environment can be made the same as or similar to the stress on the data server in the online environment. In this way, the time consumed by the data server in the process of processing a large number of test requests may be the same as or similar to the online situation, that is, a test that conforms to the online situation can be realized for the data server.
[0172] In this application, multiple online requests can be separately sent by a large number of external users to the data server during the use of the application program and need to be processed by the data server.
[0173] Both the data server and the test server have processing logics (processing mechanisms or processing capabilities) for processing requests sent by the application program, and the processing results obtained by the data server and the test server respectively for the same request are the same.
[0174] And in Figure 2 In the illustrated embodiment, the test server has obtained a processing result after processing the online request. Thus, the processing result obtained by the test server after processing the online request can be directly responded to the user, and it is not necessary for the data server to repeatedly process the online request, thereby saving the system resources of the data server.
[0175] Specifically, after the test server uses the processing function and the request parameters to process the online request to obtain the processing result, it can send the processing result to the data server. The data server can receive the processing result sent by the test server and forward the processing result externally.
[0176] Furthermore, in another embodiment of this application, the inventor also found the following situation:
[0177] For any one of multiple processing branches, the time consumed by the data server to process a certain number of online requests using this processing branch is different from the time consumed by the test server to process the same number of test requests using this processing branch.
[0178] For example, there is often a situation where the time consumed by the data server to process a certain number of online requests using this processing branch is longer than the time consumed by the test server to process the same number of test requests using this processing branch.
[0179] This results in the inaccurate measurement of the time consumed by the data server corresponding to the application program to process a large number of test requests, which does not conform to the online situation.
[0180] The inventor attempts to analyze the reason for "the time consumed by the data server to process a certain number of online requests using this processing branch is longer than the time consumed by the test server to process the same number of test requests using this processing branch".
[0181] For example, the inventor analyzed the request parameters in a certain number of online requests processed by the data server using this processing branch and the request parameters in a certain number of test requests processed by the test server using this processing branch, and found that: Although the request parameters in a certain number of online requests processed by the data server using this processing branch and the request parameters in a certain number of test requests processed by the test server using this processing branch are both within the set of request parameters corresponding to this processing branch in the first corresponding relationship, the request parameters in a certain number of online requests processed by the data server using this processing branch and the request parameters in a certain number of test requests processed by the test server using this processing branch are not all the same.
[0182] Furthermore, the inventor counted and compared the time taken for the data server to use this processing branch to process test requests including different request parameters in "the set of request parameters corresponding to this processing branch in the first corresponding relationship", and found that: The time taken for the data server to use this processing branch to process test requests including different request parameters in "the set of request parameters corresponding to this processing branch in the first corresponding relationship" is not all the same.
[0183] Thus, the inventor summarized a logical link: Since the time taken for the data server to use this processing branch to process test requests including different request parameters in "the set of request parameters corresponding to this processing branch in the first corresponding relationship" is not all the same, and the request parameters in a certain number of online requests processed by the data server using this processing branch and the request parameters in a certain number of test requests processed by the test server using this processing branch are not all the same, this results in the time taken for the data server to use this processing branch to process a certain number of online requests being longer than the time taken for the test server to use this processing branch to process a certain number of test requests.
[0184] In view of this, in order to accurately measure the time taken for the data server corresponding to the application program to process a large number of test requests.
[0185] In addition to making the ratio between the total number of times of using each processing branch in the processing function by the data server to process test requests match the ratio between the total number of times of using each processing branch in the processing function by the data server to process online requests, it is also necessary to make, for any one processing branch, the ratio between the actual quantities of each request parameter in the request parameters of each test request processed using this processing branch match the ratio between the actual quantities of each request parameter in the request parameters of each online request processed using this processing branch. Matching can be understood as being the same or similar.
[0186] To make the ratio of the total number of times each processing branch in the processing function is used by the data server to process test requests match the ratio of the total number of times each processing branch in the processing function is used by the data server to process online requests, and, for any one processing branch, to make the ratio of the actual quantities of the respective request parameters in the request parameters of each test request processed using this processing branch match the ratio of the actual quantities of the respective request parameters in the request parameters of each online request processed using this processing branch, based on the embodiment shown in Figure 2 see Figure 4 , the method further includes:
[0187] In step S301, for any one of the multiple processing branches, the online requests processed using this processing branch can be determined among the multiple online requests.
[0188] Wherein, in this application, every time the test server executes an action, the stack information corresponding to this action will be recorded. Thus, during the process of using this processing branch to process an online request, the stack information related to "using this processing branch to process this online request" will be recorded. The stack information at least includes the binding relationship between the branch identifier of the processing branch used when processing this online request and the request identifier of this online request, etc.
[0189] Thus, the online requests processed using this processing branch can be determined according to the binding relationship recorded in the stack information.
[0190] Wherein, the request identifiers of different requests are different.
[0191] In step S302, among the request parameters of the determined online requests, the actual quantities of the respective request parameters are counted.
[0192] The request parameters of the determined online requests can be extracted. Among the extracted request parameters, some request parameters are the same. Thus, the extracted request parameters can be classified, and the actual quantity of each category of request parameters can be counted separately.
[0193] In step S303, according to the branch identifier of this processing branch, the respective request parameters, and the actual quantities of the respective request parameters, a second correspondence relationship between the branch identifier of the processing branch, the request parameters, and the actual quantities is generated.
[0194] For example, the test server can create a second correspondence relationship (which can be empty and contain no content at this time). The second correspondence relationship is used to record corresponding table entries. One corresponding table entry can record three related data. For example, it includes the branch identifier of the processing branch, the request parameter, and the actual quantity of the request parameter, etc.
[0195] Among them, for any category of request parameters after classification, the branch identifier of the processing branch, the request parameter, and the actual quantity of the request parameter can be combined to form a corresponding table entry, and stored in the second correspondence relationship between the branch identifier of the processing branch, the request parameter, and the actual quantity. For each other category of request parameters after classification, the above operation is also performed.
[0196] In this way, the second correspondence relationship has substantial content, that is, the second correspondence relationship between the branch identifier of the processing branch, the request parameter, and the actual quantity is generated.
[0197] After that, the second correspondence relationship can be stored in the test server for later use.
[0198] Correspondingly, when generating a test request corresponding to the processing branch at least according to the found request parameter set and the found total number of uses in step S202, see Figure 5 , it can be through the following process including:
[0199] In step S401, obtain the second correspondence relationship between the branch identifier of the processing branch, the request parameter, and the actual quantity.
[0200] In this application, the second correspondence relationship is generated according to the processing branch, each request parameter in the online requests processed by the processing branch among multiple online requests, and the actual quantity of each request parameter (the specific generation process can refer to the embodiments shown in Figure 4 , which will not be elaborated here).
[0201] In step S402, for any request parameter in the found request parameter set, find the actual quantity corresponding to the request parameter in the second correspondence relationship. According to the found total number of uses and the found actual quantity, generate a test request corresponding to the processing branch including the request parameter.
[0202] Among them, the ratio between the request quantities of the test requests corresponding to the processing branch including each request parameter in the found request parameter set is matched with the ratio between the actual quantities corresponding to each request parameter in the found request parameter set in the second correspondence relationship. Matching can be understood as the same or similar, etc.
[0203] In the present application, for any one of the request parameters found in the set of request parameters, the ratio between the number of test requests including this request parameter to be generated in advance and the actual number corresponding to this request parameter in the second correspondence can be set.
[0204] Among them, the sum of the numbers of test requests respectively including each request parameter to be generated is proportional to the total number of times of use found.
[0205] Among them, this ratio can be set by the tester or automatically set by the test server according to the actual situation (in one example, this ratio can be 1 or 2 or 3, etc., and can be determined specifically according to the actual situation, and the present application does not limit this). In this way, the number of test requests including this request parameter to be generated can be obtained.
[0206] Then generate this number of test requests including this request parameter.
[0207] The same applies to each of the other request parameters found in the set of request parameters.
[0208] Among them, for any two request parameters found in the set of request parameters, "the ratio between the number of test requests including one request parameter to be generated and the actual number corresponding to this request parameter in the second correspondence" is the same as "the ratio between the number of test requests including the other request parameter to be generated and the actual number corresponding to the other request parameter in the second correspondence". The same applies to each of the other two request parameters found in the set of request parameters.
[0209] It should be noted that for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily essential to the present application.
[0210] Referring to Figure 6 , a structural block diagram of a data processing device of the present application is shown, which is applied to a test server. The device includes:
[0211] A first receiving module 11, configured to receive a plurality of online requests forwarded by a data server, where the plurality of online requests are sent by an external party to the data server;
[0212] The first determination module 12 is configured to, for any online request among the multiple online requests, retrieve a processing function including multiple processing branches in the test server for processing the online request, extract request parameters in the online request, process the online request using the processing function and the request parameters, and determine the processing branch used when processing the online request among the multiple processing branches;
[0213] The first generation module 13 is configured to generate a first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used according to the request parameters in each of the multiple online requests and the branch identifiers of the processing branches respectively used when processing each online request, so that for any processing branch among the multiple processing branches, the test server searches in the first correspondence relationship for the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the branch identifier of the processing branch is used; generate a test request corresponding to the processing branch at least according to the retrieved set of request parameters and the retrieved total number of times the processing branch is used, where the test request includes the request parameters in the retrieved set of request parameters; the ratio between the request quantities of the test requests respectively corresponding to the multiple processing branches generated is matched with the ratio between the total number of times the multiple processing branches in the first correspondence relationship are used; and then perform a stress test on the data server according to the test requests respectively corresponding to the multiple processing branches.
[0214] In an optional implementation manner, the first generation module includes:
[0215] The first search unit is configured to, for any online request among the multiple online requests, search in the first correspondence relationship for a corresponding entry including the branch identifier of the processing branch used when processing the online request;
[0216] The increment unit is configured to, when a corresponding entry including the branch identifier of the processing branch used when processing the online request is found in the first correspondence relationship, if the set of request parameters in the corresponding entry includes the request parameters in the online request, increment the total number of times used in the corresponding entry; or, if the set of request parameters in the corresponding entry does not include the request parameters in the online request, add the request parameters in the online request to the set of request parameters in the corresponding entry, and increment the total number of times used in the corresponding entry;
[0217] Or,
[0218] A storage unit is used to generate a request parameter set including the request parameters in the online request, set an initial value of the number of times, form a corresponding entry by using the branch identifier of the processing branch used when processing the online request, the generated request parameter set, and the initial value of the number of times, and store it in the first correspondence when no corresponding entry including the branch identifier of the processing branch used when processing the online request is found in the first correspondence.
[0219] In an optional implementation manner, the apparatus further includes:
[0220] A second determination module is used to determine, for any one of the multiple processing branches, the online requests processed by using the processing branch among the multiple online requests;
[0221] A statistics module is used to count the actual quantity of each request parameter among the request parameters in the determined online requests;
[0222] A second generation module is used to generate a second correspondence between the branch identifier of the processing branch, the request parameters, and the actual quantity according to the branch identifier of the processing branch, each request parameter, and the actual quantity of each request parameter.
[0223] In an optional implementation manner, the apparatus further includes:
[0224] A sending module is used to send the processing result obtained by processing the online request by using the processing function and the request parameters to the data server, so that the data server forwards the processing result to the outside.
[0225] In this application, the data server receives multiple online requests sent from the outside. The data server forwards the multiple online requests to the test server. The test server receives the multiple online requests forwarded by the data server. For any one of the multiple online requests, the test server invokes a processing function including multiple processing branches in the test server for processing the online request, extracts the request parameters in the online request, processes the online request by using the processing function and the request parameters, and determines the processing branch used when processing the online request among the multiple processing branches. The test server generates a first correspondence between the branch identifier of the processing branch, the request parameter set, and the total number of times the processing branch is used according to the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request.
[0226] Furthermore, the test server can obtain the first corresponding relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used. For any one of the multiple processing branches, find the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the processing branch is used corresponding to the branch identifier of the processing branch in the first corresponding relationship. Generate a test request corresponding to the processing branch at least based on the found set of request parameters and the found total number of times the processing branch is used. The test request includes the request parameters in the found set of request parameters. Perform a stress test on the data server according to the test requests corresponding to each processing branch respectively.
[0227] In this way, the usage frequency ratio among the various processing branches in the processing functions used by the data server to process a large number of online requests can be obtained. And based on the usage frequency ratio among the various processing branches in the processing function, generate test requests and use the generated test requests to perform a stress test on the data server, so that the usage frequency ratio among the various processing branches in the processing functions used by the data server to process a large number of test requests is the same as or similar to the usage frequency ratio among the various processing branches in the processing functions used by the data server to process a large number of online requests, etc. Furthermore, it can be ensured that the pressure on the data server in the test environment is the same as or similar to the pressure on the data server in the online environment. In this way, the time consumed in the process of the data server processing a large number of test requests may be the same as or similar to the online situation, that is, it is possible to achieve a test of the data server that conforms to the online situation.
[0228] Refer to Figure 7 , which shows a structural block diagram of a data processing device of the present application, applied to a data server. The device includes:
[0229] A second receiving module 21, configured to receive a plurality of online requests sent externally;
[0230] A sending module 22, configured to forward the multiple online requests to a test server, so that for any one of the multiple online requests, the test server retrieves a processing function including multiple processing branches in the test server for processing the online request, extracts request parameters in the online request, processes the online request by using the processing function and the request parameters, and determines a processing branch used when processing the online request among the multiple processing branches; generate a first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used according to the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request; and further enable the test server to look up the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the processing branch is used corresponding to the branch identifier of the processing branch in the first correspondence relationship for any one of the multiple processing branches; generate a test request corresponding to the processing branch at least according to the looked-up set of request parameters and the looked-up total number of times the processing branch is used, where the test request includes the request parameters in the looked-up set of request parameters; where the ratio between the request quantities of the test requests respectively corresponding to the generated processing branches matches the ratio between the total number of times the respective processing branches are used in the first correspondence relationship; and then perform a stress test on the data server according to the test requests respectively corresponding to the processing branches.
[0231] In an optional implementation manner, the apparatus further includes:
[0232] A third receiving module, configured to receive a processing result obtained by processing the online request by using the processing function and the request parameters, which is returned by the test server;
[0233] A forwarding module, configured to forward the processing result to the outside.
[0234] In this application, a data server receives multiple online requests sent from the outside. The data server forwards the multiple online requests to the test server. The test server receives the multiple online requests forwarded by the data server. For any one of the multiple online requests, the test server retrieves a processing function including multiple processing branches in the test server for processing the online request, extracts request parameters in the online request, processes the online request by using the processing function and the request parameters, and determines a processing branch used when processing the online request among the multiple processing branches. The test server generates a first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used according to the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request.
[0235] Furthermore, the test server can obtain the first corresponding relationship among the branch identifier of the processing branch, the set of request parameters, and the total usage times of the processing branch. For any one of the multiple processing branches, the set of request parameters corresponding to the branch identifier of the processing branch and the total usage times corresponding to the branch identifier of the processing branch are found in the first corresponding relationship. At least based on the found set of request parameters and the found total usage times, a test request corresponding to the processing branch is generated, and the test request includes the request parameters in the found set of request parameters. The data server is stress-tested according to the test requests corresponding to the respective processing branches.
[0236] In this way, the usage ratio among the respective processing branches in the processing functions used by the data server to process a large number of online requests can be obtained, and the test requests are generated according to the usage ratio among the respective processing branches in the processing function, and the data server is stress-tested using the generated test requests, so that the usage ratio among the respective processing branches in the processing functions used by the data server to process a large number of test requests is the same as or similar to the usage ratio among the respective processing branches in the processing functions used by the data server to process a large number of online requests. Furthermore, the stress on the data server in the test environment can be made the same as or similar to the stress on the data server in the online environment. In this way, the time consumed in the process of the data server processing a large number of test requests is likely to be the same as or similar to the online situation, that is, it is possible to implement a test of the data server that conforms to the online situation.
[0237] Refer to Figure 8 , which shows a structural block diagram of a data processing device of the present application, applied to a test server. The device includes:
[0238] An obtaining module 31, configured to obtain the first corresponding relationship among the branch identifier of the processing branch, the set of request parameters, and the total usage times of the processing branch. The first corresponding relationship is generated by the test server according to the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each of the online requests. The multiple online requests are sent externally to the data server and forwarded by the data server to the test server. And for any one of the multiple online requests, the request parameters in the online request are extracted by the test server from the online request, and the processing branch used when processing the online request is determined among the multiple processing branches in the case of using the processing function including multiple processing branches in the retrieved test server to process the online request using the processing function and the extracted request parameters in the online request.
[0239] A third generation module 32, configured to, for any one of the multiple processing branches, find a set of request parameters corresponding to the branch identifier of the processing branch and the total number of uses corresponding to the branch identifier of the processing branch in the first correspondence relationship; generate a test request corresponding to the processing branch at least according to the found set of request parameters and the found total number of uses, where the test request includes the request parameters in the found set of request parameters.
[0240] Wherein, the ratio between the request quantities of the test requests respectively corresponding to the generated processing branches matches the ratio between the total numbers of uses of the respective processing branches in the first correspondence relationship.
[0241] A test module 33, configured to perform a stress test on the data server according to the test requests respectively corresponding to the respective processing branches.
[0242] In an optional implementation manner, the third generation module includes:
[0243] An obtaining unit, configured to obtain a second correspondence relationship between the branch identifier of the processing branch, the request parameters, and the actual quantity, where the second correspondence relationship is generated according to the processing branch, each request parameter in the online requests processed by the processing branch among the multiple online requests, and the actual quantity of each request parameter.
[0244] A second searching unit, configured to, for any one of the request parameters in the found set of request parameters, find the actual quantity corresponding to the request parameter in the second correspondence relationship.
[0245] A generating unit, configured to generate a test request corresponding to the processing branch including the request parameter according to the found total number of uses and the found actual quantity.
[0246] Wherein, the ratio between the request quantities of the test requests respectively corresponding to the processing branch and including each request parameter in the found set of request parameters matches the ratio between the actual quantities corresponding to each request parameter in the found set of request parameters in the second correspondence relationship.
[0247] In this application, the data server receives multiple online requests sent externally. The data server forwards the multiple online requests to the test server. The test server receives the multiple online requests forwarded by the data server. For any one of the multiple online requests, the test server retrieves a processing function including multiple processing branches in the test server for processing the online request, extracts the request parameters in the online request, processes the online request using the processing function and the request parameters, and determines the processing branch used when processing the online request among the multiple processing branches. The test server generates a first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total usage times of the processing branch based on the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request.
[0248] Furthermore, the test server can obtain the first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total usage times of the processing branch. For any one of the multiple processing branches, the set of request parameters corresponding to the branch identifier of the processing branch and the total usage times corresponding to the branch identifier of the processing branch are searched for in the first correspondence relationship. At least based on the retrieved set of request parameters and the retrieved total usage times, a test request corresponding to the processing branch is generated, and the test request includes the request parameters in the retrieved set of request parameters. The data server is stress-tested according to the test requests corresponding to each processing branch.
[0249] In this way, the usage times ratio among the respective processing branches in the processing functions used by the data server to process a large number of online requests can be obtained, and test requests are generated based on the usage times ratio among the respective processing branches in the processing function and the data server is stress-tested using the generated test requests, so that the usage times ratio among the respective processing branches in the processing functions used by the data server to process a large number of test requests is the same as or similar to the usage times ratio among the respective processing branches in the processing functions used by the data server to process a large number of online requests, etc. Furthermore, the stress on the data server in the test environment can be made the same as or similar to the stress on the data server in the online environment. In this way, the time consumed in the process of the data server processing a large number of test requests is likely to be the same as or similar to the online situation, that is, a test that conforms to the online situation for the data server can be implemented.
[0250] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant parts, refer to the partial description of the method embodiment.
[0251] Optionally, an embodiment of the present invention further provides an electronic device, including: a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements each process of the above method embodiment and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0252] An embodiment of the present invention further provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by the processor, it implements each process of the above method embodiment and can achieve the same technical effect. To avoid repetition, it will not be elaborated here. Among them, the computer-readable storage medium is, for example, a read-only memory (ROM for short), a random access memory (RAM for short), a magnetic disk, or an optical disc, etc.
[0253] Figure 9 FIG. 800 is a block diagram of an electronic device 800 shown in the present application. For example, the electronic device 800 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0254] Refer to Figure 9 , the electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0255] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communication, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0256] The memory 804 is configured to store various types of data to support the operation of the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, images, videos, and the like. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk.
[0257] The power supply component 806 provides power to various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
[0258] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can not only sense the boundaries of touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
[0259] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC) that is configured to receive external audio signals when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 further includes a speaker for outputting audio signals.
[0260] The I / O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which can be a keyboard, a click wheel, buttons, etc. These buttons can include, but are not limited to: a home button, a volume button, a power button, and a lock button.
[0261] The sensor assembly 814 includes one or more sensors for providing a status assessment of various aspects for the electronic device 800. For example, the sensor assembly 814 can detect the on / off state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800. The sensor assembly 814 can also detect a change in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and a change in the temperature of the electronic device 800. The sensor assembly 814 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0262] The communication component 816 is configured to facilitate communication between the electronic device 800 and other devices in a wired or wireless manner. The electronic device 800 can access a wireless network based on communication standards, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast operation information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0263] In an exemplary embodiment, the electronic device 800 can be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above method.
[0264] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the above instructions can be executed by a processor 820 of the electronic device 800 to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0265] Figure 10It is a block diagram of an electronic device 1900 shown in the present application. For example, the electronic device 1900 can be provided as a server.
[0266] Referring to Figure 10 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by a memory 1932 for storing instructions executable by the processing component 1922, such as application programs. The application programs stored in the memory 1932 can include one or more modules each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0267] The electronic device 1900 may further include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 can operate based on an operating system stored in the memory 1932, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.
[0268] It should be noted that in this article, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including that element.
[0269] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in various embodiments of the present invention.
[0270] The embodiments of the present invention have been described above in conjunction with the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present invention, those of ordinary skill in the art can also make many forms without departing from the spirit and scope protected by the present invention and the claims, and all of them belong to the protection scope of the present invention.
[0271] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0272] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0273] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical, or other forms.
[0274] The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they can be located in one place, or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0275] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
[0276] When the above-mentioned functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or a part of this technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs.
[0277] As described above, the above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A data processing method, characterized in that, Applied to a test server, the method includes: Receiving a plurality of online requests forwarded by a data server, where the plurality of online requests are sent to the data server from the outside; For any one of the plurality of online requests, invoking a processing function in the test server that includes multiple processing branches for processing the online request, extracting request parameters in the online request, using the processing function and the request parameters to process the online request, and determining the processing branch used when processing the online request among the multiple processing branches; According to the request parameters in each of the plurality of online requests and the branch identifiers of the processing branches used when processing each of the online requests, generating a first correspondence among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used, so that for any one of the multiple processing branches, the test server searches in the first correspondence for the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the branch identifier of the processing branch is used; generating a test request corresponding to the processing branch at least based on the found set of request parameters and the found total number of times used, where the test request includes the request parameters in the found set of request parameters; wherein, the ratio between the request quantities of the test requests respectively corresponding to the generated processing branches matches the ratio between the total number of times the respective processing branches are used in the first correspondence; then performing a stress test on the data server according to the test requests respectively corresponding to the processing branches.
2. The method according to claim 1, characterized in that, The generating a first correspondence among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used according to the request parameters in each of the plurality of online requests and the branch identifiers of the processing branches used when processing each of the online requests includes: For any one of the plurality of online requests, searching in the first correspondence for a corresponding entry that includes the branch identifier of the processing branch used when processing the online request; When a corresponding entry that includes the branch identifier of the processing branch used when processing the online request is found in the first correspondence, if the set of request parameters in the corresponding entry includes the request parameters in the online request, increasing the total number of times used in the corresponding entry; or, if the set of request parameters in the corresponding entry does not include the request parameters in the online request, adding the request parameters in the online request to the set of request parameters in the corresponding entry, and increasing the total number of times used in the corresponding entry; Or, In the case that no corresponding table entry including the branch identifier of the processing branch used when processing the online request is found in the first corresponding relationship, a request parameter set including the request parameters in the online request is generated, an initial value of the number of times is set, and a corresponding table entry is formed by the branch identifier of the processing branch used when processing the online request, the generated request parameter set, and the initial value of the number of times, and is stored in the first corresponding relationship.
3. The method according to claim 1, characterized in that The method further includes: For any one of the multiple processing branches, determine the online requests processed using the processing branch among the multiple online requests; Among the request parameters in the determined online requests, count the actual number of each request parameter; According to the branch identifier of the processing branch, each request parameter, and the actual number of each request parameter, generate a second corresponding relationship among the branch identifier of the processing branch, the request parameter, and the actual number.
4. The method according to claim 1, wherein The method further includes: Send the processing result obtained by processing the online request using the processing function and the request parameter to the data server, so that the data server forwards the processing result to the outside.
5. A data processing method, characterized in that, Applied to the data server, the method includes: Receive multiple online requests sent from the outside; Forward the multiple online requests to the test server, so that for any one of the multiple online requests, the test server invokes the processing function including multiple processing branches in the test server for processing the online request, extracts the request parameters in the online request, processes the online request using the processing function and the request parameters, and determines the processing branch used when processing the online request among the multiple processing branches; according to the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request respectively, generate a first corresponding relationship among the branch identifier of the processing branch, the request parameter set, and the total number of times of use of the processing branch; and further, for any one of the multiple processing branches, the test server searches in the first corresponding relationship for the request parameter set corresponding to the branch identifier of the processing branch and the total number of times of use corresponding to the branch identifier of the processing branch; generate a test request corresponding to the processing branch at least according to the found request parameter set and the found total number of times of use, where the test request includes the request parameters in the found request parameter set; where the ratio between the request quantities of the test requests respectively corresponding to the generated processing branches matches the ratio between the total number of times of use of the respective processing branches in the first corresponding relationship; and then perform a stress test on the data server according to the test requests respectively corresponding to the processing branches.
6. The method according to claim 5, wherein The method further includes: Receive the processing result obtained by processing the online request using the processing function and the request parameter returned by the test server; Forward the processing result to the outside.
7. A data processing method, characterized in that, Applied to the test server, the method includes: Obtain the first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used. The first correspondence relationship is generated by the test server according to the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request. The multiple online requests are sent by the outside to the data server and are forwarded by the data server to the test server. And for any one of the multiple online requests, the request parameters in the online request are extracted by the test server from the online request, and the processing branch used when processing the online request is determined among the multiple processing branches in the case of using the processing function for processing the online request, which includes multiple processing branches in the retrieved test server, and using the processing function and the extracted request parameters in the online request to process the online request. For any one of the multiple processing branches, look up the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the branch identifier of the processing branch is used in the first correspondence relationship. Generate a test request corresponding to the processing branch at least according to the retrieved set of request parameters and the retrieved total number of times used. The test request includes the request parameters in the retrieved set of request parameters. Among them, the ratio between the number of test requests corresponding to each generated processing branch matches the ratio between the total number of times each processing branch is used in the first correspondence relationship. Perform a stress test on the data server according to the test requests corresponding to each processing branch.
8. The method according to claim 7, wherein The at least generating a test request corresponding to the processing branch according to the retrieved set of request parameters and the retrieved total number of times used includes: Obtain the second correspondence relationship among the branch identifier of the processing branch, the request parameters, and the actual quantity. The second correspondence relationship is generated according to the processing branch, each request parameter in the online requests processed by using the processing branch among the multiple online requests, and the actual quantity of each request parameter. For any one of the request parameters in the retrieved set of request parameters, look up the actual quantity corresponding to the request parameter in the second correspondence relationship. Generate a test request corresponding to the processing branch including the request parameter according to the retrieved total number of times used and the retrieved actual quantity. Among them, the ratio between the number of test requests corresponding to each request parameter in the retrieved set of request parameters, which are generated for the processing branch, matches the ratio between the actual quantities corresponding to each request parameter in the retrieved set of request parameters in the second correspondence relationship.
9. A data processing device, characterized in that, Applied to a test server, the device includes: A first receiving module, configured to receive multiple online requests forwarded by a data server. The multiple online requests are sent by the outside to the data server. A first determination module, configured to, for any one of the multiple online requests, retrieve a processing function including multiple processing branches in the test server for processing the online request, extract request parameters in the online request, process the online request using the processing function and the request parameters, and determine, among the multiple processing branches, the processing branch used when processing the online request; A first generation module, configured to generate a first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used according to the request parameters in each of the multiple online requests and the branch identifier of the processing branch used when processing each online request, so that for any one of the multiple processing branches, the test server searches in the first correspondence relationship for the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the branch identifier of the processing branch is used; generate a test request corresponding to the processing branch at least according to the retrieved set of request parameters and the retrieved total number of times, where the test request includes the request parameters in the retrieved set of request parameters; where the ratio between the request quantities of the test requests respectively corresponding to the generated processing branches matches the ratio between the total number of times each processing branch is used in the first correspondence relationship; and then perform a stress test on the data server according to the test requests respectively corresponding to each processing branch.
10. The device according to claim 9, characterized in that, The first generation module includes: A first search unit, configured to, for any one of the multiple online requests, search in the first correspondence relationship for a corresponding entry including the branch identifier of the processing branch used when processing the online request; An increment unit, configured to, when a corresponding entry including the branch identifier of the processing branch used when processing the online request is found in the first correspondence relationship, if the set of request parameters in the corresponding entry includes the request parameters in the online request, increment the total number of times used in the corresponding entry; or, if the set of request parameters in the corresponding entry does not include the request parameters in the online request, add the request parameters in the online request to the set of request parameters in the corresponding entry, and increment the total number of times used in the corresponding entry; Or, A storage unit, configured to, when a corresponding entry including the branch identifier of the processing branch used when processing the online request is not found in the first correspondence relationship, generate a set of request parameters including the request parameters in the online request, set an initial value for the number of times, form a corresponding entry with the branch identifier of the processing branch used when processing the online request, the generated set of request parameters, and the initial value for the number of times, and store it in the first correspondence relationship.
11. The device according to claim 9, wherein The apparatus further includes: A second determination module, configured to, for any one of the multiple processing branches, determine, among the multiple online requests, the online request processed using the processing branch; A statistics module, configured to count the actual quantity of each request parameter among the request parameters in each determined online request. A second generation module, configured to generate a second correspondence relationship between the branch identifier of the processing branch, each request parameter, and the actual quantity of each request parameter according to the branch identifier of the processing branch, each request parameter, and the actual quantity of each request parameter.
12. The device according to claim 9, characterized in that The device further includes: A sending module, configured to send the processing result obtained by processing the online request using the processing function and the request parameter to the data server, so that the data server forwards the processing result to the outside.
13. A data processing device, characterized in that, Applied to a data server, the device includes: A second receiving module, configured to receive multiple online requests sent from the outside. A sending module, configured to forward the multiple online requests to a test server, so that for any one of the multiple online requests, the test server retrieves a processing function including multiple processing branches for processing the online request in the test server, extracts the request parameters in the online request, processes the online request using the processing function and the request parameters, and determines the processing branch used when processing the online request among the multiple processing branches; generate a first correspondence relationship among the branch identifier of the processing branch, the set of request parameters, and the total number of times the processing branch is used according to the request parameters in each of the multiple online requests and the branch identifiers of the processing branches respectively used when processing each online request; and further enable the test server to look up the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times the branch identifier of the processing branch is used in the first correspondence relationship for any one of the multiple processing branches; generate a test request corresponding to the processing branch at least according to the retrieved set of request parameters and the retrieved total number of times, where the test request includes the request parameters in the retrieved set of request parameters; where the ratio between the request quantities of the test requests respectively corresponding to each processing branch generated is matched with the ratio between the total number of times each processing branch is used in the first correspondence relationship; and then perform a stress test on the data server according to the test requests respectively corresponding to each processing branch.
14. The device according to claim 13, wherein The device further includes: A third receiving module, configured to receive the processing result obtained by processing the online request using the processing function and the request parameter returned by the test server. A forwarding module, configured to forward the processing result to the outside.
15. A data processing device, characterized in that, Applied to a test server, the device includes: An obtaining module, configured to obtain a first correspondence relationship among a branch identifier of a processing branch, a set of request parameters, and the total number of times of use of the processing branch. The first correspondence relationship is generated by the test server according to the request parameters in each of a plurality of online requests and the branch identifier of the processing branch used when processing each of the online requests. The plurality of online requests are sent externally to the data server and forwarded by the data server to the test server. And for any one of the plurality of online requests, the request parameters in the online request are extracted by the test server from the online request, and the processing branch used when processing the online request is determined among the plurality of processing branches in the case of using the processing function including a plurality of processing branches in the retrieved test server for processing the online request, using the processing function and the extracted request parameters in the online request to process the online request. A third generation module, configured to, for any one of the plurality of processing branches, search in the first correspondence relationship for the set of request parameters corresponding to the branch identifier of the processing branch and the total number of times of use corresponding to the branch identifier of the processing branch; and generate a test request corresponding to the processing branch at least according to the retrieved set of request parameters and the retrieved total number of times of use, where the test request includes the request parameters in the retrieved set of request parameters. Wherein, the ratio between the request quantities of the test requests respectively corresponding to the generated respective processing branches matches the ratio between the total number of times of use of the respective processing branches in the first correspondence relationship. A test module, configured to perform a stress test on the data server according to the test requests respectively corresponding to the respective processing branches.
16. The device according to claim 15, characterized in that, The third generation module includes: An obtaining unit, configured to obtain a second correspondence relationship among a branch identifier of a processing branch, request parameters, and an actual quantity. The second correspondence relationship is generated according to the processing branch, each of the request parameters in the online requests processed by using the processing branch among the plurality of online requests, and the actual quantity of each request parameter. A second search unit, configured to, for any one of the request parameters in the retrieved set of request parameters, search in the second correspondence relationship for the actual quantity corresponding to the request parameter. A generation unit, configured to generate a test request corresponding to the processing branch including the request parameter according to the retrieved total number of times of use and the retrieved actual quantity. Wherein, the ratio between the request quantities of the test requests corresponding to the processing branch respectively including each of the request parameters in the retrieved set of request parameters matches the ratio between the actual quantities corresponding to each of the request parameters in the retrieved set of request parameters in the second correspondence relationship.
17. An electronic device, characterized in that, Including: A processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements the data processing method according to any one of claims 1 to 8.
18. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements the data processing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Software testing method and apparatus
CN107038108A
Testing method and system for application, electronic device and storage medium
CN109271325A