Interface access request processing method and storage medium
By judging the equivalence of interface access requests and blocking processing, the performance problems caused by concurrent access in traditional methods are solved, high concurrency optimization and cache dependency avoidance, and the processing efficiency and reliability of interface access requests are improved.
Patent Information
- Application Number
- CN202110996901.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-27
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2041-08-27
AI Technical Summary
When traditional methods deal with a large number of repeated requests, developers need to evaluate the interface pressure in advance, encode and implement cache functions to support high concurrency, and increase service complexity and cache dependency, making it difficult to effectively solve the performance problems caused by concurrent access.
When receiving the interface access request, determine whether there is an equivalent request that has not been returned, blocks the new request and copy the result after the result is returned, and judges the equivalent request using preset keywords and monitoring lists, avoiding cache dependency and increased complexity.
It effectively realizes high concurrency optimization, reduces the pressure of server interface processing, avoids cache dependence, and improves the reliability and performance of interface access request processing.
Smart Images

Figure CN113886099B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an interface access request processing method and a storage medium. Background Art
[0002] When a large number of repeated requests access the server at the same time, it is easy to cause excessive traffic to the service or downstream service (this service only forwards at this time), causing system performance problems. The traditional solution requires developers to actively determine whether there are a large number of concurrent usage scenarios for the server interface. According to the specific situation of the interface, use local cache or distributed cache to optimize the interface. When an external request accesses the server interface, it is determined whether there is a cache within the validity period. If so, the data in the cache is obtained as the interface return value. If not, the data is actually obtained and returned, and the return value is stored in the cache for use when the interface is accessed next time. The disadvantage of this method is that developers need to evaluate the pressure of the interface in advance during the solution design stage, and specially encode the cache function to support high concurrency. If the developer does not evaluate it in place, performance problems may occur. In addition, general cluster services use distributed cache to provide cache servers, increase middleware dependence, and increase the complexity of services. Summary of the invention
[0003] In view of the problems existing in the prior art, the present invention provides an interface access request processing method and a storage medium.
[0004] The present invention provides an interface access request processing method, comprising: receiving a first interface access request, judging whether there is currently an equivalent request that has not yet returned a request result based on the first interface access request; in response to the current existence of a second interface access request that has not yet returned the request result, blocking the first interface access request; in response to the return of the request result of the second interface access request, sending the request result to a second requester corresponding to the second interface access request, copying the request result, and sending the copied request result to a first requester corresponding to the first interface access request.
[0005] According to an interface access request processing method provided by the present invention, the determination of whether there is an equivalent request that has not yet returned a request result specifically includes: generating the keyword of the corresponding interface access request according to a preset keyword generation method; determining whether the keyword exists in a monitoring list, and if so, it indicates that there is an equivalent request that has not yet returned a request result; if not, it indicates that there is no equivalent request that has not yet returned a request result.
[0006] According to an interface access request processing method provided by the present invention, in response to the existence of a second interface access request that has not yet returned the request result, before receiving the first interface access request, the method also includes: receiving the second interface access request, and determining whether there is an equivalent request that has not yet returned the request result based on the second interface access request; if not, storing the keyword corresponding to the second interface access request in the monitoring list, registering a second listening callback function in the monitoring list and storing it corresponding to the keyword; wherein the second listening callback function is an empty function.
[0007] According to an interface access request processing method provided by the present invention, in response to the current existence of a second interface access request that has not yet returned the request result, the first interface access request is blocked, specifically including: in response to the current existence of a second interface access request that has not yet returned the request result, registering a first listening callback function corresponding to the first interface access request into the monitoring list and storing it corresponding to the keyword, blocking the first interface access request; wherein the first listening callback function is used to copy the request result.
[0008] According to an interface access request processing method provided by the present invention, the request result of the second interface access request is returned in response to the request result, the request result is sent to the second requester corresponding to the second interface access request, and the request result is copied and sent to the first requester corresponding to the first interface access request, specifically including: in response to the request result of the second interface access request, the second listening callback function and the first listening callback function are triggered; after the second listening callback function is triggered, the request result is sent to the second requester corresponding to the second interface access request; after the first listening callback function is triggered, the request result is copied and sent to the first requester corresponding to the first interface access request.
[0009] According to an interface access request processing method provided by the present invention, after sending the request result to the second requester corresponding to the second interface access request, copying the request result, and sending the copied request result to the first requester corresponding to the first interface access request, the method also includes: clearing the keyword, the first listening callback function and the second listening callback function in the monitoring list.
[0010] According to an interface access request processing method provided by the present invention, the keyword of the corresponding interface access request is generated according to a preset keyword generation method, specifically including: obtaining a request path and request parameters according to the interface access request; wherein the request parameters include url parameters and a request header; and generating the keyword of the interface access request according to the request path and the request parameters.
[0011] According to a method for processing an interface access request provided by the present invention, before generating the keyword of the interface access request according to the request path and the request parameters, the method further includes: filtering out part of the request parameters according to a blacklist.
[0012] According to an interface access request processing method provided by the present invention, the blacklist includes a global blacklist and / or a specific interface parameter blacklist; wherein the global blacklist is a blacklist applicable to all interfaces, and the specific interface parameter blacklist is a blacklist applicable to the interface corresponding to a specific request path.
[0013] According to an interface access request processing method provided by the present invention, before filtering out part of the request parameters according to a blacklist, the method also includes: for the interface corresponding to the specific request path, obtaining request processing statistics within a preset time period; wherein the request processing statistics include return values and details of the request parameters; summarizing the return values after removing a certain request parameter; and in response to the return values being the same exceeding a preset number, adding the request parameter to the specific interface parameter blacklist.
[0014] According to a method for processing an interface access request provided by the present invention, before generating the keyword of the interface access request according to the request path and the request parameters, the method also includes: obtaining the request path and the request parameters according to a whitelist; wherein the request path and the request parameters in the whitelist are parameters that have an impact on the request result.
[0015] According to an interface access request processing method provided by the present invention, the whitelist includes a global whitelist and / or a specific interface parameter whitelist; wherein the global whitelist is a whitelist applicable to all interfaces, and the specific interface parameter whitelist is a whitelist applicable to the interface corresponding to a specific request path.
[0016] According to an interface access request processing method provided by the present invention, after receiving a first interface access request and before determining whether there is an equivalent request that has not yet returned a request result based on the first interface access request, the method further includes: obtaining a request path corresponding to the first interface access request, and determining whether the request path is in a non-interception list; if so, the determination of whether there is an equivalent request that has not yet returned a request result based on the first interface access request is no longer performed, and the first interface access request is directly processed, and the processing result of the first interface access request is sent to the first requester.
[0017] The present invention also provides an interface access request processing device, including: an interception processing module, used to: receive a first interface access request, and determine whether there is an equivalent request that has not yet returned a request result based on the first interface access request; in response to the existence of a second interface access request that has not yet returned the request result, block the first interface access request; a request result sending module, used to: in response to the request result returned by the second interface access request, send the request result to the second requester corresponding to the second interface access request, and copy the request result, and send the copied request result to the first requester corresponding to the first interface access request.
[0018] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned methods for processing interface access requests are implemented.
[0019] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods for processing interface access requests are implemented.
[0020] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned methods for processing interface access requests are implemented.
[0021] The interface access request processing method and storage medium provided by the present invention effectively achieve high concurrency optimization, reduce server interface processing pressure, and avoid cache dependence by blocking processing of new requests when it is determined that an equivalent request has not yet returned a request result, and after the request result is returned, copying the request result and sending it to the requester of the new request. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 This is one of the flow charts of the method for processing an interface access request provided by the present invention;
[0024] Figure 2 This is the second flow chart of the method for processing an interface access request provided by the present invention;
[0025] Figure 3 It is a structural diagram of the interface access request processing device provided by the present invention;
[0026] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] It should be noted that the "first", "second", "third", etc. that appear in the present invention are only for distinguishing descriptions and are not used to limit the order. The specific technical solution shall prevail.
[0029] Combine the following Figure 1-Figure 4 The interface access request processing method and storage medium of the present invention are described.
[0030] Figure 1 FIG. 1 is one of the flow charts of the method for processing an interface access request provided by the present invention. Figure 1 As shown, the method includes:
[0031] Step 101: Receive a first interface access request, and determine whether there is an equivalent request that has not yet returned a request result based on the first interface access request; in response to the existence of a second interface access request that has not yet returned the request result, block the first interface access request.
[0032] The interface access request processing method provided by the present invention can be applied to a server. The server receives a first interface access request, and determines whether there is an equivalent request that has not yet returned a request result based on the first interface access request. An equivalent request refers to a request that returns the same result. If the result of the server interface processing the first interface access request is result one, then determining whether there is an equivalent request that has not yet returned a request result based on the first interface access request means determining whether there is a request whose processing result is the same as result one and has not yet returned a request result based on the first interface access request.
[0033] In response to the existence of an equivalent request that has not yet returned a request result and has the same request result as the first interface access request, such as a second interface access request, the first interface access request is blocked, that is, the first interface access request is no longer processed by the corresponding interface processing function, and the request result of the second interface access request is waited for to be returned.
[0034] Step 102: in response to the request result of the second interface access request being returned, the request result is sent to the second requester corresponding to the second interface access request, and the request result is copied and sent to the first requester corresponding to the first interface access request.
[0035] In response to the request result of the second interface access request being returned, the request result is sent to the second requester corresponding to the second interface access request. The request result is copied and sent to the first requester corresponding to the first interface access request.
[0036] If the server receives a third interface access request while the first interface access request is waiting for the request result to be returned, and the third interface access request is identical to the second interface access request and the first interface access request, the third interface access request is blocked and waits for the request result of the second interface access request to be returned.
[0037] Similarly, if more interface access requests with the same request result as the second interface access request are received before the request result of the second interface access request is returned, these requests are also blocked and wait for the request result of the second interface access request to be returned. After the request result of the second interface access request is returned, the request result is sent to the second requester corresponding to the second interface access request; the request result is copied and sent to the requesters corresponding to each identical request.
[0038] The interface access request processing method provided by the present invention effectively realizes high concurrency optimization, reduces the server interface processing pressure, and avoids cache dependence by blocking the processing of new requests when it is determined that an equivalent request has not yet returned a request result, and after the request result is returned, copies the request result and sends it to the requester of the new request.
[0039] According to an interface access request processing method provided by the present invention, the determination of whether there is an equivalent request that has not yet returned a request result specifically includes: generating the keyword of the corresponding interface access request according to a preset keyword generation method; determining whether the keyword exists in a monitoring list, and if so, it indicates that there is an equivalent request that has not yet returned a request result; if not, it indicates that there is no equivalent request that has not yet returned a request result.
[0040] When determining whether there is an equivalent request that has not yet returned a request result, a keyword for the corresponding interface access request is generated according to a preset keyword generation method. Determine whether the keyword exists in the monitoring list. If so, it means that there is an equivalent request that has not yet returned a request result; if not, it means that there is no equivalent request that has not yet returned a request result.
[0041] When determining whether there is an equivalent request that has not yet returned a request result according to the first interface access request, a keyword of the first interface access request is generated according to a preset keyword generation method. It is determined whether the keyword exists in the monitoring list. If so, it indicates that there is an equivalent request that has not yet returned a request result; if not, it indicates that there is no equivalent request that has not yet returned a request result.
[0042] When judging whether there is an equivalent request that has not yet returned a request result according to the second interface access request, a keyword of the second interface access request is generated according to a preset keyword generation method. It is judged whether the keyword exists in the monitoring list. If so, it means that there is an equivalent request that has not yet returned a request result; if not, it means that there is no equivalent request that has not yet returned a request result.
[0043] The interface access request processing method provided by the present invention generates a keyword according to the interface access request, determines whether the keyword exists in the monitoring list, and determines whether there is an equivalent request that has not yet returned a request result, thereby improving the reliability of the determination of equivalent requests.
[0044] According to an interface access request processing method provided by the present invention, in response to the existence of a second interface access request that has not yet returned the request result, before receiving the first interface access request, the method also includes: receiving the second interface access request, and determining whether there is an equivalent request that has not yet returned the request result based on the second interface access request; if not, storing the keyword corresponding to the second interface access request in a monitoring list, registering the first listening callback function corresponding to the first interface access request in the monitoring list and storing it corresponding to the keyword; wherein the second listening callback function is an empty function.
[0045] The second interface access request is actually the first of the equivalent requests for accessing the server. In response to the second interface access request that has not yet returned the request result, the second interface access request must have been received before the first interface access request was received, and the corresponding interface processing function is being processed. After receiving the second interface access request, the server also determines whether there is an equivalent request that has not yet returned the request result based on the second interface access request. Since the second interface access request is actually the first of the equivalent requests for accessing the server, it means that there is no equivalent request that has not yet returned the request result. The server stores the keyword corresponding to the second interface access request in the monitoring list, registers the second monitoring callback function in the monitoring list, and stores it in correspondence with the keyword. The keyword is a preset value of a parameter for repeated request determination. The keyword can be calculated according to the interface access request. In response to the same keyword, it means that the request result is the same, which is an equivalent request. Since the request processing time is very short, in response to a request that has not yet returned a result, the server receives another equivalent request, indicating that an equivalent request has occurred.
[0046] A single listening function can be used to register a second listening callback function, and the corresponding storage of the second listening callback function and the keyword can be realized. For example, a KV structure can be used to store the keyword and the second listening callback function in a hash structure. Among them, the keyword is the Key in the KV structure, and the second listening callback function is the Value in the KV structure. Since the second interface access request and the first interface access request are equivalent requests, the keyword calculated according to the second interface access request is the same as the keyword calculated according to the first interface access request. The second listening callback function can be an empty function, which serves to mark that a function corresponding to the current keyword is already being executed.
[0047] The interface access request processing method provided by the present invention, after receiving the second interface access request, stores the keyword corresponding to the second interface access request in a monitoring list, and registers a second monitoring callback function to the monitoring list and the corresponding storage of the keyword, thereby laying a foundation for realizing the judgment of equivalent requests.
[0048] According to an interface access request processing method provided by the present invention, in response to the current existence of a second interface access request that has not yet returned the request result, the first interface access request is blocked, specifically including: in response to the current existence of a second interface access request that has not yet returned the request result, registering a first listening callback function corresponding to the first interface access request into the monitoring list and storing it corresponding to the keyword, blocking the first interface access request; wherein the first listening callback function is used to copy the request result.
[0049] After receiving the first interface access request, in response to the second interface access request that has not yet returned the request result, the server registers the first listening callback function to the monitoring list and stores it in correspondence with the keyword. The first listening callback function corresponds to the first interface access request. The first listening callback function can be stored in an array structure under the second listening callback function. For equivalent requests received before the second interface access request returns, a corresponding first listening callback function can be generated and registered to the monitoring list and stored in correspondence with the keyword, such as being stored in the above array structure in order. The first listening callback function is a copy function, which is used to copy the request result.
[0050] The interface access request processing method provided by the present invention, after receiving the first interface access request, when it is determined that an equivalent request has not yet returned a result, registers a first monitoring callback function to a monitoring list and stores it corresponding to a keyword, thereby realizing the association and distinction between the first interface access request and the second interface access request, which is beneficial to the sending of the request result.
[0051] According to an interface access request processing method provided by the present invention, the request result of the second interface access request is returned in response to the request result, the request result is sent to the second requester corresponding to the second interface access request, and the request result is copied and sent to the first requester corresponding to the first interface access request, specifically including: in response to the request result of the second interface access request, the second listening callback function and the first listening callback function are triggered; after the second listening callback function is triggered, the request result is sent to the second requester corresponding to the second interface access request; after the first listening callback function is triggered, the request result is copied and sent to the first requester corresponding to the first interface access request.
[0052] In response to the request result of the second interface access request being returned, that is, the processing of the second interface access request is completed, and the second listening callback function and the first listening callback function registered in the monitoring list and stored corresponding to the keyword are triggered at the same time. In response to the fact that there are multiple first interface access requests, multiple corresponding first listening callback functions are triggered at the same time. After the second listening callback function is triggered, the request result is sent to the second requester corresponding to the second interface access request; after the first listening callback function is triggered, the request result is copied and the copied request result is sent to the first requester corresponding to the first interface access request.
[0053] The interface access request processing method provided by the present invention triggers the second listening callback function and the first listening callback function at the same time when the request result is returned. After the second listening callback function is triggered, the request result is sent to the second requester corresponding to the second interface access request; after the first listening callback function is triggered, the request result is copied and the copied request result is sent to the first requester corresponding to the first interface access request. By copying the request result, the sending of request results of equivalent requests is achieved while reducing concurrent processing resources.
[0054] According to an interface access request processing method provided by the present invention, after sending the request result to the second requester corresponding to the second interface access request, copying the request result, and sending the copied request result to the first requester corresponding to the first interface access request, the method also includes: clearing the keyword, the first listening callback function and the second listening callback function in the monitoring list.
[0055] After the request result is sent to the second requester corresponding to the second interface access request, and the request result is copied and sent to the first requester corresponding to the first interface access request, it means that the sending of the request result is realized for the equivalent requests. Since the second interface access request has returned the request result at this time, if the keyword continues to be stored in the monitoring list, it will cause misjudgment. The second listening callback function and the first listening callback function have also played their functions. Therefore, it is necessary to clear the keyword, the first listening callback function and the second listening callback function in the monitoring list.
[0056] The interface access request processing method provided by the present invention improves the reliability of interface access request processing by clearing the keyword, the first listening callback function and the second listening callback function in the monitoring list after sending the request result to the second requester corresponding to the second interface access request, copying the request result, and sending the copied request result to the first requester corresponding to the first interface access request.
[0057] According to an interface access request processing method provided by the present invention, the keyword of the corresponding interface access request is generated according to a preset keyword generation method, specifically including: obtaining a request path and request parameters according to the interface access request; wherein the request parameters include url parameters and a request header; and generating the keyword of the interface access request according to the request path and the request parameters.
[0058] Whether the request results are the same or not is related to the request path and request parameters. Among them, the request parameters include url parameters and request headers. When generating the keywords of the corresponding interface access request according to the preset keyword generation method, the corresponding request path and request parameters are obtained according to the interface access request; the request path is such as the http interface path, and the request parameters include url parameters and request headers. Generate the keywords of the interface access request according to the request path and request parameters.
[0059] The interface access request processing method provided by the present invention generates keywords according to the request path and request parameters including URL parameters and request headers, thereby improving the reliability of keywords in judging equivalent requests, thereby improving the reliability of interface access request processing.
[0060] According to a method for processing an interface access request provided by the present invention, the keyword of the interface access request is generated according to the request path and the request parameters, specifically comprising: sorting the url parameters and the parameters in the request header in dictionary order; concatenating the request path, the url parameters and the parameters in the request header in a preset order to generate a long string, and obtaining the keyword according to the long string.
[0061] Since the order of the parameters in the url parameters and the request header is different, they are also equal requests. Therefore, in order to avoid misjudging the requests as unequal requests due to the different order of the parameters in the url parameters and the request header, when generating the keyword of the interface access request according to the request path and the request parameters, the parameters in the url parameters and the request header are first sorted in dictionary order, and then the request path, the url parameters and the parameters in the request header are concatenated in a preset order to generate a long string, such as concatenating the request path, the url parameters, and the parameters in the request header in the order to generate a long string, and the keyword is obtained according to the long string. For example, the generated long string can be directly used as the keyword of the interface access request.
[0062] The interface access request processing method provided by the present invention, by sorting the url parameters and the parameters in the request header in dictionary order, concatenating the request path, the url parameters and the parameters in the request header in a preset order to generate a long character string, and obtaining a keyword based on the long character string, avoids the misjudgment of identical requests as unequal requests, further improves the reliability of using keywords to judge identical requests, and thus further improves the reliability of interface access request processing.
[0063] According to an interface access request processing method provided by the present invention, obtaining the keyword according to the long character string specifically includes: performing MD5 calculation on the long character string to obtain the keyword.
[0064] When obtaining a keyword based on a long string, the keyword can be obtained by performing MD5 calculation on the long string. Since MD5 calculation has a fixed length, performing MD5 calculation on the long string not only maintains the uniqueness of the keyword, but also avoids resource consumption caused by a long string.
[0065] The interface access request processing method provided by the present invention obtains a keyword by performing MD5 calculation on a long character string, thereby reducing resource consumption.
[0066] According to a method for processing an interface access request provided by the present invention, before generating the keyword of the interface access request according to the request path and the request parameters, the method further includes: filtering out part of the request parameters according to a blacklist.
[0067] The request path generally corresponds to the interface. Different request paths indicate different interfaces accessed, and the request results must be different. Since the server has multiple interfaces, the keywords of interface access requests of multiple interfaces are usually stored in a monitoring list. Therefore, to ensure that they are equivalent requests, the first thing to do is to ensure that the same interface is accessed, that is, the request path is the same. Therefore, the request path needs to be involved in the keyword calculation.
[0068] The request parameters include URL parameters and request headers. Not all request parameters have an impact on the request result. For example, the timestamp has no impact on the request result. Parameters that have no impact on the request result can be ignored when calculating keywords to avoid unnecessary consumption and waste of resources. A blacklist can be set to put request parameters that have no impact on keyword calculation in the blacklist. When calculating keywords, the request parameters in the blacklist can be filtered out.
[0069] The interface access request processing method provided by the present invention is conducive to further reducing resource consumption by filtering out some parameters that have no effect on the request result according to a blacklist before generating a keyword of the interface access request according to the request path and request parameters.
[0070] According to the interface access request processing method provided by the present invention, the blacklist includes a global blacklist and / or a specific interface parameter blacklist; wherein the global blacklist is a blacklist applicable to all interfaces, and the specific interface parameter blacklist is a blacklist applicable to the interface corresponding to a specific request path.
[0071] There are two types of blacklists: one is a global blacklist, which is applicable to all interfaces. The request parameters in the global blacklist are the request parameters that have no effect on the request results of all interfaces. The other type of blacklist is a specific interface parameter blacklist, which is applicable to the interface corresponding to a specific request path. The request parameters in the specific interface parameter blacklist are the parameters that have no effect on the request results of the interface corresponding to the specific request path.
[0072] When calculating keywords with a blacklist setting, determine whether the blacklist contains a global blacklist and a specific interface parameter blacklist. If so, further determine whether the corresponding interface is set with a specific interface parameter blacklist based on the request path of the current interface access request. If so, filter the request parameters based on the global blacklist and the specific interface parameter blacklist, and calculate the keywords based on the request path and the request parameters. In response to determining that the corresponding interface does not have a specific interface parameter blacklist based on the request path of the current interface access request, filter the request parameters based on the global blacklist, and calculate the keywords based on the request path and the request parameters.
[0073] The interface access request processing method provided by the present invention improves the flexibility of blacklist setting and interface access request processing by setting a blacklist including a global blacklist and / or a specific interface parameter blacklist.
[0074] According to an interface access request processing method provided by the present invention, before filtering out part of the request parameters according to a blacklist, the method also includes: for the interface corresponding to the specific request path, obtaining request processing statistics within a preset time period; wherein the request processing statistics include return values and details of the request parameters; summarizing the return values after removing a certain request parameter; and in response to the return values being the same exceeding a preset number, adding the request parameter to the specific interface parameter blacklist.
[0075] The blacklist can be manually preset or intelligently generated through automated statistics. For example, for the interface corresponding to a specific request path, obtain request processing statistics within a preset time period (such as a preset time period after booting, or scheduled processing); the request processing statistics include details of the return value and request parameters; summarize the return value after removing a certain request parameter; if the return values are the same for more than a preset number, it is considered that the removed request parameter has no effect on the return value, and the removed request parameter is added to the specific interface parameter blacklist.
[0076] The interface access request processing method provided by the present invention improves the accuracy and adaptability of the specific interface parameter blacklist by automatically acquiring the specific interface parameter blacklist according to request processing statistical data.
[0077] According to a method for processing an interface access request provided by the present invention, before generating the keyword of the interface access request according to the request path and the request parameters, the method also includes: obtaining the request path and the request parameters according to a whitelist; wherein the request path and the request parameters in the whitelist are parameters that have an impact on the request result.
[0078] In addition to filtering the request parameters using the blacklist method and calculating the keywords based on the request path and request parameters, you can also use the whitelist to calculate the keywords. Since the request path has an impact on the request result, the request path exists in the whitelist. In addition, the whitelist can also include some request parameters that have an impact on the request result. Calculate the keywords based on the request path and request parameters in the whitelist.
[0079] The blacklist and whitelist have different effects on keyword calculations. Therefore, the whitelist and blacklist functions are generally not enabled at the same time. You can choose one of them.
[0080] The interface access request processing method provided by the present invention obtains the request path and request parameters according to the white list and then calculates the keyword, thereby improving the flexibility of keyword calculation.
[0081] According to an interface access request processing method provided by the present invention, the whitelist includes a global whitelist and / or a specific interface parameter whitelist; wherein the global whitelist is a whitelist applicable to all interfaces, and the specific interface parameter whitelist is a whitelist applicable to the interface corresponding to a specific request path.
[0082] The whitelist can include a global whitelist and a specific interface parameter whitelist. The global whitelist is a whitelist applicable to all interfaces, that is, the parameters in the whitelist have an impact on the request results of all interfaces. The specific interface parameter whitelist is a whitelist applicable to the interface corresponding to a specific request path, that is, the request parameters in the specific interface parameter whitelist have an impact on the request results of the interface corresponding to the specific request path.
[0083] When calculating keywords with a whitelist setting, determine whether the whitelist contains a global whitelist and a specific interface parameter whitelist. If so, further determine whether the corresponding interface is set with a specific interface parameter whitelist based on the request path of the current interface access request. If so, obtain the request path and request parameters based on the global whitelist and the specific interface parameter whitelist, and calculate keywords based on the obtained request path and request parameters. When obtaining the request path and request parameters based on the global whitelist and the specific interface parameter whitelist, the request path and request parameters can be obtained by taking the union of the global whitelist and the specific interface parameter whitelist.
[0084] In response to determining that no specific interface parameter whitelist is set for the corresponding interface according to the request path of the current interface access request, the request path and request parameters are obtained according to the global whitelist, and a keyword is calculated according to the request path and request parameters.
[0085] The interface access request processing method provided by the present invention improves the flexibility of whitelist setting and interface access request processing by setting a whitelist including a global whitelist and / or a specific interface parameter whitelist.
[0086] According to an interface access request processing method provided by the present invention, after receiving a first interface access request and before determining whether there is an equivalent request that has not yet returned a request result based on the first interface access request, the method further includes: obtaining a request path corresponding to the first interface access request, and determining whether the request path is in a non-interception list; if so, the determination of whether there is an equivalent request that has not yet returned a request result based on the first interface access request is no longer performed, and the first interface access request is directly processed, and the processing result of the first interface access request is sent to the first requester.
[0087] The interface access request processing method provided by the present invention is used for all requests by default. However, when the requests for specific needs vary greatly and the possibility of repeated access requests is small, some request path interfaces can be closed according to the situation. For example, when the returned result is highly dependent on the information of the current logged-in person, it is suitable to actively close the judgment of the current path request to save server computing time.
[0088] Therefore, the request path with a lower possibility of request duplication can be set in the interception-free list. After receiving the first interface access request and before determining whether there is an equivalent request that has not yet returned a request result based on the first interface access request, the request path corresponding to the first interface access request is obtained to determine whether the request path is in the interception-free list. If so, the determination of whether there is an equivalent request that has not yet returned a request result based on the first interface access request is no longer performed, and the first interface access request is directly processed, and the processing result of the first interface access request is sent to the first requester.
[0089] The interface access request processing method provided by the present invention directly processes the request by setting an interception-free list when the request path of the interface access request is in the interception-free list, which is beneficial to further reduce resource consumption.
[0090] Figure 2 This is the second flow chart of the interface access request processing method provided by the present invention. Figure 2 As shown, the method comprises the following steps:
[0091] 1. Configure the global interception switch
[0092] Determine whether the current request needs to be intercepted and processed using the main request process based on the request path. By default, all requests are intercepted and processed using this method. When the requests for specific needs vary greatly and the likelihood of duplicate requests is low, developers can close some request path interfaces based on the situation. For example, when the returned result is highly dependent on the information of the current logged-in user, it is appropriate to actively close the current path request judgment to save server computing time.
[0093] 2. Use the keyword generator to calculate keywords
[0094] The factors that affect whether the interface can return the same result are divided into request path, request URL parameters, and request header information. The keyword generator calculates keywords using five methods: global whitelist, global blacklist, specific interface parameter whitelist, specific interface parameter blacklist, and automatic judgment based on statistical information.
[0095] The global whitelist is a list of parameters that the current server needs to use as assembly keywords. Parameters in the global whitelist will definitely participate in keyword calculation, such as the request path, which is the default global whitelist. The global blacklist is a list of parameters that the current server does not need to use as assembly keywords. Parameters in the global blacklist will definitely not participate in keyword calculation, such as the URL parameter timestamp. The default global blacklist is empty.
[0096] The specific interface parameter whitelist is the parameters that a specific interface will definitely participate in keyword calculation, and developers need to manually configure it according to the interface characteristics. The specific interface parameter blacklist is the parameters that a specific interface will definitely not participate in keyword calculation, and developers need to manually configure it according to the interface characteristics.
[0097] Automatic judgment based on statistical information: after the service has run for a period of time, the return value information can be recorded in the memory through MD5 and the detailed information of all request parameters, and executed regularly. According to the requests in the recent period, after removing a certain request parameter, the MD5 of the return value is completely the same. If it is the same, the parameter is automatically added to the specific interface parameter blacklist. The judgment of repeated interface parameters (including parameters in the global whitelist, global blacklist, specific interface parameter whitelist, and specific interface parameter blacklist) directly affects the optimization effect of high concurrency. Only reasonable judgment can effectively improve the performance of the interface under high concurrency conditions without generating incorrect return results.
[0098] The reserved request parameters are calculated according to the above method, and are concatenated in the order of request path, request url parameters, and parameters in the request header to form a long string (the request url parameters and the parameters in the request header are sorted in dictionary order). After calculating the MD5 of the long string, the corresponding keywords are obtained for subsequent request main process interception processing.
[0099] 3. Request main process interception processing
[0100] When a request reaches the interceptor, the request uses the keyword generator to generate a unique mark of whether the current request is executed, i.e., the keyword, according to the request path and request parameters, and determines whether the current keyword exists in the listening list of the event module. For multi-threaded model servers, adding locks ensures that there will be no concurrency; for servers with a single-threaded model based on an event model, no locks need to be added to ensure that there will be no concurrency. For servers that may cause concurrency, the interface access request processing provided by the present invention is performed.
[0101] When the keyword does not exist in the event module's monitoring list, add a single monitoring function to the event module's monitoring list. The callback function of the single monitoring function is an empty function, which only serves to mark that a function corresponding to the current keyword is already executed. Pass the request to the interface processor for further processing. When the interface processor returns data, trigger the callback function of the single monitoring function to clean up the callback function flag, and then return the returned data to the external request.
[0102] When the keyword exists in the event module's listening list, it means that there is another equivalent request that has been executed and the interface processing function has not returned. A single listening function is added to the event module's listening list. The callback function of the single listening function is to copy the return result of the actual call to the interface processor (the keyword is used to determine which return result to call). The current request processing is blocked waiting for the callback function to be triggered. When the request that actually calls the interface processor returns, all previously registered callback functions will be triggered at the same time, including the empty function registered by the actual call to the interface processor and other waiting copy functions. The copy function copies all the request headers, request bodies, and other contents of the returned content and sends them to the requester.
[0103] like Figure 2 As shown, it shows the situation where two external requesters request the same interface. The specific steps are described in detail as follows:
[0104] 1. External requesters 1 and 2 arrive at the server one after the other (need to arrive at the same time within the unit request processing time).
[0105] 2. Perform a duplication check on the request of external requester 1. If it is not a duplication, there is no identical request being executed. The request will pass through the interceptor and enter the interface processor. Perform a duplication check on the request of external requester 2. If it is a duplication, there is an identical request being executed. Wait for the return of external requester 1.
[0106] 3. The interface processor processes the request from requester 1.
[0107] 4. The interface processor returns, and the interceptor copies the return result to external requester 2 and passes the original result to external requester 1.
[0108] 5. External requesters 1 and 2 get the return results at the same time.
[0109] The interface access request processing method provided by the present invention can be used to implement a global interface interceptor, which mainly intercepts equivalent requests (same request results) arriving at the server at similar times, and only releases one request to the service internal processing method or the downstream service to calculate the corresponding value of the interface, and after waiting for the request to return normally, before actually returning through the network interface, copies the return data to all other intercepted interface requests, and supplies them to all interface requests. When the interface traffic is low, there are no actual concurrent repeated requests, and each request can enter the actual interface for processing through the interceptor, but when the interface concurrency is large, the interceptor can ensure that the interface has only a fixed QPS (Queries-per-second, query rate per second), and requests exceeding this value will be intercepted and wait for the same interface return value, so that the performance problem in the high concurrency scenario is guaranteed, and no extra memory will be used to cause memory-related problems.
[0110] The present invention aims at the shortcomings of traditional interface caching solutions that require advance planning and reliance on other caches. It mainly implements a global interface caching solution, which does not require developers to pre-plan caching solutions for each newly added interface. However, it does not conflict with existing caching solutions. Traditional caching solutions work in the processing of the interface, and this solution is pre-placed before the interface enters the actual processing function, which is equivalent to the working mode of the interceptor. In response to the reliance on other caches, the present invention uses a shared interface to return results, and does not require additional storage of data in local or distributed caches, so there is no problem of increased complexity caused by increased dependencies. In the actual service operation process, the performance problems caused by high concurrency actually appear in sudden high traffic. In the case of low traffic, even without the support of cache, each request is repeatedly calculated and no performance problems will be caused. Therefore, the present invention can only play a role in high concurrency and will not affect the server.
[0111] The interface access request processing device provided by the present invention is described below. The interface access request processing device described below and the interface access request processing method described above can be referenced to each other.
[0112] Figure 3 Schematic diagram of the structure of the interface access request processing device provided by the present invention. Figure 3 As shown, the device includes an interception processing module 10 and a request result sending module 20, wherein: the interception processing module 10 is used to: receive a first interface access request, and determine whether there is an equivalent request that has not yet returned a request result based on the first interface access request; in response to the existence of a second interface access request that has not yet returned the request result, block the first interface access request; the request result sending module 30 is used to: in response to the request result returned by the second interface access request, send the request result to the second requester corresponding to the second interface access request, and copy the request result, and send the copied request result to the first requester corresponding to the first interface access request.
[0113] The interface access request processing device provided by the present invention effectively realizes high concurrency optimization, reduces the server interface processing pressure, and avoids cache dependence by blocking the processing of new requests when it is determined that an equivalent request has not yet returned a request result, and after the request result is returned, copies the request result and sends it to the requester of the new request, thereby reducing the server interface processing pressure and avoiding cache dependence.
[0114] According to an interface access request processing device provided by the present invention, the interception processing module 10 is specifically used to: generate the keyword of the corresponding interface access request according to a preset keyword generation method; determine whether the keyword exists in the monitoring list, and if so, it means that there is an equivalent request that has not yet returned a request result; if not, it means that there is no equivalent request that has not yet returned a request result.
[0115] The interface access request processing device provided by the present invention generates a keyword according to the interface access request, determines whether the keyword exists in the monitoring list, and determines whether there is an equivalent request that has not yet returned a request result, thereby improving the reliability of the determination of equivalent requests.
[0116] According to an interface access request processing device provided by the present invention, in response to the existence of the second interface access request that has not yet returned the request result, before receiving the first interface access request, the interception processing module 10 is also used to: receive the second interface access request, and determine whether there is an equivalent request that has not yet returned the request result based on the second interface access request; if not, store the keyword corresponding to the second interface access request in a monitoring list, register the first listening callback function corresponding to the first interface access request in the monitoring list and store it corresponding to the keyword; wherein the second listening callback function is an empty function.
[0117] The interface access request processing device provided by the present invention, after receiving the second interface access request, stores the keyword corresponding to the second interface access request in a monitoring list, and registers a second monitoring callback function to the monitoring list and the corresponding storage of the keyword, thereby laying a foundation for realizing the judgment of equivalent requests.
[0118] According to an interface access request processing device provided by the present invention, when the interception processing module 10 is used to block the first interface access request in response to the current existence of a second interface access request that has not yet returned the request result, it is specifically used to: in response to the current existence of a second interface access request that has not yet returned the request result, register a first listening callback function corresponding to the first interface access request into the monitoring list and store it corresponding to the keyword, and block the first interface access request; wherein the first listening callback function is used to copy the request result.
[0119] The interface access request processing device provided by the present invention, after receiving the first interface access request, registers the first monitoring callback function to the monitoring list and stores it corresponding to the keyword when it is determined that an equivalent request has not yet returned a result, thereby realizing the association and distinction between the first interface access request and the second interface access request, which is beneficial to the sending of the request result.
[0120] According to an interface access request processing device provided by the present invention, the request result sending module 30 is specifically used to: in response to the request result returned by the second interface access request, trigger the second listening callback function and the first listening callback function; after the second listening callback function is triggered, send the request result to the second requester corresponding to the second interface access request; after the first listening callback function is triggered, copy the request result, and send the copied request result to the first requester corresponding to the first interface access request.
[0121] The interface access request processing device provided by the present invention triggers the second listening callback function and the first listening callback function at the same time when the request result is returned. After the second listening callback function is triggered, the request result is sent to the second requester corresponding to the second interface access request; after the first listening callback function is triggered, the request result is copied and the copied request result is sent to the first requester corresponding to the first interface access request. By copying the request result, the sending of request results of equivalent requests is achieved while reducing concurrent processing resources.
[0122] According to an interface access request processing device provided by the present invention, after sending the request result to the second requester corresponding to the second interface access request, copying the request result, and sending the copied request result to the first requester corresponding to the first interface access request, the request result sending module 30 is also used to: clear the keyword, the first listening callback function and the second listening callback function in the monitoring list.
[0123] The interface access request processing device provided by the present invention improves the reliability of interface access request processing by clearing the keyword, the first listening callback function and the second listening callback function in the monitoring list after sending the request result to the second requester corresponding to the second interface access request, copying the request result, and sending the copied request result to the first requester corresponding to the first interface access request.
[0124] According to an interface access request processing device provided by the present invention, when the interception processing module 10 is used to generate the keyword of the corresponding interface access request according to a preset keyword generation method, it is specifically used to: obtain the request path and request parameters according to the interface access request; wherein the request parameters include url parameters and request headers; generate the keyword of the interface access request according to the request path and the request parameters.
[0125] The interface access request processing device provided by the present invention generates keywords according to the request path and request parameters including URL parameters and request headers, thereby improving the reliability of keywords in judging equivalent requests, thereby improving the reliability of interface access request processing.
[0126] According to an interface access request processing device provided by the present invention, when the interception processing module 10 is used to generate the keyword of the interface access request according to the request path and the request parameters, it is specifically used to: sort the url parameters and the parameters in the request header according to the dictionary order; concatenate the request path, the url parameters and the parameters in the request header in a preset order to generate a long character string, and obtain the keyword according to the long character string.
[0127] The interface access request processing device provided by the present invention, by sorting the url parameters and the parameters in the request header in lexicographic order, concatenating the request path, the url parameters and the parameters in the request header in a preset order to generate a long character string, and obtaining a keyword based on the long character string, avoids the misjudgment of identical requests as unequal requests, further improves the reliability of using keywords to judge identical requests, and thus further improves the reliability of interface access request processing.
[0128] According to an interface access request processing device provided by the present invention, when the interception processing module 10 is used to obtain the keyword according to the long string, it is specifically used to: obtain the keyword after performing MD5 calculation on the long string.
[0129] The interface access request processing device provided by the present invention obtains a keyword by performing MD5 calculation on a long character string, thereby reducing resource consumption.
[0130] According to an interface access request processing device provided by the present invention, before being used to generate the keyword of the interface access request according to the request path and the request parameters, the interception processing module 10 is also used to: filter out part of the request parameters according to a blacklist.
[0131] The interface access request processing device provided by the present invention can further reduce resource consumption by filtering out some parameters that have no effect on the request result according to a blacklist before generating a keyword of the interface access request according to the request path and request parameters.
[0132] According to an interface access request processing device provided by the present invention, the blacklist includes a global blacklist and / or a specific interface parameter blacklist; wherein the global blacklist is a blacklist applicable to all interfaces, and the specific interface parameter blacklist is a blacklist applicable to the interface corresponding to a specific request path.
[0133] The interface access request processing device provided by the present invention improves the flexibility of blacklist setting and interface access request processing by setting a blacklist including a global blacklist and / or a specific interface parameter blacklist.
[0134] According to an interface access request processing device provided by the present invention, the interception processing module 10 is further used to: obtain request processing statistics within a preset time period for the interface corresponding to the specific request path before filtering out part of the request parameters according to the blacklist; wherein the request processing statistics include return values and details of the request parameters; summarize the return values after removing a certain request parameter; and in response to the return values being the same exceeding a preset number, add the request parameter to the specific interface parameter blacklist.
[0135] The interface access request processing device provided by the present invention improves the accuracy and adaptability of the specific interface parameter blacklist by automatically acquiring the specific interface parameter blacklist according to request processing statistical data.
[0136] According to an interface access request processing device provided by the present invention, the interception processing module 10 is further used to: obtain the request path and request parameters according to a whitelist before generating the keyword of the interface access request according to the request path and request parameters; wherein the request path and request parameters in the whitelist are parameters that have an impact on the request result.
[0137] The interface access request processing device provided by the present invention obtains the request path and request parameters according to the white list and then calculates the keyword, thereby improving the flexibility of keyword calculation.
[0138] According to an interface access request processing device provided by the present invention, the whitelist includes a global whitelist and / or a specific interface parameter whitelist; wherein the global whitelist is a whitelist applicable to all interfaces, and the specific interface parameter whitelist is a whitelist applicable to the interface corresponding to a specific request path.
[0139] The interface access request processing device provided by the present invention improves the flexibility of whitelist setting and interface access request processing by setting a whitelist including a global whitelist and / or a specific interface parameter whitelist.
[0140] According to an interface access request processing device provided by the present invention, the interception processing module 10 is further used, after being used for receiving the first interface access request and before judging whether there is an equivalent request that has not yet returned a request result according to the first interface access request, to: obtain the request path corresponding to the first interface access request, and judge whether the request path is in a list free from interception; if so, the judgment of whether there is an equivalent request that has not yet returned a request result according to the first interface access request is no longer performed, and the first interface access request is directly processed, and the processing result of the first interface access request is sent to the first requester.
[0141] The interface access request processing device provided by the present invention directly processes the request by setting an interception-free list when the request path of the interface access request is in the interception-free list, which is beneficial to further reduce resource consumption.
[0142] Figure 4 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 complete mutual communication through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the interface access request processing method, the method comprising: receiving a first interface access request, judging whether there is an equivalent request that has not yet returned a request result according to the first interface access request; in response to the existence of a second interface access request that has not yet returned the request result, blocking the first interface access request; in response to the request result of the second interface access request being returned, sending the request result to the second requester corresponding to the second interface access request, and copying the request result, and sending the copied request result to the first requester corresponding to the first interface access request.
[0143] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including responding to dry instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0144] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the interface access request processing method provided by the above methods, and the method includes: receiving a first interface access request, and judging whether there is an equivalent request that has not yet returned a request result based on the first interface access request; in response to the existence of a second interface access request that has not yet returned the request result, blocking the first interface access request; in response to the request result of the second interface access request being returned, sending the request result to the second requester corresponding to the second interface access request, and copying the request result, and sending the copied request result to the first requester corresponding to the first interface access request.
[0145] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the above-mentioned interface access request processing methods, the methods comprising: receiving a first interface access request, and determining whether there is an equivalent request that has not yet returned a request result based on the first interface access request; in response to the existence of a second interface access request that has not yet returned the request result, blocking the first interface access request; in response to the return of the request result of the second interface access request, sending the request result to the second requester corresponding to the second interface access request, and copying the request result, and sending the copied request result to the first requester corresponding to the first interface access request.
[0146] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0147] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including responding to dry instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0148] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for processing an interface access request, characterized in that: include: Receive a first interface access request, and determine, based on the first interface access request, whether there is an equivalent request that has not yet returned a request result; In response to the existence of a second interface access request that has not yet returned the request result, blocking the first interface access request; In response to the request result of the second interface access request being returned, sending the request result to the second requester corresponding to the second interface access request, and copying the request result, and sending the copied request result to the first requester corresponding to the first interface access request; The determining whether there is an equivalent request that has not yet returned a request result specifically includes: Generate the keyword of the corresponding interface access request according to a preset keyword generation method; Determine whether the keyword exists in the monitoring list. If so, it means that there is an equivalent request that has not yet returned a request result; if not, it means that there is no equivalent request that has not yet returned a request result; In response to the second interface access request that currently exists and has not yet returned the request result, before receiving the first interface access request, the method further includes: Receive the second interface access request, and determine whether there is an equivalent request that has not yet returned a request result according to the second interface access request; if not, store the keyword corresponding to the second interface access request in the monitoring list, register a second monitoring callback function in the monitoring list and store it corresponding to the keyword; wherein the second monitoring callback function is an empty function; The method of blocking the first interface access request in response to the second interface access request that has not yet returned the request result specifically includes: in response to the second interface access request that has not yet returned the request result, registering a first monitoring callback function corresponding to the first interface access request into the monitoring list and storing it corresponding to the keyword, and blocking the first interface access request; wherein the first monitoring callback function is used to copy the request result; The returning of the request result in response to the second interface access request, sending the request result to the second requester corresponding to the second interface access request, and copying the request result, and sending the copied request result to the first requester corresponding to the first interface access request, specifically includes: In response to the request result returned by the second interface access request, the second listening callback function and the first listening callback function are triggered; after the second listening callback function is triggered, the request result is sent to the second requester corresponding to the second interface access request; after the first listening callback function is triggered, the request result is copied and the copied request result is sent to the first requester corresponding to the first interface access request.
2. The method for processing an interface access request according to claim 1, characterized in that: After sending the request result to the second requester corresponding to the second interface access request, copying the request result, and sending the copied request result to the first requester corresponding to the first interface access request, the method also includes: clearing the keyword, the first monitoring callback function and the second monitoring callback function in the monitoring list.
3. The method for processing an interface access request according to claim 1, characterized in that: The step of generating the keyword of the corresponding interface access request according to the preset keyword generation method specifically includes: Obtain a request path and request parameters according to the interface access request; wherein the request parameters include url parameters and a request header; and generate the keyword of the interface access request according to the request path and the request parameters.
4. The method for processing an interface access request according to claim 3, characterized in that: Before generating the keyword of the interface access request according to the request path and the request parameters, the method further includes: Filter the request parameters described in the blacklist section; Preferably, the blacklist includes a global blacklist and / or a specific interface parameter blacklist; wherein the global blacklist is a blacklist applicable to all interfaces, and the specific interface parameter blacklist is a blacklist applicable to an interface corresponding to a specific request path.
5. The method for processing an interface access request according to claim 4, characterized in that: Before filtering out part of the request parameters according to the blacklist, the method further includes: For the interface corresponding to the specific request path, obtaining request processing statistics within a preset time period; wherein the request processing statistics include return values and details of the request parameters; The return values after removing a certain request parameter are summarized; in response to more than a preset number of the return values being the same, the request parameter is added to the specific interface parameter blacklist.
6. The method for processing an interface access request according to claim 3, characterized in that: Before generating the keyword of the interface access request according to the request path and the request parameters, the method further includes: Acquire the request path and request parameters according to the whitelist; wherein the request path and request parameters in the whitelist are parameters that have an impact on the request result; Preferably, the whitelist includes a global whitelist and / or a specific interface parameter whitelist; wherein the global whitelist is a whitelist applicable to all interfaces, and the specific interface parameter whitelist is a whitelist applicable to interfaces corresponding to specific request paths.
7. The method for processing an interface access request according to claim 1, characterized in that: After receiving the first interface access request and before determining, according to the first interface access request, whether there is an equivalent request that has not yet returned a request result, the method further includes: Obtaining a request path corresponding to the first interface access request, and determining whether the request path is in an interception-free list; If so, the step of determining whether there is an equivalent request that has not yet returned a request result based on the first interface access request is no longer performed, and the first interface access request is directly processed, and the processing result of the first interface access request is sent to the first requester.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for processing an interface access request as claimed in any one of claims 1 to 7 are implemented.
