Log playback method, boost test method, device and computer equipment
By analyzing the identification information and dependencies of the http request log data and performing reorganization processing, the problems of low efficiency and low success rate in log playback and boost test are solved, and efficient log playback and pressure measurement are achieved, and concurrency intensity is improved.
Patent Information
- Application Number
- CN202210784546.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-05
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2042-07-05
AI Technical Summary
In the prior art, log playback and booster testing are inefficient, have low success rate, and insufficient concurrency, resulting in cumbersome operation and error-proneness, and limited interface coverage.
By obtaining http request log data, analyzing the requested identification information, determining the dependencies, and performing reorganization processing, constructing a playback orchestration strategy to achieve efficient log playback and boost testing.
It improves the success rate of log playback and the concurrency intensity of pressure measurement, enhances interface coverage, and ensures the efficiency and accuracy of testing.
Smart Images

Figure CN115185919B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of testing technology, and in particular to a log playback method, a boost testing method, a log playback device, a boost testing device, a computer device, and a computer-readable storage medium. Background Art
[0002] Currently, log playback and boost testing are typically performed manually by editing requests and then replaying and testing them. This approach is cumbersome, error-prone, and has limited interface coverage.
[0003] During the implementation of the present invention, the inventors discovered that HTTP requests can be automatically retrieved by obtaining HTTP request logs, eliminating the need for manual editing. However, while this approach improves efficiency, because the database contains stateful components, individual requests must have dependencies. This can lead to inconsistent database state changes and cause playback failures. Summary of the Invention
[0004] In view of the above problems, embodiments of the present invention provide a log playback method, a boost testing method, a log playback device, a boost testing device, a computer device, and a computer-readable storage medium, which are used to solve the technical problems of low log playback efficiency, low success rate, and low boost testing concurrency in the prior art.
[0005] According to one aspect of an embodiment of the present invention, a log playback method is provided, the method comprising:
[0006] Obtaining http request log data; the http request log data includes identification information of each http request;
[0007] Parsing the http request log data according to the identification information to obtain the dependency relationship between each http request in the http request log data;
[0008] According to the dependency relationship, each HTTP request is re-arranged to obtain a playback arrangement strategy;
[0009] The http request log data is replayed according to the replay arrangement strategy.
[0010] In an optional manner, the http request log data is obtained; before the http request log data includes identification information of each http log, the method includes: intercepting the http request entry and a common database primary key generation method to record the identification information of each of the http requests.
[0011] In an optional manner, the interception of the http request entry and the public database primary key generation method to record the identification information of each of the http requests includes: based on the JVM-Sandbox sandbox, intercepting the HTTP request entry and the public database primary key generation method in sequence to record the identification information and generation time information of each of the http requests.
[0012] In an optional manner, the replay processing of the http request log data according to the replay orchestration strategy includes: replaying the http requests in sequence according to the replay editing strategy; determining whether the target http request at each moment causes the database to generate a new database object in the stress testing environment; when a new database object is generated, replacing the primary key ID of the new database object with the primary key ID in the target http request.
[0013] In an optional manner, the http request log data is parsed according to the identification information to obtain the dependency relationship between each http request in the http request log data, including: converting each of the http requests in the http request log data into triple data, the triple data including http request parameter information, identification information and PKS information; the PKS information contains the http request identification information of the next node; and determining the dependency relationship between each http request based on the PKS information.
[0014] In an optional manner, the re-arranging of each http request according to the dependency relationship to obtain a playback orchestration strategy includes: constructing a directed acyclic graph according to the dependency relationship; the nodes of the directed acyclic graph represent http requests, and the edges between the nodes represent dependency relationships; and obtaining the playback orchestration strategy according to the directed acyclic graph.
[0015] According to another aspect of an embodiment of the present invention, a pressure boosting test method is provided, the method comprising:
[0016] Replay the http request log data according to the log playback method;
[0017] When the playback is successful, the concurrent http requests are determined according to the dependency relationship for each of the http request log data to form a concurrent test strategy;
[0018] According to the concurrent testing strategy, each of the http request log data is tested.
[0019] According to another aspect of an embodiment of the present invention, a log playback device is provided, comprising:
[0020] An acquisition module is used to acquire http request log data; the http request log data includes identification information of each http request;
[0021] A parsing module, configured to parse the http request log data according to the identification information to obtain a dependency relationship between each http request in the http request log data;
[0022] A playback orchestration strategy module is used to re-arrange each HTTP request according to the dependency relationship to obtain a playback orchestration strategy;
[0023] The playback module is used to play back the http request log data according to the playback arrangement strategy.
[0024] According to another aspect of an embodiment of the present invention, a computer device is provided, including:
[0025] A processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus;
[0026] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the operation of the log playback method or the boost testing method.
[0027] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, wherein the storage medium stores at least one executable instruction. When the executable instruction is executed on a computer device, the computer device executes the operation of the log playback method or the boost testing method.
[0028] The embodiment of the present invention obtains HTTP request log data; the HTTP request log data includes identification information of each HTTP request; according to the identification information, the HTTP request log data is parsed to obtain dependency relationships of each HTTP request in the HTTP request log data; according to the dependency relationships, each HTTP request is re-arranged to obtain a playback orchestration strategy; and the HTTP request log data is replayed according to the playback orchestration strategy, so that the HTTP requests can be re-arranged according to the dependency relationships between each HTTP request, so as to efficiently perform playback and testing, improve the success rate of playback, and improve the concurrency intensity and interface coverage of stress testing.
[0029] The above description is only an overview of the technical solutions of the embodiments of the present invention. In order to more clearly understand the technical means of the embodiments of the present invention, they can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiments of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present invention. In addition, the same reference symbols are used to represent the same components throughout the drawings. In the drawings:
[0031] Figure 1 A schematic diagram illustrating an environment of a log playback method provided by an embodiment of the present invention is shown;
[0032] Figure 2 A schematic diagram of database evolution during log playback provided by an embodiment of the present invention is shown;
[0033] Figure 3 A flow chart of a log playback method provided by an embodiment of the present invention is shown;
[0034] Figure 4 A schematic diagram of HTTP log recording and request playback provided by an embodiment of the present invention is shown;
[0035] Figure 5 A schematic diagram showing dependency relationships of various HTTP requests provided by an embodiment of the present invention is shown;
[0036] Figure 6 A schematic flow chart of a pressure boosting test method according to an embodiment of the present invention is shown;
[0037] Figure 7 A schematic diagram showing the structure of a log playback device provided by an embodiment of the present invention is shown;
[0038] Figure 8 A schematic structural diagram of a computer device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0039] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0040] First, let's introduce the log playback environment diagram provided by the embodiment of the present invention. Figure 1As shown, the log playback method of the embodiment of the present invention is mainly aimed at data playback and comparison at the database level or applied to performance testing of the system. The Nginx server in the production environment is responsible for recording the http request log, and the log is parsed by the playback environment and the http request is reconstructed to achieve log playback. Among them, during the log playback process, it is necessary to simulate the environmental parameters of the production environment in the playback environment. For example, the regular code of the WEB server in the production environment is synchronized to the stressed web server in the playback environment, the files of the file server in the production environment are regularly synchronized to the file server in the playback environment, and the database data in the production environment is regularly synchronized to the receipt view in the playback environment, etc., and the log is pushed to the playback environment through regular http log synchronization for log playback.
[0041] The log playback method of this embodiment is applicable to B / S systems that meet the following conditions: 1. The primary key of the database table is a string type; 2. The primary key of the database table is uniformly generated and inserted by the JVM program; 3. If all characters of the primary key are randomly generated, the length must be greater than or equal to 8; if the primary key string is not completely randomly generated, the fixed prefix string must be clearly distinguishable; 4. The response to HTTP requests is synchronous; 5. The processing of a single HTTP request is single-threaded.
[0042] Figure 2 The flowchart of the log playback method provided by the embodiment of the present invention is shown, and the method is executed by a computer device. The computer device can be a personal computer, a tablet computer, a server device, a cloud computing device, etc., and the embodiment of the present invention does not make specific restrictions. Figure 2 As shown, the method includes the following steps:
[0043] Step 110: Acquire http request log data; the http request log data includes identification information of each http request.
[0044] The identification information may include the primary key ID and PKS information.
[0045] In the embodiment of the present invention, based on the JVM-Sandbox sandbox, HTTP request entry and public database primary key generation method are intercepted in sequence to record the identification information and generation time information of each http request, thereby obtaining http request log data. Specifically, Figure 4As shown, during the recording of HTTP request logs in a production environment, the JVM-Sandbox intercepts HTTP request entry points. When an HTTP request is generated, the HTTP return class object is stored in the current thread variable via Java-agent entry point 1. When the database generates an HTTP request, it sequentially calls the dofilter() method and the createUUID() method, generating a random number R using a global random number generator. The JVM-Sandbox writes this random number R to the HTTP return class header via Java-agent entry point 2 and stores this random number R and the corresponding HTTP request information in the log. The database writes the object primary key ID R, thereby storing the HTTP request and its corresponding primary key R in the database. This method allows the JVM-Sandbox to obtain the identification information and generation time of each HTTP request in the HTTP request log data. Based on JVM-Sandbox sandbox technology, the overall process logically uses the production environment as the recording end point. The Nginx server implements a customized HTTP access log. This log not only records key HTTP request information but also includes all primary key IDs (typically UUIDs) added to the database during the lifecycle of each request.
[0046] The purpose of doing this is to maintain data consistency. Figure 3 As shown, the inventors of the present application discovered during the implementation of the embodiments of the present invention that the following problems exist when adopting the method of regularly synchronizing http logs: Assuming that the initial states of the databases in the production environment and the playback environment are consistent, there are two objects A and B, where the circles represent the operations on the database at various times and the results of the operations, and the arrows represent the objects of the operations. Assuming that the http requests in the production environment are all in line with the business process, there is no inconsistency in the state changes of the database. At this time, the Nginx server in the production environment truthfully records all the information of the http requests. However, replaying the HTTP requests that are faithfully recorded by the Nginx server in the playback environment will cause the problem of being not completely consistent with the production environment. The reason is that the primary key ID (e.g., ID=D) of database objects generated in the production environment is usually randomly generated, and subsequent access to the object is entirely based on the previously randomly generated ID (e.g., ID=D). However, in the playback environment, since the ID of a newly generated database object is also randomly generated, the generated object has a different ID (e.g., ID=F). However, according to the collected http request log data, the object of subsequent requests in the log is still ID=D. At this time, the database in the playback environment cannot be associated with the object with ID=D (the object with ID=D does not exist in the playback environment), resulting in business data consistency issues and causing playback failure. The primary key ID can be used to match http requests with the primary key ID of the new database object.
[0047] Step 120: Parse the http request log data according to the identification information to obtain dependency relationships among the http requests in the http request log data.
[0048] Wherein, the identification information includes the primary key ID and PKS information. Each of the http requests in the http request log data is converted into triple data respectively, and the triple data includes http request parameter information, primary key ID and PKS information; the PKS information contains the http request identification information of the next node; according to the PKS information, the dependency relationship between each http request is determined. Specifically, a line of log can be simplified into a 3-tuple: [HTTP request parameter information, requestId, pks], wherein pks is usually a uuid array (primary key in some tables). The PKS information contains the http request identification information of the next node. As Figure 5 As shown, each circular graph represents an HTTP request, and each request has a corresponding occurrence time, such as T0 or T1. Request dependency is defined as follows: if any item in request A.pks appears in the parameter information of request B, then request B depends on request A, and the dependency satisfies transitive properties. For example, if object A's PKS (A.pks) appears in the triple data of object B, then object B depends on object A. This method can determine the dependency between HTTP requests and determine the temporal relationship between them.
[0049] Step 130: Rearrange each HTTP request according to the dependency relationship to obtain a playback arrangement strategy.
[0050] After obtaining the dependency relationship, each http request can be re-arranged according to the dependency relationship and the time sequence relationship, including: constructing a directed acyclic graph according to the dependency relationship; the nodes of the directed acyclic graph represent the http requests, and the edges between the nodes represent the dependency relationship; and obtaining the playback arrangement strategy according to the directed acyclic graph. Figure 5 As shown in FIG, each HTTP request can be represented by a similar directed acyclic graph, wherein the root node of the directed acyclic graph is the HTTP request in the initial state.
[0051] If no re-arrangement is performed, the Figure 5 As shown in the figure, 8 requests are initiated at different times, and the server only processes 1 request at each time, so the pressure coefficient is 1. In the embodiment of the present invention, after determining the dependency, the relationship between each http request can be determined. For requests that are not dependent on each other, they can be re-arranged and processed concurrently, and are concurrent requests. Figure 5As shown in , requests of the same color are requests with complementary dependencies.
[0052] In an embodiment of the present invention, the playback orchestration strategy uses a preset priority algorithm to traverse the directed acyclic graph. When any HTTP request node is found to have no pre-dependencies, the HTTP request or requests are sent to the server in the playback environment for playback processing. The preset priority algorithm can be a breadth-first algorithm. This playback orchestration strategy can generate multiple times the pressure on the production environment while ensuring that dependencies between requests are not violated.
[0053] Step 140: replay the http request log data according to the replay arrangement strategy.
[0054] Among them, according to the above-mentioned playback orchestration strategy, the directed acyclic graph is traversed, and when it is found that the node of any http request has no pre-dependency, the one or more http requests are sent to the server of the playback environment, and the server of the playback environment performs playback processing according to the received http requests.
[0055] In this embodiment of the present invention, the playback environment, acting as the playback endpoint, parses the Nginx server's access logs, constructs HTTP requests consistent with the production environment, and sends them to the stressed web server. Leveraging JVM-Sandbox interface enhancement technology, the stressed web server parses the HTTP request and faithfully passes the recording endpoint's primary key ID to the corresponding interface, ensuring the legitimacy of cross-references between database tables and enabling high-quality request playback.
[0056] Among them, such as Figure 4As shown in the right figure, during the playback process, the playback client parses the Nginx server log and sends the primary key ID of the http request in the http request log data to the stressed server. The JVM-Sandbox intercepts the unified http request entry, constructs the primary key ID in the log of this line and stores it in ThreadLocal (thread context data storage); at the same time, it intercepts the common primary key createUUID(). When the corresponding http request needs to be generated in the playback environment, the primary key recorded in ThreadLocal is taken out in turn to replace the primary key ID of the new database object generated by the database in the playback environment caused by the http request generated at runtime. In this way, the primary key of the http request in the http request log data and the primary key ID of the new database object generated in the playback environment can be kept consistent. Specifically, according to the playback editing strategy, the http request is played back in sequence; it is determined whether the target http request at each moment causes the database to generate a new database object in the stress testing environment; when a new database object is generated, the primary key ID of the new database object is replaced with the primary key ID in the target http request.
[0057] The embodiment of the present invention obtains HTTP request log data; the HTTP request log data includes identification information of each HTTP request; according to the identification information, the HTTP request log data is parsed to obtain dependency relationships of each HTTP request in the HTTP request log data; according to the dependency relationships, each HTTP request is re-arranged to obtain a playback orchestration strategy; and the HTTP request log data is replayed according to the playback orchestration strategy, so that the HTTP requests can be re-arranged according to the dependency relationships between each HTTP request, so as to efficiently perform playback and testing, improve the success rate of playback, and improve the concurrency intensity and interface coverage of stress testing.
[0058] Figure 6 The flowchart of the boost test method provided by another embodiment of the present invention is shown, and the method is executed by a computer device. The computer device can be a personal computer, a tablet computer, a server device, a cloud computing device, etc., and the embodiment of the present invention does not make specific restrictions. Figure 6 As shown, the method includes the following steps:
[0059] Step 210: replay the http request log data according to the log replay method.
[0060] The specific implementation process of the log playback method is generally consistent with the method steps of the above method embodiment, and will not be repeated here.
[0061] Step 220: When the playback is successful, determine the concurrent http requests for each of the http request log data according to the dependency relationship to form a concurrent test strategy.
[0062] Wherein, when the playback is successful, the dependency is determined according to the dependency determination method in the above-mentioned log playback method embodiment, and a directed acyclic graph is constructed based on the dependency; the nodes of the directed acyclic graph represent http requests, and the edges between the nodes represent dependency relationships; according to the directed acyclic graph, the concurrent test strategy is obtained. Wherein, the concurrent test strategy refers to a strategy for performing concurrent tests according to concurrent http requests. Specifically, the directed acyclic graph can be traversed according to a preset priority algorithm, and when it is found that there is no pre-dependency item for the node of any http request, the one or more http requests are sent to the test server, and the test server performs a boost test based on the received http request. In this way, the effect of increasing the stress test concurrency intensity and interface coverage as needed can be achieved.
[0063] Figure 7 FIG. 1 shows a schematic diagram of the structure of a log playback device provided by an embodiment of the present invention. Figure 7 As shown, the device 300 includes:
[0064] The acquisition module 310 is used to obtain HTTP request log data; the HTTP request log data includes identification information of each HTTP request;
[0065] The parsing module 320 is used to parse the http request log data according to the identification information to obtain the dependency relationship of each http request in the http request log data;
[0066] A playback orchestration strategy module 330 is configured to re-arrange each HTTP request according to the dependency relationship to obtain a playback orchestration strategy;
[0067] The playback module 340 is used to play back the http request log data according to the playback arrangement strategy.
[0068] In an optional manner, the http request log data is obtained; before the http request log data includes identification information of each http log, the method includes: intercepting the http request entry and a common database primary key generation method to record the identification information of each of the http requests.
[0069] In an optional manner, the interception of the http request entry and the public database primary key generation method to record the identification information of each of the http requests includes: based on the JVM-Sandbox sandbox, intercepting the HTTP request entry and the public database primary key generation method in sequence to record the identification information and generation time information of each of the http requests.
[0070] In an optional manner, the replay processing of the http request log data according to the replay orchestration strategy includes: replaying the http requests in sequence according to the replay editing strategy; determining whether the target http request at each moment causes the database to generate a new database object in the stress testing environment; when a new database object is generated, replacing the primary key ID of the new database object with the primary key ID in the target http request.
[0071] In an optional manner, the http request log data is parsed according to the identification information to obtain the dependency relationship between each http request in the http request log data, including: converting each of the http requests in the http request log data into triple data, the triple data including http request parameter information, identification information and PKS information; the PKS information contains the http request identification information of the next node; and determining the dependency relationship between each http request based on the PKS information.
[0072] In an optional manner, the re-arranging of each http request according to the dependency relationship to obtain a playback orchestration strategy includes: constructing a directed acyclic graph according to the dependency relationship; the nodes of the directed acyclic graph represent http requests, and the edges between the nodes represent dependency relationships; and obtaining the playback orchestration strategy according to the directed acyclic graph.
[0073] The specific working process of the log playback device in the embodiment of the present invention is generally consistent with the general steps of the above method embodiment, and will not be repeated here.
[0074] The embodiment of the present invention obtains HTTP request log data; the HTTP request log data includes identification information of each HTTP request; according to the identification information, the HTTP request log data is parsed to obtain dependency relationships of each HTTP request in the HTTP request log data; according to the dependency relationships, each HTTP request is re-arranged to obtain a playback orchestration strategy; and the HTTP request log data is replayed according to the playback orchestration strategy, so that the HTTP requests can be re-arranged according to the dependency relationships between each HTTP request, so as to efficiently perform playback and testing, improve the success rate of playback, and improve the concurrency intensity and interface coverage of stress testing.
[0075] Figure 8 The schematic diagram of the structure of the computer device provided by the embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the computer device.
[0076] like Figure 8 As shown, the computer device may include: a processor 402 , a communications interface 404 , a memory 406 , and a communication bus 408 .
[0077] Processor 402, communication interface 404, and memory 406 communicate with each other via communication bus 408. Communication interface 404 is used to communicate with other devices, such as clients or other server network elements. Processor 402 is used to execute program 410, which may specifically perform the steps described above for the log playback method or the boost testing method embodiment.
[0078] Specifically, the program 410 may include program code including computer-executable instructions.
[0079] Processor 402 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. The one or more processors included in a computer device may be of the same type, such as one or more CPUs, or may be of different types, such as one or more CPUs and one or more ASICs.
[0080] The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0081] The program 410 may be specifically called by the processor 402 to cause the computer device to perform the following operations:
[0082] Obtaining http request log data; the http request log data includes identification information of each http request;
[0083] Parsing the http request log data according to the identification information to obtain the dependency relationship between each http request in the http request log data;
[0084] According to the dependency relationship, each HTTP request is re-arranged to obtain a playback arrangement strategy;
[0085] Playback processing is performed on the http request log data according to the playback arrangement strategy;
[0086] or,
[0087] Replay the http request log data according to the log playback method;
[0088] When the playback is successful, the concurrent http requests are determined according to the dependency relationship for each of the http request log data to form a concurrent test strategy;
[0089] According to the concurrent testing strategy, each of the http request log data is tested.
[0090] In an optional manner, the http request log data is obtained; before the http request log data includes identification information of each http log, the method includes: intercepting the http request entry and a common database primary key generation method to record the identification information of each of the http requests.
[0091] In an optional manner, the interception of the http request entry and the public database primary key generation method to record the identification information of each of the http requests includes: based on the JVM-Sandbox sandbox, intercepting the HTTP request entry and the public database primary key generation method in sequence to record the identification information and generation time information of each of the http requests.
[0092] In an optional manner, the replay processing of the http request log data according to the replay orchestration strategy includes: replaying the http requests in sequence according to the replay editing strategy; determining whether the target http request at each moment causes the database to generate a new database object in the stress testing environment; when a new database object is generated, replacing the primary key ID of the new database object with the primary key ID in the target http request.
[0093] In an optional manner, the http request log data is parsed according to the identification information to obtain the dependency relationship between each http request in the http request log data, including: converting each of the http requests in the http request log data into triple data, the triple data including http request parameter information, identification information and PKS information; the PKS information contains the http request identification information of the next node; and determining the dependency relationship between each http request based on the PKS information.
[0094] In an optional manner, the re-arranging of each http request according to the dependency relationship to obtain a playback orchestration strategy includes: constructing a directed acyclic graph according to the dependency relationship; the nodes of the directed acyclic graph represent http requests, and the edges between the nodes represent dependency relationships; and obtaining the playback orchestration strategy according to the directed acyclic graph.
[0095] The embodiment of the present invention obtains HTTP request log data; the HTTP request log data includes identification information of each HTTP request; according to the identification information, the HTTP request log data is parsed to obtain dependency relationships of each HTTP request in the HTTP request log data; according to the dependency relationships, each HTTP request is re-arranged to obtain a playback orchestration strategy; the HTTP request log data is replayed according to the playback orchestration strategy, and the HTTP requests can be re-arranged according to the dependency relationships between the HTTP requests, so as to efficiently perform playback and testing, thereby improving stress testing concurrency intensity and interface coverage.
[0096] An embodiment of the present invention provides a computer-readable storage medium storing at least one executable instruction. When the executable instruction is executed on a computer device, the computer device executes the log playback method or the boost testing method described in any of the above method embodiments.
[0097] The executable instructions can be used to cause the computer device to perform the following operations:
[0098] Obtaining http request log data; the http request log data includes identification information of each http request;
[0099] Parsing the http request log data according to the identification information to obtain the dependency relationship between each http request in the http request log data;
[0100] According to the dependency relationship, each HTTP request is re-arranged to obtain a playback arrangement strategy;
[0101] Playback processing is performed on the http request log data according to the playback arrangement strategy;
[0102] or,
[0103] Replay the http request log data according to the log playback method;
[0104] When the playback is successful, the concurrent http requests are determined according to the dependency relationship for each of the http request log data to form a concurrent test strategy;
[0105] According to the concurrent testing strategy, each of the http request log data is tested.
[0106] In an optional manner, the http request log data is obtained; before the http request log data includes identification information of each http log, the method includes: intercepting the http request entry and a common database primary key generation method to record the identification information of each of the http requests.
[0107] In an optional manner, the interception of the http request entry and the public database primary key generation method to record the identification information of each of the http requests includes: based on the JVM-Sandbox sandbox, intercepting the HTTP request entry and the public database primary key generation method in sequence to record the identification information and generation time information of each of the http requests.
[0108] In an optional manner, the replay processing of the http request log data according to the replay orchestration strategy includes: replaying the http requests in sequence according to the replay editing strategy; determining whether the target http request at each moment causes the database to generate a new database object in the stress testing environment; when a new database object is generated, replacing the primary key ID of the new database object with the primary key ID in the target http request.
[0109] In an optional manner, the http request log data is parsed according to the identification information to obtain the dependency relationship between each http request in the http request log data, including: converting each of the http requests in the http request log data into triple data, the triple data including http request parameter information, identification information and PKS information; the PKS information contains the http request identification information of the next node; and determining the dependency relationship between each http request based on the PKS information.
[0110] In an optional manner, the re-arranging of each http request according to the dependency relationship to obtain a playback orchestration strategy includes: constructing a directed acyclic graph according to the dependency relationship; the nodes of the directed acyclic graph represent http requests, and the edges between the nodes represent dependency relationships; and obtaining the playback orchestration strategy according to the directed acyclic graph.
[0111] The embodiment of the present invention obtains HTTP request log data; the HTTP request log data includes identification information of each HTTP request; according to the identification information, the HTTP request log data is parsed to obtain dependency relationships of each HTTP request in the HTTP request log data; according to the dependency relationships, each HTTP request is re-arranged to obtain a playback orchestration strategy; and the HTTP request log data is replayed according to the playback orchestration strategy, so that the HTTP requests can be re-arranged according to the dependency relationships between each HTTP request, so as to efficiently perform playback and testing, improve the success rate of playback, and improve the concurrency intensity and interface coverage of stress testing.
[0112] An embodiment of the present invention provides a log playback device for executing the above-mentioned log playback method.
[0113] An embodiment of the present invention provides a boost test device for executing the boost test method.
[0114] An embodiment of the present invention provides a computer program that can be called by a processor to cause a computer device to execute the log playback method or the boost testing method in any of the above method embodiments.
[0115] An embodiment of the present invention provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed on a computer, the computer executes the log playback method or boost testing method in any of the above method embodiments.
[0116] The algorithm or demonstration provided herein are not inherently relevant to any particular computer, virtual system or other equipment. Various general-purpose systems may also be used together with the teachings based on this. According to the above description, it is apparent that the structure required for constructing this type of system. In addition, the embodiment of the present invention is not directed to any specific programming language yet. It should be understood that various programming languages can be utilized to realize the content of the present invention described herein, and the above description of specific languages is for the purpose of disclosing the best mode of the present invention.
[0117] In the description provided herein, numerous specific details are described. However, it is understood that embodiments of the present invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.
[0118] Similarly, it should be understood that in order to streamline the present invention and facilitate understanding of one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the embodiments of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this method of disclosure should not be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim.
[0119] Those skilled in the art will appreciate that the modules in the devices in the embodiments can be adaptively changed and set in one or more devices different from the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and can be divided into multiple sub-modules or sub-units or sub-components. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed so far can be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) can be replaced by an alternative feature that provides the same, equivalent or similar purpose.
[0120] It should be noted that the above embodiments illustrate rather than limit the invention, and that alternative embodiments may be devised by a person skilled in the art without departing from the scope of the appended claims. In the claims, any reference signs placed between brackets should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising several different elements and by means of appropriately programmed computers. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments should not be understood as limiting the order of execution unless otherwise specified.
Claims
1. A log playback method, characterized in that: The method comprises: Obtaining http request log data; the http request log data includes identification information of each http request; According to the identification information, the http request log data is parsed to obtain the dependency relationship of each http request in the http request log data; the identification information includes a primary key ID and PKS information; wherein, according to the identification information, the http request log data is parsed to obtain the dependency relationship of each http request in the http request log data, including: converting each of the http requests in the http request log data into triple data, the triple data including http request parameter information, primary key ID and PKS information; the PKS information includes the http request identification information of the next node; according to the PKS information, the dependency relationship between each http request is determined; wherein, a line of log is simplified into a 3-tuple: [HTTP request parameter information, requestId, pks], wherein pks is a uuid array; the request dependency relationship is defined as: if any item of request A.pks appears in the parameter information of request B, then request B depends on request A, and the dependency relationship satisfies transitivity; Rearranging each HTTP request according to the dependency relationship to obtain a playback arrangement strategy, including: constructing a directed acyclic graph according to the dependency relationship; the nodes of the directed acyclic graph represent HTTP requests, and the edges between the nodes represent the dependency relationship; and obtaining the playback arrangement strategy according to the directed acyclic graph; The http request log data is replayed according to the replay orchestration strategy.
2. The method according to claim 1, characterized in that The obtaining of http request log data; Before the http request log data includes identification information of each http log, the method includes: Intercept http request entry and a common database primary key generation method to record identification information of each of the http requests.
3. The method according to claim 2, characterized in that The interception http request entry and the common database primary key generation method to record the identification information of each http request include: Based on the JVM-Sandbox sandbox, the HTTP request entry and the public database primary key generation method are intercepted in sequence to record the identification information and generation time information of each of the http requests.
4. The method according to claim 1, wherein The identification information includes the primary key ID of the http request; The replaying the http request log data according to the replay arrangement strategy includes: According to the playback editing strategy, perform HTTP request playback in sequence; Determine whether the target HTTP request at each moment causes the database to generate new database objects in the stress testing environment; When a new database object is generated, the primary key ID of the new database object is replaced with the primary key ID in the target http request.
5. A boost test method, characterized in that: The method comprises: Replaying the http request log data according to the log playback method according to any one of claims 1 to 4; When the playback is successful, the concurrent http requests are determined according to the dependency relationship for each of the http request log data to form a concurrent test strategy; According to the concurrent testing strategy, each of the http request log data is tested.
6. A log playback device, characterized in that: The device comprises: An acquisition module is used to acquire http request log data; the http request log data includes identification information of each http request; A parsing module is used to parse the http request log data according to the identification information to obtain the dependency relationship of each http request in the http request log data, wherein the identification information includes a primary key ID and PKS information; wherein, parsing the http request log data according to the identification information to obtain the dependency relationship of each http request in the http request log data includes: converting each of the http requests in the http request log data into triple data, wherein the triple data includes http request parameter information, a primary key ID and PKS information; the PKS information includes the http request identification information of the next node; and determining the dependency relationship between each http request according to the PKS information; wherein, a line of log is simplified into a 3-tuple: [HTTP request parameter information, requestId, pks], wherein pks is a uuid array; the request dependency relationship is defined as: if any item of request A.pks appears in the parameter information of request B, then request B depends on request A, and the dependency relationship satisfies transitivity; A playback orchestration strategy module is configured to re-arrange each HTTP request according to the dependency relationship to obtain a playback orchestration strategy, comprising: constructing a directed acyclic graph according to the dependency relationship; the nodes of the directed acyclic graph represent HTTP requests, and the edges between the nodes represent dependency relationships; and obtaining the playback orchestration strategy according to the directed acyclic graph; The playback module is used to play back the http request log data according to the playback arrangement strategy.
7. A computer device, characterized in that: include: A processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform the operation of the log playback method according to any one of claims 1 to 4 or the boost testing method according to claim 5.
8. A computer-readable storage medium, characterized in that The storage medium stores at least one executable instruction. When the executable instruction is executed on a computer device, the computer device executes the operation of the log playback method according to any one of claims 1 to 4 or the boost testing method according to claim 5.
Citation Information
Patent Citations
Transaction log playback method and device of distributed core system, equipment and medium
CN114281784A