Webpage resource request processing method and device, equipment and medium

By analyzing the request path of the web page resource request, determining the response time and importance, and assigning it to the corresponding queue for processing, the request blocking problem is solved and the user experience and server performance are improved.

CN119357505APending Publication Date: 2025-01-24SHENZHOU LINGYUN (BEIJING) TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411915004.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

In the prior art, due to request blockage, the response of web resource requests is affected, resulting in a decline in user experience, wasted server resources, and performance bottlenecks may be triggered in a high concurrency environment.

Method used

By analyzing the request path of the web page resource request, the response time and importance are determined, and based on this, the resource request is assigned to the corresponding queue. Each queue has a concurrent request limit to process the resource request.

Benefits of technology

It effectively avoids request blocking, ensures the smooth loading of web page resource requests, reduces the risk of wasting server resources, and improves web page request processing performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357505A_ABST
    Figure CN119357505A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of webpage resource processing, and discloses a webpage resource request processing method and device, equipment and a medium, and the method comprises the steps: obtaining a webpage resource request, and determining response time and importance degree corresponding to the resource request by analyzing a request path of the resource request; allocating the resource requests to corresponding queues based on the response time and the importance degree; resource requests are processed based on concurrent request restrictions for each queue. According to the scheme, the response time and the importance degree corresponding to the resource request are determined by analyzing the request path of the resource request, so that the response time and the importance degree serve as the basis for distributing the resource request to the corresponding queue, and the resource request in the queue is processed by utilizing the concurrent request limitation of each queue; therefore, the resource request of the webpage cannot be blocked, the situation that the request cannot be loaded smoothly is avoided, the risk that server resources are wasted is reduced, and the webpage request processing performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of web page resource processing, and in particular to a method, device, equipment and medium for processing a web page resource request. Background Art

[0002] In order to ensure the reasonable allocation of network resources and improve user experience, mainstream browsers generally implement concurrent request limits, with each domain name processing a maximum of six HTTP requests at the same time. This mechanism is particularly important during the web page loading process, because if the browser's request queue is filled with time-consuming requests, other requests on the web page will be blocked. In this case, users may face the dilemma of blank pages or constant loading status, which not only causes the page information to fail to be presented in time, but also affects the user's browsing experience. In addition, when the page is refreshed or closed midway, the server will continue to process the received requests. This behavior not only consumes server resources, but may also cause the same request to be triggered multiple times, and then repeatedly call server resources. Even if the user chooses to reopen the page in a new browser tab, it may still not be loaded smoothly due to blocked requests. This behavior may also lead to a waste of server resources, especially in a high-concurrency environment, which may cause performance bottlenecks, thereby affecting the request response time of other users. Summary of the invention

[0003] In view of this, the present invention provides a method, device, equipment, and medium for processing web resource requests to solve the technical problem in the related art that request responses are affected due to request blocking.

[0004] In a first aspect, the present invention provides a method for processing web page resource requests, the method comprising: obtaining a resource request for a web page, determining a response time and importance corresponding to the resource request by parsing a request path of the resource request; allocating the resource request to a corresponding queue based on the response time and importance; and processing the resource request based on a concurrent request limit for each queue.

[0005] In combination with the first aspect, in a possible implementation of the first aspect, a resource request of a web page is obtained, and a response time and importance corresponding to the resource request are determined by parsing the request path of the resource request, including: obtaining the resource request based on a first preset interface; determining a keyword corresponding to the request path of the resource request by using a regular parsing method; and determining the response time and importance corresponding to the resource request based on the keyword and the preset correspondence.

[0006] In combination with the first aspect, in a possible implementation of the first aspect, resource requests are allocated to corresponding queues based on response time and importance, including: determining the resource type corresponding to the resource request based on the response time and importance; and allocating the resource request to the queue corresponding to the resource type.

[0007] In combination with the first aspect, in a possible implementation of the first aspect, resource requests are processed based on the concurrent request limit of each queue, including: in response to a queue not reaching the corresponding concurrent request limit, concurrently processing resource requests allocated to the corresponding queue; or, in response to any queue reaching the corresponding concurrent request limit, executing resource requests allocated to the corresponding queue based on preset rules.

[0008] In combination with the first aspect, in a possible implementation of the first aspect, resource requests allocated to the corresponding queue are executed based on preset rules, including: processing resource requests allocated to the corresponding queue based on the time of entering the queue; or, processing resource requests allocated to the corresponding queue based on the response time and importance corresponding to the resource request.

[0009] In combination with the first aspect, in a possible implementation of the first aspect, the resource request also includes identification information and a cancellation signal, and the method also includes: responding to receiving the cancellation signal; based on the cancellation signal, determining the identification information corresponding to the cancellation signal; based on the identification information, determining and terminating the corresponding resource request.

[0010] In combination with the first aspect, in a possible implementation of the first aspect, receiving a cancel signal includes: based on a preset listening event, obtaining a repeated resource request from the same browser, triggering a cancel signal for calling the previous resource request; or, based on a second preset interface, obtaining a repeated resource request between different browsers, triggering a cancel signal for calling the previous resource request.

[0011] In a second aspect, the present invention provides a device for processing web page resource requests, the device comprising: a determination module, used to obtain the resource request of the web page, and determine the response time and importance corresponding to the resource request by parsing the request path of the resource request; an allocation module, used to allocate the resource request to the corresponding queue based on the response time and importance; and a processing module, used to process the resource request based on the concurrent request limit of each queue.

[0012] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for processing web page resource requests of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0013] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method for processing a web page resource request according to the first aspect or any corresponding embodiment thereof.

[0014] The technical solution of the present invention has the following advantages: The present invention provides a method, device, equipment, and medium for processing webpage resource requests. The method obtains the resource request of the webpage, and determines the response time and importance corresponding to the resource request by parsing the request path, and allocates the queue of the resource request based on the response time and importance corresponding to the resource request, so as to process the resource request according to the concurrency limit of the corresponding queue. In this process, the response time and importance are determined by parsing the request path of the resource request, so as to allocate the resource request to the corresponding queue based on the response time and importance, and the resource request in the queue is processed by using the concurrent request limit of each queue, so that the resource request of the webpage will not be blocked, and the request cannot be loaded smoothly, thereby reducing the risk of server resources being wasted and improving the webpage request processing performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0016] Figure 1 It is a flowchart of a method for processing a webpage resource request provided according to an embodiment of the present invention; Figure 2 is a structural block diagram of a device for processing webpage resource requests provided according to an embodiment of the present invention; Figure 3 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0017] 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0018] According to an embodiment of the present invention, an embodiment of a method for processing a web page resource request is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0019] This embodiment provides a method for processing a webpage resource request. Figure 1 As shown, the method comprises the following steps: S101, obtaining a resource request of a web page, and determining a response time and importance corresponding to the resource request by parsing the request path of the resource request.

[0020] Specifically, obtaining a resource request from a web page and determining the response time and importance corresponding to the resource request by parsing the request path of the resource request refers to receiving a web page resource acquisition request sent by a browser through a preset interface, and using a regular parsing method to determine the keywords corresponding to the resource request, and determining the response time and importance corresponding to the resource request.

[0021] S102: Allocate resource requests to corresponding queues based on response time and importance.

[0022] Specifically, allocating resource requests to corresponding queues based on response time and importance means determining the resource type corresponding to the resource request through the response time and importance of the resource request, thereby determining the queue corresponding to the resource request according to the resource type, and allocating the corresponding resource request to the corresponding queue.

[0023] S103: Process resource requests based on the concurrent request limit of each queue.

[0024] Specifically, each queue has a preset concurrent request limit, for example, one, two, three or other quantity limits, which is not specifically limited in this embodiment and can be set according to actual working conditions. Based on the concurrent request limit of each queue, processing resource requests means that when the queue does not reach the corresponding concurrent request limit, the corresponding resource requests are processed concurrently, and when any queue reaches the corresponding concurrent request limit, the corresponding resource requests are executed through the preset rules of the corresponding queue.

[0025] The present invention provides a method, device, equipment, and medium for processing webpage resource requests. The method obtains the resource request of the webpage, and determines the response time and importance corresponding to the resource request by parsing the request path, and allocates the queue of the resource request based on the request, so as to process the resource request according to the concurrency limit of the corresponding queue. In this process, the response time and importance corresponding to the resource request are determined by parsing the request path of the resource request, so as to use the response time and importance as the basis for allocating the resource request to the corresponding queue, and utilize the concurrent request limit of each queue to process the resource request in the queue, so that the resource request of the webpage will not be blocked, and the occurrence of the request failing to load smoothly is avoided, the risk of server resources being wasted is reduced, and the webpage request processing performance is improved.

[0026] In an optional implementation, obtaining a resource request of a webpage and determining a response time and importance corresponding to the resource request by parsing a request path of the resource request include: A resource request is obtained based on a first preset interface; a keyword corresponding to a request path of the resource request is determined by using a regular expression analysis method; and a response time and importance corresponding to the resource request are determined based on the keyword and the preset corresponding relationship.

[0027] Specifically, the first preset interface may be an API interface in a RESTful format, which is used to receive a web page resource acquisition request sent by a browser through the interface.

[0028] Specifically, using regular expression parsing to determine the keywords corresponding to the request path of the resource request means presetting keywords for different resource types, and parsing the request path of the RESTful API through regular expression, that is, by parsing the URL (Uniform Resource Locator) of the corresponding resource request to determine the corresponding keyword.

[0029] Specifically, determining the response time and importance corresponding to the resource request based on the keyword and the preset correspondence means that after determining the corresponding keyword, since the corresponding keywords are pre-set for different resource types, the response time and importance of the corresponding resource request can be determined through the correspondence between the keyword and the resource type, thereby providing a data basis for subsequently allocating the resource request to the corresponding queue based on the response time and importance.

[0030] In an optional implementation, resource requests are allocated to corresponding queues based on response time and importance, including: Based on the response time and importance, determine the resource type corresponding to the resource request; and assign the resource request to the queue corresponding to the resource type.

[0031] Specifically, determining the resource type corresponding to a resource request based on response time and importance means that different response times and importance correspond to different resource types. For example, based on the importance of the resources, they can be divided into: resources with immediate return, resources with a longer duration, and important data requests. Similarly, taking the example of processing a maximum of six HTTP requests simultaneously for each domain name, the maximum concurrent request limits that the queues corresponding to resources with immediate return, resources with a longer duration, and important data requests can have can be three, two, one, or other combinations, respectively.

[0032] Specifically, allocating resource requests to queues corresponding to resource types refers to allocating resource requests to corresponding queues according to the resource types of the resource requests, wherein each queue has a different maximum concurrent request limit.

[0033] In an optional implementation, processing resource requests based on a concurrent request limit for each queue includes: In response to a queue not reaching a corresponding concurrent request limit, concurrently processing resource requests allocated to the corresponding queue; or, in response to any queue reaching a corresponding concurrent request limit, executing resource requests allocated to the corresponding queue based on preset rules.

[0034] Specifically, in response to a queue not reaching the corresponding concurrent request limit, concurrently processing the resource requests allocated to the corresponding queue means concurrently processing the resource requests in each queue when the queue does not reach the corresponding concurrent request limit.

[0035] Specifically, in response to any queue reaching the corresponding concurrent request limit, executing the resource requests allocated to the corresponding queue based on the preset rules means that when any queue reaches the corresponding concurrent request limit, the resource requests in the queue are executed according to the preset rules of the queue.

[0036] In an optional implementation, executing the resource request allocated to the corresponding queue based on a preset rule includes: Process resource requests allocated to the corresponding queue based on the time of entering the queue; or process resource requests allocated to the corresponding queue based on the response time and importance corresponding to the resource request.

[0037] Specifically, processing resource requests allocated to a corresponding queue based on the time of entering the queue means processing resource requests allocated to a corresponding queue based on the time when the resource requests were allocated to the queue and the time when they entered the queue. The resource requests in the queue may be processed in the order in which the requests enter the queue, that is, the resource requests that enter the queue first are processed first; or the resource requests in the queue may be processed in reverse order according to the order in which the requests enter the queue, that is, the resource requests that enter the queue later are processed first.

[0038] Specifically, based on the response time and importance corresponding to the resource requests, processing the resource requests assigned to the corresponding queue means giving priority to resource requests with short response time and high importance according to the response time and importance corresponding to the resource requests in the queue; or giving priority to resource requests with long response time and high importance.

[0039] In an optional implementation manner, the resource request further includes identification information and a cancellation signal, and the method further includes: In response to receiving a cancellation signal; based on the cancellation signal, determining identification information corresponding to the cancellation signal; based on the identification information, determining and terminating a corresponding resource request.

[0040] Specifically, the cancel signal is a parameter that is added when sending an asynchronous request. If this parameter is carried when sending a request, a method can be called to cancel the request before the request ends. The operation of canceling the request is triggered on the browser side. The triggering of the cancel signal includes: a cancel signal initiated by the user, and, when a duplicate resource request is found, calling the cancel signal of the previous resource request.

[0041] Specifically, determining the identification information corresponding to the cancellation signal based on the cancellation signal means determining the identification information of the resource request corresponding to the cancellation signal after receiving the cancellation signal.

[0042] Specifically, determining and terminating the corresponding resource request based on the identification information refers to determining the corresponding resource request through the identification information and terminating the corresponding resource request by calling a method.

[0043] In an optional implementation manner, receiving a cancellation signal includes: Based on the preset listening event, if repeated resource requests from the same browser are obtained, a cancel signal for calling the previous resource request is triggered; or, based on the second preset interface, if repeated resource requests between different browsers are obtained, a cancel signal for calling the previous resource request is triggered.

[0044] Specifically, the preset monitoring event refers to determining identification information corresponding to the resource request by setting the monitoring event, thereby determining whether the resource request of the same browser is repeated through the identification information.

[0045] Specifically, the second preset interface may be a Broadcast Channel API, which uses the same channel name for each browser tab so that any tab can use the postMessage method to send information requesting a status update, and other tabs receive this information by listening to the onmessage event, thereby achieving synchronization of the request status. Based on the second preset interface, obtaining repeated resource requests between different browsers means using the second preset interface and the onmessage event to receive tabs between different browsers, thereby determining whether resource requests corresponding to each tab are repeated.

[0046] In this embodiment, a processing device for web resource request is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0047] This embodiment provides a device for processing web resource requests, such as Figure 2 As shown, including: The determination module 201 is used to obtain the resource request of the web page, and determine the response time and importance corresponding to the resource request by parsing the request path of the resource request. The specific process can be found in the description of step S101 in the above embodiment, which will not be repeated here.

[0048] The allocation module 202 is used to allocate resource requests to corresponding queues based on response time and importance. The specific process can be found in the description of step S102 in the above embodiment, which will not be repeated here.

[0049] The processing module 203 is used to process resource requests based on the concurrent request limit of each queue. The specific process can be found in the description of step S103 in the above embodiment, which will not be repeated here.

[0050] The processing device for web resource requests in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0051] The embodiment of the present invention also provides a computer device having the above Figure 3 The processing device of web page resource request is shown.

[0052] See also Figure 3 , Figure 3 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 3 As shown, the computer device includes: one or more processors 301, memory 302, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 3 A processor 301 is taken as an example.

[0053] The processor 301 may be a central processing unit, a network processor or a combination thereof. The processor 301 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable logic gate array, a general purpose array logic or any combination thereof.

[0054] The memory 302 stores instructions executable by at least one processor 301, so that the at least one processor 301 executes the method shown in the above embodiment.

[0055] The memory 302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 302 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 302 may optionally include a memory remotely arranged relative to the processor 301, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0056] The memory 302 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 302 may also include a combination of the above types of memory. The computer device also includes a communication interface 303, which is used for the computer device to communicate with other devices or communication networks.

[0057] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0058] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for processing a webpage resource request, characterized in that: The method comprises: Obtaining a resource request of a web page, and determining a response time and importance corresponding to the resource request by parsing a request path of the resource request; Allocating the resource request to a corresponding queue based on the response time and the importance; The resource requests are processed based on a concurrent request limit for each of the queues.

2. The method according to claim 1, characterized in that: The obtaining of the resource request of the webpage, by parsing the request path of the resource request, determines the response time and importance corresponding to the resource request, including: Acquire a resource request based on a first preset interface; Determine the keyword corresponding to the request path of the resource request by using regular expression parsing; Based on the keyword and the preset corresponding relationship, a response time and an importance level corresponding to the resource request are determined.

3. The method according to claim 1, characterized in that: The allocating the resource request to a corresponding queue based on the response time and the importance includes: Determining a resource type corresponding to the resource request based on the response time and the importance; The resource request is assigned to a queue corresponding to the resource type.

4. The method according to claim 1, characterized in that: The processing of the resource request based on the concurrent request limit of each queue includes: In response to the queue not reaching the corresponding concurrent request limit, concurrently processing resource requests allocated to the corresponding queue; or, In response to any of the queues reaching a corresponding concurrent request limit, resource requests allocated to the corresponding queue are executed based on a preset rule.

5. The method according to claim 4, characterized in that The executing of the resource request allocated to the corresponding queue based on the preset rule includes: Process resource requests allocated to the corresponding queue based on the time of entry into the queue; or, Based on the response time and importance of the resource request, the resource request is assigned to the corresponding queue.

6. The method according to claim 1, characterized in that The resource request also includes identification information and a cancellation signal, and the method further includes: In response to receiving a cancel signal; Based on the cancellation signal, determining identification information corresponding to the cancellation signal; Based on the identification information, a corresponding resource request is determined and terminated.

7. The method according to claim 6, characterized in that The receiving of a cancellation signal comprises: Based on the preset listening event, if repeated resource requests from the same browser are obtained, a cancel signal for calling the previous resource request is triggered; or, Based on the second preset interface, if repeated resource requests between different browsers are obtained, a cancel signal for calling the previous resource request is triggered.

8. A device for processing webpage resource requests, characterized in that: The device comprises: A determination module, used to obtain a resource request of a web page, and determine a response time and importance corresponding to the resource request by parsing a request path of the resource request; an allocation module, configured to allocate the resource request to a corresponding queue based on the response time and the importance; A processing module is used to process the resource request based on the concurrent request limit of each queue.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for processing a web page resource request according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for processing a web page resource request according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Resource allocation system and method based on internet

    CN102790715A

  • Method and device for processing resource acquisition request, computer equipment and storage medium

    CN109710402A

  • Resource allocation method and device, computer equipment and storage medium

    CN112783659A

  • Concurrent request processing method and device, server and storage medium

    CN113342498A

  • Acquisition resource scheduling method and system

    CN115357610A