A method, device, network equipment and storage medium for backing up flow table data
By backing up the flow table data to the target memory space and message queue in a multi-core network device, and serialized by the backup core, the problem of flow table data backup affecting the data forwarding performance is solved, and efficient data synchronization and forwarding is achieved.
Patent Information
- Application Number
- CN202111272140.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2041-10-29
AI Technical Summary
In multi-core network devices, the backup method of stream table data affects the data forwarding performance of the processor core and cannot ensure the synchronization efficiency of the backup data.
Through the target forwarding core, the new flow table data is sent to the target memory space, and the backup data is sent to the target message queue. The target backup core is serialized and processed and sent, so as to realize the separation of data forwarding tasks and backup tasks, and reduce the forwarding core data processing pressure.
It improves the synchronization efficiency and data forwarding efficiency of flow table data, and reduces the data processing pressure of forwarding cores.
Smart Images

Figure CN114020529B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to network transmission technology, and in particular to a flow table data backup method, device, network equipment and storage medium. Background Art
[0002] For network devices running in the existing network, when a network device fails, another device is needed to quickly take over the current network traffic. Therefore, the active-standby disaster recovery function has become an indispensable part of network devices.
[0003] When the main machine fails, the backup machine becomes the main machine to take over the current traffic business to ensure the continuity of the business in the existing network. Whether the new main machine can quickly take over the current business traffic after the switchover depends on the flow table data on the old main machine, thereby ensuring high-speed forwarding of the traffic.
[0004] In the prior art, virtualized network devices are mostly multi-core network devices. In a multi-core environment, the backup of flow table data is usually performed by each processor core, which sends its own backup data. That is, each processor core performs flow table data backup while processing traffic forwarding. However, such flow table backup method greatly affects the data forwarding performance of the processor core and cannot ensure the synchronization efficiency of the backup data. Summary of the invention
[0005] The embodiments of the present invention provide a flow table data backup method, device, network device and storage medium to implement flow table data backup of the network device.
[0006] In a first aspect, an embodiment of the present invention provides a method for backing up flow table data, including:
[0007] In response to detecting that there is newly added flow table data in the target forwarding core, sending the backup data of the newly added flow table data to a matching target memory space through the target forwarding core;
[0008] Sending the backup data in the target memory space to a matching target message queue;
[0009] Reading the backup data in the target message queue through the target backup core, and serializing the backup data;
[0010] The serialized backup data is sent to the standby network device through the target backup core.
[0011] In a second aspect, an embodiment of the present invention provides a flow table data backup device, including:
[0012] A memory space storage module, configured to, in response to detecting that there is newly added flow table data in a target forwarding core, send backup data of the newly added flow table data to a matching target memory space through the target forwarding core;
[0013] A message queue storage module, used for sending the backup data in the target memory space to a matching target message queue;
[0014] A serialization execution module, used to read the backup data in the target message queue through a target backup core and serialize the backup data;
[0015] The backup data sending module is used to send the serialized backup data to the backup network device through the target backup core.
[0016] In a third aspect, an embodiment of the present invention further provides a network device, the network device comprising:
[0017] one or more processors;
[0018] A storage device for storing one or more programs;
[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the flow table data backup method described in any embodiment of the present invention.
[0020] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, implements the method for backing up flow table data described in any embodiment of the present invention.
[0021] The technical solution provided by the embodiment of the present invention sends the backup data of the newly added flow table data to the matching target memory space through the target forwarding core, and after sending the backup data in the target memory space to the matching target message queue, the backup data in the target message queue is read through the target backup core, and the backup data is serialized, and then the serialized backup data is sent to the backup network device, thereby realizing the separation of the data forwarding task and the flow table backup task on the forwarding core, greatly reducing the data processing pressure of the forwarding core, and improving the data forwarding efficiency of the forwarding core. At the same time, by executing serialization and sending backup data through the backup core, the synchronization efficiency of the flow table data is also improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 This is a flow chart of a method for backing up flow table data provided by Embodiment 1 of the present invention;
[0023] Figure 2is a flow chart of a method for backing up flow table data provided by Embodiment 2 of the present invention;
[0024] Figure 3 It is a structural block diagram of a flow table data backup device provided by Embodiment 3 of the present invention;
[0025] Figure 4 This is a structural block diagram of a server provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0026] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only the parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0027] Embodiment 1
[0028] Figure 1 This is a flowchart of a method for backing up flow table data provided in Embodiment 1 of the present invention. This embodiment is applicable to a network device as a host to back up flow table data to a backup machine. The method can be performed by a flow table data backup device in an embodiment of the present invention. The device can be implemented by software and / or hardware and integrated in a network device. Typically, it can be integrated in a network device such as a switch, a router or a server. The method specifically includes the following steps:
[0029] S110 . In response to detecting that there is newly added flow table data in the target forwarding core, sending backup data of the newly added flow table data to a matching target memory space through the target forwarding core.
[0030] A flow table, i.e., a traffic statistics table, is a collection of policy table entries for data flows, and is responsible for searching and forwarding data packets; the flow table includes header fields for data packet matching, counters for counting the number of matching data packets, and actions for displaying the processing methods of matching data packets; since the network traffic carried by the network device, i.e., the network data forwarded by the network device, exists in the form of data packets, a traffic statistics data item recorded in the flow table represents the parameter information of a data packet; wherein the parameter information may specifically include traffic type, rate limit configuration, protocol result, and validity verification result; traffic type, i.e., the data type of the traffic data packet, for example, TCP (Transmission Control Protocol) handshake message; rate limit configuration, i.e., the transmission rate requirement of the traffic data packet; protocol result, i.e., the protocol type used by the traffic data packet, for example, STP (Spanning Tree Protocol); validity verification result, i.e., the result identifier after the traffic data packet is validated; optionally, in an embodiment of the present invention, the parameter type of the traffic statistics data item in the flow table is not specifically limited.
[0031] The network device in the embodiment of the present invention has at least two computing engines (i.e., kernels), and the above-mentioned kernels can come from one central processing unit (CPU) or from different central processing units, that is, the network device can include one or more multi-core central processing units, or multiple single-core central processing units, or can include both single-core central processing units and multi-core central processing units; the forwarding core is a kernel used for data forwarding, and each forwarding core has an independent flow table for recording parameter information of the network data forwarded by itself; the backup core does not perform data forwarding tasks; optionally, in the embodiment of the present invention, there is no specific limitation on the number of central processing units and the number of kernels of the network device.
[0032] The memory space is the backup data storage space allocated for the forwarding core. The newly added flow table data includes the updated traffic records in the existing flow table and the traffic records in the newly created flow table. When the newly added flow table data is detected in the flow table of the target forwarding core, the backup data (i.e., the copied data) of the newly added flow table data is sent to the matching target memory space through the target forwarding core to store the backup data through the target memory space.
[0033] Optionally, in an embodiment of the present invention, before detecting the presence of newly added flow table data in the target forwarding core, it also includes: configuring the forwarding core and backup core of the network device according to the historical traffic records of the network device; wherein the network device includes at least one of the forwarding cores and at least one of the backup cores, and the backup core matches at least one of the forwarding cores. According to the historical traffic records of the network device and the data processing capabilities of each core, one or more cores are configured as forwarding cores to meet the forwarding requirements of network traffic through the above forwarding cores; at the same time, according to the data processing capabilities of each forwarding core, one or more cores are configured as backup cores, and each backup core is associated and matched with one or more forwarding cores. While ensuring that the data forwarding requirements of the network device are met, the backup core performs serialization processing and transmission of backup data, thereby reducing the data processing pressure of the forwarding core and improving the data forwarding efficiency of the forwarding core.
[0034] Optionally, in an embodiment of the present invention, sending the backup data of the newly added flow table data to a matching target memory space through the target forwarding core specifically includes: judging whether the target memory space meets the storage requirements of the backup data; if the target memory space meets the storage requirements of the backup data, sending the backup data of the newly added flow table data to a matching target memory space through the target forwarding core; if the target memory space does not meet the storage requirements of the backup data, increasing the capacity of the target memory space, and sending the backup data of the newly added flow table data to the increased target memory space through the target forwarding core.
[0035] Specifically, since each backup data includes the same parameter information items, an individual storage space of the same size, for example, 16 bytes, can be configured for each backup data; at the same time, a fixed number (for example, 1024) of individual storage spaces can be configured for each forwarding core, or different numbers of individual storage spaces can be configured according to the different network traffic carried by each forwarding core; if the target memory space includes at least one unoccupied individual storage space, it indicates that the target memory space meets the storage requirements of the backup data, and the backup data can be directly stored; if the individual storage spaces of the target memory space are all occupied, the target memory space is increased in capacity, for example, the above-mentioned fixed number (i.e., 1024) of individual storage spaces are applied for again to meet the storage requirements of the backup data.
[0036] S120: Send the backup data in the target memory space to a matching target message queue.
[0037] The message queue is a linear table. Backup data is input at one end of the message queue, that is, the backup data is written by the memory space, and backup data is output at the other end, that is, the backup data is read by the backup core.
[0038] Optionally, in an embodiment of the present invention, before detecting the presence of newly added flow table data in the target forwarding core, it also includes: in response to obtaining a device startup instruction, configuring a memory space and a message queue for the forwarding core of the network device; wherein the forwarding cores are matched one-to-one with the memory space, and the forwarding cores are matched one-to-one with the message queues. During the startup phase of the network device, memory space is allocated in advance for each forwarding core, and the corresponding message queue is initialized, so as to avoid the forwarding core from executing an application for memory space and creating a message queue during the data forwarding phase, thereby further reducing the data processing pressure of the forwarding core during the data forwarding phase.
[0039] Optionally, in an embodiment of the present invention, the memory space includes a Cache storage space; and / or the message queue runs based on a producer and consumer mode; wherein the forwarding core is the producer of the message queue, and the backup core is the consumer of the message queue. Cache memory (i.e., cache memory) has the characteristics of fast reading and writing speed. Compared with the long waiting time period required for the central processing unit to access data from the memory, the central processing unit can directly call the data in the Cache memory, which greatly reduces the access waiting time and improves the data processing efficiency; the producer and consumer model solves the problem of strong coupling between the producer (i.e., the forwarding core) and the consumer (i.e., the backup core) through an intermediate container (i.e., a message queue). The producer and consumer do not communicate directly with each other. After the forwarding core sends the backup data, it does not need to wait for the backup core to process it, and directly puts the backup data into the message queue. The backup core also does not need to wait for the producer's backup data to be sent, and directly obtains the backup data from the message queue, balancing the data processing capabilities of the forwarding core and the backup core.
[0040] S130. Read the backup data in the target message queue through the target backup core, and serialize the backup data.
[0041] Serialization is the process of converting backup data from a storage form to a transmission form, so that the backup network device can receive the local backup flow table; compared with the prior art, the serialization of backup data is performed by the forwarding core. In the embodiment of the present invention, the serialization processing of backup data is completed by the target backup core, further reducing the data processing pressure of the forwarding core; optionally, in the embodiment of the present invention, the serialization processing method is not specifically limited.
[0042] Optionally, in an embodiment of the present invention, reading the backup data in the target message queue and serializing the backup data through the target backup core includes: reading the backup data in the target message queue and serializing the backup data through the target backup core according to a preset reading cycle; and serializing the backup data; and / or sending the serialized backup data to the backup network device through the target backup core includes: sending the serialized backup data to the backup network device through the target backup core according to a preset sending cycle and a cumulative threshold to be sent.
[0043] Specifically, a first timer can be set for each backup core, and the timing interval can be set to 10ms, that is, a read notification is sent to the target backup core every 10ms; the target backup core obtains the read notification according to the above preset read cycle (i.e. 10ms), and reads the backup data in the message queue in a polling manner; in order to ensure the timeliness of the flow table data backup, a second timer can also be set for each backup core, and the timing interval can be set to 100ms, that is, a send notification is sent to the backup core every 100ms; the backup core delays the sending of the serialized backup data according to the above preset sending cycle (i.e. 100ms); at the same time, in order to avoid data backlog, a cumulative threshold to be sent is set according to the limit of the amount of data sent at a single time, for example, 1024. When the number of backup data obtained reaches the cumulative threshold to be sent, the above backup data is also sent in batches; by setting the preset sending cycle and the cumulative threshold to be sent, the number of calls to the data sending interface is reduced, and the resource occupation of the network device is reduced.
[0044] S140. Send the serialized backup data to a backup network device through the target backup core.
[0045] Optionally, in an embodiment of the present invention, after the serialized backup data is sent to the backup network device through the target backup core, it includes: determining whether the remaining space of the target memory space is greater than or equal to a preset storage threshold; if the remaining space of the target memory space is greater than or equal to the preset storage threshold, deleting the backup data, and moving the storage space occupied by the backup data out of the target memory space; if the remaining space of the target memory space is less than the preset storage threshold, deleting the backup data, and adding the storage space occupied by the backup data to the target memory space. Specifically, if the remaining space of the target memory space is large, that is, greater than or equal to the preset storage threshold, then after deleting the sent backup data, the storage space occupied by the backup data is directly released, that is, the storage space occupied by the backup data is returned to the memory; if the remaining space of the target memory space is small, that is, less than the preset storage threshold, then after deleting the sent backup data, the storage space occupied by the backup data is returned to the target memory space.
[0046] The technical solution provided by the embodiment of the present invention sends the backup data of the newly added flow table data to the matching target memory space through the target forwarding core, and after sending the backup data in the target memory space to the matching target message queue, the backup data in the target message queue is read through the target backup core, and the backup data is serialized, and then the serialized backup data is sent to the backup network device, thereby realizing the separation of the data forwarding task and the flow table backup task on the forwarding core, greatly reducing the data processing pressure of the forwarding core, and improving the data forwarding efficiency of the forwarding core. At the same time, by executing serialization and sending backup data through the backup core, the synchronization efficiency of the flow table data is also improved.
[0047] Embodiment 2
[0048] Figure 2 A flowchart of a method for backing up flow table data provided in Embodiment 2 of the present invention is provided. The embodiment of the present invention is specific based on the above technical solution. Specifically, the method includes the following steps:
[0049] S201. Configure a forwarding core and a backup core of a network device according to a historical traffic record of the network device; and execute S202.
[0050] S202. In response to obtaining the device startup instruction, execute init initialization of the network device; and execute S203.
[0051] In the embodiment of the present invention, the network device is equipped with a Linux system, and when the network device is started, the initialization of the init process under the Linux system is executed.
[0052] S203, configuring memory space for the forwarding core of the network device and initializing a message queue; executing S204.
[0053] S204: Detect that there is newly added flow table data in the target forwarding core; execute S205.
[0054] S205, determine whether the target memory space meets the storage requirements of the backup data of the newly added flow table data; if so, execute S207; if not, execute S206.
[0055] S206, increasing the capacity of the target memory space; executing S207.
[0056] S207. Send the backup data of the newly added flow table data to the target memory space through the target forwarding core; and execute S208.
[0057] S208. Send the backup data in the target memory space to the matching target message queue; execute S209.
[0058] S209 . Send a read notification to the target backup core through the first timer; and execute S210 .
[0059] S210 . Poll the target message queue through the target backup core to obtain backup data. Execute S211 .
[0060] S211, serialize the backup data and put it into a waiting queue; execute S212.
[0061] S212, determine whether the waiting queue meets the sending conditions; if so, execute S213; if not, execute S204.
[0062] Specifically, it is determined whether the sending notification sent by the second timer is obtained, and whether the amount of backup data in the waiting queue is greater than or equal to the accumulated threshold to be sent.
[0063] S213, sending the backup data in the waiting queue to the standby network device; executing S213.
[0064] S214, determine whether the remaining space of the target memory space is greater than or equal to a preset storage threshold; if so, execute S215; if not, execute S216.
[0065] S215: Delete the backup data in the target memory space, and move the storage space occupied by the backup data out of the target memory space.
[0066] S216: Delete the backup data in the target memory space, and add the storage space occupied by the backup data to the memory space management pool.
[0067] The memory space management pool is used to manage the storage space released by deleting backup data. When an application for increasing the memory space is obtained, the memory space management pool is used to allocate storage space to each memory space.
[0068] The technical solution provided by the embodiment of the present invention configures the forwarding core and the backup core of the network device, and pre-configures the memory space and initializes the message queue for the forwarding core, thereby avoiding the forwarding core from applying for the memory space and creating the message queue in the data forwarding stage, thereby realizing the separation of the data forwarding task and the flow table backup task on the forwarding core, and improving the data forwarding efficiency of the forwarding core. At the same time, through the target backup core, the backup data in the target message queue is read, the backup data is serialized, and then the serialized backup data is sent to the backup network device, so that the serialization and backup data sending performed by the backup core improve the synchronization efficiency of the flow table data.
[0069] Embodiment 3
[0070] Figure 3It is a structural block diagram of a flow table data backup device provided in the third embodiment of the present invention, which specifically includes: a memory space storage module 310, a message queue storage module 320, a serialization execution module 330 and a backup data sending module 340.
[0071] The memory space storage module 310 is used for sending the backup data of the newly added flow table data to the matching target memory space through the target forwarding core in response to detecting that the newly added flow table data exists in the target forwarding core;
[0072] The message queue storage module 320 is used to send the backup data in the target memory space to a matching target message queue;
[0073] A serialization execution module 330, configured to read the backup data in the target message queue through a target backup core and serialize the backup data;
[0074] The backup data sending module 340 is used to send the serialized backup data to the backup network device through the target backup core.
[0075] The technical solution provided by the embodiment of the present invention sends the backup data of the newly added flow table data to the matching target memory space through the target forwarding core, and after sending the backup data in the target memory space to the matching target message queue, the backup data in the target message queue is read through the target backup core, and the backup data is serialized, and then the serialized backup data is sent to the backup network device, thereby realizing the separation of the data forwarding task and the flow table backup task on the forwarding core, greatly reducing the data processing pressure of the forwarding core, and improving the data forwarding efficiency of the forwarding core. At the same time, by executing serialization and sending backup data through the backup core, the synchronization efficiency of the flow table data is also improved.
[0076] Optionally, based on the above technical solution, the flow table data backup device further includes:
[0077] A core configuration execution module is used to configure the forwarding core and backup core of the network device according to the historical traffic records of the network device; wherein the network device includes at least one forwarding core and at least one backup core, and the backup core matches at least one forwarding core.
[0078] Optionally, based on the above technical solution, the flow table data backup device further includes:
[0079] A memory space configuration module is used to configure memory space and message queues for the forwarding core of the network device in response to obtaining a device startup instruction; wherein the forwarding core matches the memory space one-to-one, and the forwarding core matches the message queue one-to-one.
[0080] Optionally, based on the above technical solution, the memory space includes a cache storage space; and / or the message queue operates based on a producer and consumer mode; wherein the forwarding core is the producer of the message queue, and the backup core is the consumer of the message queue.
[0081] Optionally, based on the above technical solution, the memory space storage module 310 specifically includes:
[0082] A storage requirement determination unit, used to determine whether the target memory space meets the storage requirement of the backup data;
[0083] A first memory space storage unit, configured to send the backup data of the newly added flow table data to a matching target memory space through the target forwarding core if the target memory space meets the storage requirements of the backup data;
[0084] The second memory space storage unit is used to increase the capacity of the target memory space if the target memory space does not meet the storage requirements of the backup data, and send the backup data of the newly added flow table data to the increased target memory space through the target forwarding core.
[0085] Optionally, based on the above technical solution, the serialization execution module 330 is specifically used to read the backup data in the target message queue through the target backup core according to a preset reading cycle, and serialize the backup data.
[0086] Optionally, based on the above technical solution, the backup data sending module 340 is specifically used to send the serialized backup data to the backup network device through the target backup core according to a preset sending cycle and a cumulative threshold to be sent.
[0087] Optionally, based on the above technical solution, the flow table data backup device further includes:
[0088] A preset storage threshold determination module is used to determine whether the remaining space of the target memory space is greater than or equal to a preset storage threshold;
[0089] A first storage space release module, configured to delete the backup data and move the storage space occupied by the backup data out of the target memory space if the remaining space of the target memory space is greater than or equal to a preset storage threshold;
[0090] The second storage space releasing module is used to delete the backup data and add the storage space occupied by the backup data to the target memory space if the remaining space of the target memory space is less than a preset storage threshold.
[0091] The above device can execute the backup method of flow table data provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not described in detail in this embodiment, please refer to the backup method of flow table data provided by any embodiment of the present invention.
[0092] Embodiment 4
[0093] Figure 4 A schematic diagram of the structure of a network device provided in Embodiment 4 of the present invention. Figure 4 A block diagram of an exemplary network device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 4 The network device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0094] like Figure 4 As shown, the network device 12 is in the form of a general-purpose computer device. The components of the network device 12 may include, but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 that connects various system components (including the memory 28 and the processing unit 16).
[0095] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0096] The network device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the network device 12, including volatile and non-volatile media, removable and non-removable media.
[0097] Memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Network device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 4 not shown, usually called a "hard drive"). Although Figure 4Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0098] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0099] The network device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may also communicate with one or more devices that enable a user to interact with the network device 12, and / or communicate with any device that enables the network device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the network device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the network device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the network device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0100] The processing unit 16 executes various functional applications and data processing by running the program stored in the memory 28, such as implementing the backup method of the flow table data provided in the embodiment of the present invention. That is: in response to detecting that there is newly added flow table data in the target forwarding core, the backup data of the newly added flow table data is sent to the matching target memory space through the target forwarding core; the backup data in the target memory space is sent to the matching target message queue; the backup data in the target message queue is read through the target backup core, and the backup data is serialized; the serialized backup data is sent to the backup network device through the target backup core.
[0101] Embodiment 5
[0102] Embodiment 5 of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for backing up flow table data as described in any embodiment of the present invention is implemented; the method includes:
[0103] In response to detecting that there is newly added flow table data in the target forwarding core, sending the backup data of the newly added flow table data to a matching target memory space through the target forwarding core;
[0104] Sending the backup data in the target memory space to a matching target message queue;
[0105] Reading the backup data in the target message queue through the target backup core, and serializing the backup data;
[0106] The serialized backup data is sent to the standby network device through the target backup core.
[0107] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0108] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0109] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0110] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0111] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A method for backing up flow table data. It is characterized in that Applied in network equipment, including: In response to detecting that there is newly added flow table data in the target forwarding core, sending the backup data of the newly added flow table data to a matching target memory space through the target forwarding core; Sending the backup data in the target memory space to a matching target message queue; Reading the backup data in the target message queue through the target backup core, and serializing the backup data; Sending the serialized backup data to a backup network device through the target backup core; The serialization is to convert the backup data from a storage form to a transmission form; Before detecting that there is newly added flow table data in the target forwarding core, the method further includes: In response to obtaining the device startup instruction, a memory space and a message queue are configured for a forwarding core of the network device; wherein the forwarding core is matched one-to-one with the memory space, and the forwarding core is matched one-to-one with the message queue; Wherein, the memory space includes a Cache storage space; And / or the message queue operates based on a producer and consumer model; The forwarding core is the producer of the message queue, and the backup core is the consumer of the message queue.
2. The method according to claim 1, It is characterized in that Before detecting that there is newly added flow table data in the target forwarding core, the following steps are also included: According to the historical traffic records of the network device, the forwarding core and the backup core of the network device are configured; wherein the network device includes at least one forwarding core and at least one backup core, and the backup core matches at least one forwarding core.
3. The method according to claim 1, It is characterized in that The sending, through the target forwarding core, the backup data of the newly added flow table data to the matching target memory space specifically includes: Determining whether the target memory space meets the storage requirements of the backup data; If the target memory space meets the storage requirements of the backup data, the backup data of the newly added flow table data is sent to the matching target memory space through the target forwarding core; If the target memory space does not meet the storage requirement of the backup data, the target memory space is increased in capacity, and the backup data of the newly added flow table data is sent to the increased target memory space through the target forwarding core.
4. The method according to claim 1, It is characterized in that The step of reading the backup data in the target message queue through the target backup core and serializing the backup data includes: Reading the backup data in the target message queue through the target backup core according to a preset reading cycle, and serializing the backup data; And / or sending the serialized backup data to the backup network device through the target backup core includes: The serialized backup data is sent to the backup network device through the target backup core according to a preset sending cycle and a cumulative threshold to be sent.
5. The method according to claim 3, It is characterized in that After the serialized backup data is sent to the standby network device through the target backup core, the method includes: Determine whether the remaining space of the target memory space is greater than or equal to a preset storage threshold; If the remaining space of the target memory space is greater than or equal to a preset storage threshold, the backup data is deleted, and the storage space occupied by the backup data is moved out of the target memory space; If the remaining space of the target memory space is less than a preset storage threshold, the backup data is deleted, and the storage space occupied by the backup data is added to the target memory space.
6. A flow table data backup device, It is characterized in that Applied in network equipment, including: A memory space storage module, configured to, in response to detecting that there is newly added flow table data in a target forwarding core, send backup data of the newly added flow table data to a matching target memory space through the target forwarding core; A message queue storage module, used for sending the backup data in the target memory space to a matching target message queue; A serialization execution module, used to read the backup data in the target message queue through a target backup core and serialize the backup data; A backup data sending module, used to send the serialized backup data to the backup network device through the target backup core; The serialization is to convert the backup data from a storage form to a transmission form; Wherein, the backup device of the flow table data further includes: A memory space configuration module, configured to configure a memory space and a message queue for a forwarding core of the network device in response to obtaining a device startup instruction; wherein the forwarding core matches the memory space one-to-one, and the forwarding core matches the message queue one-to-one; Wherein, the memory space includes a cache storage space; and / or the message queue operates based on a producer and consumer mode; wherein the forwarding core is the producer of the message queue, and the backup core is the consumer of the message queue.
7. A network device, It is characterized in that The network equipment includes: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the flow table data backup method as described in any one of claims 1 to 5.
8. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to execute the flow table data backup method according to any one of claims 1 to 5 when executed by a computer processor.
