A business processing method, device, electronic device and computer readable medium

By obtaining the pending session and target forwarding addresses in the load balancer, obtaining the global water level information of the session fast table after the matching fails, determining the number and type of offloading, and unloading the session to the session fast table for forwarding, solving the problem of the forwarding logic of the existing load balancer, and achieving high-speed forwarding and low-latency.

CN115460213BActive Publication Date: 2025-04-15JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211041649.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-29
Publication Date
2025-04-15
Estimated Expiration
2042-08-29

AI Technical Summary

Technical Problem

The forwarding logic of the existing load balancer has a delay and the forwarding speed is slow.

Method used

By obtaining the pending session and target forwarding address, matching it with the preset session table entry, obtaining attribute identifier after the matching fails, creating a new data stream, obtaining the global water level information of the session fast table, determining the number and type of unloading based on the water level information, and unloading the session to the session fast table for forwarding.

Benefits of technology

Maximize the utilization of storage and performance resources to achieve high-speed forwarding, large table entry turnover, and low-latency forwarding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115460213B_ABST
    Figure CN115460213B_ABST
Patent Text Reader

Abstract

The present application discloses a business processing method, device, electronic device and computer-readable medium, and relates to the technical field of load balancing. The method includes: obtaining a session to be processed and a target forwarding address corresponding to the session to be processed; matching the target forwarding address with a preset session table item, and in response to a match failure, obtaining an attribute identifier corresponding to the target forwarding address, and in response to a newly created data flow corresponding to the attribute identifier, obtaining the global water level information of the session cache; determining the number of sessions to be processed that are unloaded to the session cache according to the global water level information of the session cache; determining the unloading type based on the number of sessions, unloading the session to be processed to the session cache based on the unloading type, and then forwarding the session unloaded to the session cache to the server corresponding to the corresponding target forwarding address. Maximize the use of storage and performance resources to achieve high-speed forwarding, large table item turnover, and low-latency forwarding.
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 in particular to a service processing method, device, electronic device and computer-readable medium. Background Art

[0002] The currently popular four-layer load balancer is based on the LVS scheduler and is deployed through an X86 server cluster to achieve the function of traffic load balancing. When a terminal Internet user accesses the company's load balancing server from the outside, the terminal user's Web request will be sent to the LVS scheduler, which decides to send the request to a certain Web server at the backend based on a preset algorithm.

[0003] In the process of implementing this application, the inventors found that there are at least the following problems in the prior art:

[0004] The forwarding logic implemented by the load balancer has time delay and slow forwarding speed. Summary of the invention

[0005] In view of this, the embodiments of the present application provide a business processing method, device, electronic device and computer-readable medium, which can solve the problems of delay and slow forwarding speed in the forwarding logic implemented by the existing load balancer.

[0006] To achieve the above objective, according to one aspect of an embodiment of the present application, a service processing method is provided, including:

[0007] Obtain the session to be processed and the target forwarding address corresponding to the session to be processed;

[0008] Match the target forwarding address with the preset session table entry, and in response to a match failure, obtain an attribute identifier corresponding to the target forwarding address, and in response to a newly created data flow corresponding to the attribute identifier, obtain global water level information of the session cache;

[0009] Determine the number of pending sessions to be unloaded to the session fast table according to the global water level information of the session fast table;

[0010] The offloading type is determined based on the number of sessions, and the sessions corresponding to the number of sessions in the pending sessions are offloaded to the session cache based on the offloading type, and then the sessions offloaded to the session cache are forwarded to the server corresponding to the corresponding target forwarding address.

[0011] Optionally, after creating a new data flow in response to the attribute identifier, the service processing method further includes:

[0012] Create a new session node; and

[0013] Unload pending sessions to the session cache based on the unload type, including:

[0014] Through the newly created session node, unload the pending sessions corresponding to the unload type into the session fast table.

[0015] Optionally, unload the pending session to the session cache based on the unload type, including:

[0016] Determine the traffic corresponding to the session to be processed;

[0017] Determine a session corresponding to a flow rate greater than a preset flow rate threshold in the to-be-processed session as a target session;

[0018] Based on the offload type, target sessions corresponding to the number of sessions are offloaded to the session fast table.

[0019] Optionally, before obtaining the attribute identifier corresponding to the target forwarding address, the service processing method includes:

[0020] The target forwarding address is matched with the preset session cache. In response to the absence of a matching session cache entry, it is determined that the session cache match fails. The preset session cache is then called to match the target forwarding address. In response to the absence of a matching session cache entry, it is determined that the match fails.

[0021] Optionally, the service processing method further includes:

[0022] In response to a successful match, obtaining a key-value pair in the matched table entry;

[0023] The message corresponding to the session to be processed is modified based on the key-value pair, and the modified message is then forwarded.

[0024] Optionally, after unloading the to-be-processed session to the session cache based on the unloading type, the service processing method further includes:

[0025] In response to the uninstallation type being full uninstallation, a timeout aging time is set for the timer of the session cache so as to perform a deletion operation on the corresponding session when the timeout aging time is reached.

[0026] Optionally, after unloading the to-be-processed session to the session cache based on the unloading type, the method further includes:

[0027] In response to the unloading type being half unloading, the session fast table is called to periodically send a heartbeat message to reset the timer of the session slow table entry, so that the remaining to-be-processed sessions in the session slow table survive.

[0028] Optionally, the service processing method further includes:

[0029] In response to receiving the session timeout message, a corresponding session deletion operation is performed.

[0030] In addition, the present application also provides a service processing device, including:

[0031] A receiving unit, configured to obtain a session to be processed and a target forwarding address corresponding to the session to be processed;

[0032] A matching unit is configured to match the target forwarding address with a preset session table entry, obtain an attribute identifier corresponding to the target forwarding address in response to a match failure, and obtain global water level information of the session cache in response to a newly created data flow corresponding to the attribute identifier;

[0033] A session quantity determination unit, configured to determine the number of pending sessions to be unloaded into the session cache according to the global water level information of the session cache;

[0034] The session forwarding unit is configured to determine the unloading type based on the number of sessions, unload the pending sessions into the session cache based on the unloading type, and then forward the sessions unloaded into the session cache to the server corresponding to the corresponding target forwarding address.

[0035] Optionally, the device further comprises a new creation unit configured to:

[0036] Create a new session node; and

[0037] The session forwarding unit is further configured to:

[0038] Through the newly created session node, unload the pending sessions corresponding to the unload type into the session fast table.

[0039] Optionally, the session forwarding unit is further configured to:

[0040] Determine the traffic corresponding to the session to be processed;

[0041] Determine a session corresponding to a flow rate greater than a preset flow rate threshold in the to-be-processed session as a target session;

[0042] Based on the offload type, target sessions corresponding to the number of sessions are offloaded to the session fast table.

[0043] Optionally, the matching unit is further configured to:

[0044] The target forwarding address is matched with the preset session cache. In response to the absence of a matching session cache entry, it is determined that the session cache match fails. The preset session cache is then called to match the target forwarding address. In response to the absence of a matching session cache entry, it is determined that the match fails.

[0045] Optionally, the service processing device further includes a message modification unit configured to:

[0046] In response to a successful match, obtaining a key-value pair in the matched table entry;

[0047] The message corresponding to the session to be processed is modified based on the key-value pair, and the modified message is then forwarded.

[0048] Optionally, the service processing device further includes a session deleting unit configured to:

[0049] In response to the uninstallation type being full uninstallation, a timeout aging time is set for the timer of the session cache so as to perform a deletion operation on the corresponding session when the timeout aging time is reached.

[0050] Optionally, the service processing device further includes a timer resetting unit configured to:

[0051] In response to the unloading type being half unloading, the session fast table is called to periodically send a heartbeat message to reset the timer of the session slow table entry, so that the remaining to-be-processed sessions in the session slow table survive.

[0052] Optionally, the service processing device further includes a session deleting unit configured to:

[0053] In response to receiving the session timeout message, a corresponding session deletion operation is performed.

[0054] In addition, the present application also provides a business processing electronic device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the one or more processors implement the business processing method as described above.

[0055] In addition, the present application also provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the business processing method as described above is implemented.

[0056] One embodiment of the above invention has the following advantages or beneficial effects: the present application obtains the to-be-processed session and the target forwarding address corresponding to the to-be-processed session; matches the target forwarding address with the preset session table item, obtains the attribute identifier corresponding to the target forwarding address in response to the match failure, obtains the global water level information of the session cache in response to the newly created data flow corresponding to the attribute identifier; determines the number of to-be-processed sessions to be unloaded into the session cache according to the global water level information of the session cache; determines the unloading type based on the number of sessions, unloads the to-be-processed session into the session cache based on the unloading type, and then forwards the session unloaded into the session cache to the server corresponding to the corresponding target forwarding address. After the session table item fails to match, the number of sessions to be unloaded into the session cache is determined according to the global water level information of the session cache, and then the unloading type is determined according to the number of sessions, and the corresponding session unloading and session forwarding are performed according to the unloading type. Maximize the use of storage and performance resources to achieve high-speed forwarding, large table item turnover, and low-latency forwarding.

[0057] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] The accompanying drawings are used to better understand the present application and do not constitute an improper limitation on the present application.

[0059] Figure 1 is a schematic diagram of the main process of the business processing method according to the first embodiment of the present application;

[0060] Figure 2 is a schematic diagram of the main process of the business processing method according to the second embodiment of the present application;

[0061] Figure 3 is a schematic diagram of a business logic topology of a business processing method according to an embodiment of the present application;

[0062] Figure 4 is a schematic diagram of a deployment network topology of a service processing method according to an embodiment of the present application;

[0063] Figure 5 is a programmable switch processing flow chart of a service processing method according to an embodiment of the present application;

[0064] Figure 6 is a schematic diagram of main units of a service processing device according to an embodiment of the present application;

[0065] Figure 7 is an exemplary system architecture diagram to which the embodiments of the present application can be applied;

[0066] Figure 8 It is a structural diagram of a computer system of a terminal device or server suitable for implementing an embodiment of the present application. DETAILED DESCRIPTION

[0067] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description. The acquisition, storage, use, and processing of data in the technical solution of the present application are in compliance with the relevant provisions of national laws and regulations.

[0068] Figure 1 is a schematic diagram of the main process of the business processing method according to the first embodiment of the present application, such as Figure 1 As shown, the business processing method includes:

[0069] Step S101, obtaining a session to be processed and a target forwarding address corresponding to the session to be processed.

[0070] The business logic topology diagram applied by the embodiment of the present application is as follows Figure 3 As shown, the three processing parts are P4 side, ARM side and X86 side: P4 side is ASIC forwarding chip side, X86 side is intel-CPU system, ARM side is arm-CPU system side, and the three parts have different functions; X86 side calls API to publish items to P4 side chip and interacts with ARM side through messages.

[0071] The P4 side is used for matching and forwarding the session cache, and is also the transit station for the entire data packet processing; it is mainly a group of session tables used to match the five-tuple of messages (the five-tuple of messages includes: source IP, target IP, source port, target port, and protocol number) to make a fast forwarding path; the number of session tables is equal to the number of CPUs that process session additions and deletions in the X86 part to ensure the ability to send in parallel; each session (sesssion) table entry is set with an aging time, and if it is not refreshed after the timeout, the X86 part is notified to delete the session table entry; unmatched sessions are sent to the designated network port of the ARM buckle card through hash, and the messages processed by ARM are received from the 100G port and sent out according to the same hash. The session cache of the embodiment of the present application is a partial page table stored in a cache memory. As a cache of the page table, its function is similar to that of the page table, but it increases the access rate. The use of a session cache can speed up searches and increase the speed of instruction execution.

[0072] The ARM side processes the slow forwarding path, receives network port messages and performs standard DPVS processing procedures to complete the establishment of a three-way handshake session. All messages are sent back by the receiving network port after DPVS processing. After the session is established, a large-flow session (for example, a session with a flow greater than a certain threshold, the threshold is not specifically limited in the embodiment of the present application) is selected according to the flow rate and other rules, and sent to the X86 part through a dedicated network port for issuing P4 table entries.

[0073] The X86 side handles session management, receives session addition notifications from the ARM part through a dedicated network port, and sends them to the session-table corresponding to the P4 chip according to its own cpu_id; when the session table entry of the P4 chip times out, it receives a timeout notification and sends the corresponding session table entry to be deleted.

[0074] In this embodiment, the execution subject of the business processing method (for example, it can be a server mounted with a P4 device and ARM, in which the P4 device and ARM implement their respective functions) can obtain the pending session from the session slow table on the ARM side through a wired connection or a wireless connection. Specifically, in the embodiment of the present application, taking the forwarding of session data as an example, the execution subject can obtain the pending session from the session slow table, and the pending session can be the session to be forwarded. A session is a context between the communicating parties from the beginning of communication to the end of communication. This context is a section of memory on the server side: it records information such as the client machine of this connection, which application is used, and which user logs in. "Session" can be understood as a process of information interaction, such as the process of data transmission after the client and the server establish a link. This process starts from establishing a connection and ends with disconnecting the connection, and may involve multiple information transmissions by one party during this period.

[0075] The service processing request carries the address to which the session to be processed needs to be forwarded, that is, the target forwarding address corresponding to the session to be processed, that is, the target IP address. The target forwarding address is matched with the session table entry, and the value matched in the session table entry is determined as the content of the message to be modified. The session table entry stores a key-value pair, where the key is the content to be matched with the target IP address, and the value is the content of the message to be modified that matches the key (that is, after the key is matched, the corresponding IP and port in the message are modified according to the value corresponding to the matched key).

[0076] Step S102, matching the target forwarding address with the preset session table entry, in response to a match failure, obtaining an attribute identifier corresponding to the target forwarding address, and in response to the attribute identifier corresponding to a newly created data flow, obtaining session cache global water level information.

[0077] Specifically, before obtaining the attribute identifier corresponding to the target forwarding address, the business processing method includes: matching the target forwarding address with a preset session cache, and in response to the absence of a matching session cache entry, determining that the session cache match fails, and then calling the preset session cache to match the target forwarding address, and in response to the absence of a matching session cache entry, determining that the match fails.

[0078] In the embodiment of the present application, the table item content is key+value, and the key (target IP of the message) is matched, and the action after matching is value, and value is the modification of the message. A message is a session data unit exchanged and transmitted in a network, that is, a data block to be sent by a site at one time. The message contains the complete data information to be sent, and its length is very inconsistent, and the length is unlimited and variable. Specifically, the table item is: key+value, key is the content to be matched (target IP), and the field value of value (source IP, target IP and source port, target port to be replaced) is the content of the message to be modified. After obtaining the field value of the matched value, the execution subject can modify the source IP, target IP and source port, target port in the message to the source IP, target IP and source port, target port in the field value of the matched value to obtain the modified message and forward it. The principle of modifying the message is to only modify the IP and port address, and other user data remains unchanged.

[0079] In the embodiment of the present application, if there is no match on the session fast table, the data packet will be forwarded to the ARM side. The ARM part is taken over by DPVS (DPVS is a high-performance Layer 4 load balancer based on DPDK) for two 100G service network ports. DPVS parses the data packet. The execution subject can match the internally maintained session slow table with the target forwarding address. If there is a matching table item, the message is modified according to the action content of the matched table item (that is, the value in the matched key-value pair) and then forwarded to the P4 side. The P4 side directly forwards it after receiving the message. If the ARM side does not match the session slow table, it continues to determine whether it is a new flow, that is, whether the three-way handshake session establishment has been completed; if it is not a new flow, the message is directly discarded and not forwarded, which means that the session has aged.

[0080] Specifically, the service processing method further includes: in response to a successful match, obtaining a key-value pair in the matched table entry; modifying a message corresponding to the session to be processed based on the key-value pair, and then forwarding the modified message.

[0081] When the execution subject determines that the target forwarding address matches a key-value pair in the table entry, the key-value pair corresponding to the target forwarding address in the table entry can be obtained. For example, the key-value pair can be: target forwarding address-ABCD, where A and B are the matched source IP and target IP respectively, and C and D are the matched source port and target port respectively.

[0082] For example, the data packet of the session to be processed first enters the session cache of P4 for matching. If a matching entry exists, the packet is modified according to the action content in the key-value pair of the matching entry (that is, the value in the key-value pair) and then forwarded directly. The forwarding of the session cache is hardware forwarding, which can achieve the purpose of line-speed forwarding.

[0083] The target forwarding address is matched with the preset session table entry. In response to a match failure, the attribute identifier corresponding to the target forwarding address is obtained. In response to the newly created data flow corresponding to the attribute identifier, the global water level information of the session cache is obtained. The attribute identifier is used to indicate whether it is a newly created data flow. If so, the global water level information of the session cache is obtained to determine how much session data needs to be unloaded to the session cache so that the overall forwarding efficiency can be achieved.

[0084] Step S103: Determine the number of pending sessions to be unloaded into the session cache according to the global water level information of the session cache.

[0085] Global water level information, for example, can be the percentage of fast table usage, such as <80% low, <90% middle, <99% high, >99% max; each fast table usage has a corresponding session unloading threshold. Under the premise of not exceeding the session unloading threshold corresponding to the fast table usage, determine the number of high-traffic sessions that need to be unloaded to the session fast table on the P4 side, so as to achieve feedback regulation and achieve a high-efficiency forwarding level as a whole.

[0086] Step S104, determining the offload type based on the number of sessions, offloading the to-be-processed sessions to the session cache based on the offload type, and then forwarding the sessions offloaded to the session cache to a server corresponding to the corresponding target forwarding address.

[0087] Specifically, the execution subject may determine whether the traffic corresponding to the session to be processed is continuous traffic, and then determine the offloading type based on the number of sessions and whether the traffic corresponding to the session to be processed is continuous traffic.

[0088] Unloading types include full unloading and half unloading. Full unloading means only maintaining the session cache (the session cache exists in the hardware), not performing the synchronization process with the session slow table, not sending heartbeat messages, and setting a longer timeout for the session cache timer, such as 90 seconds. The sessions in the session cache will naturally age when they time out. Half unloading means performing the synchronization process between the session cache and the session slow table (the session slow table exists in the memory), and setting a shorter timeout for the session cache timer, such as 3-5 seconds. The session cache will periodically send heartbeat messages to reset the timer of the session slow table entry to ensure that after the session cache times out, the session slow table can continue to process subsequent session messages as a backup. Unloading types can be as follows: Figure 5The algorithm determination on the ARM side shown is obtained. Specifically, the ARM side obtains CPU statistical information, which includes the session traffic value and whether it is continuous traffic, wherein continuous traffic refers to uninterrupted session traffic within a preset time period. The unloading type is determined according to the session traffic value in the statistical information and whether it is continuous traffic. Specifically, half unloading is applicable to scenarios with large traffic and continuous traffic. Full unloading is applicable to scenarios other than large traffic and continuous traffic. Large traffic refers to traffic with a session traffic value exceeding a certain threshold.

[0089] Specifically, unloading the pending sessions to the session cache based on the unloading type includes: determining the traffic corresponding to the pending sessions; determining the sessions corresponding to the traffic greater than a preset traffic threshold in the pending sessions (that is, large-traffic sessions) as target sessions; and unloading the target sessions corresponding to the number of sessions to the session cache based on the unloading type (full unloading or half unloading).

[0090] The traffic corresponding to the session to be processed may be, for example, the number of data packets transmitted by both communicating parties per unit time.

[0091] Specifically, after unloading the to-be-processed session to the session cache based on the unloading type, the service processing method further includes: in response to the unloading type being a full unloading, setting a timeout aging time for the timer of the session cache so as to perform a deletion operation on the corresponding session when the timeout aging time is reached.

[0092] Among them, for the full-offload mode and the half-offload mode, in the full-offload mode: the table entries of the session slow table do not need subsequent maintenance after being sent, and only need to wait for natural timeout and aging. Subsequently, the connection messages will be processed by the session fast table. The timer timeout setting of the session fast table is relatively long, such as 90 seconds.

[0093] Specifically, after unloading the pending sessions to the session fast table based on the unloading type, the business processing method also includes: in response to the unloading type being semi-unloading, calling the session fast table to periodically send heartbeat messages to reset the timer of the session slow table entry so that the remaining pending sessions in the session slow table survive.

[0094] Semi-unload mode: After the session slow table entries are delivered, the session fast table will periodically send heartbeats to trigger the timer reset of the session slow table entries. The timer timeout of the session fast table is set to a short time, such as 3-5 seconds, to ensure that after the session fast table expires, the session slow table can continue to process subsequent messages.

[0095] Specifically, the service processing method further includes: in response to receiving a session timeout message, executing a corresponding session deletion operation.

[0096] Regardless of the full or half offload mode, the X86 side processes the aging of the corresponding fast table session timer. After receiving the entry timeout notification, it will perform the corresponding session entry deletion operation.

[0097] This embodiment obtains the to-be-processed session and the target forwarding address corresponding to the to-be-processed session; matches the target forwarding address with the preset session table entry, obtains the attribute identifier corresponding to the target forwarding address in response to a match failure, obtains the global water level information of the session cache in response to the newly created data flow corresponding to the attribute identifier; determines the number of to-be-processed sessions to be unloaded into the session cache according to the global water level information of the session cache; determines the unloading type based on the number of sessions, unloads the to-be-processed session into the session cache based on the unloading type, and then forwards the session unloaded into the session cache to the server corresponding to the corresponding target forwarding address. After the match of the session table entry fails, the number of sessions to be unloaded into the session cache is determined according to the global water level information of the session cache, and then the unloading type is determined according to the number of sessions, and the corresponding session unloading and session forwarding are performed according to the unloading type. Maximize the use of storage and performance resources to achieve high-speed forwarding, large table entry turnover, and low-latency forwarding.

[0098] Figure 2 is a schematic diagram of the main flow of the business processing method according to the second embodiment of the present application, such as Figure 2 As shown, the business processing method includes:

[0099] Step S201: obtaining a session to be processed and a target forwarding address corresponding to the session to be processed.

[0100] The target forwarding address is the IP address corresponding to the target node to which the session to be processed is finally forwarded.

[0101] Step S202, matching the target forwarding address with the preset session table entry, in response to a match failure, obtaining an attribute identifier corresponding to the target forwarding address, and creating a new session node in response to a new data flow corresponding to the attribute identifier; and unloading the pending session to the session cache based on the unloading type, including: unloading the pending session corresponding to the unloading type to the session cache through the newly created session node.

[0102] If it is a new flow, the DPVS processing flow will continue to be executed, a new session node will be created, a real backend server will be selected according to the configured policy, and then the message will be forwarded to the P4 side through the newly created session node, that is, the session to be processed corresponding to the offload type will be unloaded to the session fast table on the P4 side through the newly created session node, and the P4 side will directly forward the message after receiving it. Among them, DPVS is a high-performance four-layer load balancer (Layer-4 loadbalancer) based on DPDK.

[0103] Step S203, obtaining the global water level information of the session cache.

[0104] The global water level information of the session cache can be the usage rate of the session cache, for example <80% low (low water level), <90% middle (middle water level), <99% high (high water level), >99% max (maximum water level). It can be understood that the higher the water level corresponding to the global water level information of the session cache, the less session data can be accommodated. By obtaining the global water level information of the session cache, it is possible to accurately determine how many high-traffic sessions need to be offloaded to the session cache on the P4 side (offloading type), so as to achieve feedback regulation and achieve a high-efficiency forwarding level as a whole.

[0105] Step S204: Determine the number of pending sessions to be unloaded into the session cache according to the global water level information of the session cache.

[0106] Step S205, determining the offload type based on the number of sessions, offloading the to-be-processed sessions to the session cache based on the offload type, and then forwarding the sessions offloaded to the session cache to a server corresponding to the corresponding target forwarding address.

[0107] The embodiment of the present application determines the number of sessions that need to be unloaded to the session cache according to the global water level information of the session cache after the session table entry fails to match, and then determines the unloading type according to the number of sessions, and performs corresponding session unloading and session forwarding according to the unloading type. Maximize the use of storage and performance resources to achieve high-speed forwarding, large table entry turnover, and low forwarding latency.

[0108] Figure 4 FIG. 4 is a schematic diagram of a deployment network topology of a service processing method according to the fourth embodiment of the present application. Figure 4As shown in the figure, when a user accesses the network, when accessing an address through The Onion Router (TOR), the nodes passed through are randomly selected from the TOR node group. The working mode is DR direct routing mode. VIP routes are published through bgp to guide traffic to the P4 programmable switch. After processing, the traffic is distributed to the real server at the back end through load balancing, and the processing results after the real server responds are directly returned to the client user based on RS traffic control. The Onion Router is a proxy server similar to the P2P principle. All users who have installed the Onion Router are both users and providers of the proxy server. The Onion Router is a tool set that various organizations and individuals can use to enhance their security on the Internet. The Onion Router can anonymize your Web browsing and publishing, instant messaging, IRC, SSH and other applications that use the TCP protocol. The Onion Router also provides a platform on which software developers can build new applications with built-in anonymity, security and privacy protection features.

[0109] Figure 5 1 is a flowchart of a programmable switch processing method according to an embodiment of the present application. Figure 5 As shown, the P4 device processing flow is described as follows:

[0110] The data packet is first matched with the session cache of P4. If a matching entry exists, the packet is modified according to the action content of the matching entry and then forwarded directly. The forwarding of the session cache is hardware forwarding, which can achieve the purpose of line-speed forwarding.

[0111] If there is no match in the session fast table, the data packet is forwarded to the ARM side. The ARM part is taken over by DPVS (DPVS is a high-performance Layer 4 load balancer based on DPDK) for two 100G service network ports. DPVS parses the data packet and matches the internally maintained session slow table. If there is a matching table entry, the message is modified according to the action content of the matched table entry and then forwarded to the P4 side. After receiving the message, the P4 side directly forwards it. Session is a context between the two communicating parties from the beginning of communication to the end of communication. This context is a memory on the server side: it records the client machine of this connection, which application is used, which user logs in, and other information. "Session" can be understood as a process of information interaction, such as the process of data transmission after the client and the server establish a link. This process starts from the establishment of the connection and ends with the disconnection, and may involve multiple information transmissions on one side during the period.

[0112] If the ARM side does not match the session slow table, it determines whether it is a new flow, that is, whether the three-way handshake session establishment has been completed; if it is not a new flow, the message is directly discarded without forwarding, which means that the session has aged.

[0113] If it is determined to be a new flow, the DPVS processing flow continues to be executed, a new session node is created, a real backend server is selected according to the configured policy, and then the message is forwarded to the P4 side. After receiving the message, the P4 side directly forwards it.

[0114] After the ARM side creates a session node, it will determine based on the algorithm to offload some high-traffic sessions to the session fast table on the P4 side to reduce the load pressure on the ARM side. At the same time, it will make a synchronization judgment based on the Session_Info message synchronized from the X86 side, and based on the global water level information of the session fast table in the Session_Info message, such as: fast table usage percentage: <80% low, <90% middle, <99% high, >99% max; thus, it can be determined how many high-traffic sessions need to be offloaded to the session fast table on the P4 side (offloading type), so as to achieve feedback regulation and achieve a high-efficiency forwarding level as a whole.

[0115] The process of unloading large-traffic sessions to the fast table is to obtain the session and offload type, encapsulate the session information into the Session_Add message, and forward it to the X86 side through the 25G session interaction dedicated physical channel. After the X86 side receives the message through the network port, it obtains the session information in the message and writes it to the session fast table through the API interface of the P4 control plane.

[0116] The Session_Add message supports two types of offloading: full-offload and half-offload. After the entry of the session slow table in full-offload mode is sent, no subsequent maintenance is required. Just wait for natural timeout and aging. The subsequent connection message will be processed by the session fast table. The timer timeout of the session fast table is set to be longer, such as 90 seconds. After the entry of the session slow table in half-offload mode is sent, the session fast table will periodically send a heartbeat to trigger the timer reset of the session slow table entry. The timer timeout of the session fast table is set to be shorter, such as 3-5 seconds, to ensure that after the session fast table fails, the session slow table can continue to process subsequent messages.

[0117] When the table entry on the X86 side is in semi-unload mode, the session fast table entry will trigger the heartbeat message of the session at a fixed time (between 20-30 seconds), encapsulate the Session_Hold message and forward it to the ARM side. After the DPVS on the ARM side receives the Session_Hold message, it will trigger the timer reset in the session slow table to implement the session keep-alive function.

[0118] Regardless of the full or half offload mode, the X86 side processes the aging of the corresponding fast table session timer. After receiving the entry timeout notification, it will perform the corresponding session entry deletion operation.

[0119] The embodiment of the present application realizes traffic load balancing through the P4 programmable switch, providing large bandwidth and line-speed forwarding capabilities. Based on the ARM expansion card solution, the X86 module, ARM module, and P4 module on the P4 programmable switch maximize the use of storage and performance resources to achieve high-speed forwarding, large table entry turnover, fast and slow paths and other features.

[0120] The P4 programmable switch can achieve a maximum bandwidth forwarding capacity of 2.4T, which is 30 times the bandwidth limit of a single x86 server. In actual deployment, it can greatly reduce the scale of the deployment cluster and also reduce costs. For edge CDN rooms with low traffic, two P4 programmable switches can be deployed, and the two switches can be used for master-slave switching. This deployment is very convenient for equipment management and maintenance, and improves the work efficiency of operation and maintenance personnel. Since the P4 programmable switch side is forwarded by hardware, for the session fast table forwarding maintained by the P4 side, the traffic can be forwarded at line speed.

[0121] In the embodiments of the present application, P4: a protocol-independent packet processing programming language. LVS: Linux Virtual Server, an open source four-layer traffic load balancing project. DPDK: Data Plane Development Kit, a collection of function libraries and drivers for fast packet processing; it can greatly improve data processing performance and throughput, and improve the work efficiency of data plane applications. DPVS: an open source high-performance four-layer load balancer based on DPDK+LVS. Fast table: Here, the fast table on the P4 side refers to hardware forwarding, which can achieve the efficiency of line-speed forwarding, which is different from the slow session table on the ARM side. The session table on the ARM side is maintained by software and has a delay in forwarding; P4: P4 is a language, which refers to the P4 programmable switch here, and the P4 side represents the hardware forwarding part; Session_Hold: A message identifier, the message forwarded by the X86 side to the ARM side, the purpose is to retain the session in the slow session table to ensure that the session does not age out prematurely; Session_Info: A message identifier, the message forwarded by the X86 side to the ARM side, the purpose is to tell the ARM side the current usage rate of the session fast table; Session_Add: A message identifier, the message sent by the ARM side to the X86 side, the purpose is to encapsulate the session information (five-tuple) into this message, so that the X86 side can obtain the session information and then send it to the session fast table on the P4 side through the API interface. Figure 3The session heartbeat information obtained on the ARM side specifically refers to the identifier of this session. There are many sessions in the session table, and it is necessary to identify which specific session it is. This identifier is a five-tuple information (source IP, target IP, source port, destination port, protocol number). Table item matching: The table item is: key and value. The key is the content to be matched (target IP), and the field value of the value (source IP, target IP and source port, target port to be changed) is the content of the message to be modified; the principle of modifying the message is to only modify the IP and port addresses, and other user data remains unchanged.

[0122] The embodiment of the present application is implemented based on a programmable switch, and the physical channels of management, session interaction, and business forwarding are isolated to avoid mutual influence; ARM solves the problem that the CPU performance of standard white box devices is weak and cannot handle large amounts of traffic forwarding, and can make the X86 CPU more focused on configuration and session management; the overall solution maximizes the use of storage and performance resources for X86, ARM, and P4 to achieve high-speed forwarding, large table entry turnover, fast and slow paths, and other characteristics.

[0123] Figure 6 Schematic diagram of the main units of the service processing device according to an embodiment of the present application. Figure 6 As shown, the service processing device 600 includes a receiving unit 601 , a matching unit 602 , a session quantity determining unit 603 and a session forwarding unit 604 .

[0124] The receiving unit 601 is configured to obtain a session to be processed and a target forwarding address corresponding to the session to be processed;

[0125] The matching unit 602 is configured to match the target forwarding address with the preset session table entry, and in response to a match failure, obtain an attribute identifier corresponding to the target forwarding address, and in response to the attribute identifier corresponding to the newly created data flow, obtain global water level information of the session cache;

[0126] The session quantity determining unit 603 is configured to determine the number of pending sessions to be unloaded into the session cache according to the global water level information of the session cache;

[0127] The session forwarding unit 604 is configured to determine the offload type based on the number of sessions, offload the pending sessions to the session cache based on the offload type, and then forward the sessions offloaded to the session cache to the server corresponding to the corresponding target forwarding address.

[0128] In some embodiments, the device further comprises Figure 6 The new creation unit not shown in the figure is configured to: create a new session node; and the session forwarding unit is further configured to: unload the pending session corresponding to the unloading type to the session fast table through the newly created session node.

[0129] In some embodiments, the session forwarding unit 604 is further configured to: determine the traffic corresponding to the session to be processed; determine the session corresponding to the traffic greater than a preset traffic threshold in the session to be processed as the target session; and unload the target session corresponding to the number of sessions to the session fast list based on the unloading type.

[0130] In some embodiments, the matching unit 602 is further configured to: match the target forwarding address with a preset session cache, and in response to the absence of a matching session cache entry, determine that the session cache match fails, and then call the preset session cache to match the target forwarding address, and in response to the absence of a matching session cache entry, determine that the match fails.

[0131] In some embodiments, the service processing device further includes Figure 6 The message modification unit not shown in the figure is configured to: in response to a successful match, obtain a key-value pair in the matched table entry; modify the message corresponding to the to-be-processed session based on the key-value pair, and then forward the modified message.

[0132] In some embodiments, the service processing device further includes Figure 6 The session deletion unit not shown in the figure is configured to: in response to the uninstall type being full uninstall, set an expiration time for the timer of the session cache to perform a deletion operation on the corresponding session when the expiration time is reached.

[0133] In some embodiments, the service processing device further includes Figure 6 The timer reset unit not shown in the figure is configured to: in response to the unloading type being semi-unloading, call the session fast table to send heartbeat messages regularly to reset the timer of the session slow table entry to keep the remaining pending sessions in the session slow table alive.

[0134] In some embodiments, the service processing device further includes Figure 6 The session deletion unit not shown in the figure is configured to: in response to receiving a session timeout message, perform a corresponding session deletion operation.

[0135] It should be noted that the business processing method and the business processing device of the present application have a corresponding relationship in terms of specific implementation content, so the repeated content will not be described again.

[0136] Figure 7 An exemplary system architecture 700 is shown to which the service processing method or service processing device according to the embodiment of the present application can be applied.

[0137] like Figure 7As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0138] Users can use terminal devices 701, 702, and 703 to interact with server 705 through network 704 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0139] The terminal devices 701, 702, and 703 may be various electronic devices having a service processing screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0140] Server 705 can be a server that provides various services, such as a background management server that provides support for business processing requests submitted by users using terminal devices 701, 702, and 703 (only as an example). The background management server can obtain the pending session and the target forwarding address corresponding to the pending session; match the target forwarding address with the preset session table entry, and in response to the match failure, obtain the attribute identifier corresponding to the target forwarding address, and in response to the newly created data flow corresponding to the attribute identifier, obtain the global water level information of the session cache; determine the number of pending sessions unloaded to the session cache according to the global water level information of the session cache; determine the unloading type based on the number of sessions, unload the pending session to the session cache based on the unloading type, and then forward the unloaded session to the session cache to the server corresponding to the corresponding target forwarding address. After the session table entry fails to match, the number of sessions that need to be unloaded to the session cache is determined according to the global water level information of the session cache, and then the unloading type is determined according to the number of sessions, and the corresponding session unloading and session forwarding are performed according to the unloading type. Maximize the use of storage and performance resources to achieve high-speed forwarding, large table entry turnover, and low forwarding latency.

[0141] It should be noted that the business processing method provided in the embodiment of the present application is generally executed by the server 705 , and accordingly, the business processing device is generally set in the server 705 .

[0142] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0143] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 of a terminal device suitable for implementing an embodiment of the present application. Figure 8 The terminal device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0144] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the computer system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0145] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.

[0146] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present application are executed.

[0147] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. Computer-readable storage media may include, for example, but are not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0148] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0149] The units involved in the embodiments described in the present application may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes a receiving unit, a matching unit, a session number determination unit, and a session forwarding unit. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0150] As another aspect, the present application also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device obtains the to-be-processed session and the target forwarding address corresponding to the to-be-processed session; matches the target forwarding address with the preset session table item, and in response to the match failure, obtains the attribute identifier corresponding to the target forwarding address, and in response to the attribute identifier corresponding to the newly created data flow, obtains the global water level information of the session cache; determines the number of to-be-processed sessions to be unloaded into the session cache according to the global water level information of the session cache; determines the unloading type based on the number of sessions, unloads the to-be-processed session into the session cache based on the unloading type, and then forwards the unloaded session into the session cache to the server corresponding to the corresponding target forwarding address.

[0151] According to the technical solution of the embodiment of the present application, after the session table entry fails to match, the number of sessions that need to be unloaded to the session fast table is determined according to the global water level information of the session fast table, and then the unloading type is determined according to the number of sessions, and the corresponding session unloading and session forwarding are performed according to the unloading type. The storage and performance resources are maximized to achieve high-speed forwarding, large table entry turnover, and low forwarding latency.

[0152] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A load balancing method, characterized in that: include: Obtaining a session to be processed and a target forwarding address corresponding to the session to be processed; Matching the target forwarding address with a preset session table entry, in response to a match failure, obtaining an attribute identifier corresponding to the target forwarding address, and in response to the attribute identifier corresponding to a newly created data flow, obtaining global water level information of the session cache; Determine the number of pending sessions to be unloaded into the session cache according to the global water level information of the session cache; Determine an unloading type based on the number of sessions, unload the pending sessions to the session fast table based on the unloading type, and in response to the unloading type being semi-unloading, call the session fast table to periodically send heartbeat messages to reset the timer of the session slow table entry so that the remaining pending sessions in the session slow table survive, and then forward the sessions unloaded to the session fast table to the server corresponding to the corresponding target forwarding address.

2. The method according to claim 1, characterized in that After the newly created data stream corresponding to the attribute identifier is created in response to the attribute identifier, the method further includes: Create a new session node; and The step of unloading the to-be-processed session to a session cache based on the unloading type includes: The to-be-processed session corresponding to the offloading type is offloaded to the session cache through the newly created session node.

3. The method according to claim 1, characterized in that The step of unloading the to-be-processed session to a session cache based on the unloading type includes: Determining the flow corresponding to the session to be processed; Determine a session corresponding to a flow rate greater than a preset flow rate threshold among the to-be-processed sessions as a target session; Based on the offloading type, target sessions corresponding to the number of sessions are offloaded to a session cache.

4. The method according to claim 1, characterized in that: Before obtaining the attribute identifier corresponding to the target forwarding address, the method includes: The target forwarding address is matched with a preset session cache. In response to the absence of a matching session cache entry, it is determined that the session cache match fails. The preset session cache is then called to match the target forwarding address. In response to the absence of a matching session cache entry, it is determined that the match fails.

5. The method according to claim 1, characterized in that The method further comprises: In response to a successful match, obtaining a key-value pair in the matched table entry; The message corresponding to the session to be processed is modified based on the key-value pair, and the modified message is then forwarded.

6. The method according to claim 1, characterized in that After unloading the to-be-processed session to the session cache based on the unloading type, the method further includes: In response to the uninstallation type being a full uninstallation, a timeout aging time is set for the timer of the session cache so as to perform a deletion operation on the corresponding session when the timeout aging time is reached.

7. The method according to claim 1, characterized in that The method further comprises: In response to receiving the session timeout message, a corresponding session deletion operation is performed.

8. A service processing device, characterized in that: include: A receiving unit, configured to obtain a session to be processed and a target forwarding address corresponding to the session to be processed; a matching unit configured to match the target forwarding address with a preset session table entry, obtain an attribute identifier corresponding to the target forwarding address in response to a match failure, and obtain global water level information of the session cache in response to the attribute identifier corresponding to a newly created data flow; a session quantity determination unit configured to determine the number of pending sessions to be unloaded into the session cache according to the global water level information of the session cache; The session forwarding unit is configured to determine the unloading type based on the number of sessions, unload the pending sessions to the session fast table based on the unloading type, and in response to the unloading type being semi-unloading, call the session fast table to periodically send heartbeat messages to reset the timer of the session slow table entry so that the remaining pending sessions in the session slow table survive, and then forward the sessions unloaded to the session fast table to the server corresponding to the corresponding target forwarding address.

9. The device according to claim 8, characterized in that The device also includes a new construction unit configured to: Create a new session node; and The session forwarding unit is further configured to: The to-be-processed session corresponding to the offloading type is offloaded to the session cache through the newly created session node.

10. A business processing electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method and device for realizing accelerated forwarding, terminal and storage medium

    CN111641530A

  • Message forwarding method, apparatus and device, and computer readable storage medium

    CN113765804A