Web request distribution method and device

By dynamically adjusting the server distribution strategy based on resource type and access frequency, the problem of uneven resource utilization in load balancing is solved, achieving more efficient web request distribution and response.

CN121547458APending Publication Date: 2026-02-17XIAN JIAODA JIEPU NETWORK SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511564379.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-30
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

Existing load balancing technologies struggle to quickly and accurately adjust allocation strategies when dealing with the massive web request distribution from large, comprehensive websites, leading to uneven utilization of server resources and impacting response efficiency.

Method used

Based on the resource type of the web request, servers are added to different lists. For the first access, a preset distribution strategy is used, while for subsequent accesses, a connection list is used. The distribution strategy is based on the ratio of the number of connections to the weight of the server, taking into account server performance and status, and prioritizing the selection of the best server for response.

Benefits of technology

It improved the utilization of server resources, reduced the amount of data to be distributed and processed, accelerated request response speed, and improved the distribution efficiency of large sites.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121547458A_ABST
    Figure CN121547458A_ABST
Patent Text Reader

Abstract

The technical scheme of the invention aims to provide a web request distribution method and device. According to the method, firstly, servers are added into different lists according to resource types of sites, and when corresponding web request types are received, the servers are only selected from the lists to serve as distribution targets, so that the distribution processing data volume is reduced; secondly, the request is judged, if a request source is accessed for the first time within a certain time, the request is distributed according to a strategy, and if the request source is not accessed for the first time, the request is directly forwarded according to a maintained connection list; the distribution strategy selects the ratio of the connection number to the weight, and the performance and the current state of the server are considered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of load balancing technology, and in particular relates to a method and apparatus for distributing web requests to appropriate servers. Background Technology

[0002] To cope with the website access pressure brought about by business growth, multiple servers are usually set up to work together to handle concurrent access. With multiple servers performing the same function, there is a need for reasonable distribution of access traffic among them. Furthermore, some devices may be overloaded while others are underutilized or even idle. Load balancing technology has emerged to effectively solve this problem.

[0003] Load balancing refers to a server cluster composed of multiple servers arranged symmetrically. Its core principle is to rationally distribute incoming requests across these servers using a specific algorithm. Each server has an identical role, meaning it can independently respond to external access requests without the assistance of other servers, and they are unaffected by each other, greatly improving the response speed for concurrent access. Because the states and performance of different servers vary significantly and are constantly changing, different allocation algorithms directly impact whether efficient collaborative response can be achieved among the servers. Summary of the Invention

[0004] Based on the above background, the technical solution of the present invention aims to provide a method for distributing web requests to a server and a web request distribution device that applies the method.

[0005] Firstly, a method for distributing web requests is proposed, including: Based on the resource type of the web request, a corresponding server list is queried, and a response server is selected from it; the selection of the response server includes: if the current request is the first access of the source IP to the server list within a specific period, a preset distribution strategy is invoked to distribute the request; otherwise, the connection list is searched and the request is handed over to the corresponding server for response; the preset distribution strategy includes: based on the ratio of the number of connections of the server to a first weight, the request is distributed to the server with the smallest ratio for response.

[0006] Preferably, the first weight of the aforementioned servers is positively correlated with the server's hardware performance, including sorting servers in the same list according to their hardware performance, with higher ranking servers having a higher first weight. Alternatively, the first weight of the servers is positively correlated with their available resources, including sorting servers in the same list according to the proportion of their currently available resources to all resources, with higher ranking servers having a higher first weight.

[0007] Furthermore, a first index for identifying server hardware performance and a second index for identifying available resources are determined. The larger the ratio of the second index to the first index, the greater the server's first weight.

[0008] Preferably, if there are at least two servers with the smallest ratio of connection count to first weight, the request is distributed to the server with the largest second weight for response; the second weight is determined based on the proportion of the server's historical connection count to the total historical connection count of all servers in the server list, with a larger proportion resulting in a larger second weight. Alternatively, if there are at least two servers with the smallest ratio of connection count to first weight, the request is distributed sequentially according to the server sequence number in the list.

[0009] Furthermore, if the selected server fails to respond, it will be retried until the number of retries reaches a preset threshold, at which point the server will be removed from the server list; and the status of the removed server will be checked every first cycle, and when it recovers, it will be added back to the end of the server list with a new sequence number.

[0010] Secondly, a web request distribution device is proposed to implement the above-mentioned web request distribution method, including: The request parsing module is used to parse the received web requests to obtain request information including the request type and source IP. The request dispatch module dispatches web requests to the server for response according to the dispatch strategy. The server information module is used to maintain the site's server information for selection by the requested distribution module.

[0011] Preferably, the request distribution module described above queries the corresponding server list based on the resource type of the web request and selects a response server from it. The selection of the response server includes: if the current request is the first access of the source IP to the server list within a specific period, calling a preset distribution strategy to distribute the request; otherwise, searching the connection list and handing it over to the corresponding server for response. The preset distribution strategy includes: based on the ratio of the number of connections of the server to a first weight, distributing the request to the server with the smallest ratio for response.

[0012] Furthermore, if there are at least two servers with the smallest ratio of connection count to first weight, the request will be distributed to the server with the largest second weight for response; the second weight is determined based on the proportion of the server's historical connection count to the total historical connection count of all servers in the server list, and the larger the proportion, the larger the second weight.

[0013] The technical solution of the present invention as described above has at least the following beneficial effects: First, servers are added to different lists according to the resource type of the site. When a corresponding web request type is received, only the server in that list is selected as the distribution target, which can reduce the amount of data distributed and processed between all web requests and all servers. Second, the request is judged. If the request source is the first access within a certain period of time, it is distributed according to the strategy. If it is not the first access, it is forwarded directly according to the maintained connection list. The distribution strategy selection is based on the ratio of the number of connections to the weight, taking into account the server performance and the current state, making full use of the server and speeding up the response efficiency to requests. Attached Figure Description

[0014] Figure 1 This is a flowchart illustrating the first embodiment of the web request distribution method of the present invention.

[0015] Figure 2 This is a flowchart illustrating the second embodiment of the web request distribution method of the present invention.

[0016] Figure 3 This is a schematic diagram of the module composition of an embodiment of the web request distribution device of the present invention. Detailed Implementation

[0017] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the application.

[0018] For ease of understanding, the terms used in the embodiments of this invention are explained below: First, a brief explanation of some of the technical terms involved in the technical solution will be provided.

[0019] Commonly used load balancing algorithms each have their own advantages, but they are generally only suitable for specific scenarios. When faced with the massive web request distribution of large comprehensive websites and unpredictable changes in the network environment, they are difficult to adjust quickly and accurately and need further optimization.

[0020] For example: Round Robin: Distributes client requests sequentially to each backend server, repeating this process. Round Robin is simple to implement and suitable for scenarios where backend servers have similar performance. IP Hash: Calculates a hash based on the client's IP address, forwarding requests from the same IP address to the same backend server. IP Hash is suitable for scenarios requiring long-lived connections or session persistence. Weighted Round Robin: Distributes requests in different proportions based on the weight of the backend servers. Weighted Round Robin can be dynamically adjusted based on the performance and resources of the backend servers. Least Connections: Forwards requests to the backend server with the fewest current connections. Least Connections is suitable for scenarios requiring long-term connections, such as video conferencing and gaming.

[0021] This invention aims to solve the problem of limited applicability of a single algorithm and improve the distribution efficiency of large websites when facing multiple types of web requests. Example

[0022] like Figure 1 As shown, a web request dispatching method includes: Based on the resource type of the web request, query the corresponding server list and select a response server from it; selecting a response server includes: if the current request is the first access of the source IP to the server list within a specific period, calling a preset distribution strategy to distribute the request; otherwise, searching the connection list and handing it over to the corresponding server for response.

[0023] In this embodiment, the distribution strategy includes: distributing the request to the server with the smallest ratio for response based on the ratio of the number of connections to the first weight.

[0024] The primary weight of a server is positively correlated with its hardware performance. This includes sorting servers in the same list based on their hardware performance, with higher ranking servers having a greater primary weight.

[0025] If there are at least two servers with the smallest ratio of connection count to first weight, the request will be distributed to the server with the largest second weight for response. The second weight is determined based on the proportion of the server's historical connection count to the total historical connection count of all servers in the server list; the larger the proportion, the larger the second weight.

[0026] The technical solution of this embodiment, as described above, firstly adds servers to different lists based on the resource type of the site. When a corresponding web request type is received, only the server in that list is selected as the distribution target, which can reduce the amount of data distributed and processed between all web requests and all servers. Secondly, the request is judged. If the request source is the first access within a certain period of time, it is distributed according to the strategy. If it is not the first access, it is forwarded directly according to the maintained connection list. The distribution strategy selects the ratio of the number of connections to the weight, taking into account the server performance and the current state, making full use of the server and speeding up the response efficiency to requests. Example

[0027] like Figure 2 As shown, a web request distribution method includes: querying a corresponding server list based on the resource type of the web request, and selecting a response server from it; the selection of the response server includes: if the current request is the first access of the source IP to the server list within a specific period, invoking a preset distribution strategy to distribute the request; otherwise, searching a connection list and handing it over to the corresponding server for response; the preset distribution strategy includes: distributing the request to the server with the smallest ratio for response based on the ratio of the number of connections of the server to a first weight.

[0028] Preferably, the first weight of the aforementioned server is positively correlated with the available resources of the server, including sorting the servers in the same list according to the proportion of the server's current available resources to all resources, with the higher the ranking, the greater the first weight.

[0029] Preferably, if there are at least two servers with the smallest ratio of the number of connections to the first weight, then the servers are distributed sequentially according to their serial numbers in the list.

[0030] Furthermore, if the selected server fails to respond, and fails to respond after 3 retries, the server is removed from the server list; and the status of the removed server is checked every second cycle, and if it recovers, it is added back to the end of the server list with a new sequence number.

[0031] The technical solution of this embodiment, as described above, firstly adds servers to different lists based on the resource type of the site. When a corresponding web request type is received, only the server in that list is selected as the distribution target, which can reduce the amount of data distributed and processed between all web requests and all servers. Secondly, the request is judged. If the request source is the first access within a certain period of time, it is distributed according to the strategy. If it is not the first access, it is forwarded directly according to the maintained connection list. The distribution strategy selects the ratio of the number of connections to the weight, taking into account the server performance and the current state, making full use of the server and speeding up the response efficiency to requests. Example

[0032] A method for distributing web requests includes: querying a corresponding server list based on the resource type of the web request, and selecting a response server from the list; the selection of the response server includes: if the current request is the first access of the source IP to the server list within a specific period, invoking a preset distribution strategy to distribute the request; otherwise, searching a connection list and handing it over to the corresponding server for response; the preset distribution strategy includes: distributing the request to the server with the smallest ratio of the number of connections to the server for response based on the ratio of the number of connections to the first weight.

[0033] Preferably, the first weight of the aforementioned servers is positively correlated with the server's hardware performance, including sorting servers in the same list according to their hardware performance, with higher ranking servers having a higher first weight. Alternatively, the first weight of the servers is positively correlated with their available resources, including sorting servers in the same list according to the proportion of their currently available resources to all resources, with higher ranking servers having a higher first weight.

[0034] Furthermore, a first index for identifying server hardware performance and a second index for identifying available resources are determined. The larger the ratio of the second index to the first index, the greater the server's first weight.

[0035] Preferably, if there are at least two servers with the smallest ratio of connection count to first weight, the request is distributed to the server with the largest second weight for response; the second weight is determined based on the proportion of the server's historical connection count to the total historical connection count of all servers in the server list, with a larger proportion resulting in a larger second weight. Alternatively, if there are at least two servers with the smallest ratio of connection count to first weight, the request is distributed sequentially according to the server sequence number in the list.

[0036] Furthermore, if the selected server fails to respond, it will be retried until the number of retries reaches a preset threshold, at which point the server will be removed from the server list; and the status of the removed server will be checked every first cycle, and when it recovers, it will be added back to the end of the server list with a new sequence number.

[0037] The technical solution of this embodiment, as described above, firstly adds servers to different lists based on the resource type of the site. When a corresponding web request type is received, only the server in that list is selected as the distribution target, which can reduce the amount of data distributed and processed between all web requests and all servers. Secondly, the request is judged. If the request source is the first access within a certain period of time, it is distributed according to the strategy. If it is not the first access, it is forwarded directly according to the maintained connection list. The distribution strategy selects the ratio of the number of connections to the weight, taking into account the server performance and the current state, making full use of the server and speeding up the response efficiency to requests. Example

[0038] like Figure 3 As shown, a web request distribution apparatus, applying the web request distribution method of the above embodiments, includes: The request parsing module is used to parse the received web requests to obtain request information including the request type and source IP. The request dispatch module dispatches web requests to the server for response according to the dispatch strategy. The server information module is used to maintain the site's server information for selection by the requested distribution module.

[0039] In a preferred implementation, the request distribution module described above queries a list of corresponding servers based on the resource type of the web request and selects a response server from it. The selection of the response server includes: if the current request is the first access to the server list by the source IP within a specific period, a preset distribution strategy is invoked to distribute the request; otherwise, the connection list is searched and the request is handed over to the appropriate server for response. The preset distribution strategy includes: based on the ratio of the number of connections to a first weight, the request is distributed to the server with the smallest ratio for response.

[0040] In a preferred implementation, the first weight includes determining a first index for identifying server hardware performance and a second index for identifying available resources. The larger the ratio of the second index to the first index, the larger the first weight of the server.

[0041] Furthermore, in this embodiment, if there are at least two servers with the smallest ratio of connection count to first weight, the request will be distributed to the server with the largest second weight for response; the second weight is determined based on the proportion of the server's historical connection count to the total historical connection count of all servers in the server list, and the larger the proportion, the larger the second weight.

[0042] The technical solution of this embodiment, as described above, firstly adds servers to different lists based on the resource type of the site. When a corresponding web request type is received, only the server in that list is selected as the distribution target, which can reduce the amount of data distributed and processed between all web requests and all servers. Secondly, the request is judged. If the request source is the first access within a certain period of time, it is distributed according to the strategy. If it is not the first access, it is forwarded directly according to the maintained connection list. The distribution strategy selects the ratio of the number of connections to the weight, taking into account the server performance and the current state, making full use of the server and speeding up the response efficiency to requests.

[0043] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc.

[0044] The description of the disclosed embodiments above enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily 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 invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles disclosed herein.

Claims

1. A method for distributing web requests, characterized in that, Based on the resource type of the web request, query the corresponding server list and select the response server from it; The selection of the response server includes: if the current request is the first access of the source IP to the server list within a specific period, invoking a preset distribution strategy to distribute the request; otherwise, searching the connection list and handing it over to the corresponding server for response; the preset distribution strategy includes: according to the ratio of the number of connections of the server to a first weight, distributing the request to the server with the smallest ratio for response.

2. The web request distribution method according to claim 1, characterized in that, The first weight of the server is positively correlated with the server's hardware performance, including sorting servers in the same list according to their hardware performance, with the higher the ranking, the greater the first weight.

3. The web request distribution method according to claim 1, characterized in that, The first weight of a server is positively correlated with the server's available resources. This includes sorting servers in the same list according to the proportion of their current available resources to all resources, with servers ranked higher in the list having a larger first weight.

4. The web request distribution method according to claim 2 or 3, characterized in that, A first index is determined to identify the server's hardware performance, and a second index is determined to identify available resources. The larger the ratio of the second index to the first index, the greater the server's first weight.

5. The web request distribution method according to claim 1, characterized in that, If there are at least two servers with the smallest ratio of connection count to first weight, the request will be distributed to the server with the largest second weight for response; the second weight is determined based on the proportion of the server's historical connection count to the total historical connection count of all servers in the server list, and the larger the proportion, the larger the second weight.

6. The web request distribution method according to claim 1, characterized in that, If there are at least two servers with the smallest ratio of connection count to first weight, then the servers will be distributed sequentially according to their server numbers in the list.

7. The web request distribution method according to claim 6, characterized in that, If the selected server fails to respond, retry until the number of retries reaches a preset threshold, at which point the server will be removed from the server list. The status of the removed servers is checked every preset period, and when they are restored, they are added back to the end of the server list with a new serial number.

8. A web request distribution apparatus, implementing the web request distribution method according to any one of claims 1-7, characterized in that, include: The request parsing module is used to parse the received web requests to obtain request information including the request type and source IP. The request dispatch module dispatches web requests to the server for response according to the dispatch strategy. The server information module is used to maintain the site's server information for selection by the requested distribution module.

9. The web request distribution device according to claim 8, characterized in that, The request distribution module queries the corresponding server list based on the resource type of the web request and selects a response server from it. The selection of the response server includes: if the current request is the first access of the source IP to the server list within a specific period, invoking a preset distribution strategy to distribute the request; otherwise, searching the connection list and handing it over to the corresponding server for response; the preset distribution strategy includes: according to the ratio of the number of connections of the server to a first weight, distributing the request to the server with the smallest ratio for response.

10. The web request distribution device according to claim 9, characterized in that, If there are at least two servers with the smallest ratio of connection count to first weight, the request will be distributed to the server with the largest second weight for response; the second weight is determined based on the proportion of the server's historical connection count to the total historical connection count of all servers in the server list, and the larger the proportion, the larger the second weight.