Method and electronic device for real-time strong consistency session synchronization
Direct synchronization of session information in the data center through RDMA technology, solving the problems of real-time and low efficiency of session synchronization in the prior art, achieving high availability and scalability, and ensuring the reliability of the data center network.
Patent Information
- Application Number
- CN202210336487.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2042-03-31
AI Technical Summary
Existing session synchronization technology in data centers is due to the bandwidth and latency limitations introduced by classic network and kernel network protocol stacks, resulting in low real-time and efficiency, affecting the high availability and scalability of the system, especially in the event of node failure or performance bottlenecks. Failure to synchronize session information in time, resulting in service outage or performance degradation.
Using RDMA (Remote Direct Memory Access) technology to directly synchronize session information between multiple nodes, reducing data copying and CPU load, and real-time strong consistency sessions are achieved by allocating memory areas on each processing core and registering them with the RDMA adapter. synchronous.
It improves the real-time and efficiency of session synchronization, ensures high availability and scalability of the system, avoids service interruptions caused by node failures or performance bottlenecks, and enhances the reliability of the data center network.
Smart Images

Figure CN114885007B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data center and distributed and cloud network technology, and in particular, to a method and device, an electronic device and a computer-readable medium for real-time strong consistency session synchronization. Background Art
[0002] In a data center that includes multiple network element component nodes (such as load balancing components, firewall components with load balancing functions, etc.) or a cluster that includes multiple service nodes, when a client request reaches a node, the node will create a session to identify the current connection and the state of the connection, and complete subsequent communications based on the session retention mechanism. For example, in a data center cloud network environment, when a client sends a TCP request to access a backend server through a load balancing component, a session is created on the load balancing component to identify the TCP connection established with the backend server, thereby distinguishing which client each request comes from and which server the destination is.
[0003] In addition, in order to achieve high availability, session synchronization is generally performed between multiple nodes. In this way, on the one hand, when a node fails, other nodes can use the synchronized session information to continue to provide services, ensuring that the client's access to the backend server is not interrupted, thereby ensuring disaster recovery and / or improving the reliability of the load balancing system. On the other hand, when a node reaches a performance bottleneck, service requests can be distributed to other nodes, and other nodes can use the synchronized session information to seamlessly provide normal services to users, thereby expanding the overall performance of the system.
[0004] Existing session synchronization technologies usually choose to periodically batch-copy session information of each node in the session synchronization system, taking into account the bandwidth and latency limitations introduced by classic networks and kernel network protocol stacks. When a node fails during a synchronization cycle, the newly created sessions on the node during the synchronization cycle are disconnected due to failure to synchronize in time, affecting availability.
[0005] Therefore, it is necessary to develop new session synchronization solutions to improve system availability. Summary of the invention
[0006] The present application aims to provide a method and device for real-time strong consistency session synchronization, a compilation method and device, and an electronic device, which can improve the real-time performance and efficiency of session synchronization and improve the high availability and scalability of the system.
[0007] The user features and advantages of the present application will become apparent from the following detailed description, or may be learned in part from the practice of the present application.
[0008] According to one aspect of the present application, a method for real-time strongly consistent session synchronization is provided, which is applied to a node in a session synchronization system, wherein the node includes one or more processing cores and an RDMA adapter, and the method includes: allocating a memory area for storing session information to each processing core; registering the corresponding memory area to the RDMA adapter on each processing core; registering the node on other nodes in the session synchronization system; and performing session synchronization through RDMA between the processing core of the node and the corresponding processing cores of other nodes that require session synchronization.
[0009] According to another aspect of the present application, a method for real-time strongly consistent session synchronization is provided, which is applied to a node in a session synchronization system, wherein the node includes one or more processing cores and an RDMA adapter, and the method includes: receiving a session request from a client; establishing a first session according to the session request, and storing session information of the first session in the memory of the node; and synchronizing the session information of the first session between the node and other nodes in the session synchronization system via RDMA.
[0010] According to another aspect of the present application, a node for real-time strong consistency session synchronization is provided, which is configured in a session synchronization system, wherein the node includes: one or more processing cores, an RDMA adapter, a node controller, a session controller, and a free slot management metadata module, wherein: the node controller is used to maintain and control the nodes in the session synchronization system; the session controller is used to perform session synchronization through RDMA between the processing core of the node and the corresponding processing cores of other nodes that require session synchronization; the free slot management metadata module is used to maintain metadata of free memory slots, wherein the node controller includes: an allocation module, which is used to allocate a memory area for session information to each processing core; an RDMA registration module, which is used to register the corresponding memory area on each processing core to the RDMA adapter; a node registration module, which is used to register the node on other nodes in the session synchronization system; and a node information module, which is used to maintain relevant information of all nodes in the session synchronization system.
[0011] According to another aspect of the present application, a node for real-time strong consistency session synchronization is provided, which is configured in a session synchronization system, wherein the node includes: one or more processing cores, an RDMA adapter, a node controller, a session controller, and a free slot management metadata module, wherein: the node controller is used to maintain and control the nodes in the session synchronization system; the session controller is used to perform session synchronization through RDMA between the processing core of the node and the corresponding processing cores of other nodes that require session synchronization; the free slot management metadata module is used to maintain metadata of free memory slots, wherein the session controller includes: a session request module, which is used to receive a session request from a client; a session establishment module, which is used to establish a first session according to the session request, and the session information of the first session is stored in the memory of the node; and a session synchronization module, which is used to synchronize the session information of the first session between the node and other nodes in the session synchronization system through RDMA.
[0012] According to another aspect of the present application, an electronic device is provided, comprising: one or more processing units; a storage unit 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 aforementioned method.
[0013] According to another aspect of the present application, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the aforementioned method is implemented.
[0014] According to some embodiments of the present application, a method for real-time strongly consistent session synchronization is proposed, which can synchronize session information between multiple nodes through RDMA, reduce data copying during session synchronization, and reduce the CPU load of the node, thereby ensuring the real-time and strong consistency of session synchronization.
[0015] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above and other objects, features and advantages of the present application will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.
[0017] Figure 1 A schematic diagram showing an application scenario of the technical solution of the present application.
[0018] Figure 2 A flow chart of a method for real-time strongly consistent session synchronization according to an embodiment of the present application is shown.
[0019] Figure 3A A diagram showing a model of internal memory areas of a multi-core node according to an example embodiment.
[0020] Figure 3B A diagram showing a model for session synchronization via RDMA.
[0021] Figure 4A Shown is the structure of a piece of session information according to an exemplary embodiment.
[0022] Figure 4B The structure of a session synchronization message according to an example embodiment is shown.
[0023] Figure 5 The following illustrates a process in which a new node performs full session synchronization according to an example embodiment.
[0024] Figure 6 A flow chart illustrating a method for real-time strongly consistent session synchronization according to an example embodiment.
[0025] Figure 7 A flowchart of a method for a locking mechanism to avoid memory slot conflicts according to an example embodiment is shown.
[0026] Figure 8 The timing process of session synchronization when a new session is created according to an example embodiment is shown.
[0027] Fig. 9 A timing process of session synchronization when a session is deleted according to an example embodiment is shown.
[0028] Fig.10 A synchronization node according to an exemplary embodiment of the present application is shown.
[0029] Fig.11 A block diagram of an electronic device according to an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0030] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this application will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0031] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0032] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0033] In high-availability systems including multiple nodes such as cloud computing, session synchronization technology is usually used to achieve disaster recovery functions such as redundant switching or horizontal expansion. Currently, the commonly used session synchronization methods include periodic batch replication, state-triggered replication, multicast replication and / or unicast replication. However, these solutions either cannot meet the real-time requirements due to the bandwidth and latency limitations introduced by the classic network and kernel network protocol stack, or reduce the real-time and efficiency due to the need for CPU participation in the calculation during the session synchronization process, or do not meet the real-time requirements due to batch operations or triggered operations, resulting in reduced system high availability.
[0034] To this end, this application proposes a method for real-time strong consistency session synchronization, in which session information is stored in the memory of each node of the session synchronization system, and multiple nodes use RDMA for session synchronization. The sender sends the session information created locally by the client to all other receivers, and the receiver inserts the session information synchronized by the sender into the local memory slot. In this way, data copying during session synchronization can be reduced, and the CPU load of the node can be reduced, thereby providing a basic guarantee for the real-time and strong consistency of session synchronization.
[0035] Before describing the embodiments of the present application, some terms involved in the embodiments of the present application are explained.
[0036] RDMA: Remote Direct Memory Access is a technology that bypasses the host operating system kernel and network protocol stack of both communicating parties to directly access a specific remote memory area. Since it does not go through the operating system, it not only saves a lot of CPU resources, but also improves system throughput and reduces the system's network communication latency. It is especially suitable for large-scale parallel computer clusters. In specific remote memory read and write, the RDMA operation includes the remote virtual memory address used for read and write operations in the RDMA message for transmission. All the remote application needs to do is register the corresponding memory buffer in its local network card. The CPU of the remote node does not provide services during the entire RDMA data transmission process except for connection establishment, registration call, etc., so it does not bring any load. Currently, the network protocols that support RDMA include InfiniBand (IB), RoCE (RDMA over Converged Ethernet based on Converged Ethernet) and iWARP (Internet Wide Area RDMA Protocol, based on TCP). IB is a new generation of network protocols that supports RDMA from the beginning. Since this is a new network technology, network cards and switches that support this technology are required. RoCE is a network protocol that allows RDMA over Ethernet. This protocol allows RDMA to be used on standard Ethernet infrastructure (switches), but the network card is a special network card that supports RoCE. iWARP is a network protocol that allows RDMA over TCP. This protocol allows RDMA to be used on standard Ethernet infrastructure (switches), but the network card needs to support iWARP.
[0037] Session: refers to the information exchange process between network nodes. In order to complete the information exchange, network nodes need to establish a temporary connection between session layer entities according to certain rules, namely, a "session connection". For example, the session connection can be a TCP connection.
[0038] Session Synchronize: It is commonly used in distributed systems, allowing multiple nodes in the distributed system to provide the same service to the outside world at the same time. On the one hand, it can horizontally expand the external service capabilities of the cluster. On the other hand, it also allows the cluster to tolerate the downtime of some nodes, thereby improving the availability and reliability of the distributed system.
[0039] Processing core: A CPU or CPU core or similar processor that performs one or more tasks such as message forwarding and processing.
[0040] The technical solution of the present application is described in detail below with reference to the embodiments.
[0041] Figure 1 A schematic diagram showing an application scenario of the technical solution of the present application.
[0042] like Figure 1 As shown, in one computing scenario, the entire system includes multiple clients 101a and 101b, a session synchronization system 105, a control node or control plane 107, and multiple backend servers 109a and 109b.
[0043] See also Figure 1 , through the traffic distribution of the switch, node A or node B in the session synchronization system 105 receives session requests from multiple clients 101a and / or 101b, selects the backend server 109a or 109b according to a predetermined rule, establishes a session connection and maintains the session. Subsequent messages from the same client will be forwarded to the same backend server. At the same time, session synchronization is performed between node A and node B, so that when one of the nodes fails, the other node can seamlessly provide services, making the system service highly reliable and highly available, and making it almost impossible for customers to perceive system failures, thereby improving customer experience.
[0044] exist Figure 1 In the embodiment, the clients 101a and 101b may include but are not limited to smart phones, tablet computers, portable computers, desktop computers, etc. In addition, according to some application scenarios, the clients 101a and 101b may also be other computing nodes or network nodes.
[0045] The session synchronization system 105 may be a load balancing system, for example, including a general load balancing component, and may also include a firewall component with a load balancing function. According to other embodiments, the session synchronization system 105 may also be a cluster system including multiple service nodes.
[0046] The back-end servers 109a and 109b may be transaction processing servers, Web servers, or database servers, etc.
[0047] The control node or control plane 107 can manage and control the session synchronization system 105, for example, controlling traffic diversion, traffic extraction, selection of primary and backup nodes, etc.
[0048] Easy to understand, Figure 1 The application scenarios and architectures shown are schematic and are used to make it easier for readers to understand the technical solutions of the present application. The technical solutions according to the embodiments of the present application described below can be applied to other similar scenarios and architectures that require session synchronization.
[0049] Figure 2 A flowchart of a method for real-time strong consistency session synchronization according to an exemplary embodiment of the present application is shown.
[0050] Figure 2 The method shown can be applied to reference Figure 1The method according to the example embodiment may be applied to a node in a session synchronization system, and the node may include one or more processing cores. Figure 2 When a node in the session synchronization system is added as a new node, it is first initialized in S201 and S203, and then registered on other nodes, and then session synchronization can be performed through RDMA. The following is a detailed description.
[0051] like Figure 2 As shown, in S201, a memory region MR for storing session information is allocated to each processing core.
[0052] According to an example embodiment, the allocated memory region MR is a physically contiguous memory.
[0053] According to some embodiments, each memory region MR may be further divided into a plurality of memory slots (see Figure 3A and Figure 3B ), and can have a fixed size. Each memory slot is used to store a session message, and a session message contains two parts: metadata and session content. Figure 4A Described in detail.
[0054] According to an embodiment, the method further includes maintaining metadata of free memory slots for allocating memory slots. For example, the number (slot_id) of the free slots on each processing core is managed in a memory pool manner. Each time a memory slot needs to be allocated, a number (slot_id) of a free slot is taken out from the memory pool (which may be data of int type). Each time a memory slot is released, the corresponding slot number (slot_id) is added to the memory pool.
[0055] By allocating session memory areas to each processing core and further subdividing memory slots, memory processing efficiency can be improved, which can further improve the real-time and efficiency of session synchronization, thereby achieving high-availability node disaster recovery and / or node expansion, and improving the reliability of the data center network.
[0056] At S203 , the corresponding memory area is registered with the RDMA adapter on each processing core.
[0057] When each processing core is allocated a memory region MR for session information in S201, a key pair (local key lkey and remote key rkey) of the memory region MR of each processing core can also be generated at the same time, pointing to the memory region MR that needs to be operated. The corresponding memory region is registered to the RDMA adapter through the local key lkey and the remote key rkey and other attribute parameters (starting address, length, etc.) of the memory region MR, and the remote operation of the corresponding memory region can be performed through RDMA.
[0058] In S205, the current node is registered on other nodes in the session synchronization system.
[0059] According to some embodiments, the current node may be registered on other nodes in the session synchronization system through http or rpc service requests, so that other nodes add the current node to the node list they maintain. The registration information may include the key of the memory region MR of each processing core on the current node (including the local key lkey and the remote key rkey), the IP address of the current node, the status of the current node, etc.
[0060] According to some embodiments, the state of the current node is set to appending, and then the current node is registered as a new node on other nodes in turn, and the state of the registered new node is set to appending. The node in the appending state allows receiving sessions synchronized from other nodes, and does not synchronize sessions to other nodes. At this time, other nodes can synchronize the memory slot where the newly created session is located to the memory slot at the corresponding position of the node in the appending state through RDMA.
[0061] Accordingly, according to example embodiments, the current node may also register other nodes in the session synchronization system thereon upon request.
[0062] In S207 , session synchronization is performed between the processing core of the current node and corresponding processing cores of other nodes that require session synchronization through RDMA.
[0063] According to the example embodiment, when performing session synchronization, the node synchronizes the session information stored in the memory slot of the memory area corresponding to the processing core to other nodes through RDMA, so that the other nodes save the synchronized session information to the corresponding memory slot of the memory area on the corresponding processing core. In addition, the node also receives the session information synchronized by other nodes through RDMA, and saves it to the corresponding memory slot of the memory area on the corresponding processing core in the node.
[0064] According to an example embodiment, when performing session synchronization, the node synchronizes the session information stored in the corresponding memory slot on the processing core to the corresponding memory slots on the corresponding processing cores of all other nodes via RDMA in the form of a session synchronization message.
[0065] According to some embodiments, each processing core on the current node added as a new node requests the full amount of sessions on the corresponding processing core from any existing node via RDMA and adds them to the local memory slot. In addition, the current node can also synchronize newly created or updated sessions on other nodes in real time.
[0066] According to some embodiments, after the current node is directed (e.g., through the control plane), it is allowed to process user traffic, respond to client requests to establish sessions, and synchronize locally newly created or updated sessions to other nodes via RDMA. For example, after the current node's state on all other nodes is set to running, the current node in the running state receives user traffic and synchronizes locally newly created or updated sessions to other nodes via RDMA.
[0067] According to some embodiments, the method further includes maintaining information and status of all nodes in the session synchronization system, including keys (including local keys lkey and remote keys rkey) of memory regions MR of each processing core on all nodes, IP addresses of all nodes, and status of all nodes (running, appending, and dying). Based on the maintained node information and status, the method according to the example embodiment can perform operations of adding nodes to the session synchronization system or deleting nodes therefrom, thereby achieving expansion and contraction of the system.
[0068] Figure 3A A model diagram showing a multi-core node internal memory area according to an example embodiment, Figure 3B A diagram showing a model for session synchronization via RDMA.
[0069] like Figure 3A As shown, the example node has multiple processing cores lcore_1, lcore_2, ..., lcore_n, and each processing core is allocated a physically continuous memory region MR_1, MR_2, ..., MR_n. Each memory region MR is further subdivided into multiple fixed-size memory slots, each for storing a session information.
[0070] like Figure 3B As shown, the processing core lcore_1 in the sender node Sender_1 creates a first session locally based on the client request and stores the first session information in the first memory slot of the memory area MR_1, and then synchronizes the first session information to all other receiver nodes Receiver_1 and Receriver_2 through RDMA. The receiver nodes Receiver_1 and Receriver_2 insert the first session information synchronized by the sender node Sender_1 into the corresponding local memory area, that is, the first memory slot of the memory area MR_1 on the corresponding processing core lcore_1.
[0071] Continue to see Figure 3BAfter the processing core lcore_2 in the sender node Sender_1 updates the second session locally based on the client request and updates the second session information stored in the third memory slot of the memory area MR_2, the second session information is synchronously updated to all other receiver nodes Receiver_1 and Receriver_2 through RDMA. The receiver nodes Receiver_1 and Receriver_2 insert the second session information synchronized by the sender node Sender_1 into the corresponding local memory slot, that is, the third memory slot of the memory area MR_2 on the corresponding processing core lcore_2.
[0072] Figure 4A shows the structure of a piece of session information according to an exemplary embodiment, Figure 4B The structure of a session synchronization message according to an example embodiment is shown.
[0073] See also Figure 4A A session message contains two parts: metadata meta and session content Session. Figure 4A The session information shown may be stored in a memory slot of the memory region MR.
[0074] The metadata includes version, core ID, and state. The metadata may also include node ID and memory slot ID.
[0075] The processing core number (ID) is used to identify the memory slot of which CPU core the session information is located.
[0076] The version is used to identify the latest version of the session. Each time the session status is updated, its corresponding version increases by 1.
[0077] The session state is the state of the session connection, such as the connection state during the three-way handshake and four-way handshake of a TCP connection.
[0078] The node number (machine_uuid_x) may uniquely represent a node in the session synchronization system, and the memory slot number (slot_id) may represent a memory slot position of a session on a corresponding processing core ID on the node (machine_uuid_x).
[0079] The session content Session includes the original flow origin_flow, the return flow reply_flow, the transaction type tag flag, and the session creation timestamp create_time.
[0080] The origin_flow is used to mark the data flow from the client to the backend server. The reply_flow is used to mark the data flow from the backend server back to the client. Each data flow contains the IP protocol type, source IP, destination IP, four-layer protocol type, source port, destination port (if it is an overlay network, the tunnel ID is also required).
[0081] The transaction type tag flag is used to identify which user-defined transaction the current session belongs to.
[0082] The session creation timestamp create_timestamp is the timestamp when the session is created.
[0083] Since each processing core in each node in the session synchronization system independently provides services to users, according to some other embodiments, the metadata meta may also include a lock and a timer timer to avoid conflicts caused by the same processing core on different nodes using the same memory slot when creating a new session, as described in detail later with reference to FIG. 7.
[0084] See also Figure 4B ,A session synchronization message includes a header and a session information part. The session synchronization message header contains the target memory area number (ID), the target remote key rkey and the target memory slot number (ID). These fields in the session synchronization header are used to transmit verification information and the target memory address to the target node.
[0085] Figure 5 The following illustrates a process in which a new node performs full session synchronization according to an example embodiment.
[0086] According to an example embodiment, after a new node is registered with other nodes in the session synchronization system, full session synchronization may be performed.
[0087] See also Figure 5 , at S501, a full session is requested.
[0088] According to an example embodiment, after a new node is registered with other nodes in the session synchronization system, each processing core on the new node requests full session information on the corresponding processing core from any existing node through RDMA.
[0089] At S503 , the memory slots are filled.
[0090] According to an example embodiment, before requesting a full session, the new node has been registered on other nodes and is in an appending state. When requesting a full session, the newly created sessions on other nodes at the same time can also be synchronized in real time, thereby providing support for strong consistency. If a new session synchronized from other nodes is already stored in a certain memory slot at this time, the memory slot may be overwritten when requesting a full session. In order to ensure the correctness of the session, according to some embodiments, each memory slot can be filled according to the following rules.
[0091] (1) If the current memory slot is idle, write the session information of the corresponding memory slot synchronized via RDMA.
[0092] (2) If the current memory slot already contains a session, determine whether the session information of the corresponding memory slot synchronized via RDMA should be written based on the version of the session information.
[0093] If the version field of the current memory slot session information is greater than or equal to the version field of the synchronized session information, the current memory slot is skipped.
[0094] If the version field of the current memory slot session information is smaller than the version field of the synchronized session information, the session information synchronized via RDMA is written to the corresponding memory slot.
[0095] At S505, the node status is updated.
[0096] According to the example embodiment, after the full session synchronization is completed, the state of the new node can be set to running on all nodes, so that the new node will have the ability to create a new session locally and synchronize the newly created session to other nodes. After the new node is directed, it can process user requests, create a new session locally, and synchronize the session through RDMA.
[0097] Figure 6 A flowchart of a method for real-time strong consistency session synchronization according to an exemplary embodiment of the present application is shown.
[0098] See also Figure 6 , at S601, a session request from a client is received.
[0099] After the nodes in the session synchronization system are directed, they can receive session requests from the client. When the client sends a new connection request to the backend server, the request will first pass through the processing core of the node hit in the session synchronization system.
[0100] In S603, a first session is established according to the session request, and session information of the first session is stored in the memory of the node.
[0101] After receiving a session request from a client, a processing core creates a new session locally, such as a first session, and determines a free slot from a corresponding memory area according to the maintained free slot management metadata, and stores the session information in the free slot.
[0102] In S605 , the session information of the first session is synchronized between the node and other nodes in the session synchronization system through RDMA.
[0103] After storing the session information of the newly created first session in the free slot, the session information can be synchronized to other nodes through RDMA. Other nodes insert the synchronized session information into the corresponding local memory, that is, the corresponding memory slot of the memory area on the corresponding processing core.
[0104] Accordingly, according to the exemplary embodiment, the node also receives session information synchronized from other nodes through RDMA.
[0105] According to some embodiments, after the session state of the first session is established, the session information of the first session is synchronized via RDMA. In this way, invalid session synchronization is not performed when the session connection establishment fails, and the throughput of the session synchronization system, such as the processing capacity of new connections per second, can be improved.
[0106] According to some embodiments, when a memory slot on a processing core receives session information synchronized from multiple nodes, the session with the largest version number may be selected. A larger version number means a newer session state.
[0107] According to some embodiments, when the session state of the first session changes, the updated session information is synchronized to other nodes in the session synchronization system via RDMA before message forwarding is performed. Each time the session state changes, the version is increased (for example, by 1), and then the memory slot where the updated session information is located is synchronized to the memory slot at the same position in other nodes via RDMA, and then the user message request is forwarded to the back-end server. In other words, after other nodes have completed the synchronous update of the session information normally and confirmed it, the message confirmation forwarding is performed. In this way, it can be ensured that the corresponding session information on each node in the session synchronization system maintains strong consistency before or after the session synchronization process.
[0108] If the current node fails during the session synchronization process, the current node will not forward the message that causes the session state to change because the session synchronization has not been completed. In this way, after the message times out and is retransmitted, it will fall on other normal nodes and the node will perform session synchronization and forward the message.
[0109] According to some embodiments, when the current node performs session synchronization, the session synchronization for another node (e.g., the second node) that has failed will fail. At this time, the current node will retry the session synchronization for the second node. After three unsuccessful retries, the second node is considered to be faulty and can be deleted. First, the second node is de-streamed so that user traffic is no longer imported into the second node to be deleted. Then, the node is marked as dying in the current node, and other nodes in the session synchronization system are notified.
[0110] Figure 7 A flowchart of a method for a locking mechanism to avoid memory slot conflicts according to an example embodiment is shown.
[0111] Each processing core in each node of the session synchronization system provides services independently. Therefore, in order to avoid conflicts caused by the corresponding processing cores on different nodes using the corresponding memory slots at the same location when creating new sessions, memory slot grouping or distributed lock mechanism can be used. Common distributed lock implementation methods include database-based implementation, Redis-based implementation, zooKeeper-based implementation, etc.
[0112] According to the example embodiment of the present application, a multi-core distributed lock mechanism is adopted to reduce the dependence on external systems and improve the performance of distributed locks. In this embodiment, the metadata meta of the session information includes locks and timers. During the deployment phase of the session synchronization system or when the master node is abnormal, the upper control plane specifies or randomly selects a normal node as the master node in the session synchronization system, and registers the selected master node with other nodes.
[0113] See also Figure 7 , in S701, obtain the free slot of the master node and lock and timer.
[0114] When synchronizing the newly created session of the current node to other nodes, if the current node is the master node in the session synchronization system, a free slot is directly obtained from the memory area corresponding to the processing core K according to the free slot management metadata, the free slot is locked, and a timer is set. For example, the timer can be set according to the TCP protocol configuration.
[0115] If the current node is not the master node in the session synchronization system, a free slot M is obtained from the memory area corresponding to the processing core K in the master node, the master node locks the free slot, and sets a timer, for example, the timer can be set according to the TCP protocol configuration. In S703, the current node fills the corresponding memory slot M with session information, and synchronizes the session information to other nodes. If the synchronization is completed, go to S707; if the synchronization is not completed, go to S709.
[0116] In S707, the session synchronization is completed and the timer is reset.
[0117] If the current node completes the session synchronization within the time period specified by the timer, it will notify the master node to reset the timer of the memory slot M on the processing core K, for example, resetting the timer according to the TCP protocol configuration.
[0118] In S709 , the session synchronization is not completed and the memory slot is released.
[0119] If the node fails to complete the session synchronization within the time period specified by the timer, the master node unlocks and releases the memory slot M on the processing core K, and notifies all nodes to release the corresponding memory slot M, thereby avoiding deadlock.
[0120] At S711, the session is completed and the memory slot is released.
[0121] After the session cycle is completed, the current node notifies the master node to unlock and release the memory slot, and the master node then notifies all nodes to release the memory slot.
[0122] Figure 8 The timing process of session synchronization when a new session is created according to an example embodiment is shown.
[0123] Figure 8 The process shown in the figure can apply the aforementioned session synchronization scheme according to the embodiment of the present application, but it is easy to understand that the aforementioned session synchronization method according to the embodiment of the present application is not limited to Figure 8 Application shown.
[0124] (1) See Figure 8 , the client sends a handshake Syn packet to a node N in the session synchronization system. Node N will hash the Syn packet to a processing core core_k according to the network card RSS (receive side scaling) rule. The processing core requests a free slot from the corresponding processing core on the master node (based on the free slot management metadata), locks the free slot and sets a timer.
[0125] (2) Node N removes the free slot number (slot_id) requested from the master node from the free slot management metadata of the current node, and fills the free slot with session information. The processing core number cpu_id in the information is k, the version version is 1, and the session state state is receiving syn_recv.
[0126] (3) Node N forwards a handshake Syn packet to the backend server.
[0127] (4) The backend server replies with a Syn+Ack packet of the secondary handshake to node N. After node N searches and hits the session on processing core core_k, it directly forwards the Syn+Ack packet of the secondary handshake to the client.
[0128] (5) The client replies with an Ack packet of the three-way handshake to node N. Node N searches for and hits the session on processing core core_k again, updates the version field in the session information to 2, and updates the session state field to the establish state.
[0129] (6) Node N synchronizes the memory slot where the session information is located on the processing core core_k to all other nodes via RDMA in the form of a session synchronization message. The session synchronization message carries the remote key rkey of the destination node and the target memory slot number (slot_id). After all other nodes synchronize the session information in the corresponding memory slot, they return a confirmation message to node N.
[0130] (7) After node N waits to receive confirmation messages from all other nodes, it forwards the Ack packet of the three-way handshake to the client.
[0131] (8) Node N resets the timer of the session information in the corresponding memory slot on the processing core core_k of the master node.
[0132] Fig. 9 A timing process of session synchronization when a session is deleted according to an example embodiment is shown.
[0133] Fig. 9 The process shown in the figure can apply the aforementioned session synchronization scheme according to the embodiment of the present application, but it is easy to understand that the aforementioned session synchronization method according to the embodiment of the present application is not limited to Fig. 9 Application shown.
[0134] (1) The client sends a Fin packet to node N in the session synchronization system. Node N searches for and hits the corresponding session on the processing core core_k, increments the version field of the session information by 1 to 3, and updates the session state field to fin_wait.
[0135] (2) Node N synchronizes the updated session information of the session to all other nodes through RDMA. All other nodes compare the synchronized session information with the version field of the session information in the corresponding local memory slot. If the version field of the synchronized session information is found to be greater than the version field of the existing corresponding session information, the corresponding memory slot is updated and a confirmation message is sent to node N.
[0136] (3) After node N receives the confirmation messages sent by all other nodes, it forwards a Fin packet of handshake to the backend server.
[0137] (4) The backend server replies with the second wave Ack packet to node N. Node N updates the corresponding session information, the version field is incremented by 1 to 4, and the session state field is updated to the close_wait state.
[0138] (5) Node N synchronizes the updated session to other nodes in the same way as in (2), and after receiving confirmation messages from all other nodes, it forwards the Ack packet of the second wave to the client.
[0139] (6) After the backend server completes sending the data to be transmitted, it sends a Fin+Ack packet with three waves to node N. At this time, node N does not need to update the session state, and directly forwards the Fin+Ack packet with three waves to the client.
[0140] (7) The client sends an Ack packet with four waves to node N. After receiving the Ack packet with four waves, node N increases the version field of the session information by 1 to 5, and updates the session state field to the time waiting time_wait.
[0141] (8) Node N synchronizes the updated session information to other nodes in the same way as in (2), and after receiving the confirmation messages sent by all other nodes, it forwards the four-wave Ack packet to the backend server.
[0142] (9) After waiting for twice the maximum message lifetime (2MSL), node N increases the version field of the session information by 1 to 6, and updates the session state field to close. The updated session information is then synchronized to other nodes in the same way as in (2).
[0143] (10) Node N notifies the master node to unlock and release the memory slot corresponding to the session information, and the master node then notifies all other nodes in the session synchronization system to release the memory slots at the corresponding positions.
[0144] According to the embodiment, the node periodically releases the session information in the closed state, thereby freeing up the corresponding memory slot position for the subsequent newly created session.
[0145] The above mainly introduces the embodiments of the present application from the perspective of the method. Those skilled in the art should easily appreciate that, in combination with the operations or steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Those skilled in the art can use different ways to implement the described functions for each specific operation or method, and such implementation should not be considered to be beyond the scope of the present application.
[0146] The following describes the device embodiments of the present application. For details not described in the device embodiments of the present application, reference can be made to the method embodiments of the present application.
[0147] Fig.10 A synchronization node according to an exemplary embodiment of the present application is shown, and the synchronization node implements the above-mentioned real-time strong consistency session synchronization method.
[0148] like Fig.10 As shown, the synchronization node 1000 according to the exemplary embodiment includes a node controller 1010, a session controller 1030, and a free slot management metadata module 1050. The synchronization node 1000 may include one or more processing cores and an RDMA adapter.
[0149] The node controller 1010 is used to maintain and control the nodes in the session synchronization system. According to an example embodiment, the node controller 1010 maintains the keys (including local keys lkey and remote keys rkey) of the memory area on each forwarding core of all nodes in the session synchronization system, the IP addresses of all nodes, and the status of all nodes. The node controller allows adding / deleting nodes to the session synchronization system to achieve expansion and contraction.
[0150] According to example embodiments, the node controller 1010 may include an allocation module 1011 , an RDMA registration module 1013 , a node registration module 1015 , and a node information module 1017 .
[0151] The allocation module 1011 is used to allocate a memory area for session information to each processing core.
[0152] The RDMA registration module 1013 is used to register the corresponding memory area with the RDMA adapter on each processing core.
[0153] The node registration module 1015 is used to register the node on other nodes in the session synchronization system.
[0154] The node information module 1017 is used to maintain the relevant information of all nodes in the session synchronization system.
[0155] The session controller 1030 is used to perform session synchronization between the processing core of the node and the corresponding processing core of other nodes that need session synchronization through RDMA. According to an example embodiment, the session controller 1030 manages and controls the synchronization of session information to other nodes through RDMA and receives and processes the session information synchronized by other nodes through RDMA. In addition, the session controller 1030 can provide an interface for adding, deleting, modifying, and checking sessions.
[0156] The session controller 1030 is configured to receive a session synchronization message. As mentioned above, the session synchronization message header includes verification information and a target memory address.
[0157] According to some embodiments, session controller 1030 obtains all other nodes in running state and appending state from node controller 1010. When a new session is created or the session state changes on a local processing core, the session information is synchronized to the memory slot at the same position on the corresponding processing core of other nodes via RDMA.
[0158] According to some embodiments, when a memory slot on a processing core receives session information synchronized from multiple nodes, the session controller 1030 takes the session with the largest version number. The larger the version number, the newer the session state. The version number may be increased by 1 each time the session state changes.
[0159] The session controller 1030 will periodically release the closed sessions to free up the corresponding memory slots for the subsequent newly created sessions.
[0160] According to some embodiments, the session controller 1030 may include a session request module 1031 , a session establishment module 1033 , and a session synchronization module 1035 .
[0161] The session request module 1031 is used to receive a session request from a client.
[0162] The session establishing module 1033 is used to establish a first session according to the session request, and the session information of the first session is stored in the memory of the node.
[0163] The session synchronization module 1035 is used to synchronize the session information of the first session between the node and other nodes in the session synchronization system through RDMA.
[0164] The free slot management metadata module 1050 is used to maintain metadata of free memory slots. As described above, the free slot management metadata module 1050 can manage the number (slot_id) of the free memory slots on each processing core in a memory pool manner, taking a free slot from the memory pool each time a memory slot needs to be allocated, and adding the corresponding number (slot_id) to the memory pool each time a memory slot is released.
[0165] The synchronization node according to this embodiment can perform functions similar to those of the method provided above. For other functions, reference can be made to the above description and will not be repeated here.
[0166] Fig.11 A block diagram of an electronic device according to an exemplary embodiment of the present application is shown.
[0167] Refer to the following Fig.11 The electronic device 200 according to this embodiment of the present application is described. Fig.11 The electronic device 200 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.
[0168] like Fig.11 As shown, the electronic device 200 is in the form of a general computing device. The components of the electronic device 200 may include, but are not limited to: at least one processing unit 210, at least one storage unit 220, a bus 230 connecting different system components (including the storage unit 220 and the processing unit 210), a display unit 240, etc.
[0169] The storage unit 220 stores program codes, and the program codes can be executed by the processing unit 210, so that the processing unit 210 executes the methods described in this specification according to various embodiments of the present application.
[0170] The storage unit 220 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 2201 and / or a cache memory unit 2202 , and may further include a read-only memory unit (ROM) 2203 .
[0171] The storage unit 220 may also include a program / utility 2204 having a set (at least one) of program modules 2205, such program modules 2205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0172] Bus 230 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0173] The electronic device 200 may also communicate with one or more external devices 300 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 200, and / or communicate with any device that enables the electronic device 200 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 250. Furthermore, the electronic device 200 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 260. The network adapter 260 may communicate with other modules of the electronic device 200 via the bus 230. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0174] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented.
[0175] The embodiment of the present application also provides a computer program product, which can be operated to enable a computer to execute some or all of the steps recorded in the above method embodiment.
[0176] Those skilled in the art can clearly understand that the technical solution of the present application can be implemented with the help of software and / or hardware. The "unit" and "module" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, a field programmable gate array (FPGA), an integrated circuit (IC), etc.
[0177] It should be noted that, for the sake of simplicity of description, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously.
[0178] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0179] The embodiments of the present application are described and explained in detail above. It should be clearly understood that the present application describes how to form and use specific examples, but the present application is not limited to any details of these examples. On the contrary, based on the teaching of the contents disclosed in the present application, these principles can be applied to many other embodiments.
[0180] Through the description of the example embodiments, it is easy for those skilled in the art to understand that the technical solution according to the embodiments of the present application has at least one or more of the following advantages.
[0181] According to some embodiments, by using RDMA to synchronize session information between multiple nodes, data copying during session synchronization can be reduced and the CPU load of the node can be reduced, thereby providing a basis and guarantee for the real-time and strong consistency of session synchronization.
[0182] According to some embodiments, by allocating a session memory area to each processing core and further subdividing the memory slots, the memory processing efficiency can be improved, thereby further ensuring the real-time performance and efficiency of session synchronization.
[0183] According to some embodiments, after other nodes have completed the synchronous update of session information normally and confirmed it, the message is forwarded for confirmation. In this way, it can be ensured that the corresponding session information on each node in the session synchronization system maintains strong consistency before or after the session synchronization process.
[0184] According to some embodiments, a multi-core distributed lock mechanism is adopted to reduce the dependence on external systems and improve the performance of distributed locks while avoiding memory slot conflicts.
[0185] According to some embodiments, through the real-time and strong consistency of session synchronization, high-availability node disaster recovery and / or node expansion are achieved, thereby improving the reliability of the data center network.
[0186] The foregoing content can be better understood in accordance with the following terms:
[0187] Clause 1. A method for real-time strong consistency session synchronization, applied to a node in a session synchronization system, the node comprising one or more processing cores and an RDMA adapter, characterized in that the method comprises:
[0188] Allocate a memory area for storing session information to each processing core;
[0189] Register the corresponding memory area to the RDMA adapter on each processing core;
[0190] registering the node on other nodes in the session synchronization system;
[0191] Session synchronization is performed between the processing core of the node and corresponding processing cores of other nodes that require session synchronization through RDMA.
[0192] Clause 2. The method of clause 1, characterized in that after allocating a memory area for storing session information to each processing core, the method further comprises:
[0193] The memory area is further divided into a plurality of memory slots, each memory slot being used to store a piece of session information.
[0194] Clause 3. The method as described in Clause 2, characterized in that session synchronization is performed between the processing core of the node and the corresponding processing cores of other nodes that need session synchronization through RDMA, including:
[0195] Synchronize the session information stored in the memory slot of the memory area corresponding to the processing core of the node to other nodes through RDMA, so that the other nodes save the synchronized session information to the corresponding memory slot of the memory area on the corresponding processing core; and / or
[0196] Receive session information synchronized from other nodes via RDMA, and save it to the corresponding memory slot of the memory area on the corresponding processing core in the node.
[0197] Clause 4. The method as described in Clause 2 is characterized in that the session information includes: metadata and session content, and the metadata includes version, processing core number and session status.
[0198] Clause 5. The method as described in Clause 4, characterized in that session synchronization is performed between the processing core of the node and the corresponding processing cores of other nodes that need session synchronization through RDMA, including:
[0199] The session information stored in the memory slot of the corresponding memory area on the processing core of the node is synchronized to the corresponding memory slots on the corresponding processing cores of all other nodes through RDMA in the form of session synchronization messages.
[0200] Clause 6. The method as described in Clause 5 is characterized in that the session synchronization message includes a header and session information, and the header includes a target memory area number, a target remote key and a target memory slot number.
[0201] Clause 7. The method as described in Clause 4, characterized in that session synchronization is performed between the processing core of the node and the corresponding processing cores of other nodes that need session synchronization through RDMA, including:
[0202] Synchronize the full session on other nodes to the node.
[0203] Clause 8. The method as described in Clause 7, characterized in that synchronizing the full session on other nodes to the node comprises:
[0204] Each processing core on the node requests full session information on the corresponding processing core from other nodes via RDMA;
[0205] Filling the full session information into a corresponding memory slot of a memory area of a corresponding processing core on the node;
[0206] After the full session synchronization is completed, the status of the node is updated on all nodes.
[0207] Clause 9. The method as described in Clause 8, characterized in that filling the full session information into a corresponding memory slot of a memory area of a corresponding processing core on the node comprises:
[0208] When the corresponding memory slot is idle, writing the session information of the corresponding memory slot synchronized via RDMA;
[0209] In the case where the corresponding memory slot already contains a session, whether to write the session information of the corresponding memory slot synchronized via RDMA is determined according to the version of the session information:
[0210] If the version of the session information in the corresponding memory slot is greater than or equal to the version of the synchronized session information, skip the corresponding memory slot;
[0211] If the version of the session information in the corresponding memory slot is smaller than the version of the synchronized session information, the session information synchronized through RDMA is written to the corresponding memory slot.
[0212] Clause 10. The method as described in Clause 4, characterized in that session synchronization is performed between the processing core of the node and the corresponding processing cores of other nodes that need session synchronization through RDMA, including:
[0213] Responding to a client request to create a session, synchronizing the newly created session to other nodes via RDMA; and / or
[0214] Respond to client requests to update the created session and synchronize the updated session to other nodes via RDMA; and / or
[0215] Receive sessions synchronized from other nodes via RDMA.
[0216] Clause 11. The method of clause 10, wherein the session created synchronously to other nodes via RDMA comprises:
[0217] After the session state of the session is the established state, the session is synchronized to other nodes through RDMA.
[0218] Clause 12. The method of clause 10, wherein the updating of the created session in response to the client request and synchronizing the updated session to other nodes in the session synchronization system via RDMA comprises:
[0219] When the session state of the session changes, the updated session information is synchronized to other nodes in the session synchronization system through RDMA, and then the message forwarding in the session update process is performed.
[0220] Clause 13. The method according to clause 10, characterized in that:
[0221] The metadata also includes: locks and timers;
[0222] A node in the session synchronization system is determined as a master node.
[0223] Clause 14. The method of clause 13, wherein the step of creating a session in response to a client request and synchronizing the newly created session to other nodes via RDMA comprises:
[0224] Obtaining a free memory slot from the memory area of the corresponding processing core in the master node and setting a lock and a timer. If the node is a master node, directly obtaining a free memory slot from the memory area corresponding to the processing core;
[0225] Filling the acquired corresponding memory slot with session information at the node, and synchronizing the session information to other nodes;
[0226] If the node completes the session synchronization within the time period specified by the timer, the master node resets the timer of the corresponding memory slot on the corresponding processing core;
[0227] If the node fails to complete the session synchronization within the time period specified by the timer, the master node resets the timer of the corresponding memory slot on the corresponding processing core and notifies all nodes to release the corresponding memory slot;
[0228] After the session cycle is completed, the node notifies the master node to unlock and release the memory slot, and the master node notifies other nodes to release the corresponding memory slot.
[0229] Clause 15. The method as described in Clause 1, wherein the memory area allocated to each processing core for storing session information comprises:
[0230] When a memory area for storing session information is allocated to each processing core, a key pair of the memory area of each processing core is generated simultaneously, wherein the key pair includes a local key and a remote key.
[0231] Clause 16. The method of clause 15, wherein registering the node on other nodes in the session synchronization system comprises:
[0232] Setting the state of the node for registration with other nodes;
[0233] Registration information is provided to other nodes, the registration information including: a local key and a remote key of a memory area of each processing core on the node, an IP address of the node, and a status of the node.
[0234] Clause 17. The method according to clause 1, further comprising:
[0235] registering other nodes in the session synchronization system on the node according to the registration request;
[0236] Maintaining information and status of all nodes in the session synchronization system;
[0237] Clause 18. The method according to clause 2, further comprising:
[0238] The metadata of free memory slots is maintained for allocating memory slots for newly created sessions, and a lock mechanism is used to avoid memory slot conflicts.
[0239] Clause 19. A method for real-time strongly consistent session synchronization, applied to a node in a session synchronization system, the node comprising one or more processing cores and an RDMA adapter, characterized in that the method comprises: receiving a session request from a client;
[0240] Establishing a first session according to the session request, and storing session information of the first session in a memory of the node;
[0241] The session information of the first session is synchronized between the node and other nodes in the session synchronization system through RDMA.
[0242] Clause 20. The method as described in Clause 19 is characterized in that it also includes: when the session state of the first session changes, synchronizing the updated session information to other nodes in the session synchronization system via RDMA, and then forwarding messages during the session update process.
[0243] Clause 21. The method of clause 19, wherein synchronizing the session information of the first session between the node and other nodes in the session synchronization system via RDMA comprises:
[0244] After the session state of the first session is the established state, the first session is synchronized to other nodes through RDMA.
[0245] Clause 22. The method of Clause 19, wherein before receiving a session request from a client, the method further comprises:
[0246] Allocate a memory area for storing session information to each processing core;
[0247] further dividing the memory area into a plurality of memory slots, each memory slot being used to store a piece of session information;
[0248] Register the corresponding memory area to the RDMA adapter on each processing core;
[0249] The node is registered with other nodes in the session synchronization system.
[0250] Clause 23. The method according to clause 22, characterized in that:
[0251] The session information includes: metadata and session content, wherein the metadata includes version, processing core number, session state, lock and timer;
[0252] A node in the session synchronization system is determined as a master node.
[0253] Clause 24. The method according to clause 23, wherein establishing a first session according to the session request and storing session information of the first session in a memory of the node comprises:
[0254] The processing core hit by the request obtains an idle memory slot from the memory area of the corresponding processing core in the master node and sets a lock and a timer. If the node is the master node, the idle memory slot is directly obtained from the memory area corresponding to the processing core;
[0255] Fill the acquired corresponding memory slot with the session information of the first session at the node.
[0256] Clause 25. The method of clause 24, wherein synchronizing the session information of the first session between the node and other nodes in the session synchronization system via RDMA comprises:
[0257] The processing core hit by the request synchronizes the session information of the first session stored in the corresponding memory slot to other nodes through RDMA, so that other nodes save the synchronized session information to the corresponding memory slot of the memory area on the corresponding processing core.
[0258] Clause 26. The method according to Clause 25, further comprising:
[0259] If the synchronization of the first session is completed within the time period specified by the timer, the master node resets the timer of the corresponding memory slot on the corresponding processing core;
[0260] If the synchronization of the first session is not completed within the time period specified by the timer, the master node resets the timer of the corresponding memory slot on the corresponding processing core and notifies all nodes to release the corresponding memory slot;
[0261] After the cycle of the first session is completed, the node notifies the master node to unlock and release the memory slot, and the master node notifies other nodes to release the corresponding memory slot.
[0262] Clause 27. The method of clause 22, further comprising, after registering the node on other nodes in the session synchronization system:
[0263] Synchronize the full session on other nodes to the node.
[0264] Clause 28. The method of clause 22, further comprising, after registering the node on other nodes in the session synchronization system:
[0265] Each processing core on the node requests full session information on the corresponding processing core from other nodes via RDMA;
[0266] Filling the full session information into a corresponding memory slot of a memory area of a corresponding processing core on the node;
[0267] After the full session synchronization is completed, the status of the node is updated on all nodes.
[0268] Clause 29. The method as described in Clause 28, characterized in that filling the full session information into a corresponding memory slot of a memory area of a corresponding processing core on the node comprises:
[0269] When the corresponding memory slot is idle, writing the session information of the corresponding memory slot synchronized via RDMA;
[0270] In the case where the corresponding memory slot already contains a session, whether to write the session information of the corresponding memory slot synchronized via RDMA is determined according to the version of the session information:
[0271] If the version of the session information in the corresponding memory slot is greater than or equal to the version of the synchronized session information, skip the corresponding memory slot;
[0272] If the version of the session information in the corresponding memory slot is smaller than the version of the synchronized session information, the session information synchronized through RDMA is written to the corresponding memory slot.
[0273] Clause 30. A node for real-time strong consistency session synchronization, configured in a session synchronization system, characterized in that the node includes: one or more processing cores, an RDMA adapter, a node controller, a session controller, and a free slot management metadata module, wherein:
[0274] The node controller is used to maintain and control the nodes in the session synchronization system;
[0275] The session controller is used to perform session synchronization between the processing core of the node and the corresponding processing cores of other nodes that need session synchronization through RDMA;
[0276] The free slot management metadata module is used to maintain metadata of free memory slots.
[0277] The node controller comprises:
[0278] An allocation module, used for allocating a memory area for session information to each processing core;
[0279] An RDMA registration module is used to register the corresponding memory area to the RDMA adapter on each processing core;
[0280] A node registration module, used for registering the node on other nodes in the session synchronization system;
[0281] The node information module is used to maintain the relevant information of all nodes in the session synchronization system.
[0282] Clause 31. A node for real-time strong consistency session synchronization, configured in a session synchronization system, characterized in that the node includes: one or more processing cores, an RDMA adapter, a node controller, a session controller, and a free slot management metadata module, wherein:
[0283] The node controller is used to maintain and control the nodes in the session synchronization system;
[0284] The session controller is used to perform session synchronization between the processing core of the node and the corresponding processing cores of other nodes that need session synchronization through RDMA;
[0285] The free slot management metadata module is used to maintain metadata of free memory slots.
[0286] The session controller comprises:
[0287] A session request module, used for receiving a session request from a client;
[0288] A session establishing module, configured to establish a first session according to the session request, wherein session information of the first session is stored in a memory of the node;
[0289] The session synchronization module is used to synchronize the session information of the first session between the node and other nodes in the session synchronization system through RDMA.
[0290] Clause 32. An electronic device, characterized in that the electronic device comprises:
[0291] one or more processing units;
[0292] A storage unit for storing one or more programs;
[0293] 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 clauses 1-29.
[0294] The exemplary embodiments of the present application are specifically shown and described above. It should be understood that the present application is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present application is intended to cover various modifications and equivalent configurations included in the spirit and scope of the attached clauses.
Claims
1. A method for real-time strong consistency session synchronization, characterized in that: Applied to a node in a session synchronization system, the node includes one or more processing cores and an RDMA adapter, and the method includes: Allocate a memory area for storing session information to each processing core; further dividing the memory area into a plurality of memory slots, each memory slot being used to store a piece of session information, the session information comprising: metadata, the metadata comprising a lock and a timer, a node in the session synchronization system being determined as a master node; Register the corresponding memory area to the RDMA adapter on each processing core; registering the node on other nodes in the session synchronization system; Performing session synchronization between the processing core of the node and corresponding processing cores of other nodes that require session synchronization through RDMA; When the session state of a session changes, the updated session information is synchronized to other nodes in the session synchronization system via RDMA before message forwarding; Performing session synchronization between the processing core of the node and the corresponding processing cores of other nodes that need session synchronization through RDMA, including: responding to a client request to create a session, synchronizing the newly created session to other nodes through RDMA, including: obtaining an idle memory slot from the memory area of the corresponding processing core in the master node and setting a lock and a timer, and if the node is the master node, directly obtaining an idle memory slot from the memory area corresponding to the processing core; Filling the acquired corresponding memory slot with session information at the node, and synchronizing the session information to other nodes; If the node completes the session synchronization within the time period specified by the timer, the master node resets the timer of the corresponding memory slot on the corresponding processing core; If the node fails to complete the session synchronization within the time period specified by the timer, the master node resets the timer of the corresponding memory slot on the corresponding processing core and notifies all nodes to release the corresponding memory slot; After the session cycle is completed, the node notifies the master node to unlock and release the memory slot, and the master node notifies other nodes to release the corresponding memory slot.
2. The method according to claim 1, characterized in that Performing session synchronization between the processing core of the node and corresponding processing cores of other nodes that need session synchronization through RDMA includes: Synchronize the session information stored in the memory slot of the memory area corresponding to the processing core of the node to other nodes through RDMA, so that the other nodes save the synchronized session information to the corresponding memory slot of the memory area on the corresponding processing core; and / or Receive session information synchronized from other nodes via RDMA, and save it to the corresponding memory slot of the memory area on the corresponding processing core in the node.
3. The method according to claim 2, characterized in that The session information also includes session content, and the metadata also includes version, processing core number and session status.
4. A method for real-time strong consistency session synchronization, applied to a node in a session synchronization system, wherein the node includes one or more processing cores and an RDMA adapter, characterized in that: The method comprises: Allocate a memory area for storing session information to each processing core; further dividing the memory area into a plurality of memory slots, each memory slot being used to store a piece of session information, the session information comprising: metadata, the metadata comprising a lock and a timer, a node in the session synchronization system being determined as a master node; Receive session request from client; Establishing a first session according to the session request, and storing session information of the first session in a memory of the node; Synchronizing session information of the first session between the node and other nodes in the session synchronization system through RDMA; When the session state of a session changes, the updated session information is synchronized to other nodes in the session synchronization system via RDMA before message forwarding; Synchronizing the session information of the first session between the node and other nodes in the session synchronization system through RDMA, including: responding to a client request to create a session, synchronizing the newly created session to other nodes through RDMA, including: obtaining an idle memory slot from a memory area corresponding to a processing core in the master node and setting a lock and a timer, and if the node is the master node, directly obtaining an idle memory slot from the memory area corresponding to the processing core; Filling the acquired corresponding memory slot with session information at the node, and synchronizing the session information to other nodes; If the node completes the session synchronization within the time period specified by the timer, the master node resets the timer of the corresponding memory slot on the corresponding processing core; If the node fails to complete the session synchronization within the time period specified by the timer, the master node resets the timer of the corresponding memory slot on the corresponding processing core and notifies all nodes to release the corresponding memory slot; After the session cycle is completed, the node notifies the master node to unlock and release the memory slot, and the master node notifies other nodes to release the corresponding memory slot.
5. The method according to claim 4, characterized in that Before receiving a session request from the client, it also includes: Register the corresponding memory area to the RDMA adapter on each processing core; The node is registered with other nodes in the session synchronization system.
6. The method according to claim 5, characterized in that After registering the node on other nodes in the session synchronization system, the method further includes: Each processing core on the node requests full session information on the corresponding processing core from other nodes via RDMA; Filling the full session information into a corresponding memory slot of a memory area of a corresponding processing core on the node; After the full session synchronization is completed, the status of the node is updated on all nodes.
7. The method according to claim 6, characterized in that Filling the full session information into a corresponding memory slot of a memory area of a corresponding processing core on the node, including: When the corresponding memory slot is idle, writing the session information of the corresponding memory slot synchronized via RDMA; In the case where the corresponding memory slot already contains a session, whether to write the session information of the corresponding memory slot synchronized via RDMA is determined according to the version of the session information: If the version of the session information in the corresponding memory slot is greater than or equal to the version of the synchronized session information, skip the corresponding memory slot; If the version of the session information in the corresponding memory slot is smaller than the version of the synchronized session information, the session information synchronized through RDMA is written to the corresponding memory slot.
8. An electronic device, characterized in that: The electronic device comprises: one or more processing units; A storage unit 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.