HTTP request processing method, device, system and storage medium

By intercepting and judging frequently sent HTTP requests in the virtualized system, and giving up repeated requests to avoid excessive browser resource usage, it solves the browser stuck problem caused by a large number of HTTP requests in the virtualized system, and improves performance and user experience.

CN113688340BActive Publication Date: 2025-01-24SHANDONG HAILIANG INFORMATION TECH RES INST
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110929903.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-13
Publication Date
2025-01-24
Estimated Expiration
2041-08-13

AI Technical Summary

Technical Problem

In a virtualized system, when multiple virtual machines are turned on in batches, frequent sending a large number of the same http requests leads to excessive use of browser resources, causing the browser to get stuck and crash, and affecting the user experience.

Method used

By intercepting the current HTTP request, determine whether there are the same target request in the waiting http request. If it exists, give up the current request; if it does not exist, add it to the waiting array.

Benefits of technology

Effectively avoiding a large number of HTTP requests to occupy browser resources in the waiting state, reduce the risk of browser stuck and collapse, improve performance and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113688340B_ABST
    Figure CN113688340B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, system and computer-readable storage medium for processing HTTP requests. The method intercepts the currently generated HTTP request, and then determines whether there is a target HTTP request identical to the currently generated HTTP request among the currently waiting HTTP requests. When there is a target HTTP request identical to the currently generated HTTP request, the currently generated HTTP request is abandoned, thereby effectively avoiding a large number of the same type of HTTP requests generated in the same time period from being in a waiting state and occupying browser resources, reducing the occupation of browser resources, reducing the risk of browser freezing and crashing, improving performance and enhancing user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, system and computer-readable storage medium for processing HTTP requests. Background Art

[0002] In the era of cloud computing and big data, virtualization applications are becoming more and more common. Among the users of thousands of households, there are inevitably users of large-scale nodes. In the design of virtualization systems, the principle of resource information sharing is usually followed, and resource information is required to be synchronized in real time. For example: after operating a virtual machine, it is required to push refresh information immediately, and then the system sends an http request to obtain resource information to obtain information. If 100 virtual machines are started in batches in a large-scale node, 100 or even more resource synchronization requests will be sent within the same period of time. Since the browser processes requests in serial processing, the processing of multiple requests will cause a large number of http requests to be in a waiting state, and the browser will not be able to respond in a short time, causing the browser to freeze and crash, reduce performance, and affect the user experience.

[0003] In view of this, how to provide a method, device, system and computer-readable storage medium for processing http requests that solve the above technical problems has become a problem that needs to be solved by those skilled in the art. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a method, device, system and computer-readable storage medium for processing http requests, which can reduce the occupation of browser resources, reduce the risk of browser freezing and crashing, improve performance and enhance user experience during use.

[0005] To solve the above technical problems, an embodiment of the present invention provides a method for processing an http request, comprising:

[0006] Intercept the currently generated http request;

[0007] Determine whether there is a target http request that is the same as the currently generated http request among the currently waiting http requests;

[0008] When there is a target http request that is the same as the currently generated http request, the currently generated http request is abandoned.

[0009] Optionally, the process of determining whether there is a target http request identical to the currently generated http request among the currently awaited http requests is as follows:

[0010] It is determined whether there is a target http request identical to the currently generated http request among the currently waiting http requests in the pre-established waiting array.

[0011] Optionally, also include:

[0012] When there is no target http request identical to the currently generated http request, the currently generated http request is added to the waiting array.

[0013] Optionally, the process of determining whether there is a target http request identical to the currently generated http request among the currently waiting http requests in the pre-established waiting array is:

[0014] Get the unique identifier of the currently generated http request;

[0015] According to the unique identifier, the currently waiting http requests stored in the pre-established waiting array are screened, and it is determined whether there is a target http request consistent with the unique identifier. If so, it is determined that there is a target http request identical to the currently generated http request among the currently waiting http requests. If not, it is determined that there is no target http request identical to the currently generated http request among the currently waiting http requests.

[0016] Optionally, after determining whether there is a target http request that is consistent with the unique identifier, the method further includes:

[0017] If not, the currently generated http request is added to the waiting array.

[0018] Optionally, before abandoning the currently generated http request, the method further includes:

[0019] Determine whether the time interval between the current moment and the moment of the last released http request response in the waiting array reaches a preset time length. If so, release the currently generated http request so that the browser responds to the currently generated http request. If not, execute the step of abandoning the currently generated http request.

[0020] Optionally, also include:

[0021] When the currently generated http request is released, the target http request in the waiting array is released so that the browser can respond to the target http request.

[0022] Optionally, the preset duration is 3s.

[0023] The embodiment of the present invention also provides a device for processing an http request, comprising:

[0024] The interception module is used to intercept the currently generated http request;

[0025] A judgment module is used to judge whether there is a target http request that is the same as the currently generated http request among the currently waiting http requests, and if so, trigger the abandonment module;

[0026] The abandonment module is used to abandon the currently generated http request.

[0027] The embodiment of the present invention also provides a system for processing HTTP requests, including:

[0028] Memory for storing computer programs;

[0029] A processor is used to implement the steps of the method for processing HTTP requests as described above when executing the computer program.

[0030] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for processing an http request as described above are implemented.

[0031] The embodiment of the present invention provides a method, device, system and computer-readable storage medium for processing an http request. The method intercepts a currently generated http request, and then determines whether there is a target http request identical to the currently generated http request among the currently waiting http requests. When there is a target http request identical to the currently generated http request, the currently generated http request is abandoned, thereby effectively avoiding a large number of the same type of http requests generated in the same time period from being in a waiting state and occupying browser resources, reducing the occupation of browser resources, reducing the risk of browser freezing and crashing, improving performance and enhancing user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the prior art and the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0033] Figure 1 A flowchart of a method for processing an HTTP request provided by an embodiment of the present invention;

[0034] Figure 2 A schematic diagram of the structure of a device for processing HTTP requests provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0035] The embodiments of the present invention provide a method, device, system and computer-readable storage medium for processing http requests, which can reduce the occupation of browser resources, reduce the risk of browser freezing and crashing, improve performance and enhance user experience during use.

[0036] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments 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.

[0037] Please refer to Figure 1 , Figure 1 A flowchart of a method for processing an HTTP request provided by an embodiment of the present invention. The method comprises:

[0038] S110: intercept the currently generated http request;

[0039] It should be noted that in a large-scale multi-node virtualization system, when the same request is frequently sent to synchronize data after a batch operation, the currently generated http request can be intercepted instead of being sent directly. In actual applications, the axios request interceptor can be used to intercept the currently generated http request.

[0040] S120: Determine whether there is a target http request that is the same as the currently generated http request among the currently waiting http requests;

[0041] S130: When there is a target http request that is the same as the currently generated http request, the currently generated http request is abandoned.

[0042] Specifically, after intercepting the currently generated http request, it can be determined whether there is a target http request that is the same as the currently generated http request among the currently waiting http requests, and when the same http request exists, the currently generated http request is abandoned, that is, the currently generated http request is canceled and no longer sent, thereby reducing the occupation of browser resources.

[0043] Furthermore, the process of judging whether there is a target http request identical to the currently generated http request among the currently waiting http requests may specifically be:

[0044] Determine whether there is a target http request that is the same as the currently generated http request among the currently waiting http requests in the pre-established waiting array.

[0045] It should be noted that in actual applications, a waiting array can be established in advance, and the waiting http requests can be added to the waiting array. After intercepting the currently generated http request, it can be determined whether there is a target http request with the same target http request as the currently generated http request among the currently waiting http requests in the waiting array.

[0046] Specifically, the method may further include:

[0047] When there is no target http request identical to the currently generated http request in the waiting array, the currently generated http request is added to the waiting array.

[0048] That is, if there is no http request identical to the currently generated http request in the waiting array, the currently generated http request is stored in the waiting array for waiting.

[0049] Furthermore, the process of determining whether there is a target http request identical to the currently generated http request among the currently waiting http requests in the pre-established waiting array in S120 may specifically be:

[0050] Get the unique identifier of the currently generated http request;

[0051] According to the unique identifier, the currently waiting http requests stored in the pre-established waiting array are screened, and it is determined whether there is a target http request consistent with the unique identifier. If so, it is determined that there is a target http request identical to the currently generated http request among the currently waiting http requests.

[0052] It should be noted that in the embodiment of the present invention, each http request corresponds to a unique identifier, and after intercepting the currently generated http request, the unique identifier of the http request can be obtained, wherein the unique identifier of the http request can be uniquely determined by the uniform resource locator (URL) of the request, and the URL can be determined by the request address and the request method. After obtaining the unique identifier of the currently generated http request, it is possible to further match whether there is an http request with the same unique identifier as the currently generated http request in the waiting array according to the unique identifiers of each currently waiting http request stored in the pre-established waiting array, and if there is, the target http request is determined, which means that there is an http request with the same unique identifier as the currently generated http request that is currently waiting for a response, so there is no need to include the currently generated http request in the waiting queue to occupy resources, so the currently generated http request can be directly abandoned. Of course, if there is no matching http request in the waiting array with the same unique identifier as the currently generated http request, it means that the request type corresponding to the currently generated http request is the first time that an http request is generated, and the http request needs to be added to the waiting array and wait for a response. If an http request identical to the http request is generated subsequently, the subsequently generated http request can be abandoned.

[0053] Furthermore, before abandoning the currently generated http request, the method may further include:

[0054] Determine whether the time interval between the current moment and the moment of waiting for the response of the last released http request in the array reaches a preset time length. If so, release the currently generated http request so that the browser can respond to the currently generated http request. If not, execute the step of abandoning the currently generated http request.

[0055] It should be noted that if the http request is frequently abandoned (cancelled), it will cause the http request to have no response. To avoid this phenomenon, an anti-shake strategy can be designed in practical applications. Specifically, in the embodiment of the present invention, after determining that there is a target http request identical to the currently generated http request in the waiting array, it can be further determined whether the time interval from the last released http request in the waiting array at the current moment reaches a preset duration (e.g., 3s), and when the preset duration is reached, the currently generated http request is directly released so that the browser responds to it. When the preset duration is not reached, the step of abandoning the currently generated http request is performed again. In addition, while releasing the currently generated http request, the target http request in the waiting array can also be released in the embodiment of the present invention so that the browser responds to the target http request.

[0056] It can be seen that the method intercepts the currently generated http request, and then determines whether there is a target http request identical to the currently generated http request among the currently waiting http requests, and when there is a target http request identical to the currently generated http request, the currently generated http request is abandoned, thereby effectively avoiding a large number of the same type of http requests generated in the same time period from being in a waiting state and occupying browser resources, reducing the occupation of browser resources, reducing the risk of browser freezing and crashing, improving performance and enhancing user experience.

[0057] Based on the above embodiment, the embodiment of the present invention also provides a processing device for http request, please refer to Figure 2 , the device comprises:

[0058] The interception module 21 is used to intercept the currently generated http request;

[0059] The judging module 22 is used to judge whether there is a target http request identical to the currently generated http request among the currently waiting http requests, and if so, trigger the abandoning module 23;

[0060] The abandonment module 23 is used to abandon the currently generated http request.

[0061] Furthermore, the judging module 22 includes:

[0062] The acquisition unit is used to obtain the unique identifier of the currently generated http request;

[0063] A judging unit, used for screening each currently waiting http request stored in the waiting array according to the unique identifier, and judging whether there is a target http request consistent with the unique identifier, and if so, triggering the determining unit;

[0064] The determining unit is used to determine whether there is a target http request that is the same as the currently generated http request among the currently waiting http requests.

[0065] Furthermore, the device may also include:

[0066] If not, the unit addition is triggered;

[0067] Add unit, used to add the currently generated http request to the waiting array.

[0068] It should be noted that the improved http request processing device in the embodiment of the present invention has the same beneficial effects as the http request processing method in the above embodiment, and for the specific introduction of the http request processing method involved in the embodiment of the present invention, please refer to the above embodiment, and the present invention will not be repeated here.

[0069] Based on the above embodiment, the embodiment of the present invention further provides a system for processing http requests, the system comprising:

[0070] Memory for storing computer programs;

[0071] A processor is used to implement the steps of the above-mentioned method for processing HTTP requests when executing a computer program.

[0072] For example, the processor in the embodiment of the present invention can be specifically used to intercept the currently generated http request; determine whether there is a target http request that is the same as the currently generated http request among the currently waiting http requests, and if so, abandon the currently generated http request.

[0073] On the basis of the above embodiment, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for processing HTTP requests are implemented.

[0074] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0075] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0076] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0077] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for processing an http request, characterized in that: include: Use axios's request interceptor to intercept the currently generated http request; Determine whether there is a target http request that is the same as the currently generated http request among the currently waiting http requests; When there is a target http request that is the same as the currently generated http request, the currently generated http request is abandoned; wherein: The process of determining whether there is a target http request identical to the currently generated http request among the currently waiting http requests is as follows: Determine whether there is a target http request identical to the currently generated http request among the currently waiting http requests in the pre-established waiting array; When there is no target http request identical to the currently generated http request, adding the currently generated http request to the waiting array; Before abandoning the currently generated http request, the method further includes: Determine whether the time interval between the current moment and the moment of the last released http request response in the waiting array reaches a preset time length. If so, release the currently generated http request so that the browser responds to the currently generated http request. If not, execute the step of abandoning the currently generated http request.

2. The method for processing an http request according to claim 1, characterized in that: The process of determining whether there is a target http request identical to the currently generated http request among the currently waiting http requests in the pre-established waiting array is as follows: Get the unique identifier of the currently generated http request; According to the unique identifier, the currently waiting http requests stored in the pre-established waiting array are screened, and it is determined whether there is a target http request consistent with the unique identifier. If so, it is determined that there is a target http request identical to the currently generated http request among the currently waiting http requests. If not, it is determined that there is no target http request identical to the currently generated http request among the currently waiting http requests.

3. The method for processing an http request according to claim 1, characterized in that: Also includes: When the currently generated http request is released, the target http request in the waiting array is released so that the browser can respond to the target http request.

4. The method for processing an http request according to claim 1, wherein: The preset duration is 3 seconds.

5. A device for processing http requests, characterized in that: include: The interception module is used to intercept the currently generated http request using the axios request interceptor; A judgment module is used to judge whether there is a target http request that is the same as the currently generated http request among the currently waiting http requests, and if so, trigger the abandonment module; The abandonment module is used to abandon the currently generated http request; wherein: A judging module, used for judging whether there is a target http request identical to the currently generated http request among the currently waiting http requests in the pre-established waiting array; when there is no target http request identical to the currently generated http request, adding the currently generated http request to the waiting array; The abandonment module is used to: Determine whether the time interval between the current moment and the moment of the last released http request response in the waiting array reaches a preset time length. If so, release the currently generated http request so that the browser responds to the currently generated http request. If not, execute the step of abandoning the currently generated http request.

6. A system for processing http requests, characterized in that: include: Memory for storing computer programs; A processor, used to implement the steps of the method for processing an http request as described in any one of claims 1 to 4 when executing the computer program.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for processing an http request as claimed in any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Concurrent data request processing method and device

    CN105653695A