Load balancing method and device based on lockless session

By using client ports in load balancing devices to achieve lock-free session tables, the performance degradation caused by different CPUs processing packet requests is solved, and the fullNAT and transmissive scenarios are supported at the same time, improving device performance and flexibility.

CN119766816AActive Publication Date: 2025-04-04TMLAKE (BEIJING) TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411587812.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-04-04
Estimated Expiration
2044-11-08

AI Technical Summary

Technical Problem

The prior art requires lock protection when processing packet processing requests from different CPUs, resulting in reduced device performance and difficult to meet the needs of FullNAT and transmissive scenarios at the same time.

Method used

By using the client port to ensure lock-free session tables, client requests and application server requests are data forwarded through the same worker thread and the same session, ensuring that data packets are forwarded to the same CPU.

Benefits of technology

It realizes lock-free sessions, reduces lock overhead, improves server load balancing performance and deployment flexibility, and can meet the application needs of FullNAT and transmissive scenarios at the same time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119766816A_ABST
    Figure CN119766816A_ABST
Patent Text Reader

Abstract

The invention discloses a load balancing method and device based on a lockless session. The method comprises the following steps: initializing a port; receiving a data packet processing request in real time on the basis of a scene type, determining the source port and the destination port as well as the quoted times of the source port and the quoted times of the destination port according to the data packet processing request, and determining the quoted times of the source port and the quoted times of the destination port on the basis of the quoted times of the source port and the quoted times of the destination port. Determining a target working thread for processing the data packet processing request from the working threads according to a working thread matching formula and the number of the working threads; and based on the target working thread, creating a request processing session according to the source port, the destination port and the session table, and forwarding a data packet corresponding to the data processing request by using the request processing session. By applying the technical scheme of the invention, the lock overhead is reduced, and the load balancing performance and the deployment flexibility of the server are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and more specifically, to a load balancing method and device based on lock-free sessions. Background Art

[0002] In the era of the rapid development of the Internet and the Internet of Things, server load balancing equipment plays the role of traffic entry, so it needs to have high performance, high reliability and high scalability. Server load balancing equipment is usually divided into four-layer load balancing and seven-layer load balancing according to the working level. The four-layer load balancing works at the transport layer, and the seven-layer load balancing works at the application layer. Whether it is a four-layer load balancing or a seven-layer load balancing, it is necessary to reliably and quickly forward user requests to the back-end application server.

[0003] Common forwarding modes include transparent mode and FullNAT (Full network address translation, which refers to doing SNAT and DNAT at the same time, where SNAT is the abbreviation of Source network address translation, and DNAT is the abbreviation of Destionation network address translation). The transparent mode does not modify the source address of the data packet, but only modifies the destination IP address / destination port of the data packet to the IP address / service port of the application server. This mode can preserve the source IP address of the client, but requires the server load balancing device to exist in the form of a gateway, otherwise the response packet of the application server cannot reach the client normally. For the FullNAT mode, the server load balancing device will modify the source IP address / source port and destination IP address / destination port of the client's request data packet. This forwarding mode has low requirements on the network environment (the server load balancing device does not need to exist in the form of a gateway), but the client IP information will be lost.

[0004] The session is used to record how the data packets on each connection are forwarded, usually including the five-tuple information of the client and application server, protocol type, source IP, destination IP, source port, destination port, and the session table is the core data structure of the load balancing product. Here we mainly focus on how to establish an efficient session table and how to adapt to both transparent transmission and FullNAT scenarios.

[0005] Xinchuang load balancing refers to load balancing products that use domestic CPUs and domestic operating systems. For domestic CPUs, we use the Haiguang 7380 CPU, which has 4 NUMA nodes and 8 cores on each NUMA node. NUMA is a memory architecture design used in multi-processor systems, especially high-performance computing and server platforms. In the NUMA architecture, each CPU core has its own local memory. When a core needs to access the local memory of other CPUs, a higher latency will be generated. This access is called remote memory access. Relatively speaking, the latency of accessing one's own local memory is lower, which is called local memory access.

[0006] In a multi-core system, we usually split the session table to each working CPU, so that the data packets on each session will be processed on a fixed CPU, thus avoiding the loss caused by cross-CPU or NUMA. The existing technology generally uses the RSS mechanism of the network card, which is a network card diversion technology that aims to improve network performance by distributing data packets to multiple receiving queues.

[0007] However, this RSS split is only applicable to the FullNAT forwarding mode, because it ensures that RSS(cip,vip,cport,vport)==RSS(rip,snat_ip,rport,snat_port) by selecting the appropriate source network address translation IP address SNAT_IP / source network address translation port SNAT_port, so that both the request data packet and the response data packet can reach the same queue of the network card, and thus reach the same CPU. If the corresponding session is on the CPU, then the data packet can be quickly forwarded and processed according to the session. (Among them, RSS is Receive Side Scaling; cip is Client IP address; vip is Virtual IP address; cport is Client port; vport is Virtual port; rip is Real server IPaddress; snat_ip is Source Network Address Translation IP address; rport is Real serverport; snat_port is Source Network Address Translation port.)

[0008] At present, Xinchuang load balancing products need to adapt to both FullNAT scenarios and transparent transmission scenarios. That is, when forwarding client data packets to application servers, only VIP / Vport is changed to RIP / Rport. At this time, according to the RSS diversion algorithm, the request data packet from the client will be allocated to the RSS (cip, vip, cport, vport) CPU, and the response data packet from the application server will be allocated to the RSS (rip, cip, rport, cport) CPU. In most cases, these two values ​​are not equal, which means that the data stream from the client and the response data stream from the application server need to be processed on different CPUs. The two CPUs need to be locked when accessing the same public data structure, which seriously reduces the processing performance of the device.

[0009] Based on this, it is necessary to introduce a new method and device to ensure a lock-free session table by using the client port and to meet the requirements of the FullNAT scenario and the transparent transmission scenario at the same time. Summary of the invention

[0010] In response to the technical problems mentioned above, the present invention provides a load balancing method and device based on lock-free sessions. Based on the defined source port, destination port, working thread and session table, the lock-free session table is guaranteed by using the client port. The client request and the application server request are forwarded and processed through the same working thread and the same session, and the corresponding data packets are forwarded to the same CPU, which solves the technical problems existing in the prior art that different CPUs process data packet processing requests, resulting in lock protection and reduced device performance. It not only meets the application requirements of FullNAT scenarios and transparent transmission scenarios at the same time, but also ensures that each working thread has its own independent session table, and does not need to access other session tables across CPUs or NUMA (non-uniform memory access), thereby realizing lock-free sessions, thereby reducing lock overhead, improving the performance of server load balancing and the flexibility of deployment.

[0011] The present invention provides a load balancing method based on lock-free sessions, the method comprising:

[0012] S1, port initialization: Based on the server load balancing device, the source port, the destination port and the working thread are initialized, and the number of times the source port and the destination port are referenced by the virtual port or the application server port is counted in real time according to the user-side configuration, and a session table is constructed according to the five-tuple data structure and the session, and the number of working threads of the working thread is counted;

[0013] S2, responding to a data processing request: receiving a data packet processing request in real time based on a scenario type, determining the source port and the destination port, as well as the number of times the source port is referenced and the number of times the destination port is referenced according to the data packet processing request, and determining a target working thread for processing the data packet processing request from the working threads based on the number of times the source port is referenced and the number of times the destination port is referenced, as well as a working thread matching formula and the number of working threads;

[0014] S3, data packet forwarding: based on the target working thread, creating a request processing session according to the source port, the destination port and the session table, and using the request processing session to forward the data packet corresponding to the data processing request;

[0015] Among them, the five-tuple data structure includes the source IP address, source port, destination IP address, destination port and transport layer protocol, and the five-tuple data structure in the session table has a one-to-one correspondence with the session; the number of the working thread and the session also have a one-to-one correspondence; the scenario types include: transparent transmission scenario and complete network address translation scenario; the data packet processing request includes: client request and application server request.

[0016] Preferably, the step S1 includes:

[0017] S11, based on the server load balancing device, defining a source port reference count array and a destination port reference count array respectively;

[0018] S12, respectively configuring the source port and the destination port of the server load balancing device according to the client configuration, and setting the initial value of the number of times the source port of the server load balancing device is referenced and the initial value of the number of times the destination port is referenced to zero based on the source port reference count array and the destination port reference count array, and then initializing the number of times the source port of the server load balancing device is referenced and the number of times the destination port is referenced according to the configuration information of the virtual port and the application server port;

[0019] S13, based on the server load balancing device and the working CPU, and the five-tuple data structure, construct the session table, initialize the working thread, add numbers to the working threads, and count the number of working threads of the working thread; wherein one working thread corresponds to one working CPU.

[0020] Preferably, the step of S2 includes the step of client request processing, specifically:

[0021] When the scenario type is a transparent transmission scenario or a complete network address translation scenario, and the data packet processing request is a client request,

[0022] S211, receiving a client request based on a server load balancing device, and according to the client request, obtaining a client port and a virtual port corresponding to the client request, and determining the source port and the destination port, wherein the source port is the client port corresponding to the client request, and the destination port is the virtual port corresponding to the client request;

[0023] S212, obtaining and determining the value of the source port and the value of the destination port according to the number of times the client port corresponding to the client request and the number of times the virtual port is referenced;

[0024] S213, according to the value of the source port, the value of the destination port and the number of the working threads of the working thread, use the working thread matching formula to calculate and obtain the number of the target working thread for processing the data packet processing request.

[0025] Preferably, the step of S2 also includes the step of applying the server-side request processing in the transparent transmission scenario, specifically:

[0026] When the scenario type is a transparent transmission scenario and the data packet processing request is an application server-side request, S221, based on the server load balancing device, receives the application server-side request, and according to the transparent transmission scenario and the application server-side request, obtains the application server port and the client port corresponding to the application server-side request, and determines the source port and the destination port, wherein the source port is the application server port corresponding to the application server-side request, and the client port corresponding to the application server-side request; S222, obtains and determines the value of the source port and the value of the destination port according to the number of times the application server port corresponding to the application server-side request is referenced, and the number of times the client port is referenced; S223, according to the value of the source port, the value of the destination port and the number of working threads of the working thread, uses the working thread matching formula to calculate and obtain the number of the target working thread that processes the data packet processing request.

[0027] Preferably, the step S2 also includes the step of applying server-side request processing in a complete network address translation scenario, specifically:

[0028] When the scenario type is a complete network address translation scenario and the data packet processing request is an application server-side request, S221, based on the server load balancing device, receives the application server-side request, and according to the complete network address translation scenario and the application server-side request, obtains the application server port and the source network address translation port corresponding to the application server-side request, and determines the source port and the destination port, wherein the source port is the application server port corresponding to the application server-side request and the source network address translation port corresponding to the application server-side request; S222, obtains and determines the value of the source port and the value of the destination port according to the number of references of the application server port corresponding to the application server-side request and the number of references of the source network address translation port; S223, according to the value of the source port, the value of the destination port and the number of working threads of the working thread, uses the working thread matching formula to calculate and obtain the number of the target working thread that processes the data packet processing request.

[0029] Preferably, in step S2, the step of determining a target working thread for processing the data packet processing request from the working threads based on the number of times the source port is referenced and the number of times the destination port is referenced, as well as a working thread matching formula and the number of working threads is specifically:

[0030] 1) Determine the value of the source port and the value of the destination port according to the number of times the source port is cited and the number of times the destination port is cited, wherein:

[0031] If the number of times the source port is cited is equal to zero, recording the source port;

[0032] If the number of times the source port is cited is greater than zero, the source port is recorded as zero;

[0033] If the number of times the destination port is cited is zero, recording the destination port;

[0034] If the number of times the destination port is cited is greater than zero, the destination port is recorded as zero;

[0035] 2) according to the value of the source port, the value of the destination port and the number of the working threads of the working thread, the number of the target working thread for processing the data packet processing request is calculated using the working thread matching formula; wherein,

[0036] The working thread matching formula is: N = #$%un( S"#$% +$%un( V"#$% )%, T($ea+ , where N is the number of the working thread, $%un( S"#$%is the value of the source port, $%un( V"#$% is the value of the destination port, T($ea+ The number of worker threads for the worker thread.

[0037] Preferably, S3 includes the steps of data packet forwarding processing in the transparent transmission scenario, specifically:

[0038] When the scenario type is a transparent transmission scenario and the data packet processing request is a client request, based on the target working thread, select the five-tuple data corresponding to the source port and the destination port from the session table according to the source port and the destination port; if the five-tuple data corresponding to the source port and the destination port and the session exist in the session table, forward the data packet requested by the client to the application server using the five-tuple data corresponding to the source port and the destination port based on the session; if the five-tuple data corresponding to the source port and the destination port does not exist in the session table, modify the destination IP address corresponding to the client request to the application server IP address, modify the destination port to the application server port, generate new five-tuple data based on the source port, the source IP address, the application server IP address, the application server port and the transport layer protocol, create a new session, use the new session and the new five-tuple data to forward the data packet requested by the client to the application server, and update the new five-tuple data and the new session to the session table;

[0039] When the scenario type is a transparent transmission scenario and the data packet processing request is an application server request, the session and five-tuple data for processing the application server request are determined according to the number of the target working thread and the session table, the source IP address in the five-tuple data corresponding to the application server request is modified to the virtual IP address of the server load balancing device, and the source port is modified to the virtual port of the server load balancing device, and the modified five-tuple data is generated. The session corresponding to the application server request and the modified five-tuple data are used to forward the data packet corresponding to the application server request to the client; wherein the five-tuple data includes the source IP address, the source port, the destination IP address, the destination port and the transport layer protocol.

[0040] Preferably, the S3 further includes the steps of data packet forwarding processing in a complete network address translation scenario, specifically:

[0041] When the scenario type is a complete network address translation scenario and the data packet processing request is a client request, based on the target working thread, select the five-tuple data corresponding to the source port and the destination port from the session table according to the source port and the destination port; if the five-tuple data corresponding to the source port and the destination port and the session exist in the session table, forward the data packet requested by the client to the application server using the five-tuple data corresponding to the source port and the destination port based on the session; if the five-tuple data corresponding to the source port and the destination port does not exist in the session table, modify the source port corresponding to the client request to the target source port. The network address translation port is modified, the source IP address is modified to the target source network address translation IP address, and the destination IP address corresponding to the client request is modified to the application server IP address, and the destination port is modified to the application server port. A new five-tuple data is generated based on the target source network address translation IP address and the target source network address translation port, and the modified destination IP address, destination port and transport layer protocol corresponding to the client request, and a new session is created. The data packet of the client request is forwarded to the application server using the new session and the new five-tuple data, and the new five-tuple data and the new session are updated to the session table;

[0042] When the scenario type is a complete network address translation scenario and the data packet processing request is an application server request, the session and five-tuple data for processing the application server request are determined according to the number of the target working thread and the session table, the source IP address in the five-tuple data corresponding to the application server request is modified to the virtual IP address of the server load balancing device, and the source port is modified to the virtual port of the server load balancing device, and the modified five-tuple data is generated. The session corresponding to the application server request and the modified five-tuple data are used to forward the data packet corresponding to the application server request to the client; wherein the five-tuple data includes the source IP address, source port, destination IP address, destination port and transport layer protocol.

[0043] Preferably, if there is no five-tuple data corresponding to the source port and the destination port in the session table, before the source port corresponding to the client request is modified to the target source network address translation port and the source IP address is modified to the target source network address translation IP address, a target source network address translation port matching processing step is further included, specifically:

[0044] When the number of times the source network address translation port is referenced is equal to zero, the value of the source network address translation port is recorded; when the number of times the source network address translation port is referenced is greater than zero, the value of the source network address translation port is modified to zero;

[0045] Based on the working thread matching formula, the target source network address translation port is selected according to the number of the target working thread and the value of the source network address translation port. If the value of the source network address translation port% the number of working threads is equal to the number of the target working thread, and the value of the source network address translation port is less than 65536, then the source network address translation port is the target source network address translation port, and the source network address translation IP address corresponding to the target source network address translation port is the target source network address translation IP address.

[0046] Accordingly, the present invention also provides a device for implementing the load balancing method based on lock-free session, the device comprising a port initialization unit, a response data processing request unit and a data packet forwarding unit;

[0047] The port initialization unit is used for port initialization: based on the server load balancing device, the source port, the destination port and the working thread are initialized, and the number of times the source port and the destination port are referenced by the virtual port or the application server port is counted in real time according to the user-side configuration, and a session table is constructed according to the five-tuple data structure and the session, and the number of working threads of the working thread is counted;

[0048] The responding data processing request unit is used to respond to the data processing request: receive a data packet processing request in real time based on a scenario type, determine the source port and the destination port, as well as the number of times the source port is referenced and the number of times the destination port is referenced according to the data packet processing request, and determine a target working thread for processing the data packet processing request from the working threads based on the number of times the source port is referenced and the number of times the destination port is referenced, as well as a working thread matching formula and the number of working threads;

[0049] The data packet forwarding unit is used for data packet forwarding: based on the target working thread, creating a request processing session according to the source port, the destination port and the session table, and using the request processing session to forward the data packet corresponding to the data processing request;

[0050] The five-tuple data structure includes the source IP address, source port, destination IP address, destination port and transport layer protocol, and the five-tuple data structure in the session table has a one-to-one correspondence with the session. The worker thread number also has a one-to-one correspondence with the session; the scenario types include: transparent transmission scenario and complete network address translation scenario; the data packet processing request includes: client request and application server request.

[0051] The present invention implements a defined source port, destination port, working thread and session table by applying the above technical scheme, ensures a lock-free session table by using a client port, forwards data from the client request to the application server request through the same working thread and the same session, and forwards the corresponding data packets to the same CPU, thereby solving the technical problem in the prior art that different CPUs process data packet processing requests, leading to lock protection and reduced device performance. The present invention not only meets the application requirements of the FullNAT scenario and the transparent transmission scenario at the same time, but also ensures that each working thread has its own independent session table, and does not need to access other session tables across CPUs or NUMA (non-uniform memory access), thereby realizing a lock-free session, thereby reducing lock overhead, and improving the performance of server load balancing and the flexibility of deployment. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0053] Figure 1 A schematic flow chart of a load balancing method based on lock-free sessions proposed in an embodiment of the present invention is shown;

[0054] Figure 2 A schematic diagram of a session processing flow of a load balancing method based on lock-free sessions proposed in an embodiment of the present invention is shown;

[0055] Figure 3 A schematic diagram of a process flow of processing the number of port references in a load balancing method based on lock-free sessions proposed in an embodiment of the present invention is shown;

[0056] Figure 4 A schematic diagram of a process flow of processing a data packet processing request in a transparent transmission scenario of a load balancing method based on a lock-free session proposed in an embodiment of the present invention is shown;

[0057] Figure 5 A schematic diagram of a complete network address translation data packet processing request processing flow of a load balancing method based on lock-free sessions proposed in an embodiment of the present invention is shown;

[0058] Figure 6 A structural schematic diagram of a load balancing device based on lock-free sessions proposed in an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0059] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0060] The present invention provides a load balancing method based on lock-free sessions, such as Figure 1 As shown, the method comprises the following steps:

[0061] S1, port initialization: Based on the server load balancing device, the source port, destination port and working thread are initialized, and the number of times the source port and the destination port are referenced by the virtual port or the application server port is counted in real time according to the user-side configuration, and a session table is built according to the five-tuple data structure and the session, and the number of working threads of the working thread is counted.

[0062] In this embodiment, the step S1 includes:

[0063] S11, based on the server load balancing device, defining a source port reference count array and a destination port reference count array respectively;

[0064] S12, respectively configuring the source port and the destination port of the server load balancing device according to the client configuration, and setting the initial value of the number of times the source port of the server load balancing device is referenced and the initial value of the number of times the destination port is referenced to zero based on the source port reference count array and the destination port reference count array, and then initializing the number of times the source port of the server load balancing device is referenced and the number of times the destination port is referenced according to the configuration information of the virtual port and the application server port;

[0065] S13, based on the server load balancing device and the working CPU, and the five-tuple data structure, construct the session table, initialize the working thread, add a number to the working thread, and count the number of working threads of the working thread;

[0066] Wherein, one working thread corresponds to one working CPU.

[0067] S2, responding to data processing requests: receiving data packet processing requests in real time based on scenario types, determining the source port and the destination port, as well as the number of times the source port is referenced and the number of times the destination port is referenced according to the data packet processing requests, and determining a target working thread for processing the data packet processing request from the working threads based on the number of times the source port is referenced and the number of times the destination port is referenced, as well as a working thread matching formula and the number of working threads.

[0068] In this embodiment, the step S2 includes the step of client request processing, specifically:

[0069] When the scenario type is a transparent transmission scenario or a complete network address translation scenario, and the data packet processing request is a client request,

[0070] S211, receiving a client request based on a server load balancing device, and according to the client request, obtaining a client port and a virtual port corresponding to the client request, and determining the source port and the destination port, wherein the source port is the client port corresponding to the client request, and the destination port is the virtual port corresponding to the client request;

[0071] S212, obtaining and determining the value of the source port and the value of the destination port according to the number of times the client port corresponding to the client request and the number of times the virtual port is referenced;

[0072] S213, according to the value of the source port, the value of the destination port and the number of the working threads of the working thread, use the working thread matching formula to calculate and obtain the number of the target working thread for processing the data packet processing request.

[0073] In this embodiment, the step S2 also includes the step of applying the server-side request processing in the transparent transmission scenario, specifically:

[0074] When the scenario type is a transparent transmission scenario and the data packet processing request is an application server request,

[0075] S221, receiving an application server request based on a server load balancing device, and obtaining an application server port and a client port corresponding to the application server request according to the transparent transmission scenario and the application server request, and determining the source port and the destination port, wherein the source port is the application server port corresponding to the application server request, and the client port corresponding to the application server request;

[0076] S222, obtaining and determining the value of the source port and the value of the destination port according to the number of times the application server port corresponding to the application server request and the number of times the client port is referenced;

[0077] S223, according to the value of the source port, the value of the destination port and the number of the working threads of the working thread, use the working thread matching formula to calculate and obtain the number of the target working thread for processing the data packet processing request.

[0078] In this embodiment, the step S2 also includes the step of applying the server-side request processing in the complete network address translation scenario, specifically:

[0079] When the scenario type is a complete network address translation scenario and the data packet processing request is an application server request,

[0080] S221, receiving an application server request based on a server load balancing device, and obtaining an application server port and a source network address translation port corresponding to the application server request according to the complete network address translation scenario and the application server request, and determining the source port and the destination port, wherein the source port is the application server port corresponding to the application server request, and the source network address translation port corresponding to the application server request;

[0081] S222, obtaining and determining the value of the source port and the value of the destination port according to the number of times the application server port corresponding to the application server request is referenced and the number of times the source network address translation port is referenced;

[0082] S223, according to the value of the source port, the value of the destination port and the number of the working threads of the working thread, use the working thread matching formula to calculate and obtain the number of the target working thread for processing the data packet processing request.

[0083] In this embodiment, in step S2, the step of determining the target working thread for processing the data packet processing request from the working threads based on the number of times the source port is referenced and the number of times the destination port is referenced, as well as the working thread matching formula and the number of working threads is specifically as follows:

[0084] 1) Determine the value of the source port and the value of the destination port according to the number of times the source port is cited and the number of times the destination port is cited, wherein:

[0085] If the number of times the source port is cited is equal to zero, recording the source port;

[0086] If the number of times the source port is cited is greater than zero, the source port is recorded as zero;

[0087] If the number of times the destination port is cited is zero, recording the destination port;

[0088] If the number of times the destination port is cited is greater than zero, the destination port is recorded as zero;

[0089] 2) according to the value of the source port, the value of the destination port and the number of the working threads of the working thread, the number of the target working thread for processing the data packet processing request is calculated using the working thread matching formula;

[0090] in,

[0091] The working thread matching formula is: N = #$%un( S"#$% +$%un( V"#$% )%, T($ea+ , where N is the number of the working thread, $%un( S"#$% is the value of the source port, $%un( V"#$% is the value of the destination port, T($ea+ The number of worker threads for the worker thread.

[0092] S3, data packet forwarding: based on the target working thread, a request processing session is created according to the source port, the destination port and the session table, and the data packet corresponding to the data processing request is forwarded using the request processing session.

[0093] Among them, the five-tuple data structure includes the source IP address, source port, destination IP address, destination port and transport layer protocol, and the five-tuple data structure in the session table has a one-to-one correspondence with the session; the number of the working thread and the session also have a one-to-one correspondence; the scenario types include: transparent transmission scenario and complete network address translation scenario; the data packet processing request includes: client request and application server request.

[0094] In this embodiment, S3 includes the steps of data packet forwarding processing in the transparent transmission scenario, specifically:

[0095] When the scenario type is a transparent transmission scenario and the data packet processing request is a client request,

[0096] Based on the target working thread, selecting five-tuple data corresponding to the source port and the destination port from the session table according to the source port and the destination port,

[0097] If there is a five-tuple data and a session corresponding to the source port and the destination port in the session table, forwarding the data packet requested by the client to the application server using the five-tuple data corresponding to the source port and the destination port based on the session,

[0098] If there is no five-tuple data corresponding to the source port and the destination port in the session table, the destination IP address corresponding to the client request is modified to the application server IP address, the destination port is modified to the application server port, new five-tuple data is generated based on the source port, the source IP address, the application server IP address, the application server port and the transport layer protocol, and a new session is created, the data packet requested by the client is forwarded to the application server using the new session and the new five-tuple data, and the new five-tuple data and the new session are updated in the session table;

[0099] When the scenario type is a transparent transmission scenario and the data packet processing request is an application server request, determine the session and five-tuple data for processing the application server request according to the number of the target working thread and the session table, modify the source IP address in the five-tuple data corresponding to the application server request to the virtual IP address of the server load balancing device, modify the source port to the virtual port of the server load balancing device, generate the modified five-tuple data, and use the session corresponding to the application server request and the modified five-tuple data to forward the data packet corresponding to the application server request to the client;

[0100] The five-tuple data includes source IP address, source port, destination IP address, destination port and transport layer protocol.

[0101] In this embodiment, S3 also includes the steps of data packet forwarding processing in a complete network address translation scenario, specifically:

[0102] When the scenario type is a complete network address translation scenario and the packet processing request is a client request,

[0103] Based on the target working thread, selecting five-tuple data corresponding to the source port and the destination port from the session table according to the source port and the destination port,

[0104] If there is a five-tuple data and a session corresponding to the source port and the destination port in the session table, forwarding the data packet requested by the client to the application server using the five-tuple data corresponding to the source port and the destination port based on the session,

[0105] If there is no five-tuple data corresponding to the source port and the destination port in the session table, the source port corresponding to the client request is modified to the target source network address translation port, the source IP address is modified to the target source network address translation IP address, and the destination IP address corresponding to the client request is modified to the application server IP address, and the destination port is modified to the application server port. A new five-tuple data is generated based on the target source network address translation IP address and the target source network address translation port, as well as the modified destination IP address, destination port and transport layer protocol corresponding to the client request, and a new session is created. The data packet requested by the client is forwarded to the application server using the new session and the new five-tuple data, and the new five-tuple data and the new session are updated to the session table.

[0106] When the scenario type is a complete network address translation scenario and the data packet processing request is an application server request,

[0107] Determine the session and five-tuple data for processing the application server request according to the number of the target working thread and the session table, modify the source IP address in the five-tuple data corresponding to the application server request to the virtual IP address of the server load balancing device, modify the source port to the virtual port of the server load balancing device, generate the modified five-tuple data, and use the session corresponding to the application server request and the modified five-tuple data to forward the data packet corresponding to the application server request to the client;

[0108] The five-tuple data includes source IP address, source port, destination IP address, destination port and transport layer protocol.

[0109] In this embodiment, if there is no five-tuple data corresponding to the source port and the destination port in the session table, before the source port corresponding to the client request is modified to the target source network address translation port and the source IP address is modified to the target source network address translation IP address, a target source network address translation port matching processing step is further included, specifically:

[0110] When the number of times the source network address translation port is referenced is equal to zero, the value of the source network address translation port is recorded; when the number of times the source network address translation port is referenced is greater than zero, the value of the source network address translation port is modified to zero;

[0111] Based on the working thread matching formula, the target source network address translation port is selected according to the number of the target working thread and the value of the source network address translation port. If the value of the source network address translation port% the number of working threads is equal to the number of the target working thread, and the value of the source network address translation port is less than 65536, then the source network address translation port is the target source network address translation port, and the source network address translation IP address corresponding to the target source network address translation port is the target source network address translation IP address.

[0112] By applying the above technical solutions, a defined source port, destination port, working thread and session table is implemented. By using the client port to ensure a lock-free session table, client requests and application server requests are forwarded and processed through the same working thread and the same session, and the corresponding data packets are forwarded to the same CPU, which solves the technical problems in the prior art of different CPUs processing data packet processing requests resulting in lock protection and reduced device performance. It not only meets the application requirements of FullNAT scenarios and transparent transmission scenarios at the same time, but also ensures that each working thread has its own independent session table, and does not need to access other session tables across CPUs or NUMA (non-uniform memory access), thereby realizing lock-free sessions, thereby reducing lock overhead and improving server load balancing performance and deployment flexibility.

[0113] In order to enable those skilled in the art to better understand the technical solution provided by this application, the above steps are further explained with examples. The specific contents are as follows:

[0114]

[0115] like Figures 1 to 5 As shown, a load balancing method based on lock-free sessions comprises the following steps:

[0116] S1, port initialization: Based on the server load balancing device, the source port, destination port and working thread are initialized, and the number of times the source port and the destination port are referenced by the virtual port or the application server port is counted in real time according to the user-side configuration, and a session table is built according to the five-tuple data structure and the session, and the number of working threads of the working thread is counted.

[0117] Among them, in order to better count the number of times the source port and the destination port are referenced by the virtual port or the application server port in real time according to the user-side configuration, a port reference count array is defined to track the number of times the port is referenced by vport or rport, and the initialization value is 0, indicating that the port is not occupied.

[0118] #define MAX_PORT_NO 65535

[0119] uint16_t tml_app_port_refcnt[MAX_PORT_NO+1]={0};

[0120] Initialize the port reference count array according to the user's configuration. For example, if a virtual service is configured, the corresponding vport is 80, and the corresponding service ports of two application servers are both 8080. Then the reference count corresponding to port 80 is 1, that is, tml_app_port_refcnt

[80] == 1; the reference count corresponding to port 8080 is 2, that is, tml_app_port_refcnt

[8080] == 2.

[0121] For the Hygon C86 7380CPU, there are 32 cores in total, and 16 worker threads are used here.

[0122] S2, responding to data processing requests: receiving data packet processing requests in real time based on scenario types, determining the source port and the destination port, as well as the number of times the source port is referenced and the number of times the destination port is referenced according to the data packet processing requests, and determining a target working thread for processing the data packet processing request from the working threads based on the number of times the source port is referenced and the number of times the destination port is referenced, as well as a working thread matching formula and the number of working threads.

[0123] S3, data packet forwarding: based on the target working thread, a request processing session is created according to the source port, the destination port and the session table, and the data packet corresponding to the data processing request is forwarded using the request processing session.

[0124] Among them, the five-tuple data structure includes the source IP address, source port, destination IP address, destination port and transport layer protocol, and the five-tuple data structure in the session table has a one-to-one correspondence with the session; the number of the working thread and the session also have a one-to-one correspondence; the scenario types include: transparent transmission scenario and complete network address translation scenario; the data packet processing request includes: client request and application server request.

[0125] (I) Data packet processing request processing process in transparent transmission scenario

[0126] Step 1:

[0127] A data packet arrives from the client, and its source port and destination port are cport (client port, assumed to be 12345) and vport (virtual port, here is 80). According to the port reference count array, for the source port, tml_app_port_refcnt[cport] is 0, indicating that the port has not been registered by the service, so the source port remains unchanged, still cport; for the destination port, tml_app_port_refcnt[vport]>0, indicating that the port has been registered by the service, so the destination port becomes 0, and the changed (source port + destination port) = (cport + 0) = cport. The selected working thread is (cport% number of working threads) = N, indicating that the Nth working thread will process the session. If cport = 12345 and the number of working threads is 16, then (cport% number of working threads) = 9, which means that the 9th working thread will process the session.

[0128] Step 2:

[0129] The working thread first searches the local session table according to the five-tuple. If found, it forwards according to the session. If the corresponding session is not found, it selects the appropriate application server and creates a session. For the transparent transmission mode, there is no need to modify the source IP address and port of the data packet. The destination IP address and port of the data packet are modified to the application server IP address and rport before forwarding it to the application server.

[0130] Step 3:

[0131] A data packet arrives from the application server, with source and destination ports Rport (here 8080) and cport (client port, here 12345). According to the port reference count array, for the source port, tml_app_port_refcnt[Rport] is 2, and tml_app_port_refcnt[vport]>0, indicating that the port is registered by the service, so the source port becomes 0; for the destination port, tml_app_port_refcnt[cport]==0, indicating that the port is not registered by the service, so the destination port cport remains unchanged, and the changed (source port + destination port)=(0+cport)=cport, and the selected working thread is (cport%number of working threads)=N, indicating that the Nth working thread will process the session. If cport=12345 and the number of working threads is 16, then (cport%number of working threads)=9, which means that the 9th working thread will process the session.

[0132] Step 4:

[0133] The worker thread finds the corresponding session (created in step 2) in the local session table, then modifies the source IP address and source port of the data packet to VIP and Vport, and forwards it to the client.

[0134] In steps 1 and 3, the data flow in the client direction and the data flow in the application server direction arrive at the same working thread, so that the same session can be processed only on the same CPU.

[0135] (II) Packet processing request processing process in FullNAT scenario

[0136] Step 1:

[0137] A data packet arrives from the client, and its source port and destination port are cport (client port, assumed to be 12345) and vport (virtual port, here is 80). According to the port reference count array, for the source port, tml_app_port_refcnt[cport] is 0, indicating that the port has not been registered by the service, so the source port remains unchanged, still cport; for the destination port, tml_app_port_refcnt[vport]>0, indicating that the port has been registered by the service, so the destination port becomes 0. Now (source port + destination port) = (cport + 0) = cport, and the selected working thread is (cport% number of working threads) = N, indicating that the Nth working thread will process the session. If cport = 12345 and the number of working threads is 16, then (cport% number of working threads) = 9, which means that the 9th working thread will process the session.

[0138] Step 2:

[0139] The worker thread first searches the local session table according to the five-tuple. If found, it forwards according to the session. If the corresponding session is not found, it selects a suitable application server and creates a session. For FullNAT mode, the source IP address and source port of the data packet need to be modified. Here we focus on the selection and allocation of the source port SnatPort. The following conditions need to be met:

[0140] 1)(cport% number of working threads after change) ==(SnatPort% number of working threads after change).

[0141] 2) The value of SnatPort is less than 65536 (the reasonable port range).

[0142] The changed port means that if tml_app_port_refcnt[port]>0, the port value becomes 0; otherwise it remains unchanged and is still the original port value.

[0143] At the same time, the destination IP address and port of the data packet are modified to the application server IP address and rport and then forwarded to the application server.

[0144] Step 3:

[0145] A data packet arrives from the application server, and its source port and destination port are Rport (here 8080) and SnatPort. According to the port reference count array, for the source port, tml_app_port_refcnt[Rport] is 2, and tml_app_port_refcnt[vport]>0, indicating that the port is registered by the service, so the source port becomes 0; for the destination port, according to the requirements of step 2, (the changed source port is 0+the changed SnatPort)=(the changed SnatPort), and the selected working thread is (the changed SnatPort%number of working threads)=(the changed cport%number of working threads)=N, indicating that the Nth working thread will process the session. If the SnatPort selected in step 2 is (12345+16) and the number of working threads is 16, then (SnatPort%number of working threads)=9, which means that the 9th working thread will process the session.

[0146] Step 4:

[0147] The worker thread finds the corresponding session (created in step 2) in the local session table, and then modifies the source IP address and source port of the data packet to VIP and Vport, and the destination IP address and destination port to Cip and Cport, and forwards it to the client.

[0148] In step 1 and step 3, the data flow in the client direction and the data flow in the application server direction arrive at the same working thread, so that the same session can be processed only on the same CPU.

[0149] Based on the above steps, the client source port is used to forward the data flow from the client to the application server to the same worker thread for processing, thereby ensuring that each worker thread has its own independent session table, and does not need to access other session tables across CPU or NUMA, reducing lock overhead and improving the performance of server load balancing. At the same time, it is not only applicable to SNAT scenarios, but also to transparent transmission scenarios, providing customers with more deployment options.

[0150] Corresponding to the load balancing method based on lock-free session in one embodiment of the present invention, the present invention also discloses a load balancing device based on lock-free session, such as Figure 6 As shown, the device includes a port initialization unit, a response data processing request unit and a data packet forwarding unit;

[0151] The port initialization unit is used for port initialization: based on the server load balancing device, the source port, the destination port and the working thread are initialized, and the number of times the source port and the destination port are referenced by the virtual port or the application server port is counted in real time according to the user-side configuration, and a session table is constructed according to the five-tuple data structure and the session, and the number of working threads of the working thread is counted;

[0152] The responding data processing request unit is used to respond to the data processing request: receive a data packet processing request in real time based on a scenario type, determine the source port and the destination port, as well as the number of times the source port is referenced and the number of times the destination port is referenced according to the data packet processing request, and determine a target working thread for processing the data packet processing request from the working threads based on the number of times the source port is referenced and the number of times the destination port is referenced, as well as a working thread matching formula and the number of working threads;

[0153] The data packet forwarding unit is used for data packet forwarding: based on the target working thread, creating a request processing session according to the source port, the destination port and the session table, and using the request processing session to forward the data packet corresponding to the data processing request;

[0154] in,

[0155] The five-tuple data structure includes the source IP address, source port, destination IP address, destination port and transport layer protocol. The five-tuple data structure in the session table has a one-to-one correspondence with the session. The number of the working thread also has a one-to-one correspondence with the session.

[0156] The scenario types include: transparent transmission scenario and complete network address translation scenario;

[0157] The data packet processing request includes: a client request and an application server request.

[0158] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0159] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A load balancing method based on lock-free sessions, characterized in that: The method comprises: S1, port initialization: Based on the server load balancing device, the source port, the destination port and the working thread are initialized, and the number of times the source port and the destination port are referenced by the virtual port or the application server port is counted in real time according to the user-side configuration, and a session table is constructed according to the five-tuple data structure and the session, and the number of working threads of the working thread is counted; S2, responding to a data processing request: receiving a data packet processing request in real time based on a scenario type, determining the source port and the destination port, as well as the number of times the source port is referenced and the number of times the destination port is referenced according to the data packet processing request, and determining a target working thread for processing the data packet processing request from the working threads based on the number of times the source port is referenced and the number of times the destination port is referenced, as well as a working thread matching formula and the number of working threads; S3, data packet forwarding: based on the target working thread, creating a request processing session according to the source port, the destination port and the session table, and using the request processing session to forward the data packet corresponding to the data processing request; in, The five-tuple data structure includes a source IP address, a source port, a destination IP address, a destination port and a transport layer protocol. The five-tuple data structure in the session table has a one-to-one correspondence with the session; the number of the working thread also has a one-to-one correspondence with the session; The scenario types include: transparent transmission scenario and complete network address translation scenario; The data packet processing request includes: a client request and an application server request.

2. The method according to claim 1, characterized in that The steps of S1 include: S11, based on the server load balancing device, defining a source port reference count array and a destination port reference count array respectively; S12, respectively configuring the source port and the destination port of the server load balancing device according to the client configuration, and based on the source port reference count array and the destination port reference count array, setting the initial value of the number of times the source port of the server load balancing device and the initial value of the number of times the destination port is referenced to zero, and then initializing the number of times the source port of the server load balancing device and the number of times the destination port is referenced according to the configuration information of the virtual port and the application server port; S13, based on the server load balancing device and the working CPU, and the five-tuple data structure, constructing the session table, initializing the working thread, adding a number to the working thread, and counting the number of working threads of the working thread; Wherein, one working thread corresponds to one working CPU.

3. The method according to claim 1, characterized in that The step of S2 includes the step of client request processing, specifically: When the scenario type is a transparent transmission scenario or a complete network address translation scenario, and the data packet processing request is a client request, S211, receiving a client request based on a server load balancing device, and according to the client request, obtaining a client port and a virtual port corresponding to the client request, and determining the source port and the destination port, wherein the source port is the client port corresponding to the client request, and the destination port is the virtual port corresponding to the client request; S212, obtaining and determining the value of the source port and the value of the destination port according to the number of times the client port corresponding to the client request and the number of times the virtual port is referenced; S213, according to the value of the source port, the value of the destination port and the number of the working threads of the working thread, use the working thread matching formula to calculate and obtain the number of the target working thread for processing the data packet processing request.

4. The method according to claim 1, characterized in that The step of S2 also includes the step of applying the server-side request processing in the transparent transmission scenario, specifically: When the scenario type is a transparent transmission scenario and the data packet processing request is an application server request, S221, receiving an application server request based on a server load balancing device, and obtaining an application server port and a client port corresponding to the application server request according to the transparent transmission scenario and the application server request, and determining the source port and the destination port, wherein the source port is the application server port corresponding to the application server request, and the client port corresponding to the application server request; S222, obtaining and determining the value of the source port and the value of the destination port according to the number of times the application server port corresponding to the application server request and the number of times the client port is referenced; S223, according to the value of the source port, the value of the destination port and the number of the working threads of the working thread, use the working thread matching formula to calculate and obtain the number of the target working thread for processing the data packet processing request.

5. The method according to claim 1, characterized in that The step of S2 also includes the step of applying the server-side request processing in the complete network address translation scenario, specifically: When the scenario type is a complete network address translation scenario and the data packet processing request is an application server request, S221, receiving an application server request based on a server load balancing device, and obtaining an application server port and a source network address translation port corresponding to the application server request according to the complete network address translation scenario and the application server request, and determining the source port and the destination port, wherein the source port is the application server port corresponding to the application server request, and the source network address translation port corresponding to the application server request; S222, obtaining and determining the value of the source port and the value of the destination port according to the number of times the application server port corresponding to the application server request is referenced and the number of times the source network address translation port is referenced; S223, according to the value of the source port, the value of the destination port and the number of the working threads of the working thread, use the working thread matching formula to calculate and obtain the number of the target working thread for processing the data packet processing request.

6. The method according to claim 1, characterized in that In step S2, the step of determining a target working thread for processing the data packet processing request from the working threads based on the number of times the source port is referenced and the number of times the destination port is referenced, as well as a working thread matching formula and the number of working threads is specifically as follows: 1) Determine the value of the source port and the value of the destination port according to the number of times the source port is cited and the number of times the destination port is cited, wherein: If the number of times the source port is cited is equal to zero, recording the source port; If the number of times the source port is cited is greater than zero, the source port is recorded as zero; If the number of times the destination port is cited is equal to zero, recording the destination port; If the number of times the destination port is cited is greater than zero, the destination port is recorded as zero; 2) according to the value of the source port, the value of the destination port and the number of the working threads of the working thread, the number of the target working thread for processing the data packet processing request is calculated using the working thread matching formula; in, The working thread matching formula is: N = #$%un( S"#$% +$%un( V"#$% )%, T($ea+ , where N is the number of the working thread, $%un( S"#$% is the value of the source port, $%un( V"#$% is the value of the destination port, T($ea+ The number of worker threads for the worker thread.

7. The method according to claim 1, characterized in that S3 includes the steps of data packet forwarding processing in the transparent transmission scenario, specifically: When the scenario type is a transparent transmission scenario and the data packet processing request is a client request, Based on the target working thread, selecting five-tuple data corresponding to the source port and the destination port from the session table according to the source port and the destination port, If there is a five-tuple data and a session corresponding to the source port and the destination port in the session table, forwarding the data packet requested by the client to the application server using the five-tuple data corresponding to the source port and the destination port based on the session, If there is no five-tuple data corresponding to the source port and the destination port in the session table, the destination IP address corresponding to the client request is modified to the application server IP address, the destination port is modified to the application server port, new five-tuple data is generated based on the source port, the source IP address, the application server IP address, the application server port and the transport layer protocol, and a new session is created, the data packet requested by the client is forwarded to the application server using the new session and the new five-tuple data, and the new five-tuple data and the new session are updated in the session table; When the scenario type is a transparent transmission scenario and the data packet processing request is an application server request, Determine the session and five-tuple data for processing the application server request according to the number of the target working thread and the session table, modify the source IP address in the five-tuple data corresponding to the application server request to the virtual IP address of the server load balancing device, modify the source port to the virtual port of the server load balancing device, generate the modified five-tuple data, and use the session corresponding to the application server request and the modified five-tuple data to forward the data packet corresponding to the application server request to the client; The five-tuple data includes source IP address, source port, destination IP address, destination port and transport layer protocol.

8. The method according to claim 1, characterized in that The S3 also includes the steps of data packet forwarding processing in the complete network address translation scenario, specifically: When the scenario type is a complete network address translation scenario and the packet processing request is a client request, Based on the target working thread, selecting five-tuple data corresponding to the source port and the destination port from the session table according to the source port and the destination port, If there is a five-tuple data and a session corresponding to the source port and the destination port in the session table, forwarding the data packet requested by the client to the application server using the five-tuple data corresponding to the source port and the destination port based on the session, If there is no five-tuple data corresponding to the source port and the destination port in the session table, the source port corresponding to the client request is modified to the target source network address translation port, the source IP address is modified to the target source network address translation IP address, and the destination IP address corresponding to the client request is modified to the application server IP address, and the destination port is modified to the application server port. A new five-tuple data is generated based on the target source network address translation IP address and the target source network address translation port, as well as the modified destination IP address, destination port and transport layer protocol corresponding to the client request, and a new session is created. The data packet requested by the client is forwarded to the application server using the new session and the new five-tuple data, and the new five-tuple data and the new session are updated to the session table. When the scenario type is a complete network address translation scenario and the data packet processing request is an application server request, Determine the session and five-tuple data for processing the application server request according to the number of the target working thread and the session table, modify the source IP address in the five-tuple data corresponding to the application server request to the virtual IP address of the server load balancing device, modify the source port to the virtual port of the server load balancing device, generate the modified five-tuple data, and use the session corresponding to the application server request and the modified five-tuple data to forward the data packet corresponding to the application server request to the client; The five-tuple data includes source IP address, source port, destination IP address, destination port and transport layer protocol.

9. The method according to claim 8, characterized in that If there is no five-tuple data corresponding to the source port and the destination port in the session table, before the source port corresponding to the client request is modified to the target source network address translation port and the source IP address is modified to the target source network address translation IP address, the step of matching the target source network address translation port is further included, specifically: When the number of times the source network address translation port is referenced is equal to zero, the value of the source network address translation port is recorded; when the number of times the source network address translation port is referenced is greater than zero, the value of the source network address translation port is modified to zero; based on the working thread matching formula, the target source network address translation port is selected according to the number of the target working thread and the value of the source network address translation port; if the value of the source network address translation port% the number of working threads is equal to the number of the target working thread, and the value of the source network address translation port is less than 65536, then the source network address translation port is the target source network address translation port, and the source network address translation IP address corresponding to the target source network address translation port is the target source network address translation IP address.

10. A device for implementing the load balancing method based on lock-free session according to claim 1, characterized in that: The device comprises a port initialization unit, a response data processing request unit and a data packet forwarding unit; The port initialization unit is used for port initialization: based on the server load balancing device, the source port, the destination port and the working thread are initialized, and the number of times the source port and the destination port are referenced by the virtual port or the application server port is counted in real time according to the user-side configuration, and a session table is constructed according to the five-tuple data structure and the session, and the number of working threads of the working thread is counted; The responding data processing request unit is used to respond to the data processing request: receive a data packet processing request in real time based on a scenario type, determine the source port and the destination port, as well as the number of times the source port is referenced and the number of times the destination port is referenced according to the data packet processing request, and determine a target working thread for processing the data packet processing request from the working threads based on the number of times the source port is referenced and the number of times the destination port is referenced, as well as a working thread matching formula and the number of working threads; The data packet forwarding unit is used for data packet forwarding: based on the target working thread, creating a request processing session according to the source port, the destination port and the session table, and using the request processing session to forward the data packet corresponding to the data processing request; in, The five-tuple data structure includes the source IP address, source port, destination IP address, destination port and transport layer protocol. The five-tuple data structure in the session table has a one-to-one correspondence with the session. The number of the working thread also has a one-to-one correspondence with the session. The scenario types include: transparent transmission scenario and complete network address translation scenario; The data packet processing request includes: a client request and an application server request.

Citation Information

Patent Citations

  • Load balancing method and load equalizer

    CN102255932A

  • UDP (User Datagram Protocol) conversation multiplexing method and load balancing equipment

    CN102761608A

  • Message forwarding method and device

    CN106534345A

  • DNS load balancing performance optimization scheme based on single port

    CN115858152A

  • System, method and apparatus for implementing network interconnection

    WO2018227519A1