Method, electronic device and computer program product for managing resources
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- EMC IP HLDG CO LLC
- Filing Date
- 2021-09-30
- Publication Date
- 2026-08-07
Smart Images

Figure CN115878228B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of this disclosure relate to the field of computers, and more specifically, to methods for managing resources, electronic devices, and computer program products. Background Technology
[0002] Today, software is becoming increasingly complex, and the demands on it are becoming more dynamic. In the software industry, a new architecture—microservices—has been introduced. Microservice architecture allows for more flexible development of complex software. To implement a new end-to-end function, multiple microservices may need to work together. Therefore, call conventions are crucial, as they act as a bridge between microservices. The most common convention between microservices is the REST API (Representation Layer State Transition Application Programming Interface). The specification associated with REST APIs is the OpenAPI Specification (OAS). OAS defines URIs, input patterns, and output patterns, which can be used to generate mock servers. When given sample input, sample output is generated using the patterns defined by OAS. Summary of the Invention
[0003] The embodiments of this disclosure provide a solution for managing resources.
[0004] In a first aspect of this disclosure, a method for managing resources is provided. The method includes identifying a set of candidate historical requests associated with a target request, the set of candidate historical requests having the same request type and target resource as the target request. The method further includes determining a target request pattern for the target request based on at least one prior request of the target request. The method further includes determining a target historical request from the set of candidate historical requests based on the target request pattern. The method further includes generating a target response for the target request based on historical responses to the target historical requests.
[0005] In a second aspect of this disclosure, an electronic device is provided. The electronic device includes a processor and a memory coupled to the processor. The memory has instructions stored therein, which, when executed by the processor, cause the device to perform actions, including determining a set of candidate historical requests associated with a target request. Here, the set of candidate historical requests has the same request type and target resource as the target request. The actions also include determining a target request pattern for the target request based on at least one prior request of the target request. The actions further include determining a target historical request from the set of candidate historical requests based on the target request pattern. The actions also include generating a target response for the target request based on historical responses to the target historical requests.
[0006] In a third aspect of this disclosure, a computer program product is provided, which is tangibly stored on a computer-readable medium and includes machine-executable instructions that, when executed, cause a machine to perform the method according to the first aspect.
[0007] The summary section is provided to present the chosen concepts in a simplified form, which will be further described in the detailed description below. The summary section is not intended to identify key or principal features of this disclosure, nor is it intended to limit the scope of this disclosure. Attached Figure Description
[0008] The above and other objects, features, and advantages of this disclosure will become more apparent from the accompanying drawings, in which like reference numerals generally denote like parts. In the drawings:
[0009] Figure 1 A schematic diagram of an example environment in which embodiments of the present disclosure may be implemented is shown;
[0010] Figure 2 A flowchart illustrating an example method for managing resources according to embodiments of the present disclosure is shown;
[0011] Figure 3 A flowchart illustrating an example method for determining a target request pattern according to some embodiments of this disclosure is shown;
[0012] Figure 4 A schematic diagram illustrates an example process for determining a target request pattern according to some embodiments of the present disclosure;
[0013] Figure 5 A flowchart illustrating an example method for determining a target history request according to some embodiments of this disclosure is shown; and
[0014] Figure 6 A block diagram of an example device that can be used to implement embodiments of the present disclosure is shown. Detailed Implementation
[0015] The principles of this disclosure will now be described with reference to several exemplary embodiments illustrated in the accompanying drawings. While preferred embodiments of this disclosure are shown in the drawings, it should be understood that these embodiments are described only to enable those skilled in the art to better understand and implement this disclosure, and are not intended to limit the scope of this disclosure in any way.
[0016] The term "comprising" and its variations as used herein signify open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "at least partially based on". The terms "one example embodiment" and "one embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0017] As discussed above, a microservice may typically be associated with multiple other microservices. For example, microservices A, B, and C are interconnected. When developing new features, such as to test microservice B, it is necessary to simulate microservice A to obtain the response output and input it into microservice B.
[0018] Conventionally, OAS definitions can be used to generate mock servers. The mock server uses the OAS specification as a configuration file and generates output based on response patterns. For example, in the case of microservices interacting via a REST API, a request based on the Hypertext Transfer Protocol (HTTP) would be provided, including the request action or request type and the resource identifier of the targeted resource. In response to this request, the mock server would output the corresponding response. However, when using OAS for simulation, if the workflow is complex and multiple requests are interconnected, the responses output by the OAS-based mock server still indicate responses to individual requests and fail to reflect the relationships between them. This may result in some characteristics of microservices not being simulated. Therefore, there is a desire to simulate microservice workflows more effectively to improve engineering efficiency.
[0019] Embodiments of this disclosure propose a scheme for simulation using historical request and response data to address one or more of the aforementioned problems and other potential issues. In this scheme, a pattern of historical requests can be determined based on the request type (i.e., the action of the request) and the resource targeted by the request. A target historical request with the same request type and targeting the same resource as the target request is selected from the historical requests. Then, based on the response of the selected target historical request, a target response for the target request, based on the request pattern and the historical responses, can be generated. In this way, a more realistic and non-random response can be generated, thereby improving the accuracy of the simulation.
[0020] Figure 1 A schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented is shown. For example... Figure 1As shown, environment 100 includes computing device 110, examples of which include, but are not limited to, cloud-side servers, smartphones, laptops, tablets, desktops, or edge computing devices. Computing device 110 can receive request 120. During normal operation, upon receiving request 120, computing device 110 will invoke the corresponding application to process request 120 and output a corresponding real response 130. Simultaneously, computing device 110 stores the real response 130 in historical request 140. During simulated operation, computing device 110, for example, upon receiving request 120, can simulate and generate a test response 150 to request 120 for subsequent processing. It should be understood that the architecture and functionality in environment 100 are described for illustrative purposes only and do not imply any limitation on the scope of this disclosure. Embodiments of this disclosure can also be applied to environments involving data protection systems with different structures and / or functions.
[0021] The following will combine Figures 2 to 4 The following describes in detail the exemplary embodiments of this disclosure. Figure 2 A flowchart of an example method 200 for managing resources according to an embodiment of the present disclosure is shown. Method 200 may, for example, be derived from... Figure 1 The computing device 110 in the middle is used to execute.
[0022] like Figure 2 As shown, at box 202, computing device 110 determines a set of candidate historical requests associated with the target request. Here, the set of candidate historical requests has the same request type and target resource as the target request. Typically, a request includes a request type and a targeted resource. The request type indicates the "operation" of the request, such as requesting to retrieve, upload, or delete a resource. In some embodiments, where the request follows HTTP, the request type may be "GET", "POST", "PUT", etc. In some embodiments, where the request follows HTTP, the requested resource may be identified by a Uniform Resource Identifier (URI). In some embodiments, historical requests may be requests recorded during service integration testing, and responses to historical requests are also recorded.
[0023] At box 204, computing device 110 determines the target request pattern of the target request based on at least one prior request of the target request. Typically, to implement a specific workflow, multiple corresponding specific requests are sent to the service in a certain order. Therefore, by using at least one prior request of the target request, the workflow can be determined and the target request pattern identified. The following will refer to... Figure 3 and Figure 4 This section describes in detail the process of determining the request pattern.
[0024] Figure 3A flowchart of an example method 300 for determining a target request pattern according to some embodiments of the present disclosure is shown. Method 300 may, for example, be derived by... Figure 1 The computing device 110 in the middle performs the operation.
[0025] like Figure 3 As shown in block 302, to determine the target request pattern of a target request, computing device 110 can determine at least one prior request from a plurality of prior requests of the target request. Here, at least one prior request and one request of the target request are associated with at least one other request. The prior requests of the target request include not only prior requests associated with the workflow to which the target request belongs, but also some unrelated prior requests. Therefore, to accurately determine the target request pattern of the target request, it is necessary to select the prior requests associated with the target request. In some embodiments, the following criteria can be followed to determine whether two requests are associated:
[0026] 1. Include the same resource information in two requests or their responses.
[0027] 2. Resource information associated with one request and resource information associated with another request are included in the same third request or its response.
[0028] Here, resource information refers to information associated with the resource targeted by the request, such as the resource's ID or name. When information associated with the respective resources of two requests is included in the same third request, it can indicate that the third request associates the resources targeted by the two requests, thus making the two requests related.
[0029] It should be understood that the above criteria for judging the relevance of requests apply not only to the target request and its prior requests, but also to judging the relevance between historical requests.
[0030] At box 304, computing device 110 determines the target request pattern of the target request based on the request type, resource, and order of at least one prior request. (Refer to below) Figure 4 Describe in detail the process of determining the target request pattern.
[0031] Figure 4 A schematic diagram of an example process 400 for determining a target request pattern according to some embodiments of the present disclosure is shown. Figure 4 As shown, computing device 110 received requests 410-1, 410-2, 410-3, 410-4, and 410-5 in sequence. The response content of the requests and their responses are shown in Table 1.
[0032]
[0033] Table 1 Request Content and Response
[0034] As shown in Table 1, request 410-1 searches for an asset named "sql" by name. Request 410-1 is a "GET" request, targeting a resource identifier, such as the URI " / assets?filter=name like "sql", and receives a response. The response includes a status code of 200, indicating a successful request, and returns the asset with the name "sql-server-1" and ID "7".
[0035] Request 410-2 is for creating a policy. Request 410-2 is a POST request, the target resource's identifier URI is " / protection-policies", the policy content is in the request body, and a response is received. The response includes a status code of 201, indicating that the policy has been created, and returns a policy name of "test-policy" with an ID of "1".
[0036] Request 410-3 allocates the assets from Request 410-1 to the policy outlined in Request 410-2. Request 410-3 has a "PUT" request type, targets a resource with the URI " / protection-policies / 1 / assets-assign", and includes the request body. A response was received with the status code 204 No Content.
[0037] Request 410-4 triggers protection under the policy. Request 410-4 is a POST request, the target resource's identifier URI is " / protection-policies / 1 / backups", the specified job is in the request body, and a response is received. The response includes a status code of 200, indicating a successful request, and returns the asset with job ID "2".
[0038] Request 410-5 monitors the job mentioned in Request 410-4. Request 410-1 is a GET request, targets a resource with the URI "jobs / 2", and received a response. The response includes a status code of 200, indicating a successful request, and returns the progress of job ID "1".
[0039] In this example embodiment, the relevance between requests is determined by referencing the IDs of resources. Before request 410-3 is received, request 410-1 is for searching assets, while request 410-2 is for creating strategies. At this point, the two requests are not related. Furthermore, the response to request 410-1 includes ID "7", while the response to request 410-2 includes ID "1", which also does not meet the relevance criteria. However, upon receiving request 410-3, a relevance is established between request 410-1 and request 410-2, and both ID "7" and ID "1" appear in the request body of request 410-3, satisfying the relevance criteria. Additionally, request 410-4 includes ID "1", therefore request 410-4 is associated with request 410-3. Finally, request 410-5 includes ID "2", and the response to request 410-4 also includes ID "2", therefore request 410-4 is associated with request 410-5. Therefore, requests 410-1, 410-2, 410-3, 410-4, and 410-5 can be considered related. It should be understood that the request and response content shown herein is merely illustrative, and the scope of this disclosure is not limited to what is shown herein. Request types may also include other types specified in HTTP, and the resources targeted are not limited to assets, policies, and operations. Although the target request and its prior requests are described herein, in some embodiments, requests 410-1, 410-2, 410-3, 410-4, and 410-5 may also be considered historical requests, and the related descriptions apply to historical requests as well. For the sake of brevity, the determination of the relevance of historical requests will not be described in detail here.
[0040] return Figure 4 The request type and resource identifier, such as a URI, are determined from requests 410-1, 410-2, 410-3, 410-4, and 410-5, resulting in combinations 420-1, 420-2, 420-3, 420-4, and 420-5. After obtaining the combinations of request types and resource identifiers, to facilitate identification of each combination, in some embodiments, a hash value for each combination can be calculated based on the characters of the request type and resource identifier. For example... Figure 4As shown, for example, hash values 430-1 for request 410-1, 430-2 for request 410-2, 430-3 for request 410-3, 430-4 for request 410-4, and 430-5 for request 410-5 are obtained. It should be understood that the identifier for the combination is not limited to hash values; symbols or numbers generated by any other known method can also be used. Finally, the sequence of hash values generated constitutes the target request pattern 440. It should be understood that the target request pattern in the form of a hash value sequence is merely exemplary, and other forms are also possible, such as a sequence of combinations of URI and request type.
[0041] In some embodiments, when a query parameter is included in the resource identifier in a request, such as "filter=name like "sql" in request 410-1, the resource identifier may or may not include the query parameter. In some embodiments, weights may also be assigned to the query parameter and / or resource identifier and / or request type as needed to more accurately characterize the relevance between requests.
[0042] In some embodiments, when determining the target request pattern of a target request, the computing device 110 may also remove duplicate requests from at least one prior request. Here, the duplicate request has the same response as other requests in the at least one prior request. In other words, requests whose responses have no impact are removed, thereby simplifying the target request pattern and improving simulation efficiency.
[0043] return Figure 2 In box 206, computing device 110 determines a target historical request from a set of candidate historical requests based on the target request pattern. (See below for reference.) Figure 5 To describe in detail the process of making historical requests for the target.
[0044] Figure 5 A flowchart of an example method 500 for determining a target history request according to some embodiments of the present disclosure is shown. Method 500 may, for example, be derived by... Figure 1 The computing device 110 in the middle performs the operation.
[0045] like Figure 5 As shown, at box 502, computing device 110 can determine a set of historical request patterns from a set of candidate historical requests. The historical request patterns can be adaptively determined according to, for example... Figure 3 and Figure 4 The example methods shown in the embodiments are used to determine this. Further details will not be provided here.
[0046] At block 504, computing device 110 determines the similarity between a target request pattern and a set of historical request patterns. In some embodiments, the similarity between the target request pattern and a set of historical request patterns may indicate the number of requests with the same request type and targeting the same resource. For example, when a hash value of the combination of request type and resource identifier is calculated, the similarity indicates the number of identical hash values in the two request patterns. In some embodiments, the longest common subsequence algorithm may be used to determine the similarity. For example, the target request pattern is [2,7,8,10], the first historical request pattern of the first candidate request is [1,3,8,10], and the second historical request pattern of the second candidate request is [2,4,8,10]. Then the longest common subsequence of the first historical request pattern and the target request pattern is [8,10], and the longest common subsequence of the second historical request pattern and the target request pattern is [2,8,10]. Thus, for example, the similarity between the first historical request pattern and the target request pattern can be determined to be 2, and the similarity between the second historical request pattern and the target request pattern can be determined to be 3.
[0047] At box 506, computing device 110 determines a target historical request from a set of historical request patterns with a similarity greater than a threshold. In some embodiments, a candidate historical request with the historical request pattern having the highest similarity can be determined as the target historical request. Referring to the above embodiment, a second candidate historical request with the second historical request pattern having the highest similarity is selected as the target historical request.
[0048] return Figure 2 At box 208, computing device 110 generates a target response for the target request based on historical responses to the target historical request. Once the target historical request is determined, computing device 110 can begin processing the responses to the target historical request to generate the target response for the target request.
[0049] In some embodiments, to generate a target response to a target request, computing device 110 may determine the format of a target historical response. Here, the format indicates a set of response fields included in the target historical response. For example, if the target request is “GET / protection-policies / 1”, the determined target historical response includes the fields “id”, “name”, “assetType”, and “dataConsistency”. Accordingly, computing device 110 determines that the target response will also include these fields. Then, computing device 110 determines the fields in the response that match and do not match the request fields of the target request. For example, the request fields also include the matching field “id” and the non-matching fields “name”, “assetType”, and “dataConsistency”. Based on this, computing device 110 assigns the value “1” of the field “id” from the target request to the field “id” in the target response, and assigns the values of the fields “name”, “assetType”, and “dataConsistency” from the historical target response to the fields “name”, “assetType”, and “dataConsistency” in the target response. For example, the values "test-policy", "MSSQL", and "CRASH_CONSISTENT" from the historical target response fields are assigned to the fields "name", "assetType", and "dataConsistency" in the target response, resulting in the following target response:
[0050]
[0051] In this way, patterns of historical requests are first identified from a large number of integration tests and OAS definitions. Then, during the simulation of microservices, patterns of new target requests are identified. By comparing the target request patterns with historical request patterns, the target historical request that is closest to the target request is identified. Finally, based on the response of the target historical request, a target response that conforms to the context can be generated. This helps with the early integration of multiple microservice products, eliminating the need to generate special responses based on the situation, thus improving product quality and production efficiency.
[0052] In some embodiments, after obtaining the path of a historical request, a hash value can be calculated based on the request URI and request type. In some implementations, a hash value lookup table can also be built based on the calculated hash value. Here, the hash value lookup table includes key-value pairs for historical requests. A set of key-value pairs includes a historical request index and the hash value of the historical request. In this way, candidate historical requests can be quickly found.
[0053] Figure 6A schematic block diagram of an example device 600 that can be used to implement embodiments of the present disclosure is shown. Figure 6 As shown, device 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to computer program instructions stored in read-only memory (ROM) 602 or loaded from storage unit 608 into random access memory (RAM) 603. RAM 603 may also store various programs and data required for the operation of device 600. CPU 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0054] Multiple components in device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of monitors, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0055] The various processes and handling described above, such as methods 200, 300, and 500, can be executed by processing unit 601. For example, in some embodiments, methods 200, 300, and 500 can be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by CPU 601, one or more actions of methods 200, 300, and 500 described above can be performed.
[0056] This disclosure can be a method, apparatus, system, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of this disclosure.
[0057] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0058] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0059] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0060] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0061] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0062] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0063] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0064] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for managing resources, comprising: Identify a set of candidate historical requests associated with the target request, wherein the set of candidate historical requests has the same request type and target resource as the target request; Based on at least one prior request of the target request, determine the target request pattern of the target request; Based on the target request pattern, the target historical request is determined from the set of candidate historical requests; as well as Based on the target history response to the target history request, a target response to the target request is generated, the target response having a format corresponding to the format of the target history response. The target request pattern for determining the target request includes: The at least one prior request is determined from a plurality of prior requests of the target request, wherein the at least one prior request and one of the requests of the target request are associated with at least one other request; as well as The target request pattern of the target request is determined based on the request type, resource, and order of the at least one prior request.
2. The method of claim 1, wherein the at least one prior request and the target request are associated with at least one other request indicating at least one of the following: The same resource information is included in the request or the response to the request and in the at least one other request or the response to the at least one other request; and Resource information associated with the one request and resource information associated with the at least one other request are included in the same request or in the response to the same request.
3. The method according to claim 1, wherein determining the target request pattern of the target request further includes: Remove duplicate requests from at least one prior request, which have the same response as the other requests in the at least one prior request.
4. The method of claim 1, wherein determining the target historical request from the set of candidate historical requests comprises: Determine a set of historical request patterns for the set of candidate historical requests; as well as The target historical request is determined from the set of candidate historical requests based on a comparison between the target request pattern and the set of historical request patterns.
5. The method of claim 4, wherein determining the target historical request from the set of candidate historical requests comprises: Determine the similarity between the target request pattern and the set of historical request patterns; as well as The target historical request with a similarity greater than a threshold is determined from the set of historical request patterns.
6. The method of claim 5, wherein the similarity between the target request pattern and the set of historical request patterns indicates the number of requests with the same request type and for the same resource.
7. The method of claim 1, wherein determining a set of candidate historical requests associated with the target request comprises: Based on the request type and the target resource of the target request, determine the hash value associated with the target request; as well as The set of candidate historical requests with the hash value is determined from the set of historical requests.
8. The method of claim 1, wherein generating a target response to the target request comprises: Determine the format of the target historical response, the format indicating a set of response fields included in the target historical response; Determine the first set of fields in the set of response fields that matches the set of request fields of the target request; Based on the first set of values associated with the first set of fields in the target request, a target response with the specified format is generated.
9. The method of claim 8, wherein generating a target response having the format based on the first set of values comprises: Identify a second set of fields in the set of response fields that do not match the set of request fields in the target request; Determine the second set of values in the target historical response that are associated with the second set of fields; as well as The target response is generated based on the first set of values and the second set of values.
10. An electronic device, comprising: processor; as well as A memory coupled to the processor, the memory having instructions stored therein, the instructions causing the device to perform actions when executed by the processor, the actions including: Identify a set of candidate historical requests associated with the target request, wherein the set of candidate historical requests has the same request type and target resource as the target request; Based on at least one prior request of the target request, determine the target request pattern of the target request; Based on the target request pattern, a target historical request is determined from the set of candidate historical requests; and Based on the target history response to the target history request, a target response to the target request is generated, the target response having a format corresponding to the format of the target history response. The target request pattern for determining the target request includes: The at least one prior request is determined from a plurality of prior requests of the target request, wherein the at least one prior request and one of the requests of the target request are associated with at least one other request; and The target request pattern of the target request is determined based on the request type, resource, and order of the at least one prior request.
11. The electronic device of claim 10, wherein the at least one of the prior request and the target request is associated with at least one other request indicating at least one of the following: The same resource information is included in the request or the response to the request and in the at least one other request or the response to the at least one other request; and Resource information associated with the one request and resource information associated with the at least one other request are included in the same request or in the response to the same request.
12. The electronic device of claim 10, wherein determining the target request mode of the target request further includes: Remove duplicate requests from at least one prior request, which have the same response as the other requests in the at least one prior request.
13. The electronic device of claim 10, wherein determining the target history request from the set of candidate history requests comprises: Determine a set of historical request patterns for the set of candidate historical requests; as well as The target historical request is determined from the set of candidate historical requests based on a comparison between the target request pattern and the set of historical request patterns.
14. The electronic device of claim 13, wherein determining the target history request from the set of candidate history requests comprises: Determine the similarity between the target request pattern and the set of historical request patterns; as well as The target historical request with a similarity greater than a threshold is determined from the set of historical request patterns.
15. The electronic device of claim 14, wherein the similarity between the target request pattern and the set of historical request patterns indicates the number of requests having the same request type and targeting the same resource.
16. The electronic device of claim 10, wherein determining a set of candidate historical requests associated with the target request comprises: Based on the request type and the target resource of the target request, determine the hash value associated with the target request; as well as The set of candidate historical requests with the hash value is determined from the set of historical requests.
17. The electronic device of claim 10, wherein generating a target response to the target request comprises: Determine the format of the target historical response, the format indicating a set of response fields included in the target historical response; Determine the first set of fields in the set of response fields that matches the set of request fields of the target request; Based on the first set of values associated with the first set of fields in the target request, a target response with the specified format is generated.
18. The electronic device of claim 17, wherein generating a target response having the format based on the first set of values comprises: Identify a second set of fields in the set of response fields that do not match the set of request fields in the target request; Determine the second set of values in the target historical response that are associated with the second set of fields; as well as The target response is generated based on the first set of values and the second set of values.
19. A computer program product tangibly stored on a computer-readable medium and comprising machine-executable instructions that, when executed, cause a machine to perform the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Request response method and device, and electronic equipment
CN108696579A
Test data packet reading method, device and equipment and storage medium
CN112436980A