CN113419973B - Message forwarding method and device - Google Patents

Message forwarding method and device Download PDF

Info

Publication number
CN113419973B
CN113419973B CN202110672103.2A CN202110672103A CN113419973B CN 113419973 B CN113419973 B CN 113419973B CN 202110672103 A CN202110672103 A CN 202110672103A CN 113419973 B CN113419973 B CN 113419973B
Authority
CN
China
Prior art keywords
session
message
index table
forwarding
node
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.)
Active
Application number
CN202110672103.2A
Other languages
Chinese (zh)
Other versions
CN113419973A (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)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a message forwarding method and device, wherein 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 a Node corresponding to the target CPU; the index table item comprises a data abstract of a session forwarding table item and an identifier of the session forwarding table item; and if the message exists, determining the session forwarding table entry based on the searched identification in the index table entry, and forwarding the message according to the session information recorded by the session forwarding table entry. Based on the technical scheme, the index table is maintained on each Node of the network equipment, so that each CPU can search the index table on the corresponding Node of the CPU when processing the message, the CPU can access the local memory as much as possible, 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 disclosure relates to the field of communications technologies, and in particular, to a method and an apparatus for forwarding a message.
Background
Referring to fig. 1, fig. 1 is a schematic diagram showing the structure of three kinds of CPU access memories.
As shown in FIG. 1, a single core CPU directly accesses a unique memory, and the time for each VCPU in the CPU to access the memory is almost the same. In the UMA architecture (Uniform Memory Access, unified memory access), however, for multi-core CPUs, 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, it is limited by the bottleneck of the north bridge response time.
When the multi-core CPU adopts the NUMA (Non Uniform Memory Access, non-unified memory access) architecture, each CPU can access its own memory, and also can access the memories of other CPUs, and the time of the CPU accessing the local memory is much longer than the time of the CPU accessing the remote memory.
Disclosure of Invention
In view of this, the present application provides a method and apparatus for forwarding a message, which avoid generating excessive remote memory access by making a CPU access to an index table maintained in a corresponding Node, thereby improving performance of a network device.
Specifically, the application is realized by the following technical scheme:
in a first aspect, the present application proposes a method for forwarding a message, which is applied to a network device, where the network device is equipped with a plurality of CPUs adopting a NUMA architecture, and the network device at least includes a Node; each Node at least corresponds to one 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 a Node corresponding to the target CPU; the index table item comprises a data abstract of a session forwarding table item and an identifier of the session forwarding table item;
and if the message exists, determining the session forwarding table entry based on the searched identification in the index table entry, and forwarding the message according to the session information recorded by the session forwarding table entry.
In a second aspect, the present application further proposes a device for forwarding a message, where the device is applied to a network device, where the network device is equipped with a plurality of CPUs that adopt a NUMA architecture, and the network device includes at least one Node; each Node at least corresponds to one 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 session 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 item comprises a data abstract of a session forwarding table item and an identifier of the session forwarding table item;
and the forwarding unit is used for determining the session forwarding table entry based on the searched identification in the index table entry when the index table entry exists, and forwarding the message according to the session information recorded by the session forwarding table entry.
The technical scheme provided by the embodiment of the application can comprise the following beneficial effects:
by maintaining the index table on each Node of the network device, each CPU can search the index table on the corresponding Node of the CPU when processing the message, 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 device 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 diagram of three CPU access memories according to an exemplary embodiment of the present application;
FIG. 2 is a flow chart of a method of forwarding messages according to an exemplary embodiment of the present application;
FIG. 3 is a flow chart illustrating another method of forwarding messages according to an exemplary embodiment of the present application;
fig. 4 is a hardware structure diagram of an electronic device where a packet forwarding device according to an exemplary embodiment of the present application is located;
fig. 5 is a block diagram of a packet forwarding device according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present 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 or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first message may also be referred to as a second message, and similarly, a second message may also be referred to as a first message, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
Currently, for a single core CPU, the time for each VCPU to access memory is nearly the same inside. At this time, the session forwarding table entries of the network message are also distributed on the unique Node (memory Node), and the service performance of forwarding the message by different VCPUs is not different.
For multi-core CPUs adopting UMA architecture, each CPU shares a unique memory, the time for accessing the session forwarding table item stored in the memory is almost the same, and the service performance is not different, but is limited by the bottleneck of the north bridge response time.
The NUMA architecture is used for reducing the bandwidth requirements on buses and memories, and the NUMA architecture has higher requirements on a process scheduling algorithm at the cost of non-uniformity of memory access, so that the number of memory accesses across nodes needs to be reduced as much as possible to improve the system performance.
Therefore, for the multi-core CPU adopting the NUMA architecture, if the allocation scheme of the index table is still extended when the unique memory is still 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, if the index table is allocated to the memory corresponding to the CPU1, after the CPU0 and the CPU2 receive the message, and need to access the memory corresponding to the CPU1 when the message is forwarded by looking up the index table, excessive remote memory access will be generated, so that the efficiency of processing the message is greatly reduced, and the resources of the CPU are occupied due to too long time of remote memory access, which affects the CPU to process other services, thereby reducing the overall performance of the device.
In view of this, the present application provides a technical solution that maintains an index table on each Node of a network device, so that each CPU can search the index table on the Node corresponding to the CPU when processing a message, thereby implementing local memory access.
When the method is realized, the network equipment is provided with a plurality of CPUs adopting a NUMA architecture, and comprises at least one Node; each Node at least corresponds to one 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 a Node corresponding to the target CPU; the index table item comprises a data abstract of a session forwarding table item and an identifier of the session forwarding table item;
and if the message exists, determining the session forwarding table entry based on the searched identification in the index table entry, and forwarding the message according to the session information recorded by the session forwarding table entry.
For example, the identifier is used to indicate a memory address of the session forwarding table entry, and is offset from an address of the session forwarding table starting memory address; the target CPU can determine the memory address of the session forwarding table according to the address offset recorded in the index table, and forward the message according to the session information recorded in the session forwarding table.
In the above technical solution, by maintaining the index table on each Node of the network device, when each CPU processes the message, it is able to search the index table on the Node corresponding to the CPU, so as to avoid excessive remote memory access caused by searching the index tables on other nodes, thereby implementing that the CPU accesses the local memory as much as possible, reducing remote memory access, improving the processing performance of the network device, and improving the message forwarding efficiency.
Next, embodiments of the present application will be described in detail.
Referring to fig. 2, fig. 2 is a flowchart of a message forwarding method according to an exemplary embodiment of the present application, as shown in fig. 2, where 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 a Node corresponding to the target CPU; the index table item comprises a data abstract of a session forwarding table item and an identifier of the session forwarding table item;
step 203: and if the message exists, determining the session forwarding table entry based on the searched identification in the index table entry, and forwarding the message according to the session information recorded by the session forwarding table entry.
Wherein, the network equipment is provided with a plurality of CPUs adopting NUMA architecture, and at least comprises a Node; each Node at least corresponds to one CPU, and each Node maintains a session forwarding table and an index table.
In the embodiment, the target CPU responds to the received message and calculates a data abstract according to the session characteristics of the message;
for example, the target CPU responds to the received message, acquires the session feature of the message, and calculates a hash value corresponding to the session feature of the message based on a preset hash algorithm.
The target CPU may be a physical CPU or a VCPU, which is not limited in this application, and a person skilled in the art may associate the divided Node with the CPU according to actual needs, which only needs to ensure that each CPU has a corresponding Node.
By dividing the memory into a plurality of nodes and associating each Node with one or more CPUs, each CPU is corresponding to one Node, so that the access speed of the CPU to the local memory is improved.
In addition, the network device may determine a target CPU that processes the message from the plurality of CPUs, and send the message to the target CPU.
For example, RSS (Receive Side Scaling) is a network card driving technology, and the network device can use RSS function to realize efficient distribution of the packets received by the network card among multiple CPUs in a multi-CPU system.
In one embodiment, the network device further carries a network card with RSS function;
the network card calculates a hash value corresponding to the five-tuple 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; the least significant bit of the hash value is taken for indexing the indirect addressing table RETA (redirection table); wherein, the indirect addressing table RETA stores index values for distributing data messages to different CPU receiving processes. By offloading network traffic to multiple CPUs, the occupancy of a single CPU can be reduced.
In this embodiment, the target CPU searches for whether an index table entry corresponding to the data digest calculated according to the session feature of the received message exists in the index table maintained by the Node corresponding to itself; the index table item comprises a data abstract of a session forwarding table item and an identification of the session forwarding table item.
For example, the target CPU matches the index table maintained by the Node corresponding to itself based on the data digest calculated according to the session characteristics of the received message, and searches whether there is an index table item consistent with the data digest; the searched index table entry records the data abstract of the session forwarding table entry corresponding to the message and the identification of the session forwarding table entry.
Wherein, two continuous memory spaces can be allocated in each Node for maintaining session forwarding table and index table respectively. The session forwarding table entry in the session forwarding table records the session information required by message forwarding, and the index table entry in the index table records the data abstract of the session forwarding table entry corresponding to the message and the identification of the session forwarding table entry.
In addition, after finding that the index table entry corresponding to the data abstract exists, to ensure the matching accuracy, it may be further determined whether the five-tuple of the message is the same as the five-tuple recorded in the index table entry.
In one embodiment, the index entry also stores a five-tuple of the message;
further, comparing whether the five-tuple of the message is consistent with the found five-tuple in the index table, and if so, determining a session forwarding table item based on the found pointer in the index table item.
For session forwarding tables and index tables maintained in each Node, allocation may be performed by the network device when performing initialization operations.
In one embodiment, the method includes the steps of responding to an initialization request of the network equipment, acquiring the total number of nodes, and distributing a session for each Node based on the total number of the nodes and a memory space corresponding to the number of the sessions; and allocating a memory space for storing the index table for each Node.
For example, when the network device starts the NUMA function and performs initialization, assuming that the number of detected nodes is n and the total number of sessions supported by the device is m, m/n sessions can 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, a memory space for storing the index table can be allocated for each Node.
Further, in one embodiment shown, the sessions are linked in a linked list manner and initialized to an idle linked list; initializing the index table to an idle state.
For example, after each Node allocates a session, the allocated sessions are concatenated in a linked list manner and connected to the head of the idle linked list. By means of the linear linked list, flexible management of the session can be achieved.
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 use linked list stores session forwarding table entries which have been added.
In this embodiment, if there is an index table entry corresponding to the data summary, the session forwarding table entry is determined based on the found identifier in the index table entry, and the message is forwarded according to the session information recorded in the session forwarding table entry.
For example, after determining that there is an index table entry corresponding to the data abstract, obtaining an identifier of a session forwarding table entry recorded in the index table entry, obtaining session information recorded in the session forwarding table entry according to the identifier, and forwarding a message according to the session information recorded in the session forwarding table entry.
In one embodiment shown, the identification 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;
further, according to the address offset recorded in the index table entry, determining the memory address of the session forwarding table entry.
For example, the initial 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 one embodiment, if there is no index entry corresponding to the data summary, acquiring an idle session in the idle linked list, saving session information corresponding to the message to the idle session, and transferring the idle session to a usage linked list;
acquiring the idle index table, taking 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, recording a data abstract calculated based on the session characteristics of the message in the idle index table, and updating the idle index table into a use state;
and forwarding the message according to the session information corresponding to the message.
After the CPU executes the operation on the first received message, 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 received again later, the session forwarding table maintained by the Node has recorded the session forwarding table item corresponding to the message, the index table also has recorded the data abstract of the session forwarding table item corresponding to the message and the identifier of the session forwarding table item, and the CPU can directly complete message forwarding by using the session information only by executing the steps 201-203.
In one embodiment, traversing a usage linked list in a session forwarding table maintained by the Node to detect whether a session aging flag exists;
and if so, transferring the use session in the use linked list to an idle session chain, and updating the index table maintained by the Node into an idle state.
For example, a thread for monitoring the session usage chain may be allocated on 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 removes the session from the usage chain and hangs it on the idle chain.
In the above technical solution, by maintaining the index table on each Node of the network device, when each CPU processes the message, it is able to search the index table on the Node corresponding to the CPU, so as to avoid excessive remote memory access caused by searching the index tables on other nodes, thereby implementing that the CPU accesses the local memory as much as possible, reducing remote memory access, improving the processing performance of the network device, and improving the message 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 one embodiment, the method for forwarding a message includes the following steps:
s301: the target CPU receives the message;
the message can be loaded by network equipment and provided with a network card with an RSS function, 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 a session feature of the message, and calculate a hash value corresponding to the session feature of the message 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 a Node corresponding to the target CPU;
the index table item comprises a data abstract of a session forwarding table item and an identification of the session forwarding table item.
It should be noted that, the network device is provided with a plurality of CPUs adopting a NUMA architecture, and the network device at least comprises a Node; each Node at least corresponds to one CPU, and each Node 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 more CPUs, each CPU is corresponding to one Node, so that the access speed of the CPU to the local memory is improved.
S304: if so, determining the session forwarding table item based on the searched identification in the index table item;
the identifier is used for indicating a memory address of the session forwarding table entry, and is offset relative to an address of a 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 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 in the session forwarding table.
S306: if the index table item 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 using linked list; the idle linked list stores idle session forwarding table entries, and the use linked list stores session forwarding table entries which have been added.
S307: acquiring the idle index table, taking 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, recording a data abstract calculated based on the session characteristics of the message in the idle index table, and updating the idle index table into a use state;
the initial memory address of the session forwarding table, plus the address offset, is the acquired memory address of the idle session.
S308: and forwarding the message according to the session information corresponding to the message.
In the above technical solution, by maintaining the index table on each Node of the network device, when each CPU processes the message, it is able to search the index table on the Node corresponding to the CPU, so as to avoid excessive remote memory access caused by searching the index tables on other nodes, thereby implementing that the CPU accesses the local memory as much as possible, reducing remote memory access, improving the processing performance of the network device, and improving the message forwarding efficiency.
Corresponding to the method embodiments described above, the present application also provides embodiments of the apparatus.
Corresponding to the method embodiment, the application also provides an embodiment of the message forwarding device. The embodiment of the message forwarding device can be applied to electronic equipment. The apparatus embodiments may be implemented by software, or may be implemented by hardware or a combination of hardware and software. Taking software implementation as an example, the device in a logic sense is formed by reading corresponding computer program instructions in a nonvolatile memory into a memory by a processor of an electronic device where the device is located 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 shown in an exemplary embodiment of the present application is shown, and in addition to a processor, a memory, a network interface, and a nonvolatile memory shown in fig. 4, the electronic device where the apparatus is shown in the embodiment may further include other hardware according to an actual function of the electronic device, which is not described herein.
Referring to fig. 5, fig. 5 is a block diagram of a packet forwarding device according to an exemplary embodiment of the present application, as shown in fig. 5, the packet forwarding device 500 may be applied to the electronic device shown in fig. 4, and includes:
a calculating unit 501, configured to calculate, when a target CPU responds to a received message, a data summary according to session characteristics of the message;
a searching unit 502, configured to search whether an index table entry corresponding to the data summary exists in an index table maintained by a Node corresponding to the target CPU; the index table item comprises a data abstract of a session forwarding table item and an identifier of the session forwarding table item;
and a forwarding unit 503, configured to determine the session forwarding table entry based on the found identifier in the index table entry when the index table entry exists, and forward the packet according to session information recorded by the session forwarding table entry.
The message forwarding apparatus 500 may be applied to a network device, where the network device is equipped with a plurality of CPUs adopting a NUMA architecture, and the network device includes at least one Node; each Node at least corresponds to one CPU, and maintains a session forwarding table and an index table;
in an embodiment, the network device further carries a network card with an RSS function;
the network card calculates a hash value corresponding to the five-tuple 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 device 500 further includes:
the allocation unit is used for responding to the initialization request of the network equipment, obtaining the total number of the nodes, allocating session for each Node based on the total number of the nodes, and storing memory spaces corresponding to the number of the session; and the memory space for storing the index table is allocated for each Node.
In an embodiment, the packet forwarding device 500 further includes:
the initialization unit is used for associating the session in a linked list mode and initializing the session 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 use linked list stores session forwarding table entries which have been added.
In an embodiment, the identifier is configured to indicate a memory address of the session forwarding table entry, and is offset from an address of 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 according to the address offset recorded in the index table.
In an embodiment, the index table entry further stores a five-tuple of the message;
the message forwarding apparatus 500 further includes:
and the comparison unit is used for comparing whether the five-tuple of the message is consistent with the searched five-tuple in the index table, and if so, determining a session forwarding table item based on the searched pointer in the index table item.
In an embodiment, the packet forwarding device 500 further includes:
the first acquisition unit is used for acquiring 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 if the index table item corresponding to the data abstract does not exist;
a second obtaining unit, configured to obtain the idle index table, record a data summary calculated based on a session feature of the message, and update the idle index table to a use state, where the address offset of a memory address of the idle session relative to a starting memory address of the session forwarding table is used as an identifier;
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 device 500 further includes:
the detection unit is used for traversing a use linked list in the session forwarding table maintained by the Node and detecting whether a session aging mark exists or not;
and the transferring 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 into an idle state when the ageing mark exists.
The embodiments in this application are all described in a progressive manner, and the same/similar parts of each embodiment are all referred to each other, and each embodiment focuses on differences from other embodiments. In particular, for the client device embodiments, the apparatus embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the modules illustrated as separate components may or may not be physically separate, and the components shown as modules may or may not be physical, i.e., may be located in one place, or may be distributed over a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present application. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The apparatus, device, module or module set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or a combination of any of these devices.
Corresponding to the method embodiment described above, 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, by reading and executing machine-executable instructions stored by the memory corresponding to user authentication logic:
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 a Node corresponding to the target CPU; the index table item comprises a data abstract of a session forwarding table item and an identifier of the session forwarding table item;
and if the message exists, determining the session forwarding table entry based on the searched identification in the index table entry, and forwarding the message according to the session information recorded by the session forwarding table entry.
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 application 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 application 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 is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.
The foregoing description of the preferred embodiments of the present invention is not intended to limit the invention to the precise form disclosed, and any modifications, equivalents, improvements and alternatives falling within the spirit and principles of the present invention are intended to be included within the scope of the present invention.

Claims (9)

1. The message forwarding method is applied to network equipment, wherein the network equipment is provided with a plurality of CPUs adopting a NUMA architecture, and the network equipment at least comprises a Node; each Node at least corresponds to one CPU, and maintains a session forwarding table and an index table; the method comprises the following steps:
responding to the initialization request of the network equipment, obtaining the total number of the nodes, distributing session for each Node based on the total number of the nodes, and storing memory space corresponding to the number of the session; memory space for storing the index table is allocated for each Node;
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 a Node corresponding to the target CPU; the index table item comprises a data abstract of a session forwarding table item and an identifier of the session forwarding table item;
and if the message exists, determining the session forwarding table entry based on the searched identification in the index table entry, and forwarding the message according to the session information recorded by the session forwarding table entry.
2. The method of claim 1, wherein the network device further carries a network card with RSS function;
before the target CPU responds to the received message, the method further includes:
the network card calculates a hash value corresponding to the five-tuple 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, the method further comprising:
associating the session in a linked list mode, and initializing the session into an idle linked list;
initializing the index table to an idle state.
4. 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 use linked list stores session forwarding table entries which have been added.
5. The method of claim 1, the identifying an address offset to indicate a memory address of the session forwarding table entry relative to a starting memory address of the session forwarding table;
the determining a session forwarding table item based on the found identification in the index table item comprises:
and determining the memory address of the session forwarding table according to the address offset recorded in the index table.
6. The method of claim 1, wherein the index entry further stores a five-tuple of the message;
before determining the session forwarding table entry based on the found identification in the index table entry, the method further includes:
comparing whether the five-tuple of the message is consistent with the five-tuple in the searched index table, and if so, determining a session forwarding table item based on the identifier in the searched index table item.
7. The method of claim 4, the method further comprising:
if the index table item 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 an idle index table, taking 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, recording a data abstract calculated based on the session characteristics of the message in the idle index table, and updating the idle index table into a use state;
and forwarding the message according to the session information corresponding to the message.
8. The method of claim 4, the method further comprising:
traversing a use linked list in a session forwarding table maintained by the Node, and detecting whether a session aging mark exists;
and if so, transferring the use session in the use linked list to an idle session chain, and updating the index table maintained by the Node into an idle state.
9. The message forwarding device is applied to network equipment, wherein the network equipment is provided with a plurality of CPUs adopting a NUMA architecture, and at least comprises a Node; each Node at least corresponds to one CPU, and maintains a session forwarding table and an index table; the device comprises:
the allocation unit is used for responding to the initialization request of the network equipment, obtaining the total number of the nodes, allocating session for each Node based on the total number of the nodes, and storing memory spaces corresponding to the number of the session; and the memory space for storing the index table is allocated for each Node;
the computing unit is used for computing a data abstract according to the session 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 item comprises a data abstract of a session forwarding table item and an identifier of the session forwarding table item;
and the forwarding unit is used for determining the session forwarding table entry based on the searched identification in the index table entry when the index table entry exists, and forwarding the message according to the session information recorded by the session forwarding table entry.
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 CN113419973A (en) 2021-09-21
CN113419973B true 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)

Families Citing this family (2)

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

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112948313A (en) * 2021-03-01 2021-06-11 杭州迪普科技股份有限公司 Session data management method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114024962B (en) * 2016-09-20 2023-04-18 华为技术有限公司 Data transmission method and device
CN108363621B (en) * 2018-01-18 2020-09-01 东软集团股份有限公司 Message forwarding method and device under numa architecture, storage medium and electronic equipment
CN109359222B (en) * 2018-08-06 2021-07-06 杭州复杂美科技有限公司 Data 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

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112948313A (en) * 2021-03-01 2021-06-11 杭州迪普科技股份有限公司 Session data management method and device

Also Published As

Publication number Publication date
CN113419973A (en) 2021-09-21

Similar Documents

Publication Publication Date Title
CN113419973B (en) Message forwarding method and device
CN111796948B (en) Shared memory access method and device, computer equipment and storage medium
CN108139966B (en) Method for managing address conversion bypass cache and multi-core processor
US6502168B1 (en) Cache having virtual cache controller queues
CN107229593B (en) Cache consistency operation method of multi-chip multi-core processor and multi-chip multi-core processor
US8281103B2 (en) Method and apparatus for allocating storage addresses
CN107341114B (en) Directory management method, node controller and system
CN112948313B (en) Session data management method and device
CN115292214A (en) Page table prediction method, memory access operation method, electronic device and electronic equipment
US20170364442A1 (en) Method for accessing data visitor directory in multi-core system and device
CN109101439B (en) Message processing method and device
KR101198400B1 (en) Memory management apparatus and method
CN116010293A (en) Data request processing circuit and method, cache circuit and processor thereof
CN111367921A (en) Data object refreshing method and device
CN106302259B (en) Method and router for processing message in network on chip
CN110825521B (en) Memory use management method and device and storage medium
CN115129709A (en) Data processing method, server and system
CN115794366A (en) Memory prefetching method and device
US20040064655A1 (en) Memory access statistics tool
CN114930306A (en) Bandwidth balancing method and device
WO2023130953A1 (en) Data search method and apparatus, and network device
EP4339776A1 (en) Task scheduling method, system, and hardware task scheduler
CN111274228B (en) Policy data migration storage method, system, equipment and readable storage medium
WO2022028165A1 (en) Cache management method, terminal, and storage medium
CN117370227A (en) Memory page determining method and computing device

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