CN113419973A - Message forwarding method and device - Google Patents

Message forwarding method and device Download PDF

Info

Publication number
CN113419973A
CN113419973A CN202110672103.2A CN202110672103A CN113419973A CN 113419973 A CN113419973 A CN 113419973A CN 202110672103 A CN202110672103 A CN 202110672103A CN 113419973 A CN113419973 A CN 113419973A
Authority
CN
China
Prior art keywords
session
message
index table
forwarding
idle
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110672103.2A
Other languages
Chinese (zh)
Other versions
CN113419973B (en
Inventor
孙军伟
秦德楼
赵旭东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN202110672103.2A priority Critical patent/CN113419973B/en
Publication of CN113419973A publication Critical patent/CN113419973A/en
Application granted granted Critical
Publication of CN113419973B publication Critical patent/CN113419973B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • G06F12/0261Garbage collection, i.e. reclamation of unreferenced memory using reference counting
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application provides a message forwarding method and a device, and the method comprises the following steps: the target CPU responds to the received message and calculates a data abstract according to the session characteristics of the message; searching whether an index table item corresponding to the data abstract exists in an index table maintained by the Node corresponding to the target CPU; the index table entry comprises a data summary of a session forwarding table entry and an identifier of the session forwarding table entry; and if the message exists, determining the session forwarding table item based on the identifier in the searched index table item, and forwarding the message according to the session information recorded by the session forwarding table item. Based on the technical scheme, the index table is maintained on each Node of the network equipment, so that when each CPU processes the message, the index table on the Node corresponding to the CPU can be searched, the CPU can access the local memory as much as possible, the remote memory access is reduced, the processing performance of the network equipment is improved, and the message forwarding efficiency is improved.

Description

Message forwarding method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for forwarding a packet.
Background
Referring to fig. 1, fig. 1 is a schematic diagram illustrating three types of CPUs accessing a memory.
As shown in fig. 1, the single-core CPU directly accesses a unique memory, and the time for each VCPU inside the CPU to access the memory is almost the same. For a multi-core CPU, under a UMA architecture (unified Memory Access), each CPU accesses a unique Memory by sharing a north bridge, and although the time for each CPU to Access the Memory is almost the same, the time is limited by the bottleneck of the response time of the north bridge.
When the multi-core CPU adopts a Non Uniform Memory Access (NUMA) architecture, each CPU can Access its own Memory and also can Access the memories of other CPUs, and the time for the CPU to Access the local Memory is much longer than the time for performing remote Memory Access on other CPUs.
Disclosure of Invention
In view of this, the present application provides a method and an apparatus for forwarding a packet, which avoid generating excessive remote memory accesses by enabling a CPU to access an index table maintained in a corresponding Node, thereby improving performance of a network device.
Specifically, the method is realized through the following technical scheme:
in a first aspect, the present application provides a method for forwarding a packet, which is applied to a network device, where the network device carries multiple CPUs using a NUMA architecture, and the network device includes at least one Node; each Node at least corresponds to a CPU, and maintains a session forwarding table and an index table; the method comprises the following steps:
the target CPU responds to the received message and calculates a data abstract according to the session characteristics of the message;
searching whether an index table item corresponding to the data abstract exists in an index table maintained by the Node corresponding to the target CPU; the index table entry comprises a data summary of a session forwarding table entry and an identifier of the session forwarding table entry;
and if the message exists, determining the session forwarding table item based on the identifier in the searched index table item, and forwarding the message according to the session information recorded by the session forwarding table item.
In a second aspect, the present application further provides a device for forwarding a packet, where the device is applied to a network device, the network device carries multiple CPUs using a NUMA architecture, and the network device includes at least one Node; each Node at least corresponds to a CPU, and maintains a session forwarding table and an index table; the device includes:
the computing unit is used for computing a data abstract according to the conversation characteristics of the message when the target CPU responds to the received message;
the searching unit is used for searching whether an index table item corresponding to the data abstract exists in an index table maintained by the Node corresponding to the target CPU; the index table entry comprises a data summary of a session forwarding table entry and an identifier of the session forwarding table entry;
and the forwarding unit is used for determining the session forwarding table item based on the found identifier in the index table item and forwarding the message according to the session information recorded by the session forwarding table item when the index table item exists.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
by maintaining the index table on each Node of the network equipment, when each CPU processes the message, the index table on the Node corresponding to the CPU can be searched, and excessive remote memory access caused by searching the index tables on other nodes is avoided, so that the CPU can access the local memory as much as possible, the remote memory access is reduced, the processing performance of the network equipment is improved, and the message forwarding efficiency is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
Fig. 1 is a schematic structural diagram illustrating three types of CPUs accessing a memory according to an exemplary embodiment of the present application;
fig. 2 is a flowchart illustrating a message forwarding method according to an exemplary embodiment of the present application;
fig. 3 is a flowchart illustrating another message forwarding method according to an exemplary embodiment of the present application;
fig. 4 is a hardware structure diagram of an electronic device where a message forwarding apparatus is located according to an exemplary embodiment of the present application;
fig. 5 is a block diagram of a message forwarding apparatus according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
Currently, the time for each VCPU to access memory inside a single-core CPU is almost the same. At this time, the session forwarding table entries of the network packet are also allocated on a unique Node (memory Node), and there is no difference in service performance of different VCPUs forwarding the packet.
For a multi-core CPU adopting the UMA architecture, each CPU shares a unique memory, the time for accessing a session forwarding table entry stored on the memory is almost the same, and there is no difference in service performance, but the bottleneck of the north bridge response time is limited.
In order to reduce the bandwidth requirements on the bus and the memory, the NUMA architecture has a high requirement on a process scheduling algorithm at the cost of inconsistency of memory access, and the number of memory accesses across nodes needs to be reduced as much as possible to improve the system performance.
It can be seen that, for a multi-core CPU adopting a NUMA architecture, if the allocation scheme of the index table is still adopted when the unique memory is used, each CPU accesses the index table to generate excessive remote access memory, which affects the performance of the device.
For example, as shown in fig. 1, assuming that the index table is allocated on the memory corresponding to the CPU1, after the CPU0 and the CPU2 receive the message, when the index table needs to be searched for message forwarding, and the memory corresponding to the CPU1 needs to be accessed, excessive remote memory access may be generated, which may result in a great reduction in the efficiency of message processing, and also may cause the CPU to process other services due to the fact that the time for the remote memory access is too long, which may occupy the resources of the CPU, thereby reducing the overall performance of the device.
In view of this, the present application provides a technical solution that an index table is maintained on each Node of a network device, so that when each CPU processes a packet, the index table on the Node corresponding to the CPU can be searched, and local memory access is implemented.
When the network equipment is realized, the network equipment carries a plurality of CPUs adopting NUMA architecture, and the network equipment comprises at least one Node; each Node at least corresponds to a CPU, and maintains a session forwarding table and an index table;
after receiving the message, the target CPU calculates a data abstract according to the session characteristics of the message;
searching whether an index table item corresponding to the data abstract exists in an index table maintained by the Node corresponding to the target CPU; the index table entry comprises a data summary of a session forwarding table entry and an identifier of the session forwarding table entry;
and if the message exists, determining the session forwarding table item based on the identifier in the searched index table item, and forwarding the message according to the session information recorded by the session forwarding table item.
For example, the identifier is used to indicate a memory address of the session forwarding table entry, and an address offset from a starting memory address of the session forwarding table; the target CPU may determine the memory address of the session forwarding table entry according to the address offset recorded in the index table entry, and forward the packet according to the session information recorded in the session forwarding table entry.
In the above technical solution, the index table is maintained on each Node of the network device, so that when each CPU processes a packet, the index table on the Node corresponding to the CPU can be searched, and excessive remote memory access caused by searching the index tables on other nodes is avoided, thereby implementing that the CPU accesses the local memory as much as possible, reducing remote memory access, improving processing performance of the network device, and improving packet forwarding efficiency.
Next, examples of the present application will be described in detail.
Referring to fig. 2, fig. 2 is a flowchart illustrating a message forwarding method according to an exemplary embodiment of the present application, and as shown in fig. 2, the method is applied to a network device, and includes the following steps:
step 201: the target CPU responds to the received message and calculates a data abstract according to the session characteristics of the message;
step 202: searching whether an index table item corresponding to the data abstract exists in an index table maintained by the Node corresponding to the target CPU; the index table entry comprises a data summary of a session forwarding table entry and an identifier of the session forwarding table entry;
step 203: and if the message exists, determining the session forwarding table item based on the identifier in the searched index table item, and forwarding the message according to the session information recorded by the session forwarding table item.
The network equipment is loaded with a plurality of CPUs adopting NUMA architecture, and the network equipment at least comprises one Node; each Node at least corresponds to one CPU, and maintains a session forwarding table and an index table.
In the embodiment, the target CPU responds to the received message and calculates the data abstract according to the session characteristics of the message;
for example, the target CPU obtains the session feature of the packet in response to the received packet, and calculates a hash value corresponding to the session feature of the packet based on a preset hash algorithm.
The target CPU may be a physical CPU or a VCPU, which is not limited in the present application, and a person skilled in the art may associate the divided nodes with the CPUs according to actual needs, only by ensuring that each CPU has one corresponding Node.
By dividing the memory into a plurality of nodes and associating each Node with one or a plurality of CPUs, each CPU corresponds to one Node, thereby improving the access speed of the CPU to the local memory.
In addition, the network device may determine a target CPU for processing the packet from the plurality of CPUs, and send the packet to the target CPU.
For example, RSS (receive Side scaling) is a network card driving technology, and a network device can implement efficient distribution of a message received by a network card among multiple CPUs in a multi-CPU system by using an RSS function.
In one embodiment shown, the network device further carries a network card with RSS function;
the network card calculates a hash value corresponding to a quintuple of the message based on an RSS function;
and determining a target CPU for receiving the message according to the calculated hash value, and sending the message to the target CPU.
For example, the network card may parse the received message to obtain five-tuple information; calculating a hash value corresponding to the quintuple information through a preset hash algorithm; taking the least significant bit of the hash value to index an indirect addressing table RETA (redirection table); the indirect addressing table RETA stores index values for allocating data packets to different CPUs for receiving and processing. By offloading network traffic to multiple CPUs, the occupancy of a single CPU may be reduced.
In this embodiment, the target CPU searches whether an index table entry corresponding to the data digest calculated according to the session characteristics of the received message exists in an index table maintained by the Node corresponding to the target CPU; the index table entry comprises a data summary of a session forwarding table entry and an identifier of the session forwarding table entry.
For example, the target CPU matches an index table maintained by a Node corresponding to the target CPU based on a data digest calculated according to the session characteristics of the received packet, and searches whether an index table entry consistent with the data digest exists; the searched index table entry records the data abstract of the session forwarding table entry corresponding to the message and the identifier of the session forwarding table entry.
Two continuous memory spaces can be allocated in each Node, and are respectively used for maintaining a session forwarding table and an index table. The session forwarding table entry in the session forwarding table records session information required for forwarding the message, and the index table entry in the index table records a data summary of the session forwarding table entry corresponding to the message and an identifier of the session forwarding table entry.
In addition, after the index table entry corresponding to the data abstract is found, in order to ensure the matching accuracy, whether the quintuple of the message is the same as the quintuple recorded in the index table entry or not can be further determined.
In an embodiment shown, the index table entry further stores a five-tuple of the packet;
and further, comparing whether the quintuple of the message is consistent with the found quintuple in the index table, and if so, determining a session forwarding table item based on the pointer in the found index table item.
The session forwarding table and the index table maintained in each Node may be allocated by the network device when performing initialization operations.
In an embodiment, in response to an initialization request of the network device, acquiring a total number of the nodes, and allocating a session and a memory space corresponding to the number of the sessions to each Node based on the total number of the nodes; and allocating memory space for storing the index table for each Node.
For example, when the network device starts a NUMA function and initializes, assuming that the number of detected nodes is n and the total number of sessions supported by the device is m, m/n sessions may be allocated to each Node, and a corresponding memory space is allocated in the Node as a session pool for storing the allocated sessions; meanwhile, memory space for storing index table can be allocated for each Node.
Further, in one embodiment shown, the sessions are associated in a linked list manner and initialized to an idle linked list; initializing the index table to an idle state.
For example, after the session allocation of each Node is completed, the allocated sessions are connected in series in a linked list manner and connected to the head of the idle linked list. And flexible management of the session can be realized in a linear linked list mode.
Specifically, in one embodiment shown, the session forwarding table includes an idle linked list and a usage linked list; the idle linked list stores idle session forwarding table entries, and the usage linked list stores added session forwarding table entries.
In this embodiment, if there is an index entry corresponding to the data summary, the session forwarding entry is determined based on the identifier in the found index entry, and the packet is forwarded according to the session information recorded in the session forwarding entry.
For example, after determining that the index entry corresponding to the data summary exists, obtaining an identifier of a session forwarding entry recorded in the index entry, obtaining session information recorded in the session forwarding entry according to the identifier, and forwarding a packet according to the session information recorded in the session forwarding entry.
In an embodiment shown, the identifier is used to indicate a memory address of the session forwarding table entry, and an address offset from a starting memory address of the session forwarding table;
further, the memory address of the session forwarding table entry is determined according to the address offset recorded in the index table entry.
For example, the starting memory address of the session forwarding table, plus the address offset, is the memory address of the session forwarding table entry corresponding to the above-mentioned message.
In an embodiment shown, if there is no index entry corresponding to the data digest, acquiring an idle session in the idle linked list, storing session information corresponding to the packet to the idle session, and transferring the idle session to a use linked list;
acquiring the idle index table, recording the address offset of the memory address of the idle session relative to the initial memory address of the session forwarding table as an identifier and a data summary calculated based on the session characteristics of the message in the idle index table, and updating the idle index table to a use state;
and forwarding the message according to the session information corresponding to the message.
After the CPU executes the operation on the message received for the first time, the establishment of the session corresponding to the message is completed, and the session forwarding information corresponding to the message is updated;
when the message is subsequently received again, the session forwarding table maintained by the Node already records the session forwarding table entry corresponding to the message, the index table also records the data summary of the session forwarding table entry corresponding to the message and the identifier of the session forwarding table entry, and the CPU can directly use the session information to complete message forwarding only by executing the above steps 201 to 203.
In an embodiment, the Node is configured to traverse a usage linked list in a session forwarding table maintained by the Node, and detect whether a session aging flag exists;
if yes, transferring the use conversation in the use linked list to an idle conversation chain, and updating the index table maintained by the Node to an idle state.
For example, a thread for monitoring the session usage chain may be allocated to the CPU associated with each Node, and when the session ages, the thread detects the session aging flag, updates the index table to an idle state, and takes off the session from the usage chain and hangs it on the idle chain.
In the above technical solution, the index table is maintained on each Node of the network device, so that when each CPU processes a packet, the index table on the Node corresponding to the CPU can be searched, and excessive remote memory access caused by searching the index tables on other nodes is avoided, thereby implementing that the CPU accesses the local memory as much as possible, reducing remote memory access, improving processing performance of the network device, and improving packet forwarding efficiency.
Referring to fig. 3, fig. 3 is a flowchart illustrating another packet forwarding method according to an exemplary embodiment of the present application.
As shown in fig. 3, in an embodiment, a method for forwarding a packet includes the following steps:
s301: a target CPU receives a message;
the message can be a network card with an RSS function carried by network equipment, and a target CPU for receiving the message is determined by calculating a hash value corresponding to a quintuple of the message.
S302: calculating a data abstract according to the session characteristics of the message;
specifically, the target CPU may obtain session characteristics of the packet, and calculate a hash value corresponding to the session characteristics of the packet based on a preset hash algorithm.
S303: searching whether an index table item corresponding to the data abstract exists in an index table maintained by the Node corresponding to the target CPU;
the index table entry comprises a data summary of a session forwarding table entry and an identifier of the session forwarding table entry.
It is worth to be noted that the network device is equipped with a plurality of CPUs adopting a NUMA architecture, and the network device at least includes one Node; each Node at least corresponds to one CPU, and maintains a session forwarding table and an index table.
By dividing the memory into a plurality of nodes and associating each Node with one or a plurality of CPUs, each CPU corresponds to one Node, thereby improving the access speed of the CPU to the local memory.
S304: if the session forwarding table entry exists, determining the session forwarding table entry based on the found identifier in the index table entry;
the identifier is used for indicating the memory address of the session forwarding table entry and the address offset relative to the starting memory address of the session forwarding table.
Specifically, the memory address of the session forwarding table entry may be determined according to the address offset recorded in the index table entry, and the session information recorded in the session forwarding table entry may be obtained according to the memory address.
S305: and forwarding the message according to the session information recorded by the session forwarding table entry.
S306: if the index table entry corresponding to the data abstract does not exist, acquiring an idle session in the idle linked list, storing session information corresponding to the message to the idle session, and transferring the idle session to a use linked list;
the session forwarding table comprises an idle linked list and a use linked list; the idle linked list stores idle session forwarding table entries, and the usage linked list stores added session forwarding table entries.
S307: acquiring the idle index table, recording the address offset of the memory address of the idle session relative to the initial memory address of the session forwarding table as an identifier and a data summary calculated based on the session characteristics of the message in the idle index table, and updating the idle index table to a use state;
and adding the address offset to the initial memory address of the session forwarding table to obtain the memory address of the acquired idle session.
S308: and forwarding the message according to the session information corresponding to the message.
In the above technical solution, the index table is maintained on each Node of the network device, so that when each CPU processes a packet, the index table on the Node corresponding to the CPU can be searched, and excessive remote memory access caused by searching the index tables on other nodes is avoided, thereby implementing that the CPU accesses the local memory as much as possible, reducing remote memory access, improving processing performance of the network device, and improving packet forwarding efficiency.
Corresponding to the method embodiment, the application also provides an embodiment of the device.
Corresponding to the embodiment of the method, the application also provides an embodiment of a message forwarding device. The embodiment of the message forwarding device can be applied to electronic equipment. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. Taking a software implementation as an example, as a logical device, the device is formed by reading, by a processor of the electronic device where the device is located, a corresponding computer program instruction in the nonvolatile memory into the memory for operation. In terms of hardware, as shown in fig. 4, a hardware structure diagram of an electronic device where a message forwarding apparatus is located is shown in an exemplary embodiment of the present application, except for the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 4, the electronic device where the apparatus is located in the embodiment may also include other hardware according to an actual function of the electronic device, which is not described again.
Referring to fig. 5, fig. 5 is a block diagram of a message forwarding apparatus according to an exemplary embodiment of the present application, and as shown in fig. 5, the message forwarding apparatus 500 may be applied in the electronic device shown in fig. 4, and includes:
a calculating unit 501, configured to calculate a data summary according to session characteristics of a received packet when a target CPU responds to the packet;
a searching unit 502, configured to search whether an index table entry corresponding to the data abstract exists in an index table maintained by a Node corresponding to the target CPU; the index table entry comprises a data summary of a session forwarding table entry and an identifier of the session forwarding table entry;
a forwarding unit 503, configured to determine the session forwarding entry based on the identifier in the found index entry when the index entry exists, and forward the packet according to the session information recorded in the session forwarding entry.
The message forwarding apparatus 500 may be applied to a network device, where the network device carries multiple CPUs using a NUMA architecture, and the network device includes at least one Node; each Node at least corresponds to a CPU, and maintains a session forwarding table and an index table;
in an embodiment, the network device further carries a network card with RSS function;
the network card calculates a hash value corresponding to a quintuple of the message based on an RSS function;
and determining a target CPU for receiving the message according to the calculated hash value, and sending the message to the target CPU.
In an embodiment, the packet forwarding apparatus 500 further includes:
the distribution unit is used for responding to the initialization request of the network equipment, acquiring the total number of the nodes, and distributing a session and a memory space corresponding to the number of the sessions for each Node based on the total number of the nodes; and the memory space is used for distributing the memory space for storing the index table for each Node.
In an embodiment, the packet forwarding apparatus 500 further includes:
the initialization unit is used for associating the sessions according to a linked list mode and initializing the sessions into an idle linked list; for initializing the index table to an idle state.
In one embodiment, the session forwarding table includes an idle linked list and a usage linked list; the idle linked list stores idle session forwarding table entries, and the usage linked list stores added session forwarding table entries.
In an embodiment, the identifier is used to indicate a memory address of the session forwarding table entry, and an address offset from a starting memory address of the session forwarding table;
the forwarding unit 503 includes:
and the address calculation unit is used for determining the memory address of the session forwarding table entry according to the address offset recorded in the index table entry.
In an embodiment, the index table entry further stores a five-tuple of the packet;
the packet forwarding apparatus 500 further includes:
and the comparison unit is used for comparing whether the quintuple of the message is consistent with the found quintuple in the index table or not, and if so, determining a session forwarding table item based on the pointer in the found index table item.
In an embodiment, the packet forwarding apparatus 500 further includes:
a first obtaining unit, configured to, if there is no index entry corresponding to the data digest, obtain an idle session in the idle linked list, store session information corresponding to the packet in the idle session, and transfer the idle session to a usage linked list;
a second obtaining unit, configured to obtain the idle index table, record, in the idle index table, an address offset of a memory address of the idle session relative to a starting memory address of the session forwarding table, as an identifier, and a data digest calculated based on session characteristics of the packet, and update the idle index table to a use state;
and the second forwarding unit is used for forwarding the message according to the session information corresponding to the message.
In an embodiment, the packet forwarding apparatus 500 further includes:
the detection unit is used for traversing the usage linked list in the session forwarding table maintained by the Node and detecting whether a session aging mark exists;
and the transfer unit is used for transferring the use session in the use linked list to an idle session chain and updating the index table maintained by the Node to an idle state if the aging mark exists.
The embodiments in the present application are described in a progressive manner, and the same/similar parts in the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. Especially, for the embodiments of the client device and the apparatus, since they are substantially similar to the embodiments of the method, the description is simple, and for the relevant points, refer to the partial description of the embodiments of the method.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, wherein the modules described as separate parts may or may not be physically separate, and the parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
The apparatuses, modules or modules illustrated in the above embodiments may be implemented by a computer chip or an entity, or by an article with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
Corresponding to the method embodiment, the present specification also provides an embodiment of an electronic device. The electronic device includes: a processor and a memory for storing machine executable instructions; wherein the processor and the memory are typically interconnected by an internal bus. In other possible implementations, the device may also include an external interface to enable communication with other devices or components.
In this embodiment, the processor is caused to:
the target CPU responds to the received message and calculates a data abstract according to the session characteristics of the message;
searching whether an index table item corresponding to the data abstract exists in an index table maintained by the Node corresponding to the target CPU; the index table entry comprises a data summary of a session forwarding table entry and an identifier of the session forwarding table entry;
and if the message exists, determining the session forwarding table item based on the identifier in the searched index table item, and forwarding the message according to the session information recorded by the session forwarding table item.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (10)

1. A message forwarding method is applied to network equipment, the network equipment carries a plurality of CPUs adopting NUMA architecture, and the network equipment at least comprises a Node; each Node at least corresponds to a CPU, and maintains a session forwarding table and an index table; the method comprises the following steps:
the target CPU responds to the received message and calculates a data abstract according to the session characteristics of the message;
searching whether an index table item corresponding to the data abstract exists in an index table maintained by the Node corresponding to the target CPU; the index table entry comprises a data summary of a session forwarding table entry and an identifier of the session forwarding table entry;
and if the message exists, determining the session forwarding table item based on the identifier in the searched index table item, and forwarding the message according to the session information recorded by the session forwarding table item.
2. The method of claim 1, wherein the network device further carries a network card with RSS functionality;
before the target CPU responds to the received packet, the method further includes:
the network card calculates a hash value corresponding to a quintuple of the message based on an RSS function;
and determining a target CPU for receiving the message according to the calculated hash value, and sending the message to the target CPU.
3. The method of claim 1, further comprising:
responding to an initialization request of the network equipment, acquiring the total number of the nodes, and distributing a session and a memory space corresponding to the number of the sessions for each Node based on the total number of the nodes;
and allocating memory space for storing the index table for each Node.
4. The method of claim 3, further comprising:
associating the sessions according to a linked list mode, and initializing the sessions into an idle linked list;
initializing the index table to an idle state.
5. The method of claim 1, the session forwarding table comprising an idle linked list and a usage linked list; the idle linked list stores idle session forwarding table entries, and the usage linked list stores added session forwarding table entries.
6. The method of claim 1, wherein the identifier is used to indicate a memory address of the session forwarding table entry, an address offset relative to a starting memory address of the session forwarding table;
the determining a session forwarding entry based on the found identifier in the index entry includes:
and determining the memory address of the session forwarding table entry according to the address offset recorded in the index table entry.
7. The method of claim 1, wherein the index table entry further stores a five-tuple of the packet;
before determining a session forwarding entry based on the pointer in the found index entry, the method further includes:
and comparing whether the quintuple of the message is consistent with the found quintuple in the index table, and if so, determining a session forwarding table item based on the pointer in the found index table item.
8. The method according to any one of claims 1-6, further comprising:
if the index table entry corresponding to the data abstract does not exist, acquiring an idle session in the idle linked list, storing session information corresponding to the message to the idle session, and transferring the idle session to a use linked list;
acquiring the idle index table, recording the address offset of the memory address of the idle session relative to the initial memory address of the session forwarding table as an identifier and a data summary calculated based on the session characteristics of the message in the idle index table, and updating the idle index table to a use state;
and forwarding the message according to the session information corresponding to the message.
9. The method of claim 5, further comprising:
traversing a usage linked list in a session forwarding table maintained by the Node, and detecting whether a session aging mark exists;
if yes, transferring the use conversation in the use linked list to an idle conversation chain, and updating the index table maintained by the Node to an idle state.
10. A message forwarding device is applied to network equipment, the network equipment carries a plurality of CPUs adopting NUMA architecture, and the network equipment at least comprises a Node; each Node at least corresponds to a CPU, and maintains a session forwarding table and an index table; the device comprises:
the computing unit is used for computing a data abstract according to the conversation characteristics of the message when the target CPU responds to the received message;
the searching unit is used for searching whether an index table item corresponding to the data abstract exists in an index table maintained by the Node corresponding to the target CPU; the index table entry comprises a data summary of a session forwarding table entry and an identifier of the session forwarding table entry;
and the forwarding unit is used for determining the session forwarding table item based on the found identifier in the index table item and forwarding the message according to the session information recorded by the session forwarding table item when the index table item exists.
CN202110672103.2A 2021-06-17 2021-06-17 Message forwarding method and device Active CN113419973B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110672103.2A CN113419973B (en) 2021-06-17 2021-06-17 Message forwarding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110672103.2A CN113419973B (en) 2021-06-17 2021-06-17 Message forwarding method and device

Publications (2)

Publication Number Publication Date
CN113419973A true CN113419973A (en) 2021-09-21
CN113419973B CN113419973B (en) 2023-05-26

Family

ID=77788820

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110672103.2A Active CN113419973B (en) 2021-06-17 2021-06-17 Message forwarding method and device

Country Status (1)

Country Link
CN (1) CN113419973B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114125077A (en) * 2022-01-26 2022-03-01 之江实验室 Method and device for realizing multi-executive TCP session normalization
CN114257545A (en) * 2021-12-09 2022-03-29 北京奇艺世纪科技有限公司 Message forwarding method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108363621A (en) * 2018-01-18 2018-08-03 东软集团股份有限公司 Message forwarding method, device, storage medium under numa frameworks and electronic equipment
CN109359222A (en) * 2018-08-06 2019-02-19 杭州复杂美科技有限公司 Date storage method and system, equipment and storage medium
CN109992998A (en) * 2019-03-31 2019-07-09 杭州复杂美科技有限公司 A kind of information storage means and system, equipment and storage medium
US20190213127A1 (en) * 2016-09-20 2019-07-11 Huawei Technologies Co., Ltd. Data transmission method and apparatus
CN112948313A (en) * 2021-03-01 2021-06-11 杭州迪普科技股份有限公司 Session data management method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190213127A1 (en) * 2016-09-20 2019-07-11 Huawei Technologies Co., Ltd. Data transmission method and apparatus
CN108363621A (en) * 2018-01-18 2018-08-03 东软集团股份有限公司 Message forwarding method, device, storage medium under numa frameworks and electronic equipment
CN109359222A (en) * 2018-08-06 2019-02-19 杭州复杂美科技有限公司 Date storage method and system, equipment and storage medium
CN109992998A (en) * 2019-03-31 2019-07-09 杭州复杂美科技有限公司 A kind of information storage means and system, equipment and storage medium
CN112948313A (en) * 2021-03-01 2021-06-11 杭州迪普科技股份有限公司 Session data management method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
郑鹏: "《Linux 原理与应用》", 31 March 2008 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114257545A (en) * 2021-12-09 2022-03-29 北京奇艺世纪科技有限公司 Message forwarding method and device
CN114257545B (en) * 2021-12-09 2023-09-05 北京奇艺世纪科技有限公司 Message forwarding method and device
CN114125077A (en) * 2022-01-26 2022-03-01 之江实验室 Method and device for realizing multi-executive TCP session normalization

Also Published As

Publication number Publication date
CN113419973B (en) 2023-05-26

Similar Documents

Publication Publication Date Title
TWI549060B (en) Access methods and devices for virtual machine data
US20150163172A1 (en) Server switch integration in a virtualized system
CN113419973B (en) Message forwarding method and device
CN111796948B (en) Shared memory access method and device, computer equipment and storage medium
CN111431757B (en) Virtual network flow acquisition method and device
CN108139966B (en) Method for managing address conversion bypass cache and multi-core processor
US6662216B1 (en) Fixed bus tags for SMP buses
US7111289B2 (en) Method for implementing dual link list structure to enable fast link-list pointer updates
US8281103B2 (en) Method and apparatus for allocating storage addresses
CN107341114B (en) Directory management method, node controller and system
CN113204407B (en) Memory supermanagement method and device
CN112948313B (en) Session data management method and device
CN115292214A (en) Page table prediction method, memory access operation method, electronic device and electronic equipment
CN114625762A (en) Metadata acquisition method, network equipment and system
US20170364442A1 (en) Method for accessing data visitor directory in multi-core system and device
CN106302259B (en) Method and router for processing message in network on chip
CN115794366A (en) Memory prefetching method and device
US20040064655A1 (en) Memory access statistics tool
KR20120124743A (en) Apparatus and method for controlling cache coherence in virtualized environment based on multi-core
CN115129709A (en) Data processing method, server and system
KR100978083B1 (en) Procedure calling method in shared memory multiprocessor and computer-redable recording medium recorded procedure calling program
WO2023130953A1 (en) Data search method and apparatus, and network device
JP2006126973A (en) Storage area management method, storage area allocation program, garbage collection processing program, storage area management program, and message management program
US8806504B2 (en) Leveraging performance of resource aggressive applications
WO2022028165A1 (en) Cache management method, terminal, and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant