Message processing method and device and electronic equipment

By obtaining and storing message header information, it determines and processes duplicate data packets, solving the problems of high computational complexity and large resource occupation in the existing technology, achieving efficient detection and processing of duplicate data packets, and is suitable for high-speed bandwidth networks.

CN118764398APending Publication Date: 2024-10-11XINGRONG METADATA TECH (SUZHOU) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410929461.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

The existing technology has high computational complexity when processing repeated data packets, cannot meet high-speed bandwidth business scenarios, and consumes too much computing resources of network equipment, affecting the transmission efficiency of normal traffic.

Method used

By obtaining the message header information, converting it into a data sequence of preset length, storing the timestamp information, judging duplicate messages and deciding to discard or forward them based on the time difference, the storage space and calculation complexity are reduced.

Benefits of technology

It reduces the computational complexity of duplicate packet detection, saves storage resources, improves detection accuracy and efficiency, and meets high-speed bandwidth diversified network business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118764398A_ABST
    Figure CN118764398A_ABST
Patent Text Reader

Abstract

The invention discloses a message processing method and device and electronic equipment. The method comprises the following steps: acquiring message header information of a received first message, and converting the message header information into a data sequence with a preset length; determining a target storage unit matched with the data sequence, and storing a first timestamp for receiving the first message to the target storage unit; if the storage unit corresponding to the received second message is the target storage unit, determining that the first message and the second message are repeated messages; a second timestamp for receiving the second message is greater than the first timestamp; and calculating a time difference between a second timestamp and the first timestamp stored in the target storage unit, and determining to discard or forward a second message based on the time difference. According to the embodiment of the invention, the technical problems that the calculation complexity is high when a switch processes repeated messages, the scene of high-speed bandwidth service cannot be met, and more calculation resources of network equipment are occupied in the prior art can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a message processing method, device and electronic device. Background Art

[0002] With the rapid development of network communication technology, the management of data traffic has become increasingly complex and important. In large data centers, enterprise networks, and Internet service provider networks, duplicate data packets are generated mainly in the following situations: routing loops in the network, broadcast storms, misconfigurations, etc. In addition, duplicate data packets may also be generated due to link problems or equipment failures during data transmission. Duplicate data packets will lead to a waste of network resources, occupy bandwidth resources, and easily cause network congestion, increased latency, and decreased performance, which will have a negative impact on network stability and transmission efficiency.

[0003] In order to solve the technical problem of the above-mentioned duplicate traffic problem, the related technology uses Deep Packet Inspection (DPI) technology to identify and eliminate duplicate data packets. This solution usually requires superimposing multiple cores and multiple high-performance CPUs on the original switch. Therefore, it not only has high computational complexity and limited processing bandwidth, but also cannot meet the scenario of high-speed bandwidth business. Moreover, this solution will occupy more computing resources of network equipment, which is easy to affect the transmission efficiency of normal traffic. Summary of the invention

[0004] In view of the above problems, the present application provides a message processing method, device and electronic device to at least solve the technical problems in the related art that the switch has high computational complexity when processing duplicate messages, cannot meet the scenarios of high-speed bandwidth services, and occupies more computing resources of network devices.

[0005] According to a first aspect of an embodiment of the present application, a message processing method is provided, including: obtaining message header information of a received first message, converting the message header information into a data sequence of a preset length; determining a target storage unit that matches the data sequence, and storing a first timestamp of receiving the first message in the target storage unit; if the storage unit corresponding to the received second message is the target storage unit, determining that the first message and the second message are duplicate messages; the second timestamp of receiving the second message is greater than the first timestamp; calculating the time difference between the second timestamp and the first timestamp stored in the target storage unit, and determining whether to discard or forward the second message based on the time difference.

[0006] According to the second aspect of an embodiment of the present application, a message processing device is provided, and the above-mentioned information retrieval optimization device includes: an acquisition unit, used to acquire message header information of a received first message, and convert the message header information into a data sequence of a preset length; a first determination unit, used to determine a target storage unit matching the data sequence, and store a first timestamp of receiving the first message to the target storage unit; a second determination unit, used to determine that the first message and the second message are duplicate messages if the storage unit corresponding to the received second message is the target storage unit; the second timestamp of receiving the second message is greater than the first timestamp; a calculation unit, used to calculate the time difference between the second timestamp and the first timestamp stored in the target storage unit, and determine to discard or forward the second message based on the time difference.

[0007] According to a third aspect of an embodiment of the present application, there is also provided an electronic device, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the message processing method of the first aspect through the computer program.

[0008] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the message processing method of the first aspect mentioned above when running.

[0009] In an embodiment of the present application, by acquiring the message header information of the received first message, the message header information is converted into a data sequence of a preset length; a target storage unit matching the data sequence is determined, and the first timestamp of receiving the first message is stored in the target storage unit; if the storage unit corresponding to the received second message is the target storage unit, it is determined that the first message and the second message are duplicate messages; the second timestamp of receiving the second message is greater than the first timestamp; the time difference between the second timestamp and the first timestamp stored in the target storage unit is calculated, and a method for discarding or forwarding the second message is determined based on the time difference. Since the present application only stores the tuple information and arrival time information of the message, it can not only greatly reduce the storage space required by the network device and save storage resources; it can also effectively reduce the computational complexity of identifying and eliminating duplicate data packets, while improving the accuracy and efficiency of duplicate message detection, and can also meet the network business scenarios with high-speed bandwidth and diversity. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Moreover, the same reference numerals are used throughout the drawings to represent the same components. In the drawings:

[0011] Figure 1 is a schematic diagram of an application environment of an optional message processing method according to an embodiment of the present application;

[0012] Figure 2 It is a flowchart of an optional message processing method according to an embodiment of the present application;

[0013] Figure 3 It is a flowchart of another optional message processing method according to an embodiment of the present application;

[0014] Figure 4 It is a flowchart of another optional message processing method according to an embodiment of the present application;

[0015] Figure 5 It is a structural schematic diagram of a message processing device provided in an embodiment of the present application;

[0016] Figure 6 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0017] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only embodiments of a part of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0018] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0019] As an optional implementation, the message processing method of the present application can be applied to Figure 1 In the application environment shown. Figure 1 As shown, human-computer interaction can be performed between the user 102 and the electronic device 104. The user device 204 includes a memory 106 and a processor 108; the memory 106 is used to store various types of information of the message, and timestamp information, and the processor 108 is used to obtain the message header information of the received first message, convert the message header information into a data sequence of a preset length; determine a target storage unit matching the data sequence, and store the first timestamp of receiving the first message in the target storage unit; if the storage unit corresponding to the received second message is the target storage unit, determine that the first message and the second message are duplicate messages; the second timestamp of receiving the second message is greater than the first timestamp; calculate the time difference between the second timestamp and the first timestamp stored in the target storage unit, and determine to discard or forward the second message based on the time difference.

[0020] Optionally, the electronic device 102 includes but is not limited to various message forwarding devices, such as switches, routers and other network devices. The electronic device 102 may also include an integrated circuit (ASIC, Application Specific Integrated Circuit) chip for special applications. The memory 106 may include multiple registers. The above is only an example, and this embodiment does not make any limitation to this.

[0021] With the rapid development of network communication technology, the management of data traffic has become increasingly complex and important. In large data centers, enterprise networks, and Internet service provider networks, duplicate data packets are generated mainly in the following situations: routing loops in the network, broadcast storms, misconfigurations, etc. In addition, duplicate data packets may also be generated due to link problems or equipment failures during data transmission. Duplicate data packets will lead to a waste of network resources, occupy bandwidth resources, and easily cause network congestion, increased latency, and decreased performance, which will have a negative impact on network stability and transmission efficiency.

[0022] In order to solve the above-mentioned duplicate traffic problem, a solution is proposed. In the related technology, Deep Packet Inspection (DPI) technology is used to identify and remove duplicate data packets. This solution usually requires the addition of multiple cores and multiple high-performance CPUs to the original switch. Therefore, it not only has high computational complexity and limited processing bandwidth, but also cannot meet the needs of high-speed bandwidth services. Moreover, this solution will occupy more computing resources of network equipment, which is likely to affect the transmission efficiency of normal traffic. In addition, other solutions use a cache-based method to store the characteristic information of transmitted data packets, and identify duplicate traffic by comparing new data packets. However, this method requires a large amount of storage space, and the performance will also be significantly reduced in high-traffic environments. Traditional aggregation and diversion equipment either does not have efficient duplicate traffic detection and removal capabilities, or can only identify and remove duplicate traffic from Gbps-level traffic, and cannot cope with Tbps-level traffic access and identify and remove duplicate traffic from it.

[0023] In order to solve the above technical problems, as an optional implementation method, Figure 2 As shown, the embodiment of the present application provides a message processing method, which is applied to a network device and includes the following steps:

[0024] S202: Acquire message header information of a received first message, and convert the message header information into a data sequence of a preset length.

[0025] Specifically, the above network devices include but are not limited to message forwarding devices such as programmable switches; taking a switch as an example, when a large number of messages enter the switch, assuming that any message received at the current moment is the first message, the message header information of the first message is obtained, and the message header information includes but is not limited to five-tuple information: source IP address, source port, destination IP address, destination port and transport layer protocol, as well as valid information such as checksum. The message header information is converted into a data sequence of a preset length through a hash function. The data sequence of the preset length here can be, for example, a 32-bit hash value.

[0026] S204: Determine a target storage unit that matches the data sequence, and store a first timestamp of receiving the first message in the target storage unit.

[0027] Specifically, in the embodiment of the present application, for example, the 32-bit hash value calculated above can be used as an index to find a target storage unit that matches the 32-bit hash value, and the first timestamp of the first message entering the switch can be stored in the target storage unit.

[0028] S206: If the storage unit corresponding to the received second message is the target storage unit, determine that the first message and the second message are duplicate messages; and a second timestamp of receiving the second message is greater than the first timestamp.

[0029] Specifically, in the embodiment of the present application, after the switch receives the first message, it subsequently receives the second message, and performs the same preprocessing operation on the second message as the first message, that is, obtaining the message header information of the first message, converting the message header information into a data sequence of a preset length, and determining a target storage unit that matches the data sequence. If the received second message corresponds to the same storage unit as the first message, it is determined that the first message and the second message are duplicate messages.

[0030] S208: Calculate the time difference between the second timestamp and the first timestamp stored in the target storage unit, and determine whether to discard or forward the second message based on the time difference.

[0031] Specifically, in an embodiment of the present application, after determining that the first message and the second message are duplicate messages, the time difference between the second timestamp and the first timestamp stored in the target storage unit is calculated, and based on the time difference, it is determined to discard or forward the second message. For example, when the time difference is greater than a preset duration (message aging time), it is determined to forward the second message. When the time difference is less than or equal to the preset duration, it is determined to discard the second message.

[0032] In an embodiment of the present application, by acquiring the message header information of the received first message, the message header information is converted into a data sequence of a preset length; a target storage unit matching the data sequence is determined, and the first timestamp of receiving the first message is stored in the target storage unit; if the storage unit corresponding to the received second message is the target storage unit, it is determined that the first message and the second message are duplicate messages; the second timestamp of receiving the second message is greater than the first timestamp; the time difference between the second timestamp and the first timestamp stored in the target storage unit is calculated, and a method for discarding or forwarding the second message is determined based on the time difference. Since the present application only stores the tuple information and arrival time information of the message, it can not only greatly reduce the storage space required by the network device and save storage resources; it can also effectively reduce the computational complexity of identifying and eliminating duplicate data packets, while improving the accuracy and efficiency of duplicate message detection, and can also meet the network business scenarios with high-speed bandwidth and diversity.

[0033] In one or more embodiments, Figure 3 As shown, the embodiment of the present application also provides a message processing method, comprising the following steps:

[0034] S302, obtaining the message header information of the received first message, and combining each attribute information in the message header information into a combined character sequence;

[0035] S304, inputting the combined character sequence into a preset hash function for calculation to obtain a data sequence of the preset length;

[0036] S306: Determine a target storage unit that matches the data sequence, and store a first timestamp of receiving the first message in the target storage unit.

[0037] Specifically, the above-mentioned attribute information is, for example, quintuple information and checksum information. When the switch obtains the message header information of the first message, for example, the quintuple and checksum information are combined into a merged character sequence, and then the merged character sequence is input into a preset hash function for calculation to obtain a 32-bit data sequence, that is, a 32-bit hash value. The hash value is used as the search index of the storage unit, and after finding the target storage unit that matches the data sequence, the first timestamp of receiving the first message is stored in the target storage unit. The message processing method of the present application avoids the multiple hash calculations of the traditional Bloom Filter, reduces the computational complexity, and improves the duplicate detection efficiency and performance of the system.

[0038] S308: If the storage unit corresponding to the received second message is the target storage unit, determine that the first message and the second message are duplicate messages; and receive a second timestamp of the second message that is greater than the first timestamp.

[0039] S310: Calculate a time difference between a second timestamp and the first timestamp stored in the target storage unit, and determine whether to discard or forward the second message based on the time difference.

[0040] The above steps S308-S310 have been clearly explained in the previous text and will not be repeated here.

[0041] In one or more embodiments, the storage unit includes a register, and determining a target storage unit matching the data sequence, storing a first timestamp of receiving the first message in the target storage unit, comprises:

[0042] Using the data sequence as an index identifier of a register, determining a target register corresponding to the index identifier from registers of the network device;

[0043] The first timestamp is stored in the target register.

[0044] Specifically, the storage unit of the network device of the embodiment of the present application includes a plurality of registers, and the number of the above registers can be set according to the demand of the network bandwidth, for example, ranging from tens of thousands to millions, and each stored index identifier corresponds to a hash value. After the switch obtains the message header information of the first message, the five-tuple and the checksum information are combined into a merged character sequence, and then the merged character sequence is input into a preset hash function for calculation to obtain a data sequence of 32 bits in length, that is, a hash value of 32 bits in length. According to the hash value, the index identifier of the register that is the same as the hash value is searched, the target register corresponding to the index identifier is determined, and the first timestamp corresponding to the first message is stored in the target register.

[0045] In one or more embodiments, the message processing method further includes: dividing the data sequence into a plurality of subsequences;

[0046] The step of using the data sequence as an index identifier of a register, determining a target register corresponding to the index identifier from registers of a network device, and storing the first timestamp in the target storage unit includes:

[0047] Using the multiple subsequences as index identifiers of registers respectively, and determining multiple target registers corresponding to the index identifiers from registers of the network device;

[0048] The first timestamps are stored in the plurality of target registers respectively.

[0049] Specifically, in the embodiment of the present application, for example, after calculating the header information of the first message through the hash function, the 32-bit data sequence hash32 is obtained as: 11abcd0129202dff2211ee225522uf11, and hash32 is divided into 4 subsequences, hash_1: 11abcd01, hash_2: 29202dff, hash_1: 2211ee22, hash_1: 5522uf11. The multiple subsequences hash_1 to hash_4 are respectively used as index identifiers of registers, and 4 target registers corresponding to the index identifiers are determined from the registers of the network device; then the timestamp of the first message is stored in the 4 target registers respectively.

[0050] The embodiment of the present application uses a method of one hash calculation and multiple searches, that is, by dividing the 32-bit hash value into multiple parts and searching multiple registers respectively, a hash operation covers multiple search locations, thereby enhancing the accuracy and robustness of duplicate checking. Using the timestamp information recorded by each register, refined management in the time dimension can greatly reduce the situation of misjudgment.

[0051] In one or more embodiments, if the storage unit corresponding to the received second message is the target storage unit, determining that the first message and the second message are duplicate messages includes:

[0052] If the storage units corresponding to the received second message are the multiple target registers, it is determined that the first message and the second message are duplicate messages.

[0053] Specifically, for example, after calculating the message header information of the first message through the hash function, the 32-bit data sequence hash32 is obtained: 11abcd0129202dff2211ee225522uf11, and after calculating the message header information of the second message through the hash function, the 32-bit data sequence hash32 is also obtained: 11abcd0129202dff2211ee225522uf11, that is, the storage unit corresponding to the received second message is the multiple target registers corresponding to the first message, and it is determined that the first message and the second message are duplicate messages.

[0054] In one or more embodiments, determining to discard or forward the second message based on the time difference includes:

[0055] When the time difference is less than or equal to a preset duration, generating a discard flag corresponding to the second message, and determining to discard the second message;

[0056] When the time difference is greater than the preset duration, determine to forward the second message.

[0057] Specifically, in an embodiment of the present application, the above-mentioned preset duration can be an aging duration of the message. When the time difference between the timestamp of the first message and the timestamp of the second message is less than or equal to the preset duration, a discard flag corresponding to the second message is generated, and it is determined to discard the second message, that is, the second message is not forwarded.

[0058] When the time difference between the timestamp of the first message and the timestamp of the second message is greater than a preset duration, it is determined to forward the second message.

[0059] In one or more embodiments, calculating the time difference between the second timestamp and the first timestamp stored in the target storage unit, and determining to discard or forward the second message based on the time difference includes:

[0060] respectively calculating the time difference between the first timestamp and the second timestamp in each of the target registers;

[0061] If any of the obtained time differences is less than or equal to a preset duration, generating a discard flag corresponding to the second message, and determining to discard the second message;

[0062] If each obtained time difference is greater than the preset duration, determine to forward the second message.

[0063] Specifically, in an embodiment of the present application, when the first message and the second message are determined to be duplicate messages, taking the four target registers corresponding to the first message as an example, the four target registers store the first timestamp corresponding to the first message, and the time difference between the first timestamp and the second timestamp in each of the four registers is calculated respectively; if any of the obtained time differences is less than or equal to the preset duration, a discard flag corresponding to the second message is generated, and it is determined to discard the second message; if each of the obtained time differences is greater than the preset duration, it is determined to forward the second message.

[0064] In one or more embodiments, the message header information includes at least one of message tuple information and a checksum.

[0065] The methods for identifying and removing duplicate traffic in related technologies usually have the following problems:

[0066] 1. High CPU computational cost: Traditional duplicate traffic detection solutions usually rely on the CPU to perform in-depth analysis and comparison of data packets. Although this method can accurately detect duplicate data packets, the calculation process is complex and time-consuming. Especially in high-traffic environments, it will significantly increase the CPU load, resulting in a decrease in device processing power, which in turn affects the operation of other normal network functions. In addition, high computational costs may also lead to increased device energy consumption and reduce the energy efficiency of the overall network.

[0067] 2. Cache messages cause longer forwarding delays: Traditional solutions detect duplicate traffic by storing received packets in the cache and comparing them with the data in the cache. Although this method can reduce the computational burden on the CPU, the cache operation itself introduces additional delays. The process of accessing and comparing each packet in the cache takes time, especially when the cache space is limited and packets are replaced frequently, the delay problem becomes more prominent. This increase in forwarding delay affects applications with high real-time requirements, such as video conferencing, online games, etc., and has a negative impact on user experience.

[0068] 3. Large storage space requirements: Traditional cache-based duplicate traffic detection solutions require the storage of a large number of data packets or their characteristic information. As network traffic grows, the amount of data that the cache needs to store also increases. This not only requires network devices to have large-capacity caches, but may also increase the complexity of cache management. In addition, large cache requirements also mean higher costs and energy consumption, increasing the total cost of network operations. In a high-traffic environment, cache overflow and frequent packet replacement will further reduce the accuracy and efficiency of detection.

[0069] 4. Poor adaptability to changes in network topology: Traditional duplicate traffic detection solutions are usually designed for static network topologies and lack flexibility. When the network topology changes, these solutions require complex reconfiguration or even fail to work properly. For example, dynamic load balancing and virtualization technologies in data center networks cause network traffic patterns to change frequently, and traditional solutions are difficult to deal with effectively, resulting in poor results in duplicate traffic detection and elimination.

[0070] In order to solve the above technical problems, based on the above embodiments, as an optional implementation method, Figure 4 As shown, the embodiment of the present application also provides a message processing method, which includes:

[0071] Step S1, message A enters the system of the current network device;

[0072] Step S2, extracting valid information from the message;

[0073] Step S3, calculating the hash value of the above valid information;

[0074] Step S4, indexing the addressing register according to the hash value to obtain the target register;

[0075] Step S5, storing the timestamp of message A entering the system into the target register;

[0076] Step S6, message B enters the system and executes steps S2-S4;

[0077] Step S7, determining that the target register corresponding to message B is the same as the register corresponding to message A;

[0078] Step S8, calculating the time difference between the timestamp when message A enters the system and the timestamp when message B enters the system;

[0079] Step S9, determine whether the time difference in S8 is less than or equal to the aging time, if so, proceed to step S10; if not, proceed to step S11.

[0080] Step S10, set the discard flag of message B and discard message B;

[0081] Step S11, forwarding message B normally.

[0082] The above technical solution of the present application has the following beneficial technical effects:

[0083] 1. Reduce CPU computing costs: This application directly saves the tuple information and arrival time information of the message in the cache of the ASIC chip, and uses the efficient processing capability of the ASIC hardware to complete the detection and elimination of duplicate traffic inside the chip, which significantly reduces the demand for CPU computing resources. It not only improves the overall processing performance of the device, but also reduces energy consumption and improves the energy efficiency of network equipment.

[0084] 2. Reduce forwarding delay: This application avoids forwarding messages to other modules for processing by directly detecting and removing duplicate messages in the cache of the ASIC chip. Since the detection and removal operations are completed inside the ASIC chip, extremely low delay can be achieved, thereby greatly improving the real-time performance of message forwarding, which can be applied to delay-sensitive application scenarios such as video conferencing and online games.

[0085] 3. Save storage space: This application significantly reduces the required storage space by storing only the tuple information and arrival time information of the message in the cache of the ASIC chip. This method not only saves storage resources, but also ensures efficient duplicate traffic detection and elimination within the limited cache space through efficient hash algorithms and time window management, effectively reducing storage costs and improving the accuracy and efficiency of duplicate message detection.

[0086] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0087] According to another aspect of the embodiments of the present application, a message processing device for implementing the above message processing method is also provided. Figure 5 As shown, the device comprises:

[0088] An acquiring unit 502 is configured to acquire header information of a received first message and convert the header information into a data sequence of a preset length;

[0089] A first determining unit 504 is configured to determine a target storage unit that matches the data sequence, and store a first timestamp of receiving the first message in the target storage unit;

[0090] A second determining unit 506 is configured to determine that the first message and the second message are duplicate messages if the storage unit corresponding to the received second message is the target storage unit; and a second timestamp of receiving the second message is greater than the first timestamp;

[0091] The calculation unit 508 is configured to calculate a time difference between a second timestamp and the first timestamp stored in the target storage unit, and determine whether to discard or forward the second message based on the time difference.

[0092] In an embodiment of the present application, by acquiring the message header information of the received first message, the message header information is converted into a data sequence of a preset length; a target storage unit matching the data sequence is determined, and the first timestamp of receiving the first message is stored in the target storage unit; if the storage unit corresponding to the received second message is the target storage unit, it is determined that the first message and the second message are duplicate messages; the second timestamp of receiving the second message is greater than the first timestamp; the time difference between the second timestamp and the first timestamp stored in the target storage unit is calculated, and a method for discarding or forwarding the second message is determined based on the time difference. Since the present application only stores the tuple information and arrival time information of the message, it can not only greatly reduce the storage space required by the network device and save storage resources; it can also effectively reduce the computational complexity of identifying and eliminating duplicate data packets, while improving the accuracy and efficiency of duplicate message detection, and can also meet the network business scenarios with high-speed bandwidth and diversity.

[0093] In one or more embodiments, the acquisition unit 502 includes:

[0094] A combining module, used for combining each attribute information in the message header information into a combined character sequence;

[0095] The first calculation module is used to input the combined character sequence into a preset hash function for calculation to obtain a data sequence of the preset length.

[0096] In one or more embodiments, the storage unit includes a register, and the first determining unit 504 includes:

[0097] A first determination module, configured to use the data sequence as an index identifier of a register, and determine a target register corresponding to the index identifier from registers of the network device;

[0098] A storage module is used to store the first timestamp in the target register.

[0099] In one or more embodiments, the message processing device further includes: a division unit, configured to divide the data sequence into a plurality of subsequences;

[0100] The first determining module includes:

[0101] A first determining subunit is configured to use the multiple subsequences as index identifiers of registers, and determine multiple target registers corresponding to the index identifiers from registers of the network device;

[0102] The storage subunit is used to store the first timestamp in the multiple target registers respectively.

[0103] In one or more embodiments, the first determining unit 504 includes:

[0104] The second determining module is configured to determine that the first message and the second message are duplicate messages if the storage unit corresponding to the received second message is the plurality of target registers.

[0105] In one or more embodiments, the computing unit 508 includes:

[0106] A first discarding module, configured to generate a discarding identifier corresponding to the second message and determine to discard the second message when the time difference is less than or equal to a preset duration;

[0107] The first forwarding module is used to determine to forward the second message when the time difference is greater than the preset duration.

[0108] In one or more embodiments, the computing unit 508 includes:

[0109] A second calculation module, used for respectively calculating each time difference between the first timestamp and the second timestamp in each of the target registers;

[0110] A second discarding module is configured to generate a discarding flag corresponding to the second message if any of the obtained time differences is less than or equal to a preset duration, and determine to discard the second message

[0111] The second discarding module is used to determine to forward the second message if each obtained time difference is greater than the preset duration.

[0112] In one or more embodiments, the message header information includes at least one of message tuple information and a checksum.

[0113] According to another aspect of the embodiment of the present application, an electronic device for implementing the above-mentioned message processing method is also provided. The electronic device may be Figure 1 The electronic device shown in FIG. This embodiment is described by taking the electronic device as a switch as an example. Figure 6As shown, the electronic device includes a memory 602 and a processor 604. The memory 602 stores a computer program, and the processor 604 is configured to execute the steps in any of the above method embodiments through the computer program.

[0114] Optionally, in this embodiment, the electronic device may be at least one network device among a plurality of network devices of a computer network.

[0115] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0116] S1, obtaining message header information of a received first message, and converting the message header information into a data sequence of a preset length;

[0117] S2, determining a target storage unit that matches the data sequence, and storing a first timestamp of receiving the first message in the target storage unit;

[0118] S3, if the storage unit corresponding to the received second message is the target storage unit, determine that the first message and the second message are duplicate messages; the second timestamp of receiving the second message is greater than the first timestamp;

[0119] S4: Calculate the time difference between the second timestamp and the first timestamp stored in the target storage unit, and determine whether to discard or forward the second message based on the time difference.

[0120] Among them, the memory 602 can be used to store software programs and modules, such as the program instructions / modules corresponding to the message processing method and device in the embodiment of the present application, and the processor 604 executes various functional applications and data processing by running the software programs and modules stored in the memory 602, that is, realizing the above-mentioned message processing method. The memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 602 may further include a memory remotely arranged relative to the processor 604, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. Among them, the memory 602 can be specifically used, but not limited to, for storing message information.

[0121] As an example, Figure 6 As shown, the memory 602 may include, but is not limited to, the acquisition unit 502, the first determination unit 504, the second determination unit 506, and the calculation unit 508 in the message processing device. In addition, it may also include, but is not limited to, other module units in the message processing device, which will not be repeated in this example.

[0122] Optionally, the transmission device 606 is used to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmission device 606 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 606 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0123] In addition, the electronic device mentioned above further includes: a connection bus 608, which is used to connect various module components in the electronic device mentioned above.

[0124] In other embodiments, the electronic device may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes in the form of network communication. Among them, the nodes may form a peer-to-peer (P2P) network, and any form of computing device, such as a server, terminal, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.

[0125] In one or more embodiments, the present application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned message processing method. Wherein, the computer program is configured to execute the steps of any of the above-mentioned method embodiments when running.

[0126] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0127] S1, obtaining message header information of a received first message, and converting the message header information into a data sequence of a preset length;

[0128] S2, determining a target storage unit that matches the data sequence, and storing a first timestamp of receiving the first message in the target storage unit;

[0129] S3, if the storage unit corresponding to the received second message is the target storage unit, determine that the first message and the second message are duplicate messages; the second timestamp of receiving the second message is greater than the first timestamp;

[0130] S4: Calculate the time difference between the second timestamp and the first timestamp stored in the target storage unit, and determine whether to discard or forward the second message based on the time difference.

[0131] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0132] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0133] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention.

[0134] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0135] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0136] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0137] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0138] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

[0139] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

Claims

1. A message processing method, characterized in that: Applied to a network device, the method comprises: Acquire message header information of the received first message, and convert the message header information into a data sequence of a preset length; Determine a target storage unit that matches the data sequence, and store a first timestamp of receiving the first message in the target storage unit; If the storage unit corresponding to the received second message is the target storage unit, it is determined that the first message and the second message are duplicate messages; and a second timestamp of receiving the second message is greater than the first timestamp; A time difference between a second timestamp and the first timestamp stored in the target storage unit is calculated, and whether to discard or forward the second message is determined based on the time difference.

2. The method according to claim 1, characterized in that The converting the message header information into a data sequence of a preset length includes: Combining each attribute information in the message header information into a combined character sequence; The combined character sequence is input into a preset hash function for calculation to obtain a data sequence of the preset length.

3. The method according to claim 1 or 2, characterized in that: The storage unit includes a register, and the determining a target storage unit matching the data sequence, storing a first timestamp of receiving the first message in the target storage unit, comprises: Using the data sequence as an index identifier of a register, determining a target register corresponding to the index identifier from registers of the network device; The first timestamp is stored in the target register.

4. The method according to claim 3, characterized in that The method further comprises: dividing the data sequence into a plurality of subsequences; The step of using the data sequence as an index identifier of a register, determining a target register corresponding to the index identifier from registers of a network device, and storing the first timestamp in the target storage unit includes: Using the multiple subsequences as index identifiers of registers respectively, and determining multiple target registers corresponding to the index identifiers from registers of the network device; The first timestamps are stored in the plurality of target registers respectively.

5. The method according to claim 4, characterized in that If the storage unit corresponding to the received second message is the target storage unit, determining that the first message and the second message are duplicate messages includes: If the storage units corresponding to the received second message are the multiple target registers, it is determined that the first message and the second message are duplicate messages.

6. The method according to claim 1 or 2, characterized in that: The determining to discard or forward the second message based on the time difference includes: When the time difference is less than or equal to a preset duration, generating a discard flag corresponding to the second message, and determining to discard the second message; When the time difference is greater than the preset duration, determine to forward the second message.

7. The method according to claim 5, characterized in that The calculating a time difference between the second timestamp and the first timestamp stored in the target storage unit, and determining to discard or forward the second message based on the time difference, comprises: respectively calculating the time difference between the first timestamp and the second timestamp in each of the target registers; If any of the obtained time differences is less than or equal to the preset duration, a discard flag corresponding to the second message is generated, and the second message is discarded. If each obtained time difference is greater than the preset duration, determine to forward the second message.

8. The method according to claim 1 or 2, characterized in that: The message header information includes at least one of message tuple information and a checksum.

9. A message processing device, characterized in that: Applied to network equipment, the device comprises: An acquiring unit, configured to acquire message header information of a received first message, and convert the message header information into a data sequence of a preset length; A first determining unit, configured to determine a target storage unit matching the data sequence, and store a first timestamp of receiving the first message in the target storage unit; A second determining unit, configured to determine that the first message and the second message are duplicate messages if the storage unit corresponding to the received second message is the target storage unit; and a second timestamp of receiving the second message is greater than the first timestamp; A calculation unit is used to calculate a time difference between a second timestamp and the first timestamp stored in the target storage unit, and determine whether to discard or forward the second message based on the time difference.

10. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Method and device for judging message repetition and electronic equipment

    CN119520356A