A routing request method and terminal

By monitoring and calculating the remaining resources and weight values ​​of access applications, the problem of client long connection failures was solved, and the server's resource utilization and the accuracy of rate limiting control were improved.

CN115426399BActive Publication Date: 2026-04-24FUJIAN TIANQUAN EDUCATION TECH LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
FUJIAN TIANQUAN EDUCATION TECH LTD
Filing Date
2022-07-27
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing routing request methods cannot effectively reduce the possibility of clients failing to establish long-term connections, and server resource utilization is low.

Method used

By periodically monitoring the remaining resources of each access application, calculating their weight values ​​and sorting them in reverse order, establishing long connections based on resource usage weights, and implementing rate limiting control based on the resource consumption of long connections.

Benefits of technology

It reduces the likelihood of clients failing to establish long-term connections, improves server resource utilization, and enables more precise load balancing and rate limiting control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115426399B_ABST
    Figure CN115426399B_ABST
Patent Text Reader

Abstract

The application discloses a routing request method and a terminal, which monitors resource remaining conditions of each access application in a time manner, calculates and obtains weights of various resources of the access application, performs descending order sorting according to the calculated weights, and arranges the application with sufficient resources in a front position, so that the client only needs to sequentially establish a long link according to an address list returned by a server. Through the method, the function of load distribution according to server resources can be realized to a great extent, the possibility of long link establishment failure of the client is reduced, and the resource utilization rate of the server is improved. In addition, the long connection resource occupation amount is calculated, the resource occupation amount of each long connection can be estimated according to known resource information, and the flow control can be more accurately controlled according to the access quantity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a routing request method and terminal. Background Technology

[0002] In today's booming mobile internet era, most mobile apps offer push notification functionality, such as trending news recommendations on news apps, chat message notifications in instant messaging tools, e-commerce product promotions, and notifications and approval processes in enterprise applications. Push notifications play a crucial role in increasing product activity, improving the usage rate of functional modules, enhancing user stickiness, and increasing user retention.

[0003] Many push notification applications now employ a multi-cluster deployment of an access service and a routing cluster service. Before establishing a persistent connection, the client pre-accesses the routing cluster service's interface to obtain a list of available persistent connection addresses. It then selects one address from the list to establish the persistent connection. Once established, the server and client maintain a persistent connection, and all message sending and receiving are conducted through this connection. There are numerous such persistent connections; typically, each access application maintains hundreds of thousands of such connections.

[0004] Currently, there are generally two main push routing strategies. One is random routing, where the routing query interface returns route addresses to the client in a fixed or random order each time, and the client obtains the addresses sequentially or randomly to establish a long connection. This method is simple, but it lacks control over which application the client connects to because it uses randomness. The other strategy sorts the returned addresses based on the number of applications already connected, prioritizing addresses from machines with fewer connected applications. This guides the client to connect to applications with fewer connections. This provides some control over client access; however, because server resources vary—newer servers generally have better performance in terms of CPU and memory—even with identical parameters, the available resources on different servers will differ. This means that the actual maximum number of applications that can be connected will vary depending on the server's actual situation, leading to a higher probability of long connection establishment failures. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a routing request method and terminal that can reduce the possibility of client failure to establish long connections and improve server resource utilization.

[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:

[0007] A method for routing requests, comprising the following steps:

[0008] Regularly monitor the remaining resource status of each connected application;

[0009] The weight value of each access application is calculated based on the remaining resources and resource usage weight of each access application. The weight values ​​of each access application are sorted in reverse order, and long links are established with the access applications according to the sorting order.

[0010] The resource usage of each access application is calculated based on the resource usage weight. The remaining number of access applications that can be connected is calculated based on the resource usage of the long connections. Rate limiting control is then implemented for the access applications based on the remaining number of access applications that can be connected.

[0011] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows:

[0012] A routing request terminal includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps:

[0013] Regularly monitor the remaining resource status of each connected application;

[0014] The weight value of each access application is calculated based on the remaining resources and resource usage weight of each access application. The weight values ​​of each access application are sorted in reverse order, and long links are established with the access applications according to the sorting order.

[0015] The resource usage of each access application is calculated based on the resource usage weight. The remaining number of access applications that can be connected is calculated based on the resource usage of the long connections. Rate limiting control is then implemented for the access applications based on the remaining number of access applications that can be connected.

[0016] The beneficial effects of this invention are as follows: It periodically monitors the remaining resource status of each access application, calculates and obtains weights for various resources of each access application, and sorts them in reverse order according to the calculated weights. Applications with sufficient resources are ranked higher, and the client only needs to establish long connections sequentially according to the address list returned by the server. This method can largely achieve load balancing based on server resources, reducing the possibility of client failures in establishing long connections and improving server resource utilization. Furthermore, calculating the resource consumption of long connections allows for estimation of the resource consumption of each long connection based on known resource information, enabling more precise rate limiting control based on the number of accesses. Attached Figure Description

[0017] Figure 1 This is a flowchart of a routing request method according to an embodiment of the present invention;

[0018] Figure 2 This is a schematic diagram of a routing request terminal according to an embodiment of the present invention;

[0019] Figure 3 This is a schematic diagram of the structure of a routing request method according to an embodiment of the present invention;

[0020] Label Explanation:

[0021] 1. A routing request terminal; 2. A memory; 3. A processor. Detailed Implementation

[0022] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.

[0023] Please refer to Figure 1 This invention provides a routing request method, including the following steps:

[0024] Regularly monitor the remaining resource status of each connected application;

[0025] The weight value of each access application is calculated based on the remaining resources and resource usage weight of each access application. The weight values ​​of each access application are sorted in reverse order, and long links are established with the access applications according to the sorting order.

[0026] The resource usage of each access application is calculated based on the resource usage weight. The remaining number of access applications that can be connected is calculated based on the resource usage of the long connections. Rate limiting control is then implemented for the access applications based on the remaining number of access applications that can be connected.

[0027] As described above, the beneficial effects of this invention are as follows: It periodically monitors the remaining resource status of each access application, calculates and obtains weights for various resources of the access applications, and sorts them in reverse order according to the calculated weights. Applications with sufficient resources are ranked higher, and the client only needs to establish long connections sequentially according to the address list returned by the server. This method can largely achieve load balancing based on server resources, reducing the possibility of client failures in establishing long connections and improving server resource utilization. Furthermore, calculating the resource consumption of long connections allows for estimation of the resource consumption of each long connection based on known resource information, enabling more precise rate limiting control based on the number of accesses.

[0028] Furthermore, the remaining resource status of each access application includes the CPU utilization rate, memory utilization rate, bandwidth utilization rate, and access quantity utilization rate of the access application.

[0029] As described above, obtaining the CPU utilization, memory utilization, bandwidth utilization, and access quantity utilization of the access application facilitates subsequent weight calculation and rate limiting control of the access application.

[0030] Furthermore, calculating the weight value of each access application based on its remaining resources and resource usage weight includes:

[0031] Calculate the remaining resources of the accessed application by combining the actual resources of the accessed application with the monitored remaining resources.

[0032] The weight value of the accessed application is calculated by multiplying each remaining resource of the accessed application by its corresponding resource usage weight.

[0033] As described above, by calculating the weight value of the access application through the remaining resources and resource usage weight, the load balancing of routing requests can be carried out according to the resource situation, reducing the possibility of long connection establishment failure.

[0034] Furthermore, the step of calculating the long-connection resource consumption of each access application based on resource usage weight, and calculating the remaining number of access applications that can be connected based on the long-connection resource consumption, includes:

[0035] The resource consumption of long connections for each access application is calculated by combining the actual resources of the access application, the maximum number of accesses, and the resource usage weight.

[0036] The remaining number of accessible applications is calculated based on the remaining resources of the access applications and the resource usage of long-lived connections.

[0037] As described above, by calculating the resource consumption of long-lived connections and the remaining number of connections that can be connected, rate limiting can be implemented more accurately based on the number of connections.

[0038] Furthermore, after periodically monitoring the remaining resource status of each access application, the process includes:

[0039] The resource allocation of each access application is calculated through stress testing, including its CPU, memory, and bandwidth. Based on these resource allocations, a resource usage weight is obtained.

[0040] As described above, the resource usage weight can be dynamically adjusted according to the actual resource situation of the accessed application, which improves the accuracy of weight calculation and the precision of rate limiting control based on the number of accesses.

[0041] Please refer to Figure 2 Another embodiment of the present invention provides a routing request terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps:

[0042] Regularly monitor the remaining resource status of each connected application;

[0043] The weight value of each access application is calculated based on the remaining resources and resource usage weight of each access application. The weight values ​​of each access application are sorted in reverse order, and long links are established with the access applications according to the sorting order.

[0044] The resource usage of each access application is calculated based on the resource usage weight. The remaining number of access applications that can be connected is calculated based on the resource usage of the long connections. Rate limiting control is then implemented for the access applications based on the remaining number of access applications that can be connected.

[0045] As described above, the system periodically monitors the remaining resources of each access application, calculates and assigns weights to various resources of each application, and sorts them in reverse order based on these weights. Applications with sufficient resources are ranked higher. Clients only need to establish long connections sequentially according to the address list returned by the server. This method largely achieves load balancing based on server resources, reducing the possibility of client failures in establishing long connections and improving server resource utilization. Furthermore, calculating the resource consumption of long connections allows for estimation of the resource consumption of each long connection based on known resource information, enabling more precise rate limiting control based on the number of accesses.

[0046] Furthermore, the remaining resource status of each access application includes the CPU utilization rate, memory utilization rate, bandwidth utilization rate, and access quantity utilization rate of the access application.

[0047] As described above, obtaining the CPU utilization, memory utilization, bandwidth utilization, and access quantity utilization of the access application facilitates subsequent weight calculation and rate limiting control of the access application.

[0048] Furthermore, calculating the weight value of each access application based on its remaining resources and resource usage weight includes:

[0049] Calculate the remaining resources of the accessed application by combining the actual resources of the accessed application with the monitored remaining resources.

[0050] The weight value of the accessed application is calculated by multiplying each remaining resource of the accessed application by its corresponding resource usage weight.

[0051] As described above, by calculating the weight value of the access application through the remaining resources and resource usage weight, the load balancing of routing requests can be carried out according to the resource situation, reducing the possibility of long connection establishment failure.

[0052] Furthermore, the step of calculating the long-connection resource consumption of each access application based on resource usage weight, and calculating the remaining number of access applications that can be connected based on the long-connection resource consumption, includes:

[0053] The resource consumption of long connections for each access application is calculated by combining the actual resources of the access application, the maximum number of accesses, and the resource usage weight.

[0054] The remaining number of accessible applications is calculated based on the remaining resources of the access applications and the resource usage of long-lived connections.

[0055] As described above, by calculating the resource consumption of long-lived connections and the remaining number of connections that can be connected, rate limiting can be implemented more accurately based on the number of connections.

[0056] Furthermore, after periodically monitoring the remaining resource status of each access application, the process includes:

[0057] The resource allocation of each access application is calculated through stress testing, including its CPU, memory, and bandwidth. Based on these resource allocations, a resource usage weight is obtained.

[0058] As described above, the resource usage weight can be dynamically adjusted according to the actual resource situation of the accessed application, which improves the accuracy of weight calculation and the precision of rate limiting control based on the number of accesses.

[0059] The routing request method and terminal described above are applicable to reducing the possibility of client failure to establish long-term connections and improving server resource utilization when a client requests a routing address. The following is a detailed description of the implementation methods:

[0060] Example 1

[0061] Please refer to Figure 1 A method for routing requests, comprising the following steps:

[0062] S1. Periodically monitor the remaining resources of each access application.

[0063] In this embodiment, the access cluster includes access application A and access application B, which are deployed on different machines. A has a 4-core CPU and 8GB of memory (4C8G), and B has a 6-core CPU and 12GB of memory (6C12G).

[0064] For details, please refer to Figure 3 When a client requests the "Get Route Address List" interface from the routing cluster, the routing cluster retrieves the most recent monitoring data from the monitoring module. The monitoring module monitors the remaining resources of each machine in the cluster every 5 seconds, including CPU utilization, memory utilization, bandwidth utilization, and access quantity utilization.

[0065] In some embodiments, the resource ratio of CPU, memory, and bandwidth for each access application is calculated through stress testing, and the resource usage weight is obtained based on the resource ratio.

[0066] Specifically, for example, one machine has 4 cores and 8GB of DDR2 memory, and the resource ratio after stress testing is 1:2:2. Another machine also has 8GB of memory, but its memory is DDR4. In actual use, we can consider the resource ratio to be 1:3:2 because it uses a newer memory model, and the memory ratio should be higher. Subsequent calculations remain unchanged.

[0067] S2. Calculate the weight value of each access application based on the remaining resources and resource usage weight of each access application, sort the weight values ​​of each access application in reverse order, and establish long links with the access applications according to the sorting order.

[0068] Specifically, by combining the actual resources of the access application with the monitored remaining resources, the remaining resources of the access application are calculated. Each remaining resource of the access application is multiplied by its corresponding resource usage weight to obtain the weight value of the access application.

[0069] Specifically, in this embodiment, machine A has 40% remaining CPU, 60% remaining memory, and 50% remaining network IO (bandwidth). For a 4C8G machine, the weight of this machine is: 400%*40%+800%*60%*2+50%*2. Each machine where the access application is located calculates its weight value according to the same rules and sorts it in reverse order. The client only needs to establish long connections in the order of the returned address list.

[0070] Therefore, in some embodiments, there are situations where multiple applications can be deployed on a single machine.

[0071] S3. Calculate the long-connection resource usage of each access application based on the resource usage weight, calculate the remaining number of access applications based on the long-connection resource usage, and perform rate limiting control on the access applications based on the remaining number of access applications.

[0072] Specifically, stress testing can preliminarily determine the maximum access limit for a single application under certain machine conditions. For example, if application A (4 cores, 8GB RAM) has a maximum access limit of 50,000, let's assume that when the maximum access limit is reached, it uses all resources (4 cores, 8GB RAM, plus 100% I / O).

[0073] Therefore, the approximate resource consumption X of a long link can be calculated as: 50000*X=400%+800%*2+100%*2, and the value of X is: 0.00044.

[0074] Based on the real-time monitoring of remaining resources, the remaining number of applications that can be connected can be calculated in real time.

[0075] In this embodiment, when a machine has 4 cores and 10GB of memory, the total resources of the machine can be calculated using the formula: 400%*1+1000%*2+100%*2. Dividing the total resources by X represents the maximum number of connections the machine can handle. After deducting the actual number of connections already made, the remaining number of connections that can be made is obtained.

[0076] The number of accesses in existing access instances is actually an estimated value. The estimated value, which is based on the data provided by fixed stress testing, is not particularly accurate. However, in this embodiment, a more accurate value can be calculated based on specific resource feedback, enabling more precise rate limiting control based on the number of accesses.

[0077] The calculation of the remaining number of available connections has two aspects: First, after the monitoring system has already monitored and counted the remaining number of available connections, the routing module will obtain this remaining number of available connections from the monitoring system, thus excluding machines with 0 or a small number of available connections before the long connection is established, thereby restricting client access.

[0078] Secondly, during the establishment of long connections, the remaining number of available connections will be checked again to see if it is 0 or has not reached the preset value. If so, client access will be prohibited.

[0079] Example 2

[0080] Please refer to Figure 2 A routing request terminal 1 includes a memory 2, a processor 3, and a computer program stored on the memory 2 and executable on the processor 3. When the processor 3 executes the computer program, it implements the various steps of a routing request method according to Embodiment 1.

[0081] In summary, the routing request method and terminal provided by this invention periodically monitor the remaining resource status of each access application, calculates and obtains weights for various resources of the access applications, and sorts them in reverse order according to the calculated weights. Applications with sufficient resources are ranked higher. The client only needs to establish long connections in the order of the address list returned by the server. The remaining resource status includes the CPU utilization, memory utilization, bandwidth utilization, and access quantity utilization of the access applications. Through stress testing, the resource ratio of CPU, memory, and bandwidth for each access application is calculated, and the resource usage weight is obtained based on the resource ratio. This allows for dynamic configuration of corresponding resource usage weights for different access applications, improving the accuracy of subsequent calculations of the remaining number of long connections that can be established. This method can largely achieve load balancing based on server resources, reducing the possibility of client failures in establishing long connections and improving server resource utilization. Calculating the resource consumption of long connections allows for estimation of the resource consumption of each long connection based on known resource information, enabling more precise rate limiting control based on the number of accesses.

[0082] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A routing request method, characterized in that, Including the following steps: Regularly monitor the remaining resource status of each connected application; The weight value of each access application is calculated based on the remaining resources and resource usage weight of each access application. The weight values ​​of each access application are sorted in reverse order, and long links are established with the access applications according to the sorting order. The resource consumption of long-lived connections for each access application is calculated based on resource usage weights. The remaining number of accessable applications is then calculated based on the resource consumption of long-lived connections. Rate limiting control for accessable applications is then implemented based on the remaining number of accessable applications, including: The resource consumption of long connections for each access application is calculated by combining the actual resources of the access application, the maximum number of accesses, and the resource usage weight. Calculate the remaining number of applications that can be connected based on the remaining resources of the connected applications and the resource usage of long-lived connections. The remaining resource status of each access application includes the CPU utilization rate, memory utilization rate, bandwidth utilization rate, and access quantity utilization rate of the access application. After periodically monitoring the remaining resource status of each access application, the following steps are included: The resource ratio of CPU, memory and bandwidth for each access application is calculated through stress testing, and the resource usage weight is obtained based on the resource ratio. The remaining number of available connections can be calculated. After the monitoring system has already monitored and counted the remaining number of available connections, the routing module will obtain this remaining number of available connections from the monitoring system. Before the long connection is established, machines with a remaining number of 0 or a small number of available connections will be excluded, thus restricting client access. During the establishment of long-lived connections, the system will again check whether the remaining number of available connections is 0 or has not reached the preset value. If so, client access will be prohibited.

2. The routing request method according to claim 1, characterized in that, The weight value of each access application is calculated based on its remaining resources and resource usage weight, including: Calculate the remaining resources of the accessed application by combining the actual resources of the accessed application with the monitored remaining resources. The weight value of the accessed application is calculated by multiplying each remaining resource of the accessed application by its corresponding resource usage weight.

3. A routing request terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it performs the following steps: Regularly monitor the remaining resource status of each connected application; The weight value of each access application is calculated based on the remaining resources and resource usage weight of each access application. The weight values ​​of each access application are sorted in reverse order, and long links are established with the access applications according to the sorting order. The resource consumption of long-lived connections for each access application is calculated based on resource usage weights. The remaining number of accessable applications is then calculated based on the resource consumption of long-lived connections. Rate limiting control for accessable applications is then implemented based on the remaining number of accessable applications, including: The resource consumption of long connections for each access application is calculated by combining the actual resources of the access application, the maximum number of accesses, and the resource usage weight. Calculate the remaining number of accessible applications based on the remaining resources of the access applications and the resource usage of long-lived connections. The remaining resource status of each access application includes the CPU utilization rate, memory utilization rate, bandwidth utilization rate, and access quantity utilization rate of the access application. After periodically monitoring the remaining resource status of each access application, the following steps are included: The resource ratio of CPU, memory and bandwidth for each access application is calculated through stress testing, and the resource usage weight is obtained based on the resource ratio. The remaining number of available connections can be calculated. After the monitoring system has already monitored and counted the remaining number of available connections, the routing module will obtain this remaining number of available connections from the monitoring system. Before the long connection is established, machines with a remaining number of 0 or a small number of available connections will be excluded, thus restricting client access. During the establishment of long-lived connections, the system will again check whether the remaining number of available connections is 0 or has not reached the preset value. If so, client access will be prohibited.

4. A routing request terminal according to claim 3, characterized in that, The weight value of each access application is calculated based on its remaining resources and resource usage weight, including: Calculate the remaining resources of the accessed application by combining the actual resources of the accessed application with the monitored remaining resources. The weight value of the accessed application is calculated by multiplying each remaining resource of the accessed application by its corresponding resource usage weight.

Citation Information

Patent Citations

  • Method for improving pushing efficiency and storage medium

    CN111106994A

  • TCP communication method, system and device

    CN112583895A