A website system request flow control method, storage medium and device

By using the multi-tree structure and token bucket algorithm in the Internet industry, the network request traffic is dynamically adjusted, which solves the system crash problem caused by excessive network access request traffic and achieves flexible adjustment and stable management of network resources.

CN115776466BActive Publication Date: 2024-09-20SHENZHEN SEKORM COMPONENT NETWORK CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211166798.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-23
Publication Date
2024-09-20
Estimated Expiration
2042-09-23

AI Technical Summary

Technical Problem

Existing technologies are difficult to effectively control network access request traffic in the Internet industry, leading to network system collapse and resource waste, and there are problems with insufficient dynamic adjustment.

Method used

Using a multi-tree structure and token bucket algorithm, by monitoring the access frequency and token acquisition rate of the URL path, the token generation rate and access frequency thresholds are dynamically adjusted to control and limit network request traffic.

Benefits of technology

It achieves flexible control and current limiting of network request traffic, avoids network system collapse, and maintains the ecological stability of the website system and the dynamic balance of resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115776466B
    Figure CN115776466B
Patent Text Reader

Abstract

The present invention relates to a method, storage medium and device for controlling request flow of a website system. The method for controlling request flow of a website system comprises the following steps: establishing a flow control structure model: cutting a URL path into multiple path elements, and establishing a multi-branch tree structure according to the path elements. Setting an access frequency threshold for each node. A token bucket is configured for each layer of nodes in the multi-branch tree structure. Token rate adjustment: monitoring and adjusting the token acquisition rate of each node. Access frequency adjustment: monitoring and adjusting the access frequency of each node. The present invention provides a method for controlling request flow of a website system, which solves the problem that a network system crash is easily caused when the network access request flow is too high, can realize the control and flow limiting of network request flow, dynamically and flexibly adjust network resources, and maintain the ecological stability of the website system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of the Internet, and more specifically, to a method, storage medium and device for controlling request flow of a website system. Background Art

[0002] In the Internet industry, web sites are one of the most commonly used and widely used ways for backend systems to interact with users. Inadequate control of network access request traffic can easily cause the network system to operate poorly or even cause the backend system to crash, which also wastes network resources. For example, when users visit web pages on a website, the number of visits to a certain web page is too high in a certain period of time, while the number of visits to other web pages is very low. For web pages with too high visits, the backend system is likely to be unable to handle them or the system will crash, while for web pages with very low visits, the network resources allocated to them are idle. While facilitating users, it also provides a way for many illegal operations, such as: XSS (script attack), CSRF (request forgery), SQL injection, DDOS attack, etc. Traditional methods still have the defects of insufficient control of network request traffic, dynamic adjustment of network resources, maintenance of network ecological stability and system load balancing. Summary of the invention

[0003] The technical problem to be solved by the present invention is to provide a method, storage medium and device for controlling request flow of a website system.

[0004] The technical solution adopted by the present invention to solve the technical problem is: construct a website system request flow control method, including the following steps:

[0005] Establish a traffic control structure model: cut the URL path into multiple path elements, and establish a multi-branch tree structure based on the path elements; each of the URL paths is a branch of the multi-branch tree structure, and each of the path elements is a node of the multi-branch tree structure; set the access frequency threshold of each node; configure a token bucket for each layer of nodes in the multi-branch tree structure;

[0006] Token rate adjustment: monitor the token acquisition rate of each node, if the token acquisition rate of each node in the same layer is greater than the first preset ratio of the token generation rate of the token bucket corresponding to the layer, then increase the token generation rate of the token bucket corresponding to the layer; if the token acquisition rate of each node in the same layer is less than the first preset ratio of the token generation rate of the token bucket corresponding to the layer, then reduce the token generation rate of the token bucket corresponding to the layer;

[0007] Access frequency adjustment: monitor the access frequency of each node. When the access frequency of a certain node is greater than the access frequency threshold, reduce the access frequency thresholds of other nodes in the same layer and increase the access frequency threshold of the node.

[0008] Further, in the website system request flow control method of the present invention, the establishing of a multi-branch tree structure according to the path elements includes:

[0009] The path elements are organized into an array in a front-to-back order, and the array is converted into the multi-branch tree structure; wherein the front-to-back order is the front-to-back order of the path elements in the URL path.

[0010] Furthermore, in the website system request flow control method of the present invention, after establishing the flow control structure model, the following steps are also included:

[0011] Based on the traffic control structure model, the network access request is traversed and matched. If the match is successful, wait for the token to be obtained. If not, a new node is established.

[0012] Further, in the website system request flow control method of the present invention, the traversal matching of network access requests includes:

[0013] The URL path of the network access request is cut into a plurality of path elements, the path elements are organized into an array in a front-to-back order, the path elements in the array are traversed, and matched with the multi-branch tree structure; wherein the front-to-back order is the front-to-back order of the path elements in the URL path.

[0014] Further, in the website system request flow control method of the present invention, if the match is successful, waiting to obtain a token includes:

[0015] When the traversal matches the node, the node attempts to obtain a token within a preset time. If the waiting time exceeds the preset time, the network access request is abandoned. If not, the traversal continues to match the node in the next layer.

[0016] Further, in the website system request flow control method described in the present invention, the token rate adjustment includes:

[0017] If the token acquisition rate of each node of the same layer is greater than the first preset ratio of the token generation rate of the token bucket corresponding to the layer, the token generation rate of the token bucket corresponding to the layer is increased according to the second preset ratio;

[0018] If the token acquisition rate of each node in the same layer is less than the first preset ratio of the token generation rate threshold of the token bucket corresponding to the layer, the token generation rate of the token bucket corresponding to the layer is reduced according to the third preset ratio.

[0019] Further, in the website system request flow control method of the present invention, the access frequency adjustment includes:

[0020] When the access frequency of a certain node is greater than the access frequency threshold, the difference between the access frequency of other nodes in the same layer and the access frequency threshold is calculated, and other nodes whose difference is greater than a fourth preset proportion of the access frequency threshold are found, the access frequency thresholds of other nodes are lowered, and the access frequency threshold of this node is increased.

[0021] Further, in the website system request flow control method of the present invention, the access frequency adjustment includes:

[0022] When the access frequency of a node is greater than the access frequency threshold, the difference between the access frequency of other nodes in the same layer and the access frequency threshold is calculated, and other nodes whose difference is greater than the fourth preset proportion of the access frequency threshold are found, and the access frequency thresholds of other nodes are reduced according to the fifth preset proportion, and the corresponding values ​​of the reduced access frequency thresholds of other nodes are added to the access frequency threshold of the node.

[0023] In addition, the present invention also provides a computer-readable storage medium, which stores a computer program, and the computer program is suitable for loading by a processor to execute the steps of the website system request traffic control method as described above.

[0024] In addition, the present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the steps of the above-mentioned website system request traffic control method by calling the computer program stored in the memory.

[0025] The website system request flow control method, storage medium and device implementing the present invention have the following beneficial effects:

[0026] The website system combines the multi-tree structure and token bucket algorithm to monitor and adjust the token rate and access frequency, which can realize the control and flow limitation of network request traffic, and dynamically and flexibly adjust network resources. It solves the problem that network system crashes easily when network access request traffic is too high, and maintains the ecological stability of the website system. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0028] Figure 1 It is a flow chart of a method for controlling website system request flow provided by an embodiment of the present invention;

[0029] Figure 2 It is a schematic diagram of a multi-tree structure of a website system request flow control method provided by an embodiment of the present invention;

[0030] Figure 3 It is a token bucket allocation diagram of the website system request traffic control method provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0031] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described in detail with reference to the accompanying drawings.

[0032] In a preferred embodiment, reference Figure 1 The website system request flow control method of this embodiment includes the following steps:

[0033] S1. Establish a traffic control structure model:

[0034] The URL path is split into multiple path elements. Optionally, the URL path can be split into separate parts according to a hierarchical identifier, and these separate parts are path elements. The hierarchical identifier here can be, for example, the " / " symbol used to divide the hierarchy in the URL path.

[0035] A multi-branch tree structure is established based on the path elements, wherein each URL path is a branch of the multi-branch tree structure, and each path element is a node of the multi-branch tree structure. It should be noted that different URL paths can share at least one node. Optionally, Figure 2 As shown, A, B, C, B1, B2, B3, and C1 constitute nodes of a multi-branch tree structure, and the URL paths are "A / B / B1", "A / B / B2", "A / B / B3", and "A / C / C1".

[0036] Set the access frequency threshold for each node. It should be noted that access frequency refers to the cumulative number of visits per unit time. In other words, each node uses the access frequency attribute to count the number of times a user's access request matches a certain node, which in turn reflects the number of times a certain web page is visited in a certain time period. The website system can use this to monitor and determine whether the network is busy.

[0037] A token bucket is configured for each layer of nodes in the multi-tree structure. It should be noted that each layer of nodes refers to nodes with the same depth starting from the root node of the multi-tree structure. Specifically, assuming that the multi-tree structure is as follows Figure 3As shown, node A is a separate layer and is assigned token bucket 1. Nodes B and C are on the same layer and share token bucket 2. Nodes B1, B2, B3 and C1 are on the same layer and share token bucket 3, and so on.

[0038] S2. Token rate adjustment: monitor the token acquisition rate of each node. If the token acquisition rate of each node in the same layer is greater than the first preset ratio of the token generation rate of the token bucket corresponding to the layer, then increase the token generation rate of the token bucket corresponding to the layer. If the token acquisition rate of each node in the same layer is less than the first preset ratio of the token generation rate of the token bucket corresponding to the layer, then reduce the token generation rate of the token bucket corresponding to the layer. For example, when the token acquisition rate of each node in the same layer is greater than 50% of the token generation rate of the token bucket of the layer, the token generation rate of the token bucket of the layer is increased accordingly, and vice versa.

[0039] It should be noted that the token acquisition rate refers to the number of tokens acquired by a node per unit time; the token generation rate refers to the number of tokens generated by a token bucket per unit time. Optionally, the upper and lower limits of the token generation rate of the token bucket can be set.

[0040] S3, access frequency adjustment: monitor the access frequency of each node. When the access frequency of a node is greater than the access frequency threshold, the access frequency thresholds of other nodes in the same layer are lowered, and the access frequency threshold of the node is increased.

[0041] In this embodiment, by combining the multi-branch tree structure and the token bucket algorithm, the token rate and access frequency are monitored and adjusted, which can achieve the control and flow limiting of network request traffic, and dynamically and flexibly adjust network resources according to actual needs, thereby solving the problem of network system crash easily caused by excessive network access request traffic, and maintaining the ecological stability of the website system.

[0042] In the website system request flow control method of some embodiments, establishing a multi-branch tree structure according to path elements includes:

[0043] The path elements are organized into an array in a front-to-back order, and the array is converted into a multi-branch tree structure; wherein the front-to-back order is the front-to-back order of the path elements in the URL path.

[0044] In this embodiment, the path elements are organized into an array in the order of their appearance in the URL path, ensuring that when traversal matching is performed, the traversal order corresponds one-to-one to the hierarchical order of the URL path of the user's network access request.

[0045] In the website system request traffic control method of some embodiments, after establishing the traffic control structure model, the following steps are also included:

[0046] Based on the traffic control structure model, the network access request is traversed and matched. If the match is successful, wait for the token to be obtained. If not, a new node is established. Optionally, when the network access request is traversed and no corresponding matching node is found in the multi-branch tree structure, the website system will automatically establish and initialize a new node. Alternatively, when a new web page is added to the website, the website system can also automatically improve and update the multi-branch tree structure.

[0047] In this embodiment, it is possible to implement control and flow limiting of network request traffic, and dynamically and flexibly adjust network resources according to actual needs.

[0048] In the website system request traffic control method of some embodiments, traversing and matching the network access request includes:

[0049] The URL path of the network access request is cut into multiple path elements, the path elements are organized into an array in a front-to-back order, the path elements in the array are traversed, and matched with the multi-branch tree structure; wherein the front-to-back order is the front-to-back order of the path elements in the URL path.

[0050] In this embodiment, by processing the URL path of the network access request accordingly and matching it with the multi-branch tree structure traversal, it is possible to control and limit the network request traffic, and dynamically and flexibly adjust network resources according to actual needs.

[0051] In the website system request flow control method of some embodiments, if the match is successful, waiting to obtain the token includes:

[0052] When the traversal matches a certain node, the node can be called a matching hit node. At this time, the matching hit node tries to obtain a token within a preset time. If the waiting time exceeds the preset time, the network access request is abandoned. If not, the traversal continues to match the next layer of nodes.

[0053] In this embodiment, it is possible to implement control and flow limiting of network request traffic, and dynamically and flexibly adjust network resources according to actual needs.

[0054] In the website system request flow control method of some embodiments, token rate adjustment includes:

[0055] If the token acquisition rate of each node in the same layer is greater than the first preset ratio of the token generation rate of the token bucket corresponding to the layer, the token generation rate of the token bucket corresponding to the layer is increased according to the second preset ratio.

[0056] If the token acquisition rate of each node in the same layer is less than the first preset ratio of the token generation rate threshold of the token bucket corresponding to the layer, the token generation rate of the token bucket corresponding to the layer is reduced according to the third preset ratio.

[0057] For example, when the token acquisition rate of each node in the same layer is greater than 50% of the token generation rate of the token bucket corresponding to the layer, the token generation rate of the token bucket corresponding to the layer will be increased by 30%; when the token acquisition rate of each node in the same layer is less than 50% of the token generation rate of the token bucket corresponding to the layer, the token generation rate of the token bucket of the layer will be reduced by 10%.

[0058] In this embodiment, by monitoring the token acquisition rate of each node and dynamically adjusting the token generation rate of the corresponding token bucket, not only the control of network request traffic is achieved, but also the dynamic and flexible adjustment of network resources such as token generation can be achieved according to actual needs, thereby achieving the purpose of website system load balancing.

[0059] In the website system request flow control method of some embodiments, access frequency adjustment includes:

[0060] When the access frequency of a certain node is greater than the access frequency threshold, the difference between the access frequency of other nodes in the same layer and the access frequency threshold is calculated, and other nodes whose difference is greater than a fourth preset ratio of the access frequency threshold are found, and the access frequency threshold of other nodes is reduced, and the access frequency threshold of the node is increased. Optionally, reducing the access frequency threshold of other nodes may be reducing the access frequency threshold of at least one other node that meets the condition.

[0061] In this embodiment, by monitoring the access frequency of each node and dynamically adjusting the access frequency threshold between nodes in the same layer, not only the control of network request traffic is achieved, but also the dynamic and flexible adjustment of network resources such as access frequency threshold can be made according to actual needs, so that the matching hit node that exceeds the specified threshold can increase its own threshold by reducing the number of threshold frequencies of other nodes in the same layer, so that the network access request or the next network access request has the opportunity to obtain the token and access successfully when it reaches the matching hit node.

[0062] In the website system request flow control method of some embodiments, access frequency adjustment includes:

[0063] When the access frequency of a certain node is greater than the access frequency threshold, the difference between the access frequency of other nodes in the same layer and the access frequency threshold is calculated, and other nodes whose difference is greater than the fourth preset ratio of the access frequency threshold are found, and the access frequency thresholds of other nodes are reduced according to the fifth preset ratio, and the corresponding values ​​of the reduced access frequency thresholds of other nodes are added to the access frequency threshold of the node. For example, at least one other node in the same layer whose difference is greater than 50% of the access frequency threshold is found, and the access frequency threshold of at least one other node in the same layer is reduced by 30%, and the corresponding reduced 30% value is added to the access frequency threshold of the node.

[0064] In this embodiment, by monitoring the access frequency of each node and dynamically adjusting the access frequency threshold between nodes in the same layer, not only the control of network request traffic is achieved, but also the dynamic and flexible adjustment of network resources such as access frequency threshold can be made according to actual needs, so that the matching hit node that exceeds the specified threshold can increase its own threshold by reducing the number of threshold frequencies of other nodes in the same layer, so that the network access request or the next network access request has the opportunity to obtain the token and access successfully when it reaches the matching hit node.

[0065] In a preferred embodiment, a computer-readable storage medium stores a computer program, and the computer program is suitable for loading by a processor to execute the steps of the website system request traffic control method as described above.

[0066] In this embodiment, it is possible to implement control and flow limiting of network request traffic, dynamically and flexibly adjust network resources according to actual needs, solve the problem of network system crash easily caused by excessive network access request traffic, and maintain the ecological stability of the website system.

[0067] In a preferred embodiment, a computer device includes a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the steps of the above-mentioned website system request traffic control method by calling the computer program stored in the memory.

[0068] In this embodiment, it is possible to implement control and flow limiting of network request traffic, dynamically and flexibly adjust network resources according to actual needs, solve the problem of network system crash easily caused by excessive network access request traffic, and maintain the ecological stability of the website system.

[0069] 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.

[0070] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0071] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0072] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot limit the scope of protection of the present invention. All equivalent changes and modifications made to the scope of the claims of the present invention should fall within the scope of the claims of the present invention.

Claims

1. A method for controlling request flow of a website system, characterized in that: The following steps are involved: Establish a traffic control structure model: cut the URL path into multiple path elements, and establish a multi-branch tree structure based on the path elements; each of the URL paths is a branch of the multi-branch tree structure, and each of the path elements is a node of the multi-branch tree structure; set the access frequency threshold of each node; configure a token bucket for each layer of nodes in the multi-branch tree structure; Token rate adjustment: monitor the token acquisition rate of each node, if the token acquisition rate of each node in the same layer is greater than the first preset ratio of the token generation rate of the token bucket corresponding to the layer, then increase the token generation rate of the token bucket corresponding to the layer; if the token acquisition rate of each node in the same layer is less than the first preset ratio of the token generation rate of the token bucket corresponding to the layer, then reduce the token generation rate of the token bucket corresponding to the layer; Access frequency adjustment: monitoring the access frequency of each node, when the access frequency of a certain node is greater than the access frequency threshold, calculating the difference between the access frequency of other nodes in the same layer and the access frequency threshold, finding other nodes whose difference is greater than a fourth preset ratio of the access frequency threshold, reducing the access frequency threshold of other nodes, and increasing the access frequency threshold of the node; The establishing of a multi-branch tree structure according to the path elements comprises: The path elements are organized into an array in a front-to-back order, and the array is converted into the multi-branch tree structure; wherein the front-to-back order is the front-to-back order of the path elements in the URL path.

2. The website system request flow control method according to claim 1, characterized in that: After the flow control structure model is established, the following steps are also included: Based on the traffic control structure model, the network access request is traversed and matched. If the match is successful, wait for the token to be obtained. If not, a new node is established.

3. The website system request flow control method according to claim 2 is characterized in that: The traversal matching of the network access request includes: The URL path of the network access request is cut into a plurality of path elements, the path elements are organized into an array in a front-to-back order, the path elements in the array are traversed, and matched with the multi-branch tree structure; wherein the front-to-back order is the front-to-back order of the path elements in the URL path.

4. The website system request flow control method according to claim 2, characterized in that: If the match is successful, waiting to obtain the token includes: When the traversal matches the node, the node attempts to obtain a token within a preset time. If the waiting time exceeds the preset time, the network access request is abandoned. If not, the traversal continues to match the node in the next layer.

5. The website system request flow control method according to claim 1, characterized in that: The token rate adjustment includes: If the token acquisition rate of each node of the same layer is greater than the first preset ratio of the token generation rate of the token bucket corresponding to the layer, the token generation rate of the token bucket corresponding to the layer is increased according to the second preset ratio; If the token acquisition rate of each node in the same layer is less than the first preset ratio of the token generation rate threshold of the token bucket corresponding to the layer, the token generation rate of the token bucket corresponding to the layer is reduced according to the third preset ratio.

6. The website system request flow control method according to claim 1, characterized in that: The step of lowering the access frequency threshold of the other nodes and increasing the access frequency threshold of the node includes: The access frequency thresholds of the other nodes are reduced according to a fifth preset ratio, and the corresponding values ​​of the reduced access frequency thresholds of the other nodes are added to the access frequency threshold of the node.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the steps of the website system request traffic control method as described in any one of claims 1 to 6.

8. A computer device, characterized in that: It includes a memory and a processor, the memory stores a computer program, and the processor executes the steps of the website system request traffic control method as described in any one of claims 1 to 6 by calling the computer program stored in the memory.

Citation Information

Patent Citations

  • Thermal analysis method, device and equipment of webpage access

    CN108121802A

  • Request control method and device, computer device and storage medium

    CN109194765A

  • Classifying urls

    US20160048586A1

  • Systems and methods for rate limiting of processing systems

    US20210279100A1