Load balancing system based on long connection traffic and bandwidth dynamic perception

By constructing a load balancing system based on dynamic perception of long-connection traffic and bandwidth, and dynamically monitoring and analyzing bandwidth data, the problem of inaccurate perception of bandwidth load in existing technologies is solved, thereby improving system stability and data continuity.

CN121334063BActive Publication Date: 2026-02-27KYLIN CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511905910.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-02-27
Estimated Expiration
2045-12-17

AI Technical Summary

Technical Problem

Existing load balancing technologies cannot accurately perceive the real-time bandwidth load of the server and the traffic characteristics of long-term agent connections, leading to initial unevenness, overload triggering, cascading failures and system avalanches, which seriously affect the availability and data integrity of large-scale distributed data acquisition systems.

Method used

A load balancing system based on dynamic awareness of long-connection traffic and bandwidth is constructed. Through the Agent layer, Server layer, scheduling layer and time-series database, bandwidth data is monitored and analyzed in real time, load benchmarks are dynamically calculated, preventive scheduling is performed, and the connection mapping between Agent and Server is adjusted.

Benefits of technology

It enables intervention before system overload, avoids cascading failures, ensures load balancing, improves system stability and data continuity, and enhances resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121334063B_ABST
    Figure CN121334063B_ABST
Patent Text Reader

Abstract

The application relates to a load balancing system based on long connection flow and bandwidth dynamic perception, which comprises an Agent layer, a Server layer, a scheduling layer and a time sequence database connected in sequence, the Server layer comprises multiple servers, the Agent layer comprises multiple agents, each agent is connected with a server of the Server layer; the agent sends real-time bandwidth data to the server every first predetermined period, and the server transmits the real-time bandwidth data to the time sequence database for storage; the scheduling layer acquires the bandwidth data of all the agents of the Agent layer in a past third predetermined period from the time sequence database every second predetermined period, and completes resource scheduling of the agents on the servers. Through dynamic perception and preventive scheduling, the application can intervene before serious overload of the system occurs, and fundamentally avoids the occurrence of chain failures.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of load balancing, and particularly relates to a load balancing system based on dynamic perception of long connection traffic and bandwidth. BACKGROUND

[0002] In a large-scale distributed data collection system (such as an observability system), a large number of TCP long connections need to be maintained between data reporting ends (Agents) and data processing ends (Servers) to continuously upload data. Existing load balancing technologies mostly use static or simple dynamic strategies (such as round robin, random) for initial connection allocation.

[0003] The fundamental defect of the prior art is that the real-time bandwidth load of the Server and the traffic characteristics of the Agent long connection cannot be accurately perceived. This results in "blind" scheduling decisions, thereby causing a fatal "snowball effect":

[0004] Initial unevenness: Due to lack of perception, new Agents may be continuously allocated to Servers that are already highly loaded.

[0005] Overload triggering: The bandwidth resources of the over-allocated Server are rapidly depleted, and the performance is rapidly degraded.

[0006] Chain failure: The overloaded Server goes down, and the Agent set it hosts collectively disconnects and reconnects to other Servers, transferring the pressure to healthy nodes.

[0007] System avalanche: The above process is viciously cyclic, ultimately leading to large-scale interruption of the entire data collection link, severely damaging the availability and data integrity of the platform. SUMMARY

[0008] To solve the deficiencies of the existing technology, the present application provides a load balancing system based on dynamic perception of long connection traffic and bandwidth, which comprises an Agent layer, a Server layer, a scheduling layer and a time series database connected in turn, the Server layer is connected with the scheduling layer in information,

[0009] The Server layer comprises a plurality of Servers, each Server comprises a control module and a data module connected with each other, and the control module and the data module of each Server are deployed in the same Pod;

[0010] The Agent layer is deployed on a data collection end of a Kubernetes node and comprises a plurality of Agents, each Agent is connected with a Server of the Server layer;

[0011] Each Agent sends its real-time bandwidth data to the control module of the connected Server every first predetermined period, and the control module transmits the real-time bandwidth data to the time series database through the data module for storage;

[0012] The scheduling layer acquires the bandwidth data of all Agents of the Agent layer in the past third predetermined period from the time series database every second predetermined period, and based on the bandwidth data of all Agents of the Agent layer in the past third predetermined period, issues scheduling instructions to the control module on the corresponding Server in the Server layer to complete the resource scheduling of the Agents on the Server.

[0013] The time series database is selected from a Clickhouse database.

[0014] The real-time bandwidth data sent by each Agent to the control module of the connected Server every first predetermined period includes Agent ID, time stamp and sending bandwidth value.

[0015] The third predetermined period is greater than the second predetermined period, and the second predetermined period is greater than the first predetermined period.

[0016] After the scheduling layer acquires the bandwidth data of all Agents of the Agent layer in the past third predetermined period, the resource scheduling of the Agents on the Server is completed by the following method:

[0017] Step S1: calculating total bandwidth and Server average receiving bandwidth;

[0018] Step S2: determining overloaded Servers and idle Servers based on the Server average receiving bandwidth and the real-time receiving bandwidth of each Server;

[0019] Step S3: taking a number of Agents from each overloaded Server to form an Agent queue;

[0020] Step S4: forming an idle Server queue with idle Servers;

[0021] Step S5: scheduling the Agents in the Agent queue to the Servers in the idle Server queue one by one, so that the real-time receiving bandwidth of each Server tends to the Server average receiving bandwidth.

[0022] In the step S1, the Server average receiving bandwidth = total bandwidth / Server number.

[0023] The step S2, the real-time receiving bandwidth of the Server is greater than or equal to the average receiving bandwidth of the Server, and the real-time receiving bandwidth of the Server is less than the average receiving bandwidth of the Server.

[0024] The step S3, the Agent is removed from the overloaded Server in the order from small to large until the sum of the real-time sending bandwidth of the removed Agent is greater than or equal to the difference value, the difference value = the real-time receiving bandwidth of the overloaded Server - the average receiving bandwidth of the Server.

[0025] The Agent in the Agent queue is arranged in the order from small to large according to the sending bandwidth value, and the Server in the idle Server queue is arranged in the order from small to large according to the real-time receiving bandwidth.

[0026] The step S5 includes:

[0027] The step S51, an Agent is taken out from the Agent queue in order as a target Agent.

[0028] The step S52, a Server is taken out from the idle Server queue in order as a target Server, and it is judged whether the real-time receiving bandwidth of the target Server is greater than or equal to the average receiving bandwidth of the Server.

[0029] If not, the target Agent is dispatched to the target Server.

[0030] If yes, the next Server is taken out from the Server queue in order as a target Server, and it is judged again whether the real-time receiving bandwidth of the target Server is greater than or equal to the average receiving bandwidth of the Server until the target Server with the real-time receiving bandwidth less than the average receiving bandwidth of the Server appears.

[0031] The step S53, the target Agent is dispatched to the target Server, and the real-time receiving bandwidth of the target Server is updated.

[0032] The step S54, the step S51 is re-executed until all the Agents in the Agent queue are dispatched.

[0033] The step S52, if the real-time receiving bandwidth of all the Servers in the idle Server queue is greater than or equal to the average receiving bandwidth of the Server, the Server with the minimum real-time receiving bandwidth is selected from all the Servers as a target Server.

[0034] The application can intervene before the system appears serious overload through dynamic perception and preventive scheduling, and fundamentally avoids the occurrence of chain failure. BRIEF DESCRIPTION OF DRAWINGS

[0035] Figure 1 A logic architecture diagram of the load balancing system based on long connection traffic and bandwidth dynamic perception of the application. DETAILED DESCRIPTION

[0036] In order to have a further understanding of the technical solutions and beneficial effects of the application, the technical solutions and the beneficial effects thereof will be described in detail below with reference to the drawings.

[0037] In order to solve the problem of uneven load and "snowball effect" caused by the inability to dynamically perceive the bandwidth load of the Server and the traffic characteristics of the Agent in the prior art, and improve the stability of large-scale long connection systems, the core of the application is to build a closed-loop control system of "data perception-intelligent decision-connection regulation". Through real-time and historical bandwidth data, the system load benchmark is dynamically calculated, and the connection mapping between the Agent and the Server is intelligently and preventively adjusted, so as to prevent the occurrence of "snowball effect" from the source.

[0038] Figure 1 A logic architecture diagram of the load balancing system based on long connection traffic and bandwidth dynamic perception of the application, as shown in Figure 1 The application includes an Agent layer, a Server layer, a scheduling layer and a time series database connected in sequence, the Server layer is connected with the scheduling layer in information at the same time,

[0039] The Server layer includes a plurality of Servers, each Server includes a control module and a data module connected with each other, and the control module and the data module of each Server are deployed in the same Pod;

[0040] The Agent layer is deployed on a data acquisition end of a Kubernetes node and includes a plurality of Agents, each Agent establishes a TCP long connection with a Server of the Server layer, continuously uploads real-time bandwidth data, and the data includes an Agent ID, a timestamp and a sending bandwidth;

[0041] Each Agent sends its real-time bandwidth data to the control module of the connected Server every first predetermined period, the control module processes the Agent connection, and the real-time bandwidth data of the Agent is transmitted to the time series database for storage through the data module;

[0042] The time series database uses ClickHouse to store historical bandwidth data, supports high-performance queries and analysis, and can quickly calculate the total and average bandwidth of the past 24 hours;

[0043] The scheduling layer obtains the bandwidth data of all Agents in the Agent layer from the time series database every second predetermined period (e.g., once every hour) within a third predetermined period (e.g., within the past 24 hours), and based on the bandwidth data of all Agents in the Agent layer within the third predetermined period, executes a load balancing algorithm to generate scheduling instructions and issue the scheduling instructions to the control module on the corresponding Server in the Server layer, completing the resource scheduling of Agents on the Server.

[0044] An example of the data structure stored by ClickHouse is as follows:

[0045] ```sql

[0046] CREATE TABLE bandwidth_data (

[0047] agent_id String,

[0048] timestamp DateTime,

[0049] bandwidth_mbps Float64

[0050] ) ENGINE = MergeTree() ORDER BY (agent_id, timestamp)。

[0051] The scheduling layer executes scheduling once every hour, and the execution logic of each scheduling is as follows:

[0052] 1. Calculate the total bandwidth (SUM), the average bandwidth of Agents (total bandwidth / number of Agents), and the average received bandwidth of Servers (total bandwidth / number of Servers).

[0053] - Example calculation:

[0054] - Assuming 300 Agents and a total bandwidth of 3000 MB / s, the average bandwidth of Agents is 10 MB / s.

[0055] - Assuming 5 Servers, the average received bandwidth of Servers is 600 MB / s.

[0056] 2. Identify idle Servers, overloaded Servers, and unload overloaded Servers.

[0057] For each Server, calculate its current real-time receiving bandwidth (i.e. the sum of bandwidths of its Agents).

[0058] If the current real-time receiving bandwidth of the Server > the average receiving bandwidth of the Server, mark it as an overload Server. If the current real-time receiving bandwidth of the Server < the average receiving bandwidth of the Server, mark it as an idle Server.

[0059] The excess bandwidth of the idle Server = the current real-time receiving bandwidth - the average receiving bandwidth of the Server.

[0060] 3. For each overload Server, take out a number of Agents from it to form an Agent queue.

[0061] Specifically, sort the Agents on the overload Server by sending bandwidth from small to large, and select some Agents to move into the Agent queue until the overload bandwidth is covered.

[0062] Example: the current receiving bandwidth of Server S1 is 800 MB / s, the average value is 600 MB / s, and the excess bandwidth is 200 MB / s. Move out the Agents with smaller bandwidth (such as 10 MB / s Agents) on it until the total bandwidth removed ≥ 200 MB / s.

[0063] Specifically, arrange the Agents in the Agent queue in ascending order of sending bandwidth value.

[0064] 4. Form an idle Server queue from the idle Servers, and specifically arrange the idle Server queue in ascending order of real-time receiving bandwidth.

[0065] 5. Schedule the Agents in the Agent queue to the Servers in the idle Server queue one by one, so that the real-time receiving bandwidth of each Server tends to the average receiving bandwidth of the Server, which specifically includes:

[0066] (1) Take out an Agent from the Agent queue as a target Agent in order;

[0067] (2) Take out a Server from the idle Server queue as a target Server in order, and judge whether its real-time receiving bandwidth is greater than or equal to the average receiving bandwidth of the Server:

[0068] If not, generate a scheduling instruction to schedule the target Agent to the target Server;

[0069] If yes, the next server in the server queue is taken as the target server in order, and it is judged again whether the real-time receiving bandwidth is greater than or equal to the server average receiving bandwidth until the target server with a real-time receiving bandwidth less than the server average receiving bandwidth appears;

[0070] If the real-time receiving bandwidth of all servers in the idle server queue is greater than or equal to the server average receiving bandwidth, the server with the minimum real-time receiving bandwidth is selected from all servers as the target server.

[0071] The format of the scheduling instruction is (Agent_ID, Target_Server_IP)`, and the instruction is issued to the target agent through the control module of the target server. After receiving the instruction, the target agent actively establishes a TCP long connection with the target server, and closes the old connection after the new connection is successfully established, thereby realizing smooth switching.

[0072] - Scheduling result example: `{agent1: server1, agent2: server2,...}`.

[0073] (3) The target agent is scheduled to the target server, and the real-time receiving bandwidth of the target server is updated;

[0074] (4) Steps (1) to (3) are re-executed until all agents in the agent queue are scheduled.

[0075] The present application can realize the following technical effects:

[0076] Eliminate the "snowball effect": through dynamic perception and preventive scheduling, intervention is carried out before the system appears serious overload, which fundamentally avoids the occurrence of chain failure.

[0077] Realize accurate load balancing: based on real and historical bandwidth data rather than simple connection number for decision making, the load distribution is more scientific, and the resource utilization rate is significantly improved.

[0078] Guarantee system stability and data continuity: the "small flow priority migration" strategy maximally reduces the interference of the scheduling process on data flow, and ensures the high availability of service and the integrity of data without loss.

[0079] Have foresight and expansibility: use historical data for trend analysis, so that the system has a certain load prediction ability and can automatically adapt to the change of cluster size.

[0080] Although the present application has been described with reference to the preferred embodiments thereof, it is to be understood that the application is not limited to the details described herein and that various modifications and changes can be made without departing from the spirit and scope of the present application. It is therefore desired that what is claimed be what the application is intended to cover.

Claims

1. A load balancing system based on long connection traffic and bandwidth dynamic perception, characterized in that: The system comprises an Agent layer, a Server layer, a scheduling layer and a time series database connected in sequence, the Server layer is connected with the scheduling layer in information, The Server layer comprises a plurality of Servers, each Server comprises a control module and a data module connected with each other, and the control module and the data module of each Server are arranged in a same Pod; The Agent layer is arranged on a data collection end of a Kubernetes node and comprises a plurality of Agents, each Agent is connected with a Server of the Server layer; Each Agent sends real-time bandwidth data to the control module of the connected Server every first predetermined period, and the control module transmits the real-time bandwidth data to the time series database for storage through the data module; The scheduling layer acquires bandwidth data of all Agents of the Agent layer in a past third predetermined period from the time series database every second predetermined period, and based on the bandwidth data of all Agents of the Agent layer in the past third predetermined period, the scheduling layer sends a scheduling instruction to the control module of a corresponding Server in the Server layer, and the resource scheduling of the Agents on the Server is completed by the following method: Step S1: calculating total bandwidth and Server average receiving bandwidth; Step S2: determining overload Servers and idle Servers based on the Server average receiving bandwidth and real-time receiving bandwidth of each Server; Step S3: for each overload Server, a plurality of Agents are taken out from the overload Server to form an Agent queue; Step S4: forming an idle Server queue by using the idle Servers; Step S5: scheduling the Agents in the Agent queue to the Servers in the idle Server queue in sequence, so that the real-time receiving bandwidth of each Server tends to the Server average receiving bandwidth.

2. The load balancing system based on long connection traffic and bandwidth dynamic perception of claim 1, wherein: The time series database is selected from a Clickhouse database.

3. The load balancing system based on long connection traffic and bandwidth dynamic perception of claim 1, wherein: The real-time bandwidth data sent by each Agent to the control module of the connected Server every first predetermined period comprises an Agent ID, a timestamp and a sending bandwidth value.

4. The load balancing system based on long connection traffic and bandwidth dynamic perception of claim 1, wherein: The third predetermined period is greater than the second predetermined period, and the second predetermined period is greater than the first predetermined period.

5. The load balancing system based on long connection traffic and bandwidth dynamic perception according to claim 1, wherein: In the step S1, the Server average receiving bandwidth = total bandwidth / Server number; In the step S2, the Servers with real-time receiving bandwidth greater than or equal to the Server average receiving bandwidth are determined as overload Servers, and the Servers with real-time receiving bandwidth less than the Server average receiving bandwidth are determined as idle Servers.

6. The load balancing system based on long connection traffic and bandwidth dynamic perception of claim 1, wherein: In step S3, several Agents are taken out from the overload Server in order from small to large, until the total of real-time sending bandwidth of removed Agents is greater than or equal to the difference, the difference = real-time receiving bandwidth of the overload Server - average receiving bandwidth of the Server.

7. The load balancing system based on long connection traffic and bandwidth dynamic perception of claim 1, wherein: In the Agent queue, Agents are arranged in order from small to large according to sending bandwidth values; in the idle Server queue, Servers are arranged in order from small to large according to real-time receiving bandwidth.

8. The load balancing system based on long connection traffic and bandwidth dynamic perception of claim 1, wherein: The step S5 comprises: Step S51: taking out an Agent from the Agent queue in order as a target Agent; Step S52: taking out a Server from the idle Server queue in order as a target Server, and judging whether the real-time receiving bandwidth of the target Server is greater than or equal to the average receiving bandwidth of the Server: If not, the target Agent is dispatched to the target Server; If yes, the next Server is taken out from the Server queue in order as a target Server, and the real-time receiving bandwidth of the target Server is again judged whether it is greater than or equal to the average receiving bandwidth of the Server, until the target Server whose real-time receiving bandwidth is less than the average receiving bandwidth of the Server appears; Step S53: dispatching the target Agent to the target Server, and updating the real-time receiving bandwidth of the target Server; Step S54: re-executing step S51 until all Agents in the Agent queue are dispatched.

9. The load balancing system based on long connection traffic and bandwidth dynamic perception of claim 8, wherein: In step S52, if the real-time receiving bandwidth of all Servers in the idle Server queue is greater than or equal to the average receiving bandwidth of the Server, the Server with the smallest real-time receiving bandwidth is selected from all Servers as the target Server.

Citation Information

Patent Citations

  • Load balancing method with combination of random sampling and virtualization technology

    CN103944997A

  • Kubernetes based capacitor cloud configuration and interaction method among modules of cloud configuration

    CN106888254A