WO2023134574A1 - Method for flow statistics, device, and system - Google Patents

Method for flow statistics, device, and system Download PDF

Info

Publication number
WO2023134574A1
WO2023134574A1 PCT/CN2023/070981 CN2023070981W WO2023134574A1 WO 2023134574 A1 WO2023134574 A1 WO 2023134574A1 CN 2023070981 W CN2023070981 W CN 2023070981W WO 2023134574 A1 WO2023134574 A1 WO 2023134574A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
index
storage unit
flow
count value
Prior art date
Application number
PCT/CN2023/070981
Other languages
French (fr)
Chinese (zh)
Inventor
曲迪
张亚丽
杨仝
Original Assignee
华为技术有限公司
北京大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司, 北京大学 filed Critical 华为技术有限公司
Publication of WO2023134574A1 publication Critical patent/WO2023134574A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/142Network analysis or design using statistical or mathematical methods
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0823Errors, e.g. transmission errors
    • H04L43/0829Packet loss

Definitions

  • the present application relates to the field of network technologies, and in particular to a flow statistics method, device and system.
  • the large flow refers to several data flows with the largest amount of packets (number or number of bytes) transmitted within a certain period of time.
  • a network device such as a switch
  • the control device may count the number of sampled packets corresponding to each data flow, and determine several data flows with the highest number of sampled packets as large flows.
  • the above method needs to report a large number of sampled messages to the control device, which not only occupies more storage space of the control device, but also has low statistical efficiency.
  • the present application provides a flow statistics method, device and system, which can solve the technical problem that the flow statistics method in the related art occupies more storage space of the control equipment and has low statistical efficiency.
  • a flow statistics method is provided, which is applied to network equipment.
  • the network device first obtains the target packet. Then, the network device obtains the target flow index according to the target flow identifier of the data flow to which the target packet belongs, and obtains the target address index according to the target flow identifier.
  • the target address index is used to indicate a storage area in the storage space of the network device, the storage area includes a plurality of storage units, and each storage unit is used to store a flow index and a packet of the data flow indicated by the flow index count value.
  • the network device also updates the flow index and/or packet count value in the first storage unit among the plurality of storage units according to the target flow index, and counts the packet count value based on the updated packet count value in the first storage unit Traffic of the data flow to which the target packet belongs. Specifically, the network device processes the target flow identifier of the data flow to which the target packet belongs through the first mapping function to obtain the target flow index, and processes the target flow identifier through the second mapping function to obtain the target address index.
  • the traffic of the statistical data stream is not the real traffic of the statistical data stream, but a numerical value that can reflect the traffic volume of the data stream, such as a traffic statistics value.
  • the network device can record the flow index and packet count value of the data flow in the storage unit, and count the traffic of the data flow based on the packet count value. Since the network device does not need to report sampling packets to the control device, the efficiency of flow statistics is improved, and the storage space of the control device will not be occupied. Furthermore, since the stream index in the storage unit is obtained by processing the target stream identifier through the first mapping function, the storage space occupied by the stream index can be reduced.
  • the manner in which the network device updates the flow index and/or the packet count value in the first storage unit among the multiple storage units according to the target flow index may include any of the following: Mode 1, if the If the target flow index is stored in the first storage unit, the packet count value in the first storage unit is increased by a first preset value.
  • Method 2 If there is no storage unit that has stored the target flow index in the multiple storage units, store the target flow index and the initial message count value in a free storage unit among the multiple storage units, and the free storage unit is the first A storage unit, where an idle storage unit refers to a storage unit that does not store a flow index or a message count value.
  • Method 3 If there is no storage unit that has stored the target flow index in the multiple storage units, and there is no free storage unit, then the flow index in a storage unit whose message count value is the initial value in the multiple storage units The target flow index is updated, and the storage unit whose packet count value is the initial value is the first storage unit.
  • the network device can determine the data flow indicated by the flow index stored in the first storage unit (hereinafter referred to as data flow 1) , the number of target packets of the data stream 1 that the network device has obtained is an initial value. Assuming that the data flow of the target packet currently obtained by the network device is data flow 2, it can be inferred that the number of target packets of the data flow 2 currently obtained by the network device is different from that of the data flow 1 obtained by the network device. The number of target packets is equivalent.
  • the network device uses the target stream index of data stream 2 to update the stream index of data stream 1 in the first storage unit, which can ensure that identification of a specific stream among the multiple data streams will not be affected.
  • the specific flow may refer to a data flow with a high flow rate or a high change amount of the flow rate.
  • the network device can also store the multiple The packet count value in the storage unit with the smallest packet count value in the cell is reduced by a first preset value.
  • the packet count value in the storage unit with the least packet count value is reduced to the initial value, when the network device obtains the target packet again, it can be updated using the method shown in the third method above
  • the stream index in the storage unit with the smallest packet count value Based on the above update method, it can be ensured that only when the number of target packets of a new data flow obtained by the network device is greater than or equal to the minimum packet count value in the plurality of storage units, the new data flow can be used.
  • the flow index of the data flow replaces the flow index in the storage unit with the least packet count value. Therefore, in a scenario where the number of storage units in the network device is limited, reliable statistics of the packet count value of the data flow with high traffic can be realized.
  • the process of the network device counting the traffic of the data flow to which the target packet belongs based on the updated packet count value in the first storage unit may include: if the updated packet count value in the first storage unit satisfies If the statistical condition is met, the target flow identifier is reported to the control device, so that the control device increases the traffic statistics value of the data flow indicated by the target flow identifier by a second preset value. Alternatively, if the updated packet count value in the first storage unit satisfies the statistics condition, then increase the traffic statistics value of the data flow indicated by the target flow identifier by a second preset value.
  • the packet count value stored in the first storage unit may be obtained by counting the number of target packets of different data flows.
  • the packet count value when the packet count value satisfies the statistical condition, the currently acquired traffic statistics value of the data flow to which the target packet belongs is updated. Since the network device obtains a large number of target packets of the data flow with a large flow, the number of updates of the traffic statistics value of the data flow with a large flow will be more.
  • the number of target packets obtained by the network device for the data flow with a small flow is small, so the number of updates of the traffic statistics value for the data flow with a small flow will be less. Based on this, relatively accurate statistics on the traffic of different data streams can be realized, and thus a specific stream among multiple data streams can be accurately identified.
  • the process for the network device to report the target flow identifier to the control device may include: the network device encapsulates the target flow identifier in a statistical message, and reports the statistical message to the control device.
  • the network device can adopt the encapsulation method of encapsulating IP (IP encapsulation within IP, IPinIP) in the Internet Protocol (Internet Protocol, IP) to construct the statistical message.
  • IP Internet Protocol
  • the outer destination IP address of the statistical message is the IP address of the control device.
  • the statistical condition may include: the packet count value is an integer multiple of a statistical threshold, and the statistical threshold is an integer greater than 1.
  • the solution provided by this application updates the traffic statistics value of the data flow at the statistics threshold as a statistical interval, which can effectively reduce the update frequency of the traffic statistics value. In this way, it is possible to avoid the excessively high update frequency of the traffic statistics value and the occupation of more processing resources.
  • the network device may also output the flow identifiers of the top K data flows with the highest flow statistics.
  • the network device may also output the flow identifiers of the top K data flows with the highest changes in traffic statistics within a set period of time.
  • K is an integer greater than or equal to 1.
  • the network device may periodically output flow identifiers of the first K data flows according to a preset statistical period.
  • the flow identifier of the data flow output by the network device may refer to: the network device displays the flow identifier of the data flow, or the network device sends the flow identifier of the data flow to another device for the other device to display.
  • the second mapping function includes a first sub-mapping function and a second sub-mapping function.
  • the process for the network device to process the target flow identifier through the second mapping function to obtain the target address index may include: processing the target flow identifier through the first sub-mapping function to obtain the first sub-index.
  • the second sub-index of the target flow identifier is processed by the second sub-mapping function, and the target address index includes the first sub-index and the second sub-index.
  • the storage area indicated by the target address index includes: a first sub-storage area indicated by the first sub-index, and a second sub-storage area indicated by the second sub-index.
  • the plurality of storage units include storage units corresponding to the first sub-storage area and the second sub-storage area.
  • the network device may also store the flow index and packet count in the second storage unit The value is deleted.
  • the storage space of the second storage unit can be released, so as to continue to store the stream index and packet count value of other data streams.
  • the target message may be any message received by the network device, or the target message may be a message to be discarded by the network device.
  • the traffic volume of the data flow counted by the network device may refer to the total packet volume of the data flow. If the target packet is a packet to be discarded by the network device, the traffic volume of the data flow collected by the network device may refer to the packet loss amount of the data flow.
  • a network device in a second aspect, includes multiple functional units, and the multiple functional units interact to implement the methods in the above first aspect and various implementation manners thereof.
  • the multiple functional units can be implemented based on software, hardware or a combination of software and hardware, and the multiple functional units can be combined or divided arbitrarily based on the specific implementation.
  • a network device in a third aspect, includes: a memory, a processor, and a computer program stored on the memory and operable on the processor.
  • the processor executes the computer program, the methods in the above first aspect and its various implementation manners are realized.
  • a flow statistics system includes the network device provided in any one of the above aspects, and a control device.
  • the network device is configured to report the target flow identifier to the control device based on the updated packet count value in the first storage unit.
  • the control device is configured to, based on the received target flow identifier, collect statistics on the traffic of the data flow indicated by the target flow identifier.
  • the network device is configured to report the target flow identifier to the control device if the updated packet count value in the first storage unit satisfies a statistical condition.
  • the control device is configured to increase the traffic statistics value of the data flow indicated by the target flow identifier by a second preset value.
  • control device is further configured to: output the flow identifiers of the top K data flows with the highest traffic statistics, or output the flow identifiers of the top K data flows with the highest changes in the traffic statistics within a set period of time; K is an integer greater than or equal to 1.
  • the network device may be a first chip
  • the control device may be a second chip.
  • the first chip is also called a data plane chip or a forwarding plane chip
  • the second chip is also called a control plane chip.
  • a computer-readable storage medium In a fifth aspect, a computer-readable storage medium is provided. Instructions are stored in the computer-readable storage medium, and when the instructions are executed by the processor, the methods in the above first aspect and various implementation manners thereof are realized.
  • a computer program product including instructions is provided.
  • the instructions in the computer program product are executed by the processor, the methods in the above first aspect and various implementation manners thereof are realized.
  • a chip in a seventh aspect, includes a programmable logic circuit and/or program instructions, and when the chip is running, implements the method in the above first aspect and various implementation manners thereof.
  • the network device After the network device obtains the target packet, it can process the target flow identifier of the data flow to which the target packet belongs through the mapping function to obtain the target flow index and the target address index. Afterwards, the network device can update the flow index and/or packet count value in the first storage unit among the multiple storage units indicated by the target address index according to the target flow index, and based on the updated packet in the first storage unit Counting value, counting the traffic of the data flow to which the target packet belongs. Since the network device does not need to report sampling packets to the control device during the above flow statistics process, the efficiency of flow statistics is effectively improved, and the storage space of the control device will not be occupied. Furthermore, since the stream index stored in the first storage unit is obtained by processing the target stream ID through a mapping function, it is possible to avoid directly storing the target stream ID and occupying more storage space.
  • FIG. 1 is a schematic structural diagram of a flow statistics system provided by an embodiment of the present application
  • Fig. 2 is a schematic structural diagram of another flow statistics system provided by the embodiment of the present application.
  • FIG. 3 is a flow chart of a flow statistics method provided in an embodiment of the present application.
  • Fig. 4 is a schematic diagram of updating a first storage unit provided by an embodiment of the present application.
  • Fig. 5 is a schematic diagram of another first storage unit provided by the embodiment of the present application.
  • FIG. 6 is a schematic diagram of a correspondence between a flow identifier and a traffic statistics value provided by an embodiment of the present application
  • FIG. 7 is a schematic structural diagram of a network device provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of another network device provided by an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of another network device provided by an embodiment of the present application.
  • FIG. 1 is a schematic structural diagram of a flow statistics system provided by an embodiment of the present application.
  • the flow statistics system may include a network device 01 and a control device 02 .
  • the network device 01 is used to obtain the target message.
  • the target flow identifier of the data flow to which the target message belongs is processed by the first mapping function to obtain the target flow index, and the target flow identifier is processed by the second mapping function to obtain the target address index.
  • the target address index indicates a storage area of the network device 01, and the storage area includes multiple storage units, and each storage unit is used to store a flow index and a packet count value of the data flow indicated by the flow index.
  • the network device 01 is further configured to update the flow index and/or packet count value in the first storage unit among the plurality of storage units according to the target flow index, and based on the updated packet count value in the first storage unit, set the target The flow identification is reported to the control device 02.
  • the control device 02 is configured to collect statistics on the traffic of the data flow indicated by the target flow identifier.
  • the "statistics of data stream traffic” mentioned in the embodiment of the present application is not to count the real traffic of data streams, but to count the values that can reflect the traffic volume of the data streams. For example, this value could be the traffic statistics described below.
  • control device 02 may further identify K specific flows from the multiple data flows.
  • the K specific streams may be the top K data streams with the highest traffic among the multiple data streams, or may be the top K data streams with the highest traffic variation among the multiple data streams.
  • K is an integer greater than or equal to 1.
  • the network device 01 may be a first chip
  • the control device 02 may be a second chip.
  • the first chip and the second chip can be deployed in the same device.
  • the first chip and the second chip may be deployed in the same device for forwarding packets, such as a switch or a router, or the first chip and the second chip may be deployed in the same network card.
  • the flow statistics system may be a device for forwarding packets.
  • the first chip may also be called a data plane chip, a forwarding plane chip, or an interface board.
  • the second chip may also be called a control plane chip or a main control board.
  • the data plane chip is used to forward the message and count the message count value.
  • the control plane chip is used to count the traffic of the data flow to which the message belongs based on the message count value.
  • the switch, router or network card is equivalent to the flow statistics system shown in FIG. 1 .
  • the network device 01 and the control device 02 may be two independent devices.
  • the network device 01 may be a device for forwarding packets, such as a switch or a router.
  • the control device 02 may be a forwarding device such as a switch or a router for forwarding packets, or may be a server.
  • the server may be an independent physical server, or a server cluster composed of multiple physical servers, or may be a cloud server (also called a cloud computing service center).
  • the control device 02 may also be a software system running on a server.
  • the flow statistics system may include multiple network devices 01 .
  • the control device 02 may receive the flow identifiers reported by the multiple network devices 01, and perform global statistics on the traffic of the data flows indicated by the flow identifiers reported by the multiple network devices 01.
  • the control device 02 may be a forwarding device at an upper level of the multiple network devices 01 .
  • multiple network devices 01 may be access layer devices, and the control device 02 may be an aggregation layer device.
  • multiple network devices 01 may be aggregation layer devices, and the control device 02 may be a core layer device.
  • the topology of the flow statistics system is a leaf-spine topology
  • the plurality of network devices 01 may be leaf devices in the leaf-spine topology
  • the control device 02 may be spine devices in the leaf-spine topology .
  • the flow statistics system provided in the embodiment of the present application may be applied to a data center network (data center network, DCN), a metropolitan area network, a wide area network, or a campus network.
  • DCN data center network
  • a metropolitan area network a wide area network
  • a campus network a campus network.
  • FIG. 3 is a flow chart of a flow statistics method provided by an embodiment of the present application.
  • the method can be applied to a network device, and the network device can be the network device 01 in the flow statistics system shown in FIG. 1 or FIG. 2 .
  • the method includes:
  • Step 101 acquire the target message.
  • the network device can obtain the target message during the process of forwarding the message of each data flow.
  • the target message may be any message received by the network device.
  • the packet count value of the data flow counted by the embodiment of the present application corresponds to the total amount of packets in the data flow.
  • the target packet may be a packet to be discarded by the network device.
  • the packet count value of the data flow counted by the embodiment of the present application corresponds to the amount of packet loss in the data flow.
  • a network device After a network device receives a message, if it detects any of the following situations, it can discard the message: message verification failure, network congestion, port or link failure of the network device, The forwarding entry of the packet has not been obtained.
  • Step 102 acquire the target flow index.
  • the network device After the network device obtains the target packet, it can obtain the flow identifier of the data flow to which the target packet belongs (referred to as the target flow identifier in this application).
  • the target flow identifier may be an identifier that can uniquely indicate the data flow to which the target packet belongs.
  • the network device can then determine the target flow index for the data flow.
  • the network device may use the target flow identifier as the target flow index, or, the network device processes the target flow identifier through its pre-configured first mapping function, so as to obtain the target flow index of the data flow to which the target packet belongs.
  • the flow identifier of any data flow may include part or all of the information in the 5-tuple of the data flow.
  • the flow identifier may include a source Internet Protocol (Internet Protocol, IP) address and a destination IP address in the five-tuple.
  • the first mapping function may be a hash function (also referred to as a hash function), which can map the flow identifier of the data flow into a fixed-length flow index.
  • the length of the flow index is smaller than the length of the flow identifier.
  • the length of the flow identifier can range from 8 bytes (byte) to 13 bytes (byte).
  • the length of the stream index obtained after being mapped by the first mapping function may be 1 byte.
  • the flow identifier of the data flow may also be referred to as a key value (key) of the data flow.
  • a flow index of a data flow may also be called a flow fingerprint.
  • Step 103 acquire the target address index.
  • the target address index is obtained according to the target flow identifier.
  • a second mapping function is pre-configured in the network device, and the second mapping function may also be a hash function.
  • the network device After the network device acquires the target flow identifier, it can also process the target flow identifier through the second mapping function to obtain the target address index.
  • the target address index indicates a storage area of the network device.
  • the storage area includes a plurality of storage units, and each storage unit is used to store a flow index and a packet count value of the data flow indicated by the flow index. That is, the data storage format of each storage unit may be [stream index, message count value].
  • a hash table may be stored in the network device.
  • the hash table corresponds to storage units with M rows and N columns, and each storage unit may also be called a hash bucket.
  • M and N can be integers greater than 1, and M and N can be flexibly configured according to the storage space of the network device and the number of data streams to be counted.
  • the target address index can indicate at least one row of storage units in the hash table. That is, the storage area indicated by the target address index includes at least one row of storage units in the hash table, where each row of storage units includes N storage units. Correspondingly, the target address index may also be called a row index (index). Certainly, the target address index may also indicate at least one column of storage units in the hash table. Correspondingly, the target address index may also be called a column index.
  • the second mapping function H2 may include a first sub-mapping function H21 and a second sub-mapping function H22.
  • the network device can process the target flow identifier through the first sub-mapping function H21 to obtain the first sub-index a1, and can process the second sub-index a2 of the target flow identifier through the second sub-mapping function H22.
  • the target address index includes a first sub-index a1 and a second sub-index a2.
  • a storage area indicated by the target address index includes: a first sub-storage area S1 indicated by the first sub-index a1, and a second sub-storage area S2 indicated by the second sub-index a2.
  • the multiple storage units in the storage area indicated by the target address index include: storage units corresponding to the first sub-storage area S1 and the second sub-storage area S2.
  • both the first sub-index a1 and the second sub-index a2 are row indexes.
  • the storage unit corresponding to the first sub-storage area S1 is a row of storage units indicated by the first sub-index a1.
  • the storage unit corresponding to the second sub-storage area S2 is a row of storage units indicated by the second sub-index a2.
  • the storage area indicated by the target address index includes two rows (that is, 2 ⁇ N) storage units.
  • the number of sub-mapping functions included in the second mapping function may also be greater than 2.
  • a storage area indicated by the target address index may include 4 sub-storage areas indicated by the 4 sub-mapping functions.
  • the above-mentioned first mapping function and second mapping function may also be other mapping functions except the hash function, which is not limited in this embodiment of the present application.
  • Step 104 Update the flow index and/or packet count value in the first storage unit among the multiple storage units according to the target flow index.
  • the updated flow index in the first storage unit is the target flow index
  • the updated packet count value in the first storage unit can be used to count traffic of the data flow to which the target packet belongs.
  • the network device may match the target flow index with the flow indices in the multiple storage units. According to different matching results, the network device may update the flow index and/or packet count value in the first storage unit among the multiple storage units in different ways.
  • the manner in which the network device updates the first storage unit may include any of the following manners:
  • the network device can directly increase the packet count value in the first storage unit by a first preset value .
  • the first preset value may be a fixed value pre-configured in the network device.
  • the first preset value may be a minimum counting unit of the packet count value.
  • the first preset value may be 1.
  • the target stream index calculated by the network device through the first mapping function H1 is K5
  • the target address index calculated through the first sub-mapping function H21 and the second sub-mapping function H22 includes the first sub-index a1 and the second sub-index a2.
  • the network device may increase the packet count value C5 in the first storage unit by the first preset value.
  • Method 2 If there is no storage unit that has stored the target flow index among the multiple storage units, store the target flow index and the initial message count value in a free storage unit among the multiple storage units, and the free storage unit is is the first storage unit.
  • the free storage unit refers to a storage unit that does not store the flow index and the packet count value.
  • the network device may store the target flow index in a free storage unit of the plurality of storage units and the initial packet count value. That is, the network device may select an idle storage unit from the multiple storage units as the first storage unit.
  • the initial packet count value may be an initial value of a packet count value pre-configured in the network device. For example, the initial packet count value may be 1.
  • the network device may randomly select an idle storage unit to store the target flow index and the initial packet count value.
  • the network device may also select a free storage unit traversed first to store the target flow index and the initial packet count value.
  • the target stream index calculated by the network device through the first mapping function H1 is K0
  • the target address index calculated through the first sub-mapping function H21 and the second sub-mapping function H22 includes the first sub-index a1 and the second sub-index a2.
  • the network device can store the target flow index K0 and the initial packet count value C0 in a free storage unit in the second sub-storage area S2.
  • the initial message count value C0 may be equal to 1.
  • Method 3 If there is no storage unit that has stored the target flow index in the multiple storage units, and there is no free storage unit, then the flow index in a storage unit whose message count value is the initial value in the multiple storage units It is updated as the target flow index, and the storage unit whose packet count value is the initial value is the first storage unit.
  • the network device since the target stream index does not match the stream index in any of the multiple storage units, and there is no idle storage unit in the multiple storage units, the network device needs to use the target stream index Replace the stream index already stored in a storage unit.
  • the network device may update the flow index in a storage unit whose packet count value is an initial value among the plurality of storage units to the target flow index.
  • the network device may keep the packet count value in the first storage unit unchanged, that is, the packet count value in the first storage unit is still an initial value.
  • the initial value may be a fixed value preconfigured in the network device, for example, the initial value may be 1.
  • each time a network device acquires a target packet it can update the stream index and/or packet count value of a certain storage unit in the storage space through the method shown in the above steps. If the packet count value in the first storage unit is the initial value, it indicates that for the data flow indicated by the flow index in the first storage unit (hereinafter referred to as data flow 1), the data flow currently acquired by the network device
  • the number of target packets of 1 is an initial value (for example, only one target packet of the data flow 1 has been obtained).
  • the network device After the network device obtains a target packet of data flow 2, if it detects that the matching result of the target flow index of data flow 2 is the situation in the above method 3, it can use the target flow index of data flow 2 to replace Stream index of data stream 1 stored in the first storage unit. Moreover, since the number of target packets of the data flow 2 acquired by the network device is also an initial value, there is no need to update the packet count value in the first storage unit.
  • the number of target packets of data flow 1 currently obtained by the network device is equivalent to the number of target packets of data flow 2 currently obtained. Therefore, updating the stream index of data stream 1 in the first storage unit by the network device to the target stream index of data stream 2 will not affect identification of a specific stream among the multiple data streams. It can be seen that the method provided by the embodiment of the present application can effectively reduce the number of storage units occupied by the flow index and packet statistics under the premise of accurately identifying the specific flow, thereby reducing the impact on the storage capacity of the network device. Require.
  • the network device may also fail to obtain the first storage unit that meets the condition from the multiple storage units. That is, there may be the following scenario: among the multiple storage units indicated by the target address index, there is no storage unit that has already stored the target flow index, and the packet count value in each storage unit is greater than the initial packet count value. For this scenario, the network device may decrease the packet count value in the storage unit with the smallest packet count value among the multiple storage units by a first preset value. In addition, the network device does not need to update the flow index in the storage unit with the least packet count value.
  • the network device obtains the target message of a certain data flow (hereinafter referred to as data flow 5), if there is no first storage unit, only when the number of target packets of data flow 5 obtained by the network device is greater than or equal to the minimum packet count value in the plurality of storage units, the flow index of the data flow 5 can be used to replace the packet The stream index in the storage unit with the least file count value.
  • the above update method can be understood as: when the number of target packets of data flow 5 acquired by the network device is greater than or equal to the network
  • the device will replace the stream index of data stream 6 with the stream index of data stream 5 only when the number of target packets of data stream 6 has been obtained by the device. Based on this, in a scenario where the number of storage units is limited, it is possible to realize reliable statistics of packet count values of data streams with high traffic.
  • Step 105 Based on the updated packet count value in the first storage unit, collect statistics on the traffic of the data flow to which the target packet belongs.
  • counting the traffic of the data stream to which the target message belongs refers to: counting a traffic statistical value that can reflect the traffic volume of the data stream to which the target message belongs.
  • the network device can report the target flow identifier to the control device, so that the control device can indicate the target flow identifier
  • the traffic statistics value of the data flow is increased by a second preset value.
  • the second preset value may be the minimum counting unit of the traffic statistics value, for example, the second preset value may be equal to 1.
  • the network device may encapsulate the target flow identifier in a statistical message, and report the statistical message to the control device.
  • the network device may use IPinIP encapsulation to construct a statistical message, and the outer destination IP address of the statistical message is the IP address of the control device.
  • the control device may store the corresponding relationship between the flow identifier of the data flow and the traffic statistics value.
  • the traffic statistics value corresponding to the flow identifier may be increased by a second preset value.
  • the traffic statistics value may be, for example, the number of reports.
  • the network device may report the target flow identifier FID-1 to the control device, and the control device may then identify the target flow as FID-1 and increase the traffic statistics value corresponding to FID-1 by 1.
  • the control device may update the traffic statistics value corresponding to the target flow identifier as FID-1 from 10 to 11.
  • the control device may receive flow identifiers reported by multiple network devices, and may collect statistics on traffic statistics of the data flows indicated by the received flow identifiers.
  • the control device may also identify K specific flows from the plurality of data flows based on the counted traffic statistics values of the plurality of data flows. That is, the control device can perform global statistics on the traffic of multiple data flows passing through multiple network devices, and thus can identify K specific flows globally.
  • the control device may also output the K specific streams through an output device, for example, the output device may be a display screen or an interface connected to a network management system.
  • the network device may directly increase the traffic statistical value of the data flow indicated by the target flow identifier by a second preset value .
  • the network device itself has a traffic statistics function.
  • the network device also stores the corresponding relationship between the flow identifier and the traffic statistics value of the data flow as shown in FIG.
  • the network device may include a data plane chip and a control plane chip.
  • the data plane chip is used to forward the message and count the message count value, that is, the data plane chip is used to maintain the hash table.
  • the data plane chip is further configured to report the target flow identifier to the control plane chip if it is detected that the updated packet count value in the first storage unit satisfies the statistical condition.
  • the control plane chip is used to increase the traffic statistic value of the data flow indicated by the target flow identifier by a second preset value, that is, the control plane chip is used to count the traffic statistic value of each data flow.
  • the same flow index may be obtained, that is, there may be a hash conflict between the flow indexes of different data flows.
  • the packet count value stored in the first storage unit may be obtained by counting the number of target packets of different data flows.
  • the network device or the data plane chip can report the target flow identifier of the data flow to which the currently acquired target packet belongs when the count value of the packet meets the statistical condition.
  • data flow 3 For the scenario where there is a hash conflict between the flow index of the data flow with a large traffic (hereinafter referred to as data flow 3) and the flow index of a data flow with a small traffic (hereinafter referred to as data flow 4), due to the network device or data plane chip
  • data flow 4 The number of target packets of the obtained data flow 3 is large, so the number of times of reporting the flow identifier of the data flow 3 is large.
  • the number of target packets of the data flow 4 obtained by the network device or the data plane chip is relatively small, so the number of times to report the flow identifier of the data flow 4 is relatively small.
  • the control device or the control plane chip can then accurately count the traffic of the data flows indicated by each flow identifier according to the number of received flow identifiers, and thus can accurately identify a specific flow among multiple data flows. It can be seen that the method provided by the embodiment of the present application can not only realize the multiplexing of the storage resources of the storage unit (that is, the packet count values of different data streams can be recorded in the same storage unit), but also realize the multiplexing of the storage resources of different data streams. Accurate statistics of traffic.
  • the statistical threshold may be an integer greater than 1, such as 128.
  • the method provided by the embodiment of the present application updates the traffic statistics of the data flow with the statistical threshold as the statistical interval, which can effectively reduce the update frequency of the traffic statistics, thereby reducing the Resource occupation of control devices or control plane chips.
  • the packet count value is exactly an integer multiple of the statistical threshold low probability. Therefore, reporting the target flow identifier after the packet count value satisfies the statistical condition can further reduce the probability of reporting the flow identifier of the data flow with small traffic. In this way, it can be ensured that the traffic statistical value obtained through statistics can more accurately reflect the traffic volume of each data flow in the network.
  • the statistics threshold may be a fixed value pre-configured in the network device. That is to say, during the flow statistics process, the statistics threshold always remains unchanged.
  • the statistical threshold may also vary with changes in packet count values. For example, the statistics threshold may increase as the packet count increases.
  • the network device can update the traffic statistical value with the statistical threshold of the first numerical value as the statistical interval. If the updated packet count value in the first storage unit is within the second numerical range, the network device can update the traffic statistical value with the statistical threshold of the second numerical value as the statistical interval.
  • the lower limit of the second numerical range is greater than the upper limit of the first numerical range, and the second numerical value is greater than the first numerical value.
  • Step 106 if the flow index and packet count value in the second storage unit among the plurality of storage units have not been updated for a set period of time, delete the flow index and packet count value stored in the second storage unit.
  • an aging mechanism of the storage unit is also configured in the network device. Based on the aging mechanism, the network device can delete the flow index and the packet count value in the second storage unit that have not been updated for a set period of time. That is, the network device can age the second storage unit, and the aged second storage unit is an idle storage unit. Based on the aging mechanism, the network device can release the storage space of the second storage unit in time, so as to store flow indexes and packet count values of other data flows.
  • the set duration may be a fixed value pre-configured in the network device, for example, it may be equal to 1 second.
  • the network device may record the update timestamp of the storage unit. If the network device detects that the time between the update timestamp of the second storage unit and the current time exceeds the set time period, it may determine that the flow index and packet count in the second storage unit have not been updated beyond the set time period.
  • Step 107 Based on the traffic statistics of each data flow, output the flow identifiers of the top K data flows.
  • the network device may also sort the flow identifiers of each data flow based on the traffic statistics of each data flow every statistical period.
  • the network device may output flow identifiers of the top K data flows based on the sorting result.
  • the duration of the statistical period may be pre-configured in the network device. For example, the duration of the statistical period may be 100 milliseconds or 1 second.
  • the top K data streams may be the top K data streams with the highest traffic statistics. That is, the network device can identify and output flow identifiers of the top K data flows with the highest traffic among the multiple data flows.
  • the top K data streams may be flow identifiers of the top K data streams with the highest variation in traffic statistics within a set period of time. That is, the network device can identify and output flow identifiers of the top K data flows with the largest traffic changes among the multiple data flows.
  • the set period of time may be the previous statistical period, or may also refer to the period from the initial statistical moment to the current statistical moment.
  • the network device outputting the flow identifiers of the first K data flows may refer to: the network device displays the flow identifiers of the first K data flows on its display screen.
  • the network device sends the flow identifiers of the first K data flows to another device for display by the other device.
  • the other device may be a control device, or may be a user device.
  • the control device may also execute the method shown in step 107 above after counting the traffic statistics of each data flow. That is, the control device may output flow identifiers of the first K data flows based on the traffic statistics of each data flow.
  • the network device or the control device can automatically output the flow identifiers of the first K data streams according to the statistical period, it is not necessary to query the data stored in the network device when the first K data streams need to be counted. Packet count value in the unit. Thus, the efficiency of flow statistics is effectively improved.
  • the order of the steps of the flow statistics method provided in the embodiment of the present application can be adjusted appropriately, and the steps can also be increased or decreased accordingly according to the situation.
  • the above step 103 may be performed before step 102 .
  • the above step 106 may be deleted according to circumstances, that is, the network device may not need to age the storage unit that has not been updated for a long time.
  • the above step 107 may be performed before step 106, or may be deleted according to circumstances.
  • the embodiment of the present application provides a flow statistics method.
  • the network device After the network device obtains the target packet, it can process the target flow identifier of the data flow to which the target packet belongs through the mapping function to obtain the target flow index and the target address index. Afterwards, the network device can update the flow index and/or packet count value in the first storage unit among the multiple storage units indicated by the target address index according to the target flow index, and based on the updated packet in the first storage unit Counting value, counting the traffic of the data flow to which the target packet belongs. Since the network device does not need to report sampling packets to the control device during the above flow statistics process, the efficiency of flow statistics is effectively improved, and the storage space of the control device will not be occupied. Furthermore, since the stream index stored in the first storage unit is obtained by processing the target stream ID through a mapping function, it is possible to avoid directly storing the target stream ID and occupying more storage space.
  • FIG. 7 is a schematic structural diagram of a network device provided by an embodiment of the present application.
  • the network device can be applied to the flow statistics system shown in FIG. 1 or FIG. 2 , and can be used to implement the flow statistics method provided in the foregoing method embodiments.
  • the network equipment includes:
  • the obtaining unit 011 is configured to obtain the target message.
  • the acquiring unit 011 reference may be made to the related description of the above-mentioned step 101.
  • the processing unit 012 is configured to obtain a target flow index according to the target flow identifier of the data flow to which the target packet belongs; and obtain a target address index according to the target flow identifier.
  • the target address index indicates a storage area of the network device, and the storage area includes a plurality of storage units, and each storage unit is used to store a flow index and a packet count value of the data flow indicated by the flow index.
  • the processing unit 012 processes the target flow identifier of the data flow to which the target packet belongs through the first mapping function to obtain the target flow index, and processes the target flow identifier through the second mapping function to obtain the target address index.
  • step 102 For the function implementation of the processing unit 012, reference may be made to the related descriptions of the above-mentioned step 102 and step 103.
  • An updating unit 013 configured to update the flow index and/or packet count value in the first storage unit among the plurality of storage units according to the target flow index.
  • the updating unit 013 For the function implementation of the updating unit 013, reference may be made to the relevant description of the above step 104.
  • the statistics unit 014 is configured to, based on the updated packet count value in the first storage unit, count the traffic of the data flow to which the target packet belongs. For the function realization of the statistical unit 014, reference may be made to the relevant description of the above-mentioned step 105.
  • the updating unit 013 can be used for:
  • the target stream index is stored in the first storage unit among the plurality of storage units, increasing the packet count value in the first storage unit by a first preset value
  • the target flow index and the initial message count value in an idle storage unit among the plurality of storage units, and the idle storage unit is the first storage unit, and the free storage unit refers to a storage unit that does not store the flow index and the packet count value;
  • the flow index in a storage unit whose message count value is the initial value in the plurality of storage units The target flow index is updated, and the storage unit whose packet count value is an initial value is the first storage unit.
  • the update unit 013 may also be used for: if there is no storage unit that has stored the target stream index among the plurality of storage units, and the message count value in each storage unit is greater than the initial message count value, then the packet count value in the storage unit with the smallest packet count value among the plurality of storage units is reduced by a first preset value.
  • the statistics unit 014 may be configured to: if the updated packet count value in the first storage unit satisfies the statistics condition, report the target flow identifier to the control device for the control device to The traffic statistics value of the data flow indicated by the target flow identifier is increased by a second preset value; or, if the updated packet count value in the first storage unit satisfies the statistical condition, then the traffic statistics value of the data flow indicated by the target flow identifier is The traffic statistical value is increased by a second preset value.
  • the statistical condition includes: the packet count value is an integer multiple of a statistical threshold, and the statistical threshold is an integer greater than 1.
  • the network device may further include an output unit 015, which is configured to: output flow identifiers of the top K data flows with the highest traffic statistics; or output the traffic statistics at the set The stream identifiers of the top K data streams with the highest variation within the time period; where K is an integer greater than or equal to 1.
  • the second mapping function includes a first sub-mapping function and a second sub-mapping function;
  • the processing unit 012 may be configured to: use the first sub-mapping function to process the target flow identifier to obtain the first sub-index; and use the second The second sub-mapping function processes the target stream to identify the second sub-index, and the target address index includes the first sub-index and the second sub-index;
  • the storage area includes: the first sub-storage area indicated by the first sub-index, and the second sub-storage area indicated by the second sub-index, the plurality of storage units include storage units corresponding to the first sub-storage area and the second sub-storage area.
  • the updating unit 013 can also be used to: if the flow index and packet count value in the second storage unit among the plurality of storage units have not been updated for a set period of time, then store in the second storage unit The stream index and packet count value of the stream are deleted.
  • the update unit 013 reference may also be made to the relevant description of the above-mentioned step 106.
  • the target message is any message received by the network device, or the target message is a message to be discarded by the network device.
  • the network equipment provided in the embodiment of the present application can also be realized by application-specific integrated circuit (application-specific integrated circuit, ASIC), or programmable logic device (programmable logic device, PLD).
  • the above-mentioned PLD can be complex Program logic device (complex programmable logical device, CPLD), field-programmable gate array (field-programmable gate array, FPGA), general array logic (generic array logic, GAL) or any combination thereof.
  • the flow statistics method provided by the above method embodiment may also be implemented by software, and when the flow statistics method provided by the above method embodiment is implemented by software, each functional unit in the network device may also be a software module.
  • FIG. 8 is a schematic structural diagram of another network device provided by an embodiment of the present application.
  • the network device can be applied to the flow statistics system shown in FIG. 1 or FIG. 2 , and can be used to implement the flow statistics method provided in the foregoing method embodiments.
  • the network device includes: a processor 201 , a memory 202 , a network interface 203 and a bus 204 .
  • a computer program 2021 is stored in the memory 202, and the computer program 2021 is used to realize various application functions.
  • the processor 201 is configured to execute the computer program 2021 to implement the flow statistics method provided by the foregoing method embodiments.
  • the processor 201 can be a central processing unit (central processing unit, CPU), and the processor 201 can also be other general-purpose processors, a digital signal processor (digital signal processor, DSP), ASIC, FPGA, graphics processing unit (graphics processing unit, GPU) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general purpose processor can be a microprocessor or any conventional processor.
  • Memory 202 can be volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory.
  • the non-volatile memory can be read-only memory (read-only memory, ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically programmable Erases programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • Volatile memory can be random access memory (RAM), which acts as external cache memory.
  • RAM random access memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous dynamic random access memory
  • SDRAM double data rate synchronous dynamic random access memory
  • double data date SDRAM double data date SDRAM
  • DDR SDRAM double data date SDRAM
  • ESDRAM enhanced synchronous dynamic random access memory
  • synchronous connection dynamic random access memory direct rambus RAM, DR RAM
  • network interfaces 203 There may be multiple network interfaces 203, and the network interfaces 203 are used to implement communication connections with other devices (which may be wired or wireless). Wherein, in the embodiment of the present application, the network interface 203 is used to send and receive messages. Wherein, other devices may be devices such as terminals, servers, VMs, or other network devices.
  • the bus 204 is used to connect the processor 201 , the memory 202 and the network interface 203 .
  • the bus 204 may include a power bus, a control bus, a status signal bus, etc. in addition to a data bus.
  • the various buses are labeled as bus 204 in the figure.
  • FIG. 9 is a schematic structural diagram of another network device provided by an embodiment of the present application.
  • the network device can be applied to the flow statistics system shown in FIG. 1 or FIG. 2 , and can be used to implement the flow statistics method provided in the foregoing method embodiments.
  • the network device includes: a main control board 301 and at least one interface board (an interface board is also called a line card or a service board), for example, an interface board 302 and an interface board 303 are shown in FIG. 9 .
  • the network device may further include a switching fabric board 304, and the switching fabric board 304 is used to complete data exchange between the interface boards.
  • the main control board 301 is also called a main processing unit (main processing unit, MPU) or a route processing card (route processor card), and the main control board 301 is used to complete functions such as system management, equipment maintenance, and protocol processing.
  • main processing unit main processing unit
  • route processing card route processor card
  • the main control board 301 is used to complete functions such as system management, equipment maintenance, and protocol processing.
  • the main control board 301 includes: a CPU 3011 and a memory 3012 .
  • the interface boards 302 and 303 are also called line interface unit cards (line processing unit, LPU), line cards (line card) or service boards, and the interface boards are used to provide various service interfaces and realize message forwarding.
  • the service interfaces provided by the interface board may include: SONET/SDH-based packet (packet over SONET/SDH, POS) interface, Gigabit Ethernet (gigabit Ethernet, GE) interface and asynchronous transfer mode (asynchronous transfer mode, ATM) interface, etc.
  • SONET refers to synchronous optical network (synchronous optical network)
  • SDH refers to synchronous digital hierarchy (synchronous digital hierarchy).
  • the main control board 301 , the interface board 302 and the interface board 303 are connected to the system backplane through a system bus to realize intercommunication.
  • the interface board 302 includes one or more central processing units 3021 .
  • the central processing unit 3021 is used to control and manage the interface board 302 and communicate with the central processing unit 3011 on the main control board 301 and the interface board 302 .
  • the memory 3024 on the interface board 302 is used to store forwarding entries, and the network processor 3022 can forward packets by looking up the forwarding entries stored in the memory 3024 .
  • Memory 3024 can also be used to store program codes.
  • the interface board 302 also includes one or more physical interface cards 3023, the one or more physical interface cards 3023 are used to receive the message sent by the previous hop node, and send the message to the next hop node according to the instructions of the central processing unit 3021 processed message.
  • the forwarding plane is processed by dedicated hardware or chips.
  • the central processing unit 3021 and/or the network processor 3022 may also use a general-purpose processor, such as a general-purpose CPU, to implement the functions described above.
  • the network device includes an interface board 302 and an interface board 303 .
  • the structure of the interface board 303 is basically the same as that of the interface board 302 , and the operations on the interface board 303 are basically similar to those of the interface board 302 , which are not repeated for brevity.
  • the multiple interface boards can communicate through one or more switching fabric boards 304, and can realize load sharing and redundant backup to provide large-capacity data exchange and processing capabilities .
  • the network device may not need the switching fabric board 304, and the interface board undertakes the processing function of the service data of the whole system. Therefore, the data access and processing capabilities of network devices with a distributed architecture are greater than those with a centralized architecture. Which architecture to use depends on the specific networking deployment scenario, and there is no limitation here.
  • the memory 3012 and the memory 3024 can be ROM or other types of static storage devices that can store static information and instructions, or RAM or other types of dynamic storage devices that can store information and instructions, or Is EEPROM, compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), magnetic disk or other magnetic storage devices , or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
  • ROM read-only memory
  • CD-ROM compact disc read-only memory
  • optical disc storage including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.
  • magnetic disk or other magnetic storage devices or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
  • the memory 3024 in the interface board 302 may exist independently and be connected to the central processing unit 3021 through a communication bus; or, the memory 3024 may also be integrated with the central processing unit 3021 .
  • the memory 3012 in the main control board 301 can exist independently and be connected with the central processing unit 3011 through a communication bus; or, the memory 3012 can also be integrated with the central processing unit 3011 .
  • the program codes stored in the memory 3024 are executed under the control of the CPU 3021
  • the program codes stored in the memory 3012 are executed under the control of the CPU 3011 .
  • the central processing unit 3021 and/or the central processing unit 3011 may implement the flow statistics method provided in the foregoing embodiments by executing program codes.
  • One or more software units may be included in the program code stored in memory 3024 and/or memory 3012 .
  • the one or more software units may be functional units in the embodiment shown in FIG. 7 .
  • the acquisition unit 011 , processing unit 012 and update unit 013 in FIG. 7 can all be deployed in the forwarding board 302
  • the statistics unit 014 and output unit 015 can be deployed in the main control board 301 .
  • the physical interface card 3023 may use any device such as a transceiver for communicating with other devices or communication networks, such as Ethernet, radio access network (radio access network, RAN), Wireless local area networks (wireless local area networks, WLAN), etc.
  • a transceiver for communicating with other devices or communication networks, such as Ethernet, radio access network (radio access network, RAN), Wireless local area networks (wireless local area networks, WLAN), etc.
  • the embodiment of the present application also provides a computer-readable storage medium, where an instruction is stored in the computer-readable storage medium, and when the instruction is executed by a processor, the flow statistics method provided by the foregoing method embodiment can be implemented.
  • the embodiment of the present application also provides a computer program product containing instructions.
  • the instructions in the computer program product are executed by a processor, the flow statistics method provided by the above method embodiment can be implemented.
  • the program can be stored in a computer-readable storage medium.
  • the above-mentioned The storage medium mentioned may be a read-only memory, a magnetic disk or an optical disk, and the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Environmental & Geological Engineering (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Algebra (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present application belongs to the technical field of communication and provides a method for flow statistics, a device, and a system. In a solution provided by the present application, a network device obtains a target flow index and a target address index according to a target flow identifier of a data flow to which a target message belongs; then the network device updates, according to the target flow index, a packet count value and/or a flow index in a first storage unit among a plurality of storage units indicated by the target address index (104), and performs statistics on traffic of a data flow to which the target packet belongs on the basis of the updated packet count value in the first storage unit (105). In the described process for traffic statistics, the network device does not need to report a sampled packet to a control device, and thereby the efficiency for flow statistics is effectively improved, and same does not take up storage space of the control device. Furthermore, the target flow index can be obtained by means of a mapping function processing the target flow identifier, and therefore storage space occupied by a flow index can be reduced.

Description

流统计方法、装置及系统Flow statistics method, device and system
本申请要求于2022年1月12日提交的申请号为202210029639.7、发明名称为“一种流识别方法、相关装置和网络系统”的中国专利申请的优先权,以及要求于2022年3月1日提交的申请号为202210195673.1、发明名称为“流统计方法、装置及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202210029639.7 and the title of the invention "A flow identification method, related device and network system" filed on January 12, 2022, and claims on March 1, 2022 The priority of the Chinese patent application submitted with the application number 202210195673.1 and the title of the invention is "Flow Statistics Method, Device and System", the entire content of which is incorporated in this application by reference.
技术领域technical field
本申请涉及网络技术领域,特别涉及一种流统计方法、装置及系统。The present application relates to the field of network technologies, and in particular to a flow statistics method, device and system.
背景技术Background technique
为了确保网络中各数据流的传输性能,运维人员需要对各数据流中的大流的相关性能参数(例如带宽和时延等)进行密切监控。其中,大流是指在一定时长内传输的报文量(个数或字节数)最多的若干个数据流。In order to ensure the transmission performance of each data flow in the network, operation and maintenance personnel need to closely monitor the relevant performance parameters (such as bandwidth and delay, etc.) of large flows in each data flow. Among them, the large flow refers to several data flows with the largest amount of packets (number or number of bytes) transmitted within a certain period of time.
相关技术中,为了从大量的数据流中识别出大流,网络设备(如交换机)可以在转发数据流的报文的过程中,对各个数据流的报文进行采样,并将采样得到的采样报文发送至控制设备(例如,分析器)。控制设备可以统计各个数据流对应的采样报文的数量,并将采样报文的数量最高的若干个数据流确定为大流。In related technologies, in order to identify a large flow from a large number of data flows, a network device (such as a switch) may sample the packets of each data flow during the process of forwarding the packets of the data flow, and sample the The message is sent to a control device (eg analyzer). The control device may count the number of sampled packets corresponding to each data flow, and determine several data flows with the highest number of sampled packets as large flows.
但是上述方法需要向控制设备上报大量的采样报文,不仅会占用控制设备较多的存储空间,而且统计效率也较低。However, the above method needs to report a large number of sampled messages to the control device, which not only occupies more storage space of the control device, but also has low statistical efficiency.
发明内容Contents of the invention
本申请提供了一种流统计方法、装置及系统,可以解决相关技术中的流统计方法会占用控制设备较多的存储空间,且统计效率较低的技术问题。The present application provides a flow statistics method, device and system, which can solve the technical problem that the flow statistics method in the related art occupies more storage space of the control equipment and has low statistical efficiency.
第一方面,提供了一种流统计方法,应用于网络设备。网络设备首先获取目标报文。然后,网络设备根据该目标报文所属数据流的目标流标识获取目标流索引,以及根据该目标流标识获取目标地址索引。该目标地址索引用于指示该网络设备的存储空间中的一个存储区域,该存储区域包括多个存储单元,每个存储单元用于存储一个流索引,以及该流索引指示的数据流的报文计数值。网络设备还根据该目标流索引更新该多个存储单元中第一存储单元中的流索引和/或报文计数值,并基于更新后的该第一存储单元中的报文计数值,统计该目标报文所属数据流的流量。具体地,网络设备通过第一映射函数处理目标报文所属数据流的目标流标识得到目标流索引,并通过第二映射函数处理目标流标识得到目标地址索引。In the first aspect, a flow statistics method is provided, which is applied to network equipment. The network device first obtains the target packet. Then, the network device obtains the target flow index according to the target flow identifier of the data flow to which the target packet belongs, and obtains the target address index according to the target flow identifier. The target address index is used to indicate a storage area in the storage space of the network device, the storage area includes a plurality of storage units, and each storage unit is used to store a flow index and a packet of the data flow indicated by the flow index count value. The network device also updates the flow index and/or packet count value in the first storage unit among the plurality of storage units according to the target flow index, and counts the packet count value based on the updated packet count value in the first storage unit Traffic of the data flow to which the target packet belongs. Specifically, the network device processes the target flow identifier of the data flow to which the target packet belongs through the first mapping function to obtain the target flow index, and processes the target flow identifier through the second mapping function to obtain the target address index.
其中,统计数据流的流量并非是统计数据流的真实流量,而是统计出能够反映该数据流的流量大小的数值,例如流量统计值。本申请提供的方案中,网络设备能够在存储单元中记录数据流的流索引和报文计数值,并基于该报文计数值对数据流的流量进行统计。由于网络设备无需向控制设备上报采样报文,因此提高了流统计的效率,且不会占用控制设备的存储空间。又由于存储单元中的流索引是通过第一映射函数处理目标流标识得到的,因此能减小流索引对存储空间的占用。Wherein, the traffic of the statistical data stream is not the real traffic of the statistical data stream, but a numerical value that can reflect the traffic volume of the data stream, such as a traffic statistics value. In the solution provided by the present application, the network device can record the flow index and packet count value of the data flow in the storage unit, and count the traffic of the data flow based on the packet count value. Since the network device does not need to report sampling packets to the control device, the efficiency of flow statistics is improved, and the storage space of the control device will not be occupied. Furthermore, since the stream index in the storage unit is obtained by processing the target stream identifier through the first mapping function, the storage space occupied by the stream index can be reduced.
可选地,网络设备根据目标流索引更新多个存储单元中第一存储单元中的流索引和/或报 文计数值的方式可以包括以下任意一种:方式一,若多个存储单元中的第一存储单元中存储有目标流索引,则将第一存储单元中的报文计数值增加第一预设值。方式二,若多个存储单元中不存在已存储有目标流索引的存储单元,则在多个存储单元中的一个空闲存储单元中存储目标流索引和初始报文计数值,空闲存储单元为第一存储单元,空闲存储单元是指未存储流索引和报文计数值的存储单元。方式三,若多个存储单元中不存在已存储有目标流索引的存储单元,且不存在空闲存储单元,则将多个存储单元中报文计数值为初始值的一个存储单元中的流索引更新为目标流索引,报文计数值为初始值的存储单元为第一存储单元。Optionally, the manner in which the network device updates the flow index and/or the packet count value in the first storage unit among the multiple storage units according to the target flow index may include any of the following: Mode 1, if the If the target flow index is stored in the first storage unit, the packet count value in the first storage unit is increased by a first preset value. Method 2: If there is no storage unit that has stored the target flow index in the multiple storage units, store the target flow index and the initial message count value in a free storage unit among the multiple storage units, and the free storage unit is the first A storage unit, where an idle storage unit refers to a storage unit that does not store a flow index or a message count value. Method 3: If there is no storage unit that has stored the target flow index in the multiple storage units, and there is no free storage unit, then the flow index in a storage unit whose message count value is the initial value in the multiple storage units The target flow index is updated, and the storage unit whose packet count value is the initial value is the first storage unit.
上述方式三中,若第一存储单元中的报文计数值为初始值,则网络设备可以确定对于该第一存储单元中已存储的流索引所指示的数据流(下文称为数据流1),网络设备已获取到的该数据流1的目标报文的数量为初始值。假设网络设备当前获取到的目标报文所属的数据流为数据流2,则可以推断出网络设备当前已获取到的数据流2的目标报文的数量,与网络设备已获取到的数据流1的目标报文的数量相当。相应的,网络设备采用数据流2的目标流索引更新第一存储单元中的数据流1的流索引,可以确保不会对多个数据流中的特定流的识别造成影响。其中,特定流可以是指流量较高或流量的变化量较高的数据流。In the third manner above, if the packet count value in the first storage unit is the initial value, the network device can determine the data flow indicated by the flow index stored in the first storage unit (hereinafter referred to as data flow 1) , the number of target packets of the data stream 1 that the network device has obtained is an initial value. Assuming that the data flow of the target packet currently obtained by the network device is data flow 2, it can be inferred that the number of target packets of the data flow 2 currently obtained by the network device is different from that of the data flow 1 obtained by the network device. The number of target packets is equivalent. Correspondingly, the network device uses the target stream index of data stream 2 to update the stream index of data stream 1 in the first storage unit, which can ensure that identification of a specific stream among the multiple data streams will not be affected. Wherein, the specific flow may refer to a data flow with a high flow rate or a high change amount of the flow rate.
可选地,若多个存储单元中不存在已存储有目标流索引的存储单元,且每个存储单元中的报文计数值均大于初始报文计数值,则网络设备还可以将多个存储单元中报文计数值最少的存储单元中的报文计数值减少第一预设值。Optionally, if there is no storage unit that has stored the target flow index among the multiple storage units, and the packet count value in each storage unit is greater than the initial packet count value, the network device can also store the multiple The packet count value in the storage unit with the smallest packet count value in the cell is reduced by a first preset value.
可以理解的是,若报文计数值最少的存储单元中的报文计数值被减少至初始值,则当网络设备再次获取到目标报文时,即可采用上述方式三中所示的方法更新该报文计数值最少的存储单元中的流索引。基于上述更新方式,可以确保只有当网络设备获取到的某个新的数据流的目标报文的数量大于或等于该多个存储单元中的最少的报文计数值时,才能够采用该新的数据流的流索引替换报文计数值最少的存储单元中的流索引。由此,可以在网络设备中存储单元的数量有限的场景中,实现对流量较高的数据流的报文计数值的可靠统计。It can be understood that if the packet count value in the storage unit with the least packet count value is reduced to the initial value, when the network device obtains the target packet again, it can be updated using the method shown in the third method above The stream index in the storage unit with the smallest packet count value. Based on the above update method, it can be ensured that only when the number of target packets of a new data flow obtained by the network device is greater than or equal to the minimum packet count value in the plurality of storage units, the new data flow can be used. The flow index of the data flow replaces the flow index in the storage unit with the least packet count value. Therefore, in a scenario where the number of storage units in the network device is limited, reliable statistics of the packet count value of the data flow with high traffic can be realized.
可选地,网络设备基于更新后的第一存储单元中的报文计数值,统计目标报文所属数据流的流量的过程可以包括:若更新后的第一存储单元中的报文计数值满足统计条件,则将目标流标识上报至控制设备,以供控制设备将目标流标识指示的数据流的流量统计值增加第二预设值。或者,若更新后的第一存储单元中的报文计数值满足统计条件,则将目标流标识指示的数据流的流量统计值增加第二预设值。Optionally, the process of the network device counting the traffic of the data flow to which the target packet belongs based on the updated packet count value in the first storage unit may include: if the updated packet count value in the first storage unit satisfies If the statistical condition is met, the target flow identifier is reported to the control device, so that the control device increases the traffic statistics value of the data flow indicated by the target flow identifier by a second preset value. Alternatively, if the updated packet count value in the first storage unit satisfies the statistics condition, then increase the traffic statistics value of the data flow indicated by the target flow identifier by a second preset value.
可以理解的是,网络设备通过第一映射函数处理不同的流标识后,可能会得到相同的流索引,即不同数据流的流索引可能存在哈希冲突。由此可能会导致第一存储单元中存储的报文计数值是对不同数据流的目标报文的数量进行统计得到的。而本申请提供的方案可以在报文计数值满足统计条件时,更新当前获取到的目标报文所属数据流的流量统计值。由于网络设备获取到流量较大的数据流的目标报文的数量较多,因此对该流量较大的数据流的流量统计值的更新次数会较多。而网络设备获取到流量较小的数据流的目标报文的数量较少,因此对该流量较小的数据流的流量统计值的更新次数会较少。基于此,可以实现对不同数据流的流量的较为准确地统计,进而能够准确识别多个数据流中的特定流。It can be understood that, after the network device processes different flow identifiers through the first mapping function, the same flow index may be obtained, that is, there may be a hash conflict between the flow indexes of different data flows. As a result, the packet count value stored in the first storage unit may be obtained by counting the number of target packets of different data flows. However, in the solution provided by the present application, when the packet count value satisfies the statistical condition, the currently acquired traffic statistics value of the data flow to which the target packet belongs is updated. Since the network device obtains a large number of target packets of the data flow with a large flow, the number of updates of the traffic statistics value of the data flow with a large flow will be more. However, the number of target packets obtained by the network device for the data flow with a small flow is small, so the number of updates of the traffic statistics value for the data flow with a small flow will be less. Based on this, relatively accurate statistics on the traffic of different data streams can be realized, and thus a specific stream among multiple data streams can be accurately identified.
可选地,网络设备将目标流标识上报至控制设备的过程可以包括:网络设备将目标流标识封装在统计报文中,并将该统计报文上报至控制设备。其中,网络设备可以采用在互联网协议(Internet Protocol,IP)中封装IP(IP encapsulation within IP,IPinIP)的封装方式构造统计报文。该统计报文的外层目的IP地址为控制设备的IP地址。Optionally, the process for the network device to report the target flow identifier to the control device may include: the network device encapsulates the target flow identifier in a statistical message, and reports the statistical message to the control device. Wherein, the network device can adopt the encapsulation method of encapsulating IP (IP encapsulation within IP, IPinIP) in the Internet Protocol (Internet Protocol, IP) to construct the statistical message. The outer destination IP address of the statistical message is the IP address of the control device.
可选地,该统计条件可以包括:报文计数值为统计阈值的整数倍,该统计阈值为大于1的整数。相比于基于报文计数值的变化实时更新流量统计值,本申请提供的方案以统计阈值为统计间隔更新数据流的流量统计值,可以有效降低流量统计值的更新频率。由此,可以避免流量统计值的更新频率过高而占用较多的处理资源。Optionally, the statistical condition may include: the packet count value is an integer multiple of a statistical threshold, and the statistical threshold is an integer greater than 1. Compared with updating the traffic statistics value in real time based on the change of the packet count value, the solution provided by this application updates the traffic statistics value of the data flow at the statistics threshold as a statistical interval, which can effectively reduce the update frequency of the traffic statistics value. In this way, it is possible to avoid the excessively high update frequency of the traffic statistics value and the occupation of more processing resources.
可选地,网络设备还可以输出流量统计值最高的前K个数据流的流标识。或者,网络设备还可以输出流量统计值在设定时段内的变化量最高的前K个数据流的流标识。其中,K为大于或等于1的整数。Optionally, the network device may also output the flow identifiers of the top K data flows with the highest flow statistics. Alternatively, the network device may also output the flow identifiers of the top K data flows with the highest changes in traffic statistics within a set period of time. Wherein, K is an integer greater than or equal to 1.
在本申请中,网络设备可以按照预设的统计周期,周期性输出前K个数据流的流标识。其中,网络设备输出数据流的流标识可以是指:网络设备显示数据流的流标识,或者网络设备将数据流的流标识发送至另一设备,以供另一设备显示。In this application, the network device may periodically output flow identifiers of the first K data flows according to a preset statistical period. Wherein, the flow identifier of the data flow output by the network device may refer to: the network device displays the flow identifier of the data flow, or the network device sends the flow identifier of the data flow to another device for the other device to display.
可选地,第二映射函数包括第一子映射函数和第二子映射函数。网络设备通过第二映射函数处理目标流标识进行映射得到目标地址索引的过程可以包括:通过第一子映射函数处理目标流标识得到第一子索引。通过第二子映射函数处理目标流标识第二子索引,目标地址索引包括第一子索引和第二子索引。目标地址索引指示的存储区域包括:第一子索引指示的第一子存储区域,以及第二子索引指示的第二子存储区域。多个存储单元包括第一子存储区域和第二子存储区域对应的存储单元。Optionally, the second mapping function includes a first sub-mapping function and a second sub-mapping function. The process for the network device to process the target flow identifier through the second mapping function to obtain the target address index may include: processing the target flow identifier through the first sub-mapping function to obtain the first sub-index. The second sub-index of the target flow identifier is processed by the second sub-mapping function, and the target address index includes the first sub-index and the second sub-index. The storage area indicated by the target address index includes: a first sub-storage area indicated by the first sub-index, and a second sub-storage area indicated by the second sub-index. The plurality of storage units include storage units corresponding to the first sub-storage area and the second sub-storage area.
通过采用两个不同的子映射函数处理目标流标识,可以确保对于一个目标流索引,能够确定出两个候选的子存储区域。由此,可以有效提高在该两个子存储区域中确定出满足条件的第一存储单元的概率,进而有效降低哈希冲突的概率。By using two different sub-mapping functions to process the target stream identifier, it can be ensured that two candidate sub-storage areas can be determined for one target stream index. Thus, the probability of determining the first storage unit satisfying the condition in the two sub-storage areas can be effectively increased, thereby effectively reducing the probability of hash collisions.
可选地,若多个存储单元中的第二存储单元中的流索引和报文计数值超过设定时长未更新,则网络设备还可以将第二存储单元中存储的流索引和报文计数值删除。由此,可以释放第二存储单元的存储空间,以便继续存储其他数据流的流索引和报文计数值。Optionally, if the flow index and packet count in the second storage unit among the plurality of storage units have not been updated for a set period of time, the network device may also store the flow index and packet count in the second storage unit The value is deleted. Thus, the storage space of the second storage unit can be released, so as to continue to store the stream index and packet count value of other data streams.
可选地,该目标报文可以为网络设备接收到的任一报文,或者该目标报文可以为网络设备待丢弃的报文。其中,若目标报文为网络设备接收到的任一报文,则网络设备所统计的数据流的流量可以是指数据流的总报文量。若目标报文为网络设备待丢弃的报文,则网络设备所统计的数据流的流量可以是指数据流的丢包量。Optionally, the target message may be any message received by the network device, or the target message may be a message to be discarded by the network device. Wherein, if the target packet is any packet received by the network device, the traffic volume of the data flow counted by the network device may refer to the total packet volume of the data flow. If the target packet is a packet to be discarded by the network device, the traffic volume of the data flow collected by the network device may refer to the packet loss amount of the data flow.
第二方面,提供了一种网络设备。该网络设备包括多个功能单元,该多个功能单元相互作用,以实现上述第一方面及其各实施方式中的方法。该多个功能单元可以基于软件、硬件或软件和硬件的结合实现,且该多个功能单元可以基于具体实现进行任意组合或分割。In a second aspect, a network device is provided. The network device includes multiple functional units, and the multiple functional units interact to implement the methods in the above first aspect and various implementation manners thereof. The multiple functional units can be implemented based on software, hardware or a combination of software and hardware, and the multiple functional units can be combined or divided arbitrarily based on the specific implementation.
第三方面,提供了一种网络设备。该网络设备包括:存储器,处理器及存储在该存储器上并可在该处理器上运行的计算机程序。该处理器执行该计算机程序时实现如上述第一方面及其各实施方式中的方法。In a third aspect, a network device is provided. The network device includes: a memory, a processor, and a computer program stored on the memory and operable on the processor. When the processor executes the computer program, the methods in the above first aspect and its various implementation manners are realized.
第四方面,提供了一种流统计系统。该流统计系统包括如上述任一方面提供的网络设备,以及控制设备。其中,网络设备用于基于更新后的第一存储单元中的报文计数值,向控制设备上报目标流标识。控制设备用于基于接收到的所述目标流标识,统计所述目标流标识指示的数据流的流量。In a fourth aspect, a flow statistics system is provided. The flow statistics system includes the network device provided in any one of the above aspects, and a control device. Wherein, the network device is configured to report the target flow identifier to the control device based on the updated packet count value in the first storage unit. The control device is configured to, based on the received target flow identifier, collect statistics on the traffic of the data flow indicated by the target flow identifier.
可选地,该网络设备用于若更新后的第一存储单元中的报文计数值满足统计条件,则将目标流标识上报至控制设备。该控制设备,用于将目标流标识指示的数据流的流量统计值增加第二预设值。Optionally, the network device is configured to report the target flow identifier to the control device if the updated packet count value in the first storage unit satisfies a statistical condition. The control device is configured to increase the traffic statistics value of the data flow indicated by the target flow identifier by a second preset value.
可选地,控制设备还用于:输出流量统计值最高的前K个数据流的流标识,或者,输出流 量统计值在设定时段内的变化量最高的前K个数据流的流标识;K为大于或等于1的整数。Optionally, the control device is further configured to: output the flow identifiers of the top K data flows with the highest traffic statistics, or output the flow identifiers of the top K data flows with the highest changes in the traffic statistics within a set period of time; K is an integer greater than or equal to 1.
可选地,该网络设备可以为第一芯片,该控制设备可以为第二芯片。其中,第一芯片也称为数据面芯片或转发面芯片,第二芯片也称为控制面芯片。Optionally, the network device may be a first chip, and the control device may be a second chip. Wherein, the first chip is also called a data plane chip or a forwarding plane chip, and the second chip is also called a control plane chip.
第五方面,提供了一种计算机可读存储介质。该计算机可读存储介质中存储有指令,当该指令被处理器执行时,实现如上述第一方面及其各实施方式中的方法。In a fifth aspect, a computer-readable storage medium is provided. Instructions are stored in the computer-readable storage medium, and when the instructions are executed by the processor, the methods in the above first aspect and various implementation manners thereof are realized.
第六方面,提供了一种包含指令的计算机程序产品。当该计算机程序产品中的指令被处理器执行时,实现如上述第一方面及其各实施方式中的方法。In a sixth aspect, a computer program product including instructions is provided. When the instructions in the computer program product are executed by the processor, the methods in the above first aspect and various implementation manners thereof are realized.
第七方面,提供了一种芯片,该芯片包括可编程逻辑电路和/或程序指令,当芯片运行时,实现上述第一方面及其各实施方式中的方法。In a seventh aspect, a chip is provided, the chip includes a programmable logic circuit and/or program instructions, and when the chip is running, implements the method in the above first aspect and various implementation manners thereof.
本申请提供的技术方案带来的有益效果至少包括:The beneficial effects brought by the technical solution provided by the application at least include:
网络设备获取到目标报文后,能够通过映射函数处理目标报文所属数据流的目标流标识,得到目标流索引和目标地址索引。之后,网络设备能够根据目标流索引更新该目标地址索引指示的多个存储单元中第一存储单元中的流索引和/或报文计数值,并基于更新后的第一存储单元中的报文计数值,统计目标报文所属数据流的流量。由于在上述流量统计的过程中,网络设备无需向控制设备上报采样报文,因此有效提高了流统计的效率,且不会占用控制设备的存储空间。又由于第一存储单元中存储的流索引是通过映射函数处理目标流标识得到的,因此可以避免直接存储目标流标识而占用较多的存储空间。After the network device obtains the target packet, it can process the target flow identifier of the data flow to which the target packet belongs through the mapping function to obtain the target flow index and the target address index. Afterwards, the network device can update the flow index and/or packet count value in the first storage unit among the multiple storage units indicated by the target address index according to the target flow index, and based on the updated packet in the first storage unit Counting value, counting the traffic of the data flow to which the target packet belongs. Since the network device does not need to report sampling packets to the control device during the above flow statistics process, the efficiency of flow statistics is effectively improved, and the storage space of the control device will not be occupied. Furthermore, since the stream index stored in the first storage unit is obtained by processing the target stream ID through a mapping function, it is possible to avoid directly storing the target stream ID and occupying more storage space.
附图说明Description of drawings
图1是本申请实施例提供的一种流统计系统的结构示意图;FIG. 1 is a schematic structural diagram of a flow statistics system provided by an embodiment of the present application;
图2是本申请实施例提供的另一种流统计系统的结构示意图;Fig. 2 is a schematic structural diagram of another flow statistics system provided by the embodiment of the present application;
图3是本申请实施例提供的一种流统计方法的流程图;FIG. 3 is a flow chart of a flow statistics method provided in an embodiment of the present application;
图4是本申请实施例提供的一种更新第一存储单元的示意图;Fig. 4 is a schematic diagram of updating a first storage unit provided by an embodiment of the present application;
图5是本申请实施例提供的另一种第一存储单元的示意图;Fig. 5 is a schematic diagram of another first storage unit provided by the embodiment of the present application;
图6是本申请实施例提供的一种流标识与流量统计值的对应关系的示意图;FIG. 6 is a schematic diagram of a correspondence between a flow identifier and a traffic statistics value provided by an embodiment of the present application;
图7是本申请实施例提供的一种网络设备的结构示意图;FIG. 7 is a schematic structural diagram of a network device provided by an embodiment of the present application;
图8是本申请实施例提供的另一种网络设备的结构示意图;FIG. 8 is a schematic structural diagram of another network device provided by an embodiment of the present application;
图9是本申请实施例提供的又一种网络设备的结构示意图。FIG. 9 is a schematic structural diagram of another network device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面结合附图详细介绍本申请实施例提供的流统计方法、装置及系统。The flow statistics method, device, and system provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
图1是本申请实施例提供的一种流统计系统的结构示意图。如图1所示,该流统计系统可以包括网络设备01和控制设备02。其中,网络设备01用于获取目标报文。通过第一映射函数处理该目标报文所属数据流的目标流标识得到目标流索引,并通过第二映射函数处理该目标流标识得到目标地址索引。该目标地址索引指示网络设备01的一个存储区域,该存储区域包括多个存储单元,每个存储单元用于存储一个流索引以及该流索引指示的数据流的报文计数值。网络设备01还用于根据目标流索引更新多个存储单元中第一存储单元中的流索引和/或报文计数值,以及基于更新后的第一存储单元中的报文计数值,将目标流标识上报至控制设备02。控制设备02用于统计该目标流标识指示的数据流的流量。FIG. 1 is a schematic structural diagram of a flow statistics system provided by an embodiment of the present application. As shown in FIG. 1 , the flow statistics system may include a network device 01 and a control device 02 . Wherein, the network device 01 is used to obtain the target message. The target flow identifier of the data flow to which the target message belongs is processed by the first mapping function to obtain the target flow index, and the target flow identifier is processed by the second mapping function to obtain the target address index. The target address index indicates a storage area of the network device 01, and the storage area includes multiple storage units, and each storage unit is used to store a flow index and a packet count value of the data flow indicated by the flow index. The network device 01 is further configured to update the flow index and/or packet count value in the first storage unit among the plurality of storage units according to the target flow index, and based on the updated packet count value in the first storage unit, set the target The flow identification is reported to the control device 02. The control device 02 is configured to collect statistics on the traffic of the data flow indicated by the target flow identifier.
可以理解的是,本申请实施例所述的“统计数据流的流量”,并非是统计数据流的真实 流量,而是统计出能够反映该数据流的流量大小的数值。例如,该数值可以是下文所述的流量统计值。It can be understood that the "statistics of data stream traffic" mentioned in the embodiment of the present application is not to count the real traffic of data streams, but to count the values that can reflect the traffic volume of the data streams. For example, this value could be the traffic statistics described below.
可选地,控制设备02在基于网络设备01上报的流标识统计出多个数据流的流量后,还可以从该多个数据流中识别出K个特定流。该K个特定流可以是多个数据流中流量最高的前K个数据流,或者可以是多个数据流中流量变化量最高的前K个数据流。其中,K为大于或等于1的整数。Optionally, after the control device 02 counts the traffic of multiple data flows based on the flow identifier reported by the network device 01 , it may further identify K specific flows from the multiple data flows. The K specific streams may be the top K data streams with the highest traffic among the multiple data streams, or may be the top K data streams with the highest traffic variation among the multiple data streams. Wherein, K is an integer greater than or equal to 1.
在第一种可能的实现方式中,网络设备01可以为第一芯片,控制设备02可以为第二芯片。该第一芯片和第二芯片可以部署在同一个设备中。例如,该第一芯片和第二芯片可以部署在同一个交换机或路由器等用于转发报文的设备,或,第一芯片和第二芯片部署在同一个网卡中。也即是,该流统计系统可以是用于转发报文的设备。其中,第一芯片也可以称为数据面芯片、转发面芯片或接口板。第二芯片也可以称为控制面芯片或主控板。其中,数据面芯片用于转发报文并统计报文计数值。控制面芯片用于基于报文计数值,统计报文所属数据流的流量。这种情况下,交换机、路由器或网卡就相当于图1所示的流统计系统。In a first possible implementation manner, the network device 01 may be a first chip, and the control device 02 may be a second chip. The first chip and the second chip can be deployed in the same device. For example, the first chip and the second chip may be deployed in the same device for forwarding packets, such as a switch or a router, or the first chip and the second chip may be deployed in the same network card. That is, the flow statistics system may be a device for forwarding packets. Wherein, the first chip may also be called a data plane chip, a forwarding plane chip, or an interface board. The second chip may also be called a control plane chip or a main control board. Among them, the data plane chip is used to forward the message and count the message count value. The control plane chip is used to count the traffic of the data flow to which the message belongs based on the message count value. In this case, the switch, router or network card is equivalent to the flow statistics system shown in FIG. 1 .
在第二种可能的实现方式中,如图2所示,该网络设备01和控制设备02可以是相互独立的两个设备。其中,网络设备01可以为交换机或路由器等用于转发报文的设备。控制设备02可以是交换机或路由器等用于转发报文的转发设备,也可以是服务器。该服务器可以是一台独立的物理服务器,也可以是多台物理服务器组成的服务器集群,或者可以是云服务器(也称云计算服务中心)。控制设备02还可以是运行在服务器上的软件系统。In a second possible implementation manner, as shown in FIG. 2 , the network device 01 and the control device 02 may be two independent devices. Wherein, the network device 01 may be a device for forwarding packets, such as a switch or a router. The control device 02 may be a forwarding device such as a switch or a router for forwarding packets, or may be a server. The server may be an independent physical server, or a server cluster composed of multiple physical servers, or may be a cloud server (also called a cloud computing service center). The control device 02 may also be a software system running on a server.
可选地,参考图2,该流统计系统可以包括多个网络设备01。控制设备02可以接收该多个网络设备01上报的流标识,并对该多个网络设备01上报的流标识所指示的数据流的流量进行全局统计。Optionally, referring to FIG. 2 , the flow statistics system may include multiple network devices 01 . The control device 02 may receive the flow identifiers reported by the multiple network devices 01, and perform global statistics on the traffic of the data flows indicated by the flow identifiers reported by the multiple network devices 01.
在该第二种可能的实现方式中,若控制设备02为用于转发报文的设备,则该控制设备02可以是多个网络设备01的上一层级的转发设备。例如,多个网络设备01可以是接入层设备,控制设备02可以是汇聚层设备。或者,多个网络设备01可以是汇聚层设备,控制设备02可以是核心层设备。又或者,若该流统计系统的拓扑结构为叶脊(leaf-spine)拓扑,则该多个网络设备01可以是叶脊拓扑中的leaf设备,控制设备02可以是叶脊拓扑中的spine设备。In the second possible implementation manner, if the control device 02 is a device for forwarding packets, the control device 02 may be a forwarding device at an upper level of the multiple network devices 01 . For example, multiple network devices 01 may be access layer devices, and the control device 02 may be an aggregation layer device. Alternatively, multiple network devices 01 may be aggregation layer devices, and the control device 02 may be a core layer device. Alternatively, if the topology of the flow statistics system is a leaf-spine topology, the plurality of network devices 01 may be leaf devices in the leaf-spine topology, and the control device 02 may be spine devices in the leaf-spine topology .
可选地,本申请实施例提供的流统计系统可以应用于数据中心网络(data center network,DCN)、城域网络、广域网络或园区网络等。Optionally, the flow statistics system provided in the embodiment of the present application may be applied to a data center network (data center network, DCN), a metropolitan area network, a wide area network, or a campus network.
下面结合图1-图3对本申请实施例提供的流统计方法的流程进行举例说明。The flow of the flow statistics method provided by the embodiment of the present application will be illustrated below with reference to FIGS. 1-3 .
图3是本申请实施例提供的一种流统计方法的流程图。该方法可以应用于网络设备,该网络设备可以是图1或图2所示的流统计系统中的网络设备01。参考图3,该方法包括:FIG. 3 is a flow chart of a flow statistics method provided by an embodiment of the present application. The method can be applied to a network device, and the network device can be the network device 01 in the flow statistics system shown in FIG. 1 or FIG. 2 . Referring to Figure 3, the method includes:
步骤101、获取目标报文。 Step 101, acquire the target message.
在本申请实施例中,网络设备能够在转发各个数据流的报文的过程中,获取目标报文。其中,该目标报文可以是网络设备接收到的任一报文。相应的,本申请实施例所统计的数据流的报文计数值对应该数据流中的报文的总量。或者,该目标报文可以是网络设备待丢弃的报文。相应的,本申请实施例所统计的数据流的报文计数值对应该数据流中的报文丢失量。In the embodiment of the present application, the network device can obtain the target message during the process of forwarding the message of each data flow. Wherein, the target message may be any message received by the network device. Correspondingly, the packet count value of the data flow counted by the embodiment of the present application corresponds to the total amount of packets in the data flow. Alternatively, the target packet may be a packet to be discarded by the network device. Correspondingly, the packet count value of the data flow counted by the embodiment of the present application corresponds to the amount of packet loss in the data flow.
可以理解的是,网络设备接收到报文后,若检测到下述情况中的任一种,则可以丢弃该报文:报文校验失败、网络拥塞、网络设备的端口或链路故障、未获取到报文的转发表项。It can be understood that after a network device receives a message, if it detects any of the following situations, it can discard the message: message verification failure, network congestion, port or link failure of the network device, The forwarding entry of the packet has not been obtained.
步骤102、获取目标流索引。 Step 102, acquire the target flow index.
网络设备获取到目标报文后,可以获取该目标报文所属数据流的流标识(本申请简称为目标流标识)。该目标流标识可以是能够唯一指示目标报文所属数据流的标识。之后,网络设备可以确定该数据流的目标流索引。网络设备可以将该目标流标识作为目标流索引,或者,网络设备通过其预先配置的第一映射函数处理该目标流标识,从而得到目标报文所属数据流的目标流索引。After the network device obtains the target packet, it can obtain the flow identifier of the data flow to which the target packet belongs (referred to as the target flow identifier in this application). The target flow identifier may be an identifier that can uniquely indicate the data flow to which the target packet belongs. The network device can then determine the target flow index for the data flow. The network device may use the target flow identifier as the target flow index, or, the network device processes the target flow identifier through its pre-configured first mapping function, so as to obtain the target flow index of the data flow to which the target packet belongs.
其中,任一数据流的流标识(如上述目标流标识)可以包括该数据流的五元组中的部分或全部信息。例如,该流标识可以包括五元组中的源互联网协议(Internet Protocol,IP)地址和目的IP地址。该第一映射函数可以为哈希函数(也称为散列函数),其能够将数据流的流标识映射为固定长度的流索引。并且,该流索引的长度小于流标识的长度。例如,流标识的长度范围可以为8个字节(byte)至13个字节(byte)。采用第一映射函数映射后得到的流索引的长度可以为1个字节。在本申请实施例中,数据流的流标识也可以称为数据流的键值(key)。数据流的流索引也可以称为流指纹。Wherein, the flow identifier of any data flow (such as the above-mentioned target flow identifier) may include part or all of the information in the 5-tuple of the data flow. For example, the flow identifier may include a source Internet Protocol (Internet Protocol, IP) address and a destination IP address in the five-tuple. The first mapping function may be a hash function (also referred to as a hash function), which can map the flow identifier of the data flow into a fixed-length flow index. Moreover, the length of the flow index is smaller than the length of the flow identifier. For example, the length of the flow identifier can range from 8 bytes (byte) to 13 bytes (byte). The length of the stream index obtained after being mapped by the first mapping function may be 1 byte. In this embodiment of the present application, the flow identifier of the data flow may also be referred to as a key value (key) of the data flow. A flow index of a data flow may also be called a flow fingerprint.
步骤103、获取目标地址索引。 Step 103, acquire the target address index.
该目标地址索引是根据目标流标识得到的。The target address index is obtained according to the target flow identifier.
例如,网络设备中还预先配置有第二映射函数,该第二映射函数也可以为哈希函数。网络设备获取到目标流标识后,还能够通过该第二映射函数处理该目标流标识得到目标地址索引。该目标地址索引指示网络设备的一个存储区域。该存储区域包括多个存储单元,每个存储单元用于存储一个流索引以及流索引指示的数据流的报文计数值。也即是,每个存储单元的数据存储格式可以为[流索引,报文计数值]。For example, a second mapping function is pre-configured in the network device, and the second mapping function may also be a hash function. After the network device acquires the target flow identifier, it can also process the target flow identifier through the second mapping function to obtain the target address index. The target address index indicates a storage area of the network device. The storage area includes a plurality of storage units, and each storage unit is used to store a flow index and a packet count value of the data flow indicated by the flow index. That is, the data storage format of each storage unit may be [stream index, message count value].
可选地,网络设备中可以存储有哈希表。参考图4,该哈希表对应M行N列存储单元,每个存储单元也可以称为一个哈希桶。其中,M和N均可以为大于1的整数,且M和N可以根据网络设备的存储空间的大小,以及所需统计的数据流的数量灵活配置。Optionally, a hash table may be stored in the network device. Referring to FIG. 4, the hash table corresponds to storage units with M rows and N columns, and each storage unit may also be called a hash bucket. Wherein, both M and N can be integers greater than 1, and M and N can be flexibly configured according to the storage space of the network device and the number of data streams to be counted.
该目标地址索引能够指示哈希表中的至少一行存储单元。也即是,该目标地址索引指示的存储区域包括哈希表中的至少一行存储单元,其中每行存储单元包括N个存储单元。相应的,该目标地址索引也可以称为行索引(index)。当然,该目标地址索引也可以指示哈希表中的至少一列存储单元。相应的,该目标地址索引也可以称为列索引。The target address index can indicate at least one row of storage units in the hash table. That is, the storage area indicated by the target address index includes at least one row of storage units in the hash table, where each row of storage units includes N storage units. Correspondingly, the target address index may also be called a row index (index). Certainly, the target address index may also indicate at least one column of storage units in the hash table. Correspondingly, the target address index may also be called a column index.
可选地,参考图4,该第二映射函数H2可以包括第一子映射函数H21和第二子映射函数H22。网络设备可以通过第一子映射函数H21处理目标流标识得到第一子索引a1,并可以通过第二子映射函数H22处理目标流标识第二子索引a2。该目标地址索引包括第一子索引a1和第二子索引a2。并且,该目标地址索引指示的一个存储区域包括:第一子索引a1指示的第一子存储区域S1,以及第二子索引a2指示的第二子存储区域S2。该目标地址索引指示的存储区域中的多个存储单元包括:第一子存储区域S1和第二子存储区域S2所对应的存储单元。Optionally, referring to FIG. 4, the second mapping function H2 may include a first sub-mapping function H21 and a second sub-mapping function H22. The network device can process the target flow identifier through the first sub-mapping function H21 to obtain the first sub-index a1, and can process the second sub-index a2 of the target flow identifier through the second sub-mapping function H22. The target address index includes a first sub-index a1 and a second sub-index a2. Moreover, a storage area indicated by the target address index includes: a first sub-storage area S1 indicated by the first sub-index a1, and a second sub-storage area S2 indicated by the second sub-index a2. The multiple storage units in the storage area indicated by the target address index include: storage units corresponding to the first sub-storage area S1 and the second sub-storage area S2.
示例的,假设第一子索引a1和第二子索引a2均为行索引。则如图4所示,第一子存储区域S1对应的存储单元即为第一子索引a1指示的一行存储单元。第二子存储区域S2对应的存储单元即为第二子索引a2指示的一行存储单元。相应的,该目标地址索引指示的存储区域中共包括两行(即2×N个)存储单元。For example, it is assumed that both the first sub-index a1 and the second sub-index a2 are row indexes. Then, as shown in FIG. 4 , the storage unit corresponding to the first sub-storage area S1 is a row of storage units indicated by the first sub-index a1. The storage unit corresponding to the second sub-storage area S2 is a row of storage units indicated by the second sub-index a2. Correspondingly, the storage area indicated by the target address index includes two rows (that is, 2×N) storage units.
通过采用两个不同的子映射函数处理目标流标识,可以确保对于一个目标流索引,能够确定出两个候选的子存储区域。由于确定出的候选的存储单元的数量较多,因此可以有效提高在该多个存储单元中确定出满足条件的第一存储单元的概率。By using two different sub-mapping functions to process the target stream identifier, it can be ensured that two candidate sub-storage areas can be determined for one target stream index. Since the number of determined candidate storage units is large, the probability of determining the first storage unit meeting the condition among the plurality of storage units can be effectively increased.
可以理解的是,该第二映射函数所包括的子映射函数的个数也可以大于2。例如,假设第 二映射函数包括4个子映射函数,则目标地址索引指示的一个存储区域可以包括该4个子映射函数所指示的4个子存储区域。此外,上述第一映射函数和第二映射函数也可以是除哈希函数之外的其他映射函数,本申请实施例对此不做限定。It can be understood that the number of sub-mapping functions included in the second mapping function may also be greater than 2. For example, assuming that the second mapping function includes 4 sub-mapping functions, a storage area indicated by the target address index may include 4 sub-storage areas indicated by the 4 sub-mapping functions. In addition, the above-mentioned first mapping function and second mapping function may also be other mapping functions except the hash function, which is not limited in this embodiment of the present application.
步骤104、根据目标流索引更新多个存储单元中第一存储单元中的流索引和/或报文计数值。Step 104: Update the flow index and/or packet count value in the first storage unit among the multiple storage units according to the target flow index.
其中,更新后的第一存储单元中的流索引为该目标流索引,且更新后的第一存储单元中的报文计数值能够用于统计目标报文所属数据流的流量。Wherein, the updated flow index in the first storage unit is the target flow index, and the updated packet count value in the first storage unit can be used to count traffic of the data flow to which the target packet belongs.
在本申请实施例中,网络设备确定出目标流索引,并确定出目标地址索引指示的多个存储单元后,可以将该目标流索引与该多个存储单元中的流索引进行匹配。根据匹配结果的不同,网络设备可以采用不同的方式更新该多个存储单元中第一存储单元中的流索引和/或报文计数值。其中,网络设备更新第一存储单元的方式可以包括以下方式中的任意一种:In this embodiment of the present application, after the network device determines the target flow index and determines the multiple storage units indicated by the target address index, it may match the target flow index with the flow indices in the multiple storage units. According to different matching results, the network device may update the flow index and/or packet count value in the first storage unit among the multiple storage units in different ways. Wherein, the manner in which the network device updates the first storage unit may include any of the following manners:
方式一:若多个存储单元中的第一存储单元中存储有目标流索引,则将第一存储单元中的报文计数值增加第一预设值。Manner 1: If the target stream index is stored in the first storage unit among the plurality of storage units, the packet count value in the first storage unit is increased by a first preset value.
在方式一中,由于目标流索引与该多个存储单元中的第一存储单元中的流索引匹配,因此网络设备可以直接将该第一存储单元中的报文计数值增加第一预设值。其中,该第一预设值可以为网络设备中预先配置的固定值。可选地,该第一预设值可以是报文计数值的最小计数单位。例如,该第一预设值可以为1。In mode one, since the target flow index matches the flow index in the first storage unit among the plurality of storage units, the network device can directly increase the packet count value in the first storage unit by a first preset value . Wherein, the first preset value may be a fixed value pre-configured in the network device. Optionally, the first preset value may be a minimum counting unit of the packet count value. For example, the first preset value may be 1.
示例的,参考图4,假设网络设备通过第一映射函数H1计算得到的目标流索引为K5,通过第一子映射函数H21和第二子映射函数H22计算得到的目标地址索引包括第一子索引a1和第二子索引a2。从图4可以看出,第一子索引a1指示的第一子存储区域S1中存在第一存储单元,该第一存储单元中存储的流索引为K5。由此,网络设备可以将该第一存储单元中的报文计数值C5增加第一预设值。例如,网络设备可以将该报文计数值C5更新为:C5=C5+1。For example, referring to FIG. 4 , it is assumed that the target stream index calculated by the network device through the first mapping function H1 is K5, and the target address index calculated through the first sub-mapping function H21 and the second sub-mapping function H22 includes the first sub-index a1 and the second sub-index a2. It can be seen from FIG. 4 that there is a first storage unit in the first sub-storage area S1 indicated by the first sub-index a1, and the stream index stored in the first storage unit is K5. Thus, the network device may increase the packet count value C5 in the first storage unit by the first preset value. For example, the network device may update the packet count value C5 to: C5=C5+1.
方式二:若多个存储单元中不存在已存储有目标流索引的存储单元,则在多个存储单元中的一个空闲存储单元中存储目标流索引和初始报文计数值,该空闲存储单元即为第一存储单元。Method 2: If there is no storage unit that has stored the target flow index among the multiple storage units, store the target flow index and the initial message count value in a free storage unit among the multiple storage units, and the free storage unit is is the first storage unit.
其中,空闲存储单元是指未存储流索引和报文计数值的存储单元。在方式二中,由于目标流索引与该多个存储单元中任一存储单元中的流索引均不匹配,因此网络设备可以在该多个存储单元中的一个空闲存储单元中存储该目标流索引和初始报文计数值。也即是,网络设备可以在多个存储单元中选取一个空闲存储单元作为第一存储单元。其中,该初始报文计数值可以是网络设备中预先配置的报文计数值的初始值。例如,该初始报文计数值可以为1。Wherein, the free storage unit refers to a storage unit that does not store the flow index and the packet count value. In mode 2, since the target flow index does not match the flow index in any storage unit of the plurality of storage units, the network device may store the target flow index in a free storage unit of the plurality of storage units and the initial packet count value. That is, the network device may select an idle storage unit from the multiple storage units as the first storage unit. Wherein, the initial packet count value may be an initial value of a packet count value pre-configured in the network device. For example, the initial packet count value may be 1.
可选地,在上述方式二中,若多个存储单元中存在多个空闲存储单元,则网络设备可以随机选取一个空闲存储单元来存储目标流索引和初始报文计数值。或者,网络设备也可以选择最先遍历到的一个空闲存储单元来存储该目标流索引和初始报文计数值。Optionally, in the second manner above, if there are multiple free storage units among the multiple storage units, the network device may randomly select an idle storage unit to store the target flow index and the initial packet count value. Alternatively, the network device may also select a free storage unit traversed first to store the target flow index and the initial packet count value.
示例的,参考图5,假设网络设备通过第一映射函数H1计算得到的目标流索引为K0,通过第一子映射函数H21和第二子映射函数H22计算得到的目标地址索引包括第一子索引a1和第二子索引a2。从图5可以看出,第一子索引a1和第二子索引a2指示的两个子存储区域中均不存在已存储有目标流索引K0的存储单元,且第二子存储区域S2中存在空闲存储单元。因此,网络设备可以在第二子存储区域S2中的一个空闲存储单元中存储该目标流索引K0和初始报文计数值C0。其中,该初始报文计数值C0可以等于1。For example, referring to FIG. 5 , it is assumed that the target stream index calculated by the network device through the first mapping function H1 is K0, and the target address index calculated through the first sub-mapping function H21 and the second sub-mapping function H22 includes the first sub-index a1 and the second sub-index a2. It can be seen from Fig. 5 that there is no storage unit that already stores the target flow index K0 in the two sub-storage areas indicated by the first sub-index a1 and the second sub-index a2, and there is free storage in the second sub-storage area S2 unit. Therefore, the network device can store the target flow index K0 and the initial packet count value C0 in a free storage unit in the second sub-storage area S2. Wherein, the initial message count value C0 may be equal to 1.
方式三:若多个存储单元中不存在已存储有目标流索引的存储单元,且不存在空闲存储 单元,则将多个存储单元中报文计数值为初始值的一个存储单元中的流索引更新为目标流索引,该报文计数值为初始值的存储单元即为第一存储单元。Method 3: If there is no storage unit that has stored the target flow index in the multiple storage units, and there is no free storage unit, then the flow index in a storage unit whose message count value is the initial value in the multiple storage units It is updated as the target flow index, and the storage unit whose packet count value is the initial value is the first storage unit.
在方式三中,由于目标流索引与多个存储单元中任一存储单元中的流索引均不匹配,且该多个存储单元中也不存在空闲存储单元,因此网络设备需要采用该目标流索引替换某一存储单元中已存储的流索引。为了确保报文计数值统计的准确性,网络设备可以将该多个存储单元中报文计数值为初始值的一个存储单元中的流索引更新为该目标流索引。并且,网络设备可以保持该第一存储单元中的报文计数值不变,即该第一存储单元中的报文计数值仍然为初始值。其中,该初始值可以是网络设备中预先配置的固定值,例如该初始值可以为1。In mode 3, since the target stream index does not match the stream index in any of the multiple storage units, and there is no idle storage unit in the multiple storage units, the network device needs to use the target stream index Replace the stream index already stored in a storage unit. In order to ensure the accuracy of counting the packet count value, the network device may update the flow index in a storage unit whose packet count value is an initial value among the plurality of storage units to the target flow index. In addition, the network device may keep the packet count value in the first storage unit unchanged, that is, the packet count value in the first storage unit is still an initial value. Wherein, the initial value may be a fixed value preconfigured in the network device, for example, the initial value may be 1.
可以理解的是,网络设备每获取到一个目标报文,均可以通过上述步骤所示的方法更新存储空间中某个存储单元的流索引和/或报文计数值。若第一存储单元中的报文计数值为初始值,则表明对于该第一存储单元中的流索引所指示的数据流(下文称为数据流1),网络设备当前已获取到的数据流1的目标报文的数量为初始值(例如只获取到了该数据流1的一个目标报文)。基于此,网络设备获取到数据流2的一个目标报文后,若检测到数据流2的目标流索引的匹配结果为上述方式三中的情况,则可以采用该数据流2的目标流索引替换第一存储单元中已存储的数据流1的流索引。并且,由于网络设备已获取到的数据流2的目标报文的数量也为初始值,因此无需更新该第一存储单元中的报文计数值。It can be understood that, each time a network device acquires a target packet, it can update the stream index and/or packet count value of a certain storage unit in the storage space through the method shown in the above steps. If the packet count value in the first storage unit is the initial value, it indicates that for the data flow indicated by the flow index in the first storage unit (hereinafter referred to as data flow 1), the data flow currently acquired by the network device The number of target packets of 1 is an initial value (for example, only one target packet of the data flow 1 has been obtained). Based on this, after the network device obtains a target packet of data flow 2, if it detects that the matching result of the target flow index of data flow 2 is the situation in the above method 3, it can use the target flow index of data flow 2 to replace Stream index of data stream 1 stored in the first storage unit. Moreover, since the number of target packets of the data flow 2 acquired by the network device is also an initial value, there is no need to update the packet count value in the first storage unit.
基于上述分析可知,在方式三中,网络设备当前已获取到的数据流1的目标报文的数量,与当前已获取到的数据流2的目标报文的数量相当。因此,网络设备将第一存储单元中数据流1的流索引更新为数据流2的目标流索引,并不会对多个数据流中的特定流的识别造成影响。由此可知,本申请实施例提供的方法可以在准确识别特定流的前提下,有效减小流索引和报文统计值所需占用的存储单元的个数,进而降低对网络设备的存储容量的要求。Based on the above analysis, it can be seen that in the third mode, the number of target packets of data flow 1 currently obtained by the network device is equivalent to the number of target packets of data flow 2 currently obtained. Therefore, updating the stream index of data stream 1 in the first storage unit by the network device to the target stream index of data stream 2 will not affect identification of a specific stream among the multiple data streams. It can be seen that the method provided by the embodiment of the present application can effectively reduce the number of storage units occupied by the flow index and packet statistics under the premise of accurately identifying the specific flow, thereby reducing the impact on the storage capacity of the network device. Require.
可以理解的是,网络设备基于目标流索引也可能无法从多个存储单元中获取到满足条件的第一存储单元。也即是,可能存在如下场景:目标地址索引指示的多个存储单元中不存在已存储有目标流索引的存储单元,且每个存储单元中的报文计数值均大于初始报文计数值。对于该场景,网络设备可以将多个存储单元中报文计数值最少的存储单元中的报文计数值减少第一预设值。并且,网络设备无需更新该报文计数值最少的存储单元中的流索引。It can be understood that, based on the target stream index, the network device may also fail to obtain the first storage unit that meets the condition from the multiple storage units. That is, there may be the following scenario: among the multiple storage units indicated by the target address index, there is no storage unit that has already stored the target flow index, and the packet count value in each storage unit is greater than the initial packet count value. For this scenario, the network device may decrease the packet count value in the storage unit with the smallest packet count value among the multiple storage units by a first preset value. In addition, the network device does not need to update the flow index in the storage unit with the least packet count value.
可以理解的是,若报文计数值最少的存储单元中的报文计数值被减少至初始值,则当网络设备再次获取到目标报文,即可采用上述方式三中所示的方法更新该报文计数值最少的存储单元中的流索引。It can be understood that if the packet count value in the storage unit with the least packet count value is reduced to the initial value, then when the network device obtains the target packet again, the method shown in the above method 3 can be used to update the packet count value. Flow index in the storage unit with the least packet count value.
基于上述更新方式可知,网络设备获取到某个数据流(下文称为数据流5)的目标报文后,若该数据流5的流索引指示的多个存储单元中不存在满足条件的第一存储单元,则只有当网络设备获取到的数据流5的目标报文的数量大于或等于该多个存储单元中的最少的报文计数值时,才能够采用该数据流5的流索引替换报文计数值最少的存储单元中的流索引。Based on the above update method, it can be seen that after the network device obtains the target message of a certain data flow (hereinafter referred to as data flow 5), if there is no first storage unit, only when the number of target packets of data flow 5 obtained by the network device is greater than or equal to the minimum packet count value in the plurality of storage units, the flow index of the data flow 5 can be used to replace the packet The stream index in the storage unit with the least file count value.
假设报文计数值最少的存储单元中的流索引所指示的数据流为数据流6,则上述更新方式可以理解为:当网络设备获取到的数据流5的目标报文的数量大于或等于网络设备已获取到的数据流6的目标报文的数量时,才会采用该数据流5的流索引替换数据流6的流索引。基于此,可以在存储单元的数量有限的场景中,实现对流量较高的数据流的报文计数值的可靠统计。Assuming that the data flow indicated by the flow index in the storage unit with the least packet count value is data flow 6, the above update method can be understood as: when the number of target packets of data flow 5 acquired by the network device is greater than or equal to the network The device will replace the stream index of data stream 6 with the stream index of data stream 5 only when the number of target packets of data stream 6 has been obtained by the device. Based on this, in a scenario where the number of storage units is limited, it is possible to realize reliable statistics of packet count values of data streams with high traffic.
步骤105、基于更新后的第一存储单元中的报文计数值,统计目标报文所属数据流的流量。Step 105: Based on the updated packet count value in the first storage unit, collect statistics on the traffic of the data flow to which the target packet belongs.
在本申请实施例中,网络设备更新第一存储单元中的流索引和/或报文计数值之后,即可 基于更新后的第一存储单元中的报文计数值,统计该目标报文所属数据流的流量。其中,统计目标报文所属数据流的流量是指:统计出能够反映该目标报文所属数据流的流量大小的流量统计值。In this embodiment of the application, after the network device updates the flow index and/or the packet count value in the first storage unit, it can count the number of streams the target packet belongs to based on the updated packet count value in the first storage unit. flow of data streams. Wherein, counting the traffic of the data stream to which the target message belongs refers to: counting a traffic statistical value that can reflect the traffic volume of the data stream to which the target message belongs.
作为第一种可能的实现方式,若更新后的第一存储单元中的报文计数值满足统计条件,则网络设备可以将该目标流标识上报至控制设备,以供控制设备将目标流标识指示的数据流的流量统计值增加第二预设值。As a first possible implementation, if the updated packet count value in the first storage unit satisfies the statistical condition, the network device can report the target flow identifier to the control device, so that the control device can indicate the target flow identifier The traffic statistics value of the data flow is increased by a second preset value.
其中,该第二预设值可以是流量统计值的最小计数单位,例如,该第二预设值可以等于1。在该第一种实现方式中,网络设备可以将目标流标识封装在统计报文中,并将该统计报文上报至控制设备。例如,网络设备可以采用IPinIP的封装方式构造统计报文,该统计报文的外层目的IP地址为控制设备的IP地址。Wherein, the second preset value may be the minimum counting unit of the traffic statistics value, for example, the second preset value may be equal to 1. In the first implementation manner, the network device may encapsulate the target flow identifier in a statistical message, and report the statistical message to the control device. For example, the network device may use IPinIP encapsulation to construct a statistical message, and the outer destination IP address of the statistical message is the IP address of the control device.
如图6所示,控制设备中可以存储有数据流的流标识和流量统计值的对应关系。控制设备每接收到网络设备上报的一个数据流的流标识(例如目标流标识),则可以将该流标识所对应的流量统计值增加第二预设值。其中,该流量统计值例如可以是上报次数。As shown in FIG. 6 , the control device may store the corresponding relationship between the flow identifier of the data flow and the traffic statistics value. Each time the control device receives a flow identifier (for example, a target flow identifier) of a data flow reported by the network device, the traffic statistics value corresponding to the flow identifier may be increased by a second preset value. Wherein, the traffic statistics value may be, for example, the number of reports.
示例的,假设更新后的第一存储单元中的报文计数值满足统计条件,且网络设备当前获取到的目标报文所属的数据流的目标流标识为FID-1。则网络设备可以将该目标流标识FID-1上报至控制设备,控制设备进而可以将该目标流标识为FID-1对应的流量统计值增加1。参考图6,控制设备可以将目标流标识为FID-1对应的流量统计值由10更新为11。As an example, assume that the updated packet count value in the first storage unit satisfies the statistical condition, and the target flow identifier of the data flow to which the target packet currently acquired by the network device is FID-1. Then the network device may report the target flow identifier FID-1 to the control device, and the control device may then identify the target flow as FID-1 and increase the traffic statistics value corresponding to FID-1 by 1. Referring to FIG. 6 , the control device may update the traffic statistics value corresponding to the target flow identifier as FID-1 from 10 to 11.
可选地,在该第一种实现方式中,控制设备可以接收到多个网络设备上报的流标识,并能统计接收到的各个流标识所指示的数据流的流量统计值。并且,控制设备还可以基于统计到的多个数据流的流量统计值,从该多个数据流中识别出K个特定流。也即是,控制设备能够对流经多个网络设备的多个数据流的流量进行全局统计,因此能够在全局范围内识别出K个特定流。进一步地,控制设备还可以通过输出装置输出该K个特定流,该输出装置例如可以是显示屏或连接网管的接口。Optionally, in the first implementation manner, the control device may receive flow identifiers reported by multiple network devices, and may collect statistics on traffic statistics of the data flows indicated by the received flow identifiers. In addition, the control device may also identify K specific flows from the plurality of data flows based on the counted traffic statistics values of the plurality of data flows. That is, the control device can perform global statistics on the traffic of multiple data flows passing through multiple network devices, and thus can identify K specific flows globally. Further, the control device may also output the K specific streams through an output device, for example, the output device may be a display screen or an interface connected to a network management system.
作为第二种可能的实现方式,若更新后的第一存储单元中的报文计数值满足统计条件,则网络设备可以直接将目标流标识指示的数据流的流量统计值增加第二预设值。As a second possible implementation, if the updated packet count value in the first storage unit satisfies the statistical condition, the network device may directly increase the traffic statistical value of the data flow indicated by the target flow identifier by a second preset value .
在该第二种实现方式中,网络设备自身具备流量统计的功能。例如,网络设备中也存储有诸如图6所示的数据流的流标识和流量统计值的对应关系,网络设备在检测到统计条件满足时,可以直接更新该目标流标识对应的流量统计值。In the second implementation manner, the network device itself has a traffic statistics function. For example, the network device also stores the corresponding relationship between the flow identifier and the traffic statistics value of the data flow as shown in FIG.
可选地,网络设备可以包括数据面芯片和控制面芯片。其中,数据面芯片用于转发报文并统计报文计数值,即数据面芯片用于维护哈希表。数据面芯片还用于若检测到更新后的第一存储单元中的报文计数值满足统计条件,则将目标流标识上报至控制面芯片。控制面芯片用于将该目标流标识指示的数据流的流量统计值增加第二预设值,即控制面芯片用于统计各个数据流的流量统计值。Optionally, the network device may include a data plane chip and a control plane chip. Among them, the data plane chip is used to forward the message and count the message count value, that is, the data plane chip is used to maintain the hash table. The data plane chip is further configured to report the target flow identifier to the control plane chip if it is detected that the updated packet count value in the first storage unit satisfies the statistical condition. The control plane chip is used to increase the traffic statistic value of the data flow indicated by the target flow identifier by a second preset value, that is, the control plane chip is used to count the traffic statistic value of each data flow.
可以理解的是,网络设备通过第一映射函数处理不同的流标识后,可能会得到相同的流索引,即不同数据流的流索引可能存在哈希冲突。由此可能会导致第一存储单元中存储的报文计数值是对不同数据流的目标报文的数量进行统计得到的。而在上述两种实现方式中,网络设备或数据面芯片能够在报文计数值满足统计条件时,上报当前获取到的目标报文所属数据流的目标流标识。对于流量较大的数据流(下文称为数据流3)的流索引与流量较小的数据流(下文称为数据流4)的流索引存在哈希冲突的场景,由于网络设备或数据面芯片获取到的数据流3的目标报文的数量较多,因此上报该数据流3的流标识的次数较多。而网络设备或数 据面芯片获取到的数据流4的目标报文的数量较少,因此上报该数据流4的流标识的次数较少。控制设备或控制面芯片进而能够根据接收到的流标识的次数,准确统计各个流标识指示的数据流的流量,进而能够准确识别多个数据流中的特定流。由此可知,本申请实施例提供的方法不仅能够实现对存储单元的存储资源的复用(即不同数据流的报文计数值可以记录在同一个存储单元中),而且可以实现对不同数据流的流量的准确统计。It can be understood that, after the network device processes different flow identifiers through the first mapping function, the same flow index may be obtained, that is, there may be a hash conflict between the flow indexes of different data flows. As a result, the packet count value stored in the first storage unit may be obtained by counting the number of target packets of different data flows. In the above two implementation manners, the network device or the data plane chip can report the target flow identifier of the data flow to which the currently acquired target packet belongs when the count value of the packet meets the statistical condition. For the scenario where there is a hash conflict between the flow index of the data flow with a large traffic (hereinafter referred to as data flow 3) and the flow index of a data flow with a small traffic (hereinafter referred to as data flow 4), due to the network device or data plane chip The number of target packets of the obtained data flow 3 is large, so the number of times of reporting the flow identifier of the data flow 3 is large. However, the number of target packets of the data flow 4 obtained by the network device or the data plane chip is relatively small, so the number of times to report the flow identifier of the data flow 4 is relatively small. The control device or the control plane chip can then accurately count the traffic of the data flows indicated by each flow identifier according to the number of received flow identifiers, and thus can accurately identify a specific flow among multiple data flows. It can be seen that the method provided by the embodiment of the present application can not only realize the multiplexing of the storage resources of the storage unit (that is, the packet count values of different data streams can be recorded in the same storage unit), but also realize the multiplexing of the storage resources of different data streams. Accurate statistics of traffic.
可选地,上述两种实现方式中所述的统计条件可以包括:报文计数值为统计阈值的整数倍。基于该统计条件可知,网络设备若检测到更新后的第一存储单元中的报文计数值满足:报文计数值%统计阈值==0,则可以通过上述第一种或第二种实现方式更新目标流标识指示的数据流的流量统计值。其中,该统计阈值可以为大于1的整数,例如可以为128。Optionally, the statistical conditions described in the above two implementation manners may include: the packet count value is an integer multiple of the statistical threshold. Based on this statistical condition, it can be seen that if the network device detects that the packet count value in the first storage unit after the update satisfies: packet count value% statistical threshold==0, then the above-mentioned first or second implementation method can be used Update the traffic statistics value of the data flow indicated by the target flow identifier. Wherein, the statistical threshold may be an integer greater than 1, such as 128.
相比于基于报文计数值的变化实时更新流量统计值,本申请实施例提供的方法以统计阈值为统计间隔更新数据流的流量统计值,可以有效降低流量统计值的更新频率,进而减少对控制设备或控制面芯片的资源占用。并且,对于流量较小的数据流4,网络设备在获取到该数据流4的目标报文并更新第一存储单元中的报文计数值后,该报文计数值恰好为统计阈值的整数倍的概率较低。因此,在报文计数值满足统计条件后再上报目标流标识,可以进一步降低上报流量较小的数据流的流标识的概率。由此,可以确保统计得到的流量统计值能够较为准确地反映网络中各个数据流的流量大小。Compared with updating the traffic statistics in real time based on the change of the packet count value, the method provided by the embodiment of the present application updates the traffic statistics of the data flow with the statistical threshold as the statistical interval, which can effectively reduce the update frequency of the traffic statistics, thereby reducing the Resource occupation of control devices or control plane chips. Moreover, for the data flow 4 with a small traffic, after the network device acquires the target packet of the data flow 4 and updates the packet count value in the first storage unit, the packet count value is exactly an integer multiple of the statistical threshold low probability. Therefore, reporting the target flow identifier after the packet count value satisfies the statistical condition can further reduce the probability of reporting the flow identifier of the data flow with small traffic. In this way, it can be ensured that the traffic statistical value obtained through statistics can more accurately reflect the traffic volume of each data flow in the network.
可选地,该统计阈值可以是网络设备中预先配置的固定值。也即是,在流统计的过程中,该统计阈值始终保持不变。或者,该统计阈值也可以随报文计数值的变化而变化。例如,该统计阈值可以随着报文计数值的增大而增大。Optionally, the statistics threshold may be a fixed value pre-configured in the network device. That is to say, during the flow statistics process, the statistics threshold always remains unchanged. Alternatively, the statistical threshold may also vary with changes in packet count values. For example, the statistics threshold may increase as the packet count increases.
示例的,若更新后的第一存储单元中的报文计数值位于第一数值范围,则网络设备能以第一数值的统计阈值为统计间隔更新流量统计值。若更新后的第一存储单元中的报文计数值位于第二数值范围,则网络设备能以第二数值的统计阈值为统计间隔更新流量统计值。其中,第二数值范围的下限大于第一数值范围的上限,第二数值大于第一数值。For example, if the updated packet count value in the first storage unit is within the first numerical range, the network device can update the traffic statistical value with the statistical threshold of the first numerical value as the statistical interval. If the updated packet count value in the first storage unit is within the second numerical range, the network device can update the traffic statistical value with the statistical threshold of the second numerical value as the statistical interval. Wherein, the lower limit of the second numerical range is greater than the upper limit of the first numerical range, and the second numerical value is greater than the first numerical value.
步骤106、若多个存储单元中的第二存储单元中的流索引和报文计数值超过设定时长未更新,则将该第二存储单元中存储的流索引和报文计数值删除。 Step 106, if the flow index and packet count value in the second storage unit among the plurality of storage units have not been updated for a set period of time, delete the flow index and packet count value stored in the second storage unit.
在本申请实施例中,网络设备中还配置有存储单元的老化机制。网络设备能够基于该老化机制将超过设定时长未更新的第二存储单元中的流索引和报文计数值删除。也即是,网络设备能够将第二存储单元老化,老化后的第二存储单元为空闲存储单元。基于该老化机制,网络设备可以及时释放第二存储单元的存储空间,以便存储其他数据流的流索引和报文计数值。其中,该设定时长可以是网络设备中预先配置的固定值,例如可以等于1秒。In the embodiment of the present application, an aging mechanism of the storage unit is also configured in the network device. Based on the aging mechanism, the network device can delete the flow index and the packet count value in the second storage unit that have not been updated for a set period of time. That is, the network device can age the second storage unit, and the aged second storage unit is an idle storage unit. Based on the aging mechanism, the network device can release the storage space of the second storage unit in time, so as to store flow indexes and packet count values of other data flows. Wherein, the set duration may be a fixed value pre-configured in the network device, for example, it may be equal to 1 second.
可选地,网络设备在每次更新某个存储单元中的流索引和/或报文计数值后,可以记录该存储单元的更新时间戳。网络设备若检测到第二存储单元的更新时间戳距离当前时刻的时长超过该设定时长,则可以确定该第二存储单元中的流索引和报文计数值超过设定时长未更新。Optionally, after updating the flow index and/or packet count value in a storage unit each time, the network device may record the update timestamp of the storage unit. If the network device detects that the time between the update timestamp of the second storage unit and the current time exceeds the set time period, it may determine that the flow index and packet count in the second storage unit have not been updated beyond the set time period.
步骤107、基于各个数据流的流量统计值,输出前K个数据流的流标识。Step 107: Based on the traffic statistics of each data flow, output the flow identifiers of the top K data flows.
网络设备在基于上述步骤105中的第二种实现方式统计各个数据流的流量统计值后,还可以每隔统计周期,基于各个数据流的流量统计值对各个数据流的流标识进行一次排序。并且,网络设备可以基于排序结果,输出前K个数据流的流标识。其中,该统计周期的时长可以是网络设备中预先配置的。例如该统计周期的时长可以为100毫秒或1秒。After the network device counts the traffic statistics of each data flow based on the second implementation manner in step 105, it may also sort the flow identifiers of each data flow based on the traffic statistics of each data flow every statistical period. In addition, the network device may output flow identifiers of the top K data flows based on the sorting result. Wherein, the duration of the statistical period may be pre-configured in the network device. For example, the duration of the statistical period may be 100 milliseconds or 1 second.
可选地,该前K个数据流可以是流量统计值最高的前K个数据流。也即是,网络设备可以识别并输出多个数据流中流量最高的前K个数据流的流标识。或者,该前K个数据流可以是流 量统计值在设定时段内的变化量最高的前K个数据流的流标识。也即是,网络设备可以识别并输出多个数据流中流量变化最大的前K个数据流的流标识。其中,设定时段可以是前一个统计周期,或者也可以是指从起始统计时刻到当前统计时刻之间的时段。Optionally, the top K data streams may be the top K data streams with the highest traffic statistics. That is, the network device can identify and output flow identifiers of the top K data flows with the highest traffic among the multiple data flows. Alternatively, the top K data streams may be flow identifiers of the top K data streams with the highest variation in traffic statistics within a set period of time. That is, the network device can identify and output flow identifiers of the top K data flows with the largest traffic changes among the multiple data flows. Wherein, the set period of time may be the previous statistical period, or may also refer to the period from the initial statistical moment to the current statistical moment.
可选地,网络设备输出前K个数据流的流标识可以是指:网络设备在其显示屏中显示该前K个数据流的流标识。或者,网络设备将该前K个数据流的流标识发送至另一设备,以供另一设备显示。其中,该另一设备可以是控制设备,或者可以是用户设备。Optionally, the network device outputting the flow identifiers of the first K data flows may refer to: the network device displays the flow identifiers of the first K data flows on its display screen. Alternatively, the network device sends the flow identifiers of the first K data flows to another device for display by the other device. Wherein, the other device may be a control device, or may be a user device.
可以理解的是,对于上述步骤105中的第一种实现方式,控制设备在统计各个数据流的流量统计值后也可以执行上述步骤107所示的方法。也即是,控制设备可以基于各个数据流的流量统计值,输出前K个数据流的流标识。本申请实施例提供的方案中,由于网络设备或控制设备能够按照统计周期自动输出前K个数据流的流标识,因此无需在需要统计前K个数据流时,再去查询网络设备中各存储单元中的报文计数值。由此,有效提高了流统计的效率。It can be understood that, for the first implementation manner in step 105 above, the control device may also execute the method shown in step 107 above after counting the traffic statistics of each data flow. That is, the control device may output flow identifiers of the first K data flows based on the traffic statistics of each data flow. In the solution provided by the embodiment of the present application, since the network device or the control device can automatically output the flow identifiers of the first K data streams according to the statistical period, it is not necessary to query the data stored in the network device when the first K data streams need to be counted. Packet count value in the unit. Thus, the efficiency of flow statistics is effectively improved.
还可以理解的是,本申请实施例提供的流统计方法的步骤先后顺序可以进行适当调整,步骤也可以根据情况进行相应增减。例如,上述步骤103可以在步骤102之前执行。或者,上述步骤106可以根据情况删除,即网络设备也可以无需老化长时间未更新的存储单元。又或者,上述步骤107可以在步骤106之前执行,或可以根据情况删除。It can also be understood that the order of the steps of the flow statistics method provided in the embodiment of the present application can be adjusted appropriately, and the steps can also be increased or decreased accordingly according to the situation. For example, the above step 103 may be performed before step 102 . Alternatively, the above step 106 may be deleted according to circumstances, that is, the network device may not need to age the storage unit that has not been updated for a long time. Alternatively, the above step 107 may be performed before step 106, or may be deleted according to circumstances.
综上所述,本申请实施例提供了一种流统计方法。网络设备获取到目标报文后,能够通过映射函数处理目标报文所属数据流的目标流标识,得到目标流索引和目标地址索引。之后,网络设备能够根据目标流索引更新该目标地址索引指示的多个存储单元中第一存储单元中的流索引和/或报文计数值,并基于更新后的第一存储单元中的报文计数值,统计目标报文所属数据流的流量。由于在上述流量统计的过程中,网络设备无需向控制设备上报采样报文,因此有效提高了流统计的效率,且不会占用控制设备的存储空间。又由于第一存储单元中存储的流索引是通过映射函数处理目标流标识得到的,因此可以避免直接存储目标流标识而占用较多的存储空间。To sum up, the embodiment of the present application provides a flow statistics method. After the network device obtains the target packet, it can process the target flow identifier of the data flow to which the target packet belongs through the mapping function to obtain the target flow index and the target address index. Afterwards, the network device can update the flow index and/or packet count value in the first storage unit among the multiple storage units indicated by the target address index according to the target flow index, and based on the updated packet in the first storage unit Counting value, counting the traffic of the data flow to which the target packet belongs. Since the network device does not need to report sampling packets to the control device during the above flow statistics process, the efficiency of flow statistics is effectively improved, and the storage space of the control device will not be occupied. Furthermore, since the stream index stored in the first storage unit is obtained by processing the target stream ID through a mapping function, it is possible to avoid directly storing the target stream ID and occupying more storage space.
图7是本申请实施例提供的一种网络设备的结构示意图。该网络设备可以应用于如图1或图2所示的流统计系统,且可以用于实现上述方法实施例提供的流统计方法。如图7所示,该网络设备包括:FIG. 7 is a schematic structural diagram of a network device provided by an embodiment of the present application. The network device can be applied to the flow statistics system shown in FIG. 1 or FIG. 2 , and can be used to implement the flow statistics method provided in the foregoing method embodiments. As shown in Figure 7, the network equipment includes:
获取单元011,用于获取目标报文。该获取单元011的功能实现可以参考上述步骤101的相关描述。The obtaining unit 011 is configured to obtain the target message. For the function implementation of the acquiring unit 011, reference may be made to the related description of the above-mentioned step 101.
处理单元012,用于根据所述目标报文所属数据流的目标流标识获取目标流索引;以及,根据所述目标流标识获取目标地址索引。该目标地址索引指示该网络设备的一个存储区域,该存储区域包括多个存储单元,每个存储单元用于存储一个流索引以及该流索引指示的数据流的报文计数值。例如,处理单元012通过第一映射函数处理该目标报文所属数据流的目标流标识得到目标流索引,以及,通过第二映射函数处理该目标流标识得到目标地址索引。The processing unit 012 is configured to obtain a target flow index according to the target flow identifier of the data flow to which the target packet belongs; and obtain a target address index according to the target flow identifier. The target address index indicates a storage area of the network device, and the storage area includes a plurality of storage units, and each storage unit is used to store a flow index and a packet count value of the data flow indicated by the flow index. For example, the processing unit 012 processes the target flow identifier of the data flow to which the target packet belongs through the first mapping function to obtain the target flow index, and processes the target flow identifier through the second mapping function to obtain the target address index.
该处理单元012的功能实现可以参考上述步骤102和步骤103的相关描述。For the function implementation of the processing unit 012, reference may be made to the related descriptions of the above-mentioned step 102 and step 103.
更新单元013,用于根据该目标流索引更新该多个存储单元中第一存储单元中的流索引和/或报文计数值。该更新单元013的功能实现可以参考上述步骤104的相关描述。An updating unit 013, configured to update the flow index and/or packet count value in the first storage unit among the plurality of storage units according to the target flow index. For the function implementation of the updating unit 013, reference may be made to the relevant description of the above step 104.
统计单元014,用于基于更新后的该第一存储单元中的报文计数值,统计该目标报文所属数据流的流量。该统计单元014的功能实现可以参考上述步骤105的相关描述。The statistics unit 014 is configured to, based on the updated packet count value in the first storage unit, count the traffic of the data flow to which the target packet belongs. For the function realization of the statistical unit 014, reference may be made to the relevant description of the above-mentioned step 105.
可选地,该更新单元013可以用于:Optionally, the updating unit 013 can be used for:
若该多个存储单元中的第一存储单元中存储有该目标流索引,则将该第一存储单元中的报文计数值增加第一预设值;If the target stream index is stored in the first storage unit among the plurality of storage units, increasing the packet count value in the first storage unit by a first preset value;
若该多个存储单元中不存在已存储有该目标流索引的存储单元,则在该多个存储单元中的一个空闲存储单元中存储该目标流索引和初始报文计数值,该空闲存储单元为该第一存储单元,该空闲存储单元是指未存储流索引和报文计数值的存储单元;If there is no storage unit that has stored the target flow index in the plurality of storage units, then store the target flow index and the initial message count value in an idle storage unit among the plurality of storage units, and the idle storage unit is the first storage unit, and the free storage unit refers to a storage unit that does not store the flow index and the packet count value;
若该多个存储单元中不存在已存储有该目标流索引的存储单元,且不存在空闲存储单元,则将该多个存储单元中报文计数值为初始值的一个存储单元中的流索引更新为该目标流索引,该报文计数值为初始值的存储单元为该第一存储单元。If there is no storage unit that has stored the target flow index in the plurality of storage units, and there is no free storage unit, then the flow index in a storage unit whose message count value is the initial value in the plurality of storage units The target flow index is updated, and the storage unit whose packet count value is an initial value is the first storage unit.
可选地,该更新单元013还可以用于:若该多个存储单元中不存在已存储有该目标流索引的存储单元,且每个存储单元中的报文计数值均大于初始报文计数值,则将该多个存储单元中报文计数值最少的存储单元中的报文计数值减少第一预设值。Optionally, the update unit 013 may also be used for: if there is no storage unit that has stored the target stream index among the plurality of storage units, and the message count value in each storage unit is greater than the initial message count value, then the packet count value in the storage unit with the smallest packet count value among the plurality of storage units is reduced by a first preset value.
可选地,该统计单元014,可以用于:若更新后的该第一存储单元中的报文计数值满足统计条件,则将该目标流标识上报至控制设备,以供该控制设备将该目标流标识指示的数据流的流量统计值增加第二预设值;或者,若更新后的该第一存储单元中的报文计数值满足统计条件,则将该目标流标识指示的数据流的流量统计值增加第二预设值。Optionally, the statistics unit 014 may be configured to: if the updated packet count value in the first storage unit satisfies the statistics condition, report the target flow identifier to the control device for the control device to The traffic statistics value of the data flow indicated by the target flow identifier is increased by a second preset value; or, if the updated packet count value in the first storage unit satisfies the statistical condition, then the traffic statistics value of the data flow indicated by the target flow identifier is The traffic statistical value is increased by a second preset value.
可选地,该统计条件包括:报文计数值为统计阈值的整数倍,该统计阈值为大于1的整数。Optionally, the statistical condition includes: the packet count value is an integer multiple of a statistical threshold, and the statistical threshold is an integer greater than 1.
可选地,继续参考图7,该网络设备还可以包括输出单元015,该输出单元015用于:输出流量统计值最高的前K个数据流的流标识;或者,输出流量统计值在设定时段内的变化量最高的前K个数据流的流标识;其中,K为大于或等于1的整数。Optionally, continuing to refer to FIG. 7 , the network device may further include an output unit 015, which is configured to: output flow identifiers of the top K data flows with the highest traffic statistics; or output the traffic statistics at the set The stream identifiers of the top K data streams with the highest variation within the time period; where K is an integer greater than or equal to 1.
该输出单元015的功能实现可以参考上述步骤107的相关描述。For the function implementation of the output unit 015, reference may be made to the relevant description of the above-mentioned step 107.
可选地,该第二映射函数包括第一子映射函数和第二子映射函数;该处理单元012可以用于:通过第一子映射函数处理该目标流标识得到第一子索引;并通过第二子映射函数处理该目标流标识第二子索引,该目标地址索引包括该第一子索引和第二子索引;相应的,该存储区域包括:第一子索引指示的第一子存储区域,以及第二子索引指示的第二子存储区域,该多个存储单元包括该第一子存储区域和第二子存储区域对应的存储单元。Optionally, the second mapping function includes a first sub-mapping function and a second sub-mapping function; the processing unit 012 may be configured to: use the first sub-mapping function to process the target flow identifier to obtain the first sub-index; and use the second The second sub-mapping function processes the target stream to identify the second sub-index, and the target address index includes the first sub-index and the second sub-index; correspondingly, the storage area includes: the first sub-storage area indicated by the first sub-index, and the second sub-storage area indicated by the second sub-index, the plurality of storage units include storage units corresponding to the first sub-storage area and the second sub-storage area.
可选地,该更新单元013还可以用于:若该多个存储单元中的第二存储单元中的流索引和报文计数值超过设定时长未更新,则将该第二存储单元中存储的流索引和报文计数值删除。该更新单元013的功能实现还可以参考上述步骤106的相关描述。Optionally, the updating unit 013 can also be used to: if the flow index and packet count value in the second storage unit among the plurality of storage units have not been updated for a set period of time, then store in the second storage unit The stream index and packet count value of the stream are deleted. For the function implementation of the update unit 013, reference may also be made to the relevant description of the above-mentioned step 106.
可选地,该目标报文为该网络设备接收到的任一报文,或者该目标报文为该网络设备待丢弃的报文。Optionally, the target message is any message received by the network device, or the target message is a message to be discarded by the network device.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上文描述的网络设备以及各单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the network device and each unit described above can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
可以理解的是,本申请实施例提供的网络设备还可以用特定应用集成电路(application-specific integrated circuit,ASIC)实现,或可编程逻辑器件(programmable logic device,PLD)实现,上述PLD可以是复杂程序逻辑器件(complex programmable logical device,CPLD),现场可编程门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合。此外,也可以通过软件实现上述方法实施例提供的流统计方法,当通过软件实现上述方法实施例提供的流统计方法时,该网络设备中的各个功能单元也可以为软件模块。It can be understood that the network equipment provided in the embodiment of the present application can also be realized by application-specific integrated circuit (application-specific integrated circuit, ASIC), or programmable logic device (programmable logic device, PLD). The above-mentioned PLD can be complex Program logic device (complex programmable logical device, CPLD), field-programmable gate array (field-programmable gate array, FPGA), general array logic (generic array logic, GAL) or any combination thereof. In addition, the flow statistics method provided by the above method embodiment may also be implemented by software, and when the flow statistics method provided by the above method embodiment is implemented by software, each functional unit in the network device may also be a software module.
图8是本申请实施例提供的另一种网络设备的结构示意图。该网络设备可以应用于如图1或图2所示的流统计系统,且可以用于实现上述方法实施例提供的流统计方法。如图8所示,该网络设备包括:处理器201、存储器202、网络接口203和总线204。FIG. 8 is a schematic structural diagram of another network device provided by an embodiment of the present application. The network device can be applied to the flow statistics system shown in FIG. 1 or FIG. 2 , and can be used to implement the flow statistics method provided in the foregoing method embodiments. As shown in FIG. 8 , the network device includes: a processor 201 , a memory 202 , a network interface 203 and a bus 204 .
其中,存储器202中存储有计算机程序2021,计算机程序2021用于实现各种应用功能。处理器201用于执行该计算机程序2021以实现上述方法实施例提供的流统计方法。Wherein, a computer program 2021 is stored in the memory 202, and the computer program 2021 is used to realize various application functions. The processor 201 is configured to execute the computer program 2021 to implement the flow statistics method provided by the foregoing method embodiments.
处理器201可以是中央处理器(central processing unit,CPU),该处理器201还可以是其他通用处理器、数字信号处理器(digital signal processor,DSP)、ASIC、FPGA、图形处理器(graphics processing unit,GPU)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者是任何常规的处理器。The processor 201 can be a central processing unit (central processing unit, CPU), and the processor 201 can also be other general-purpose processors, a digital signal processor (digital signal processor, DSP), ASIC, FPGA, graphics processing unit (graphics processing unit, GPU) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor can be a microprocessor or any conventional processor.
存储器202可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data date SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。Memory 202 can be volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. Among them, the non-volatile memory can be read-only memory (read-only memory, ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically programmable Erases programmable read-only memory (electrically EPROM, EEPROM) or flash memory. Volatile memory can be random access memory (RAM), which acts as external cache memory. By way of illustration and not limitation, many forms of RAM are available such as static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data date SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (synchlink DRAM, SLDRAM ) and direct memory bus random access memory (direct rambus RAM, DR RAM).
网络接口203可以为多个,且网络接口203用于实现与其他设备之间的通信连接(可以是有线或者无线)。其中,在本申请实施例中,网络接口203用于收发报文。其中,其他设备可以是终端、服务器、VM等设备或其它网络设备。There may be multiple network interfaces 203, and the network interfaces 203 are used to implement communication connections with other devices (which may be wired or wireless). Wherein, in the embodiment of the present application, the network interface 203 is used to send and receive messages. Wherein, other devices may be devices such as terminals, servers, VMs, or other network devices.
总线204用于连接处理器201、存储器202和网络接口203。并且,总线204除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都标为总线204。The bus 204 is used to connect the processor 201 , the memory 202 and the network interface 203 . Moreover, the bus 204 may include a power bus, a control bus, a status signal bus, etc. in addition to a data bus. However, for clarity of illustration, the various buses are labeled as bus 204 in the figure.
图9是本申请实施例提供的又一种网络设备的结构示意图。该网络设备可以应用于如图1或图2所示的流统计系统,且可以用于实现上述方法实施例提供的流统计方法。如图9所示,该网络设备包括:主控板301和至少一个接口板(接口板也称为线卡或业务板),例如图9中示出了接口板302和接口板303。多个接口板的情况下网络设备还可以包括交换网板304,该交换网板304用于完成各接口板之间的数据交换。FIG. 9 is a schematic structural diagram of another network device provided by an embodiment of the present application. The network device can be applied to the flow statistics system shown in FIG. 1 or FIG. 2 , and can be used to implement the flow statistics method provided in the foregoing method embodiments. As shown in FIG. 9 , the network device includes: a main control board 301 and at least one interface board (an interface board is also called a line card or a service board), for example, an interface board 302 and an interface board 303 are shown in FIG. 9 . In the case of multiple interface boards, the network device may further include a switching fabric board 304, and the switching fabric board 304 is used to complete data exchange between the interface boards.
其中,主控板301也称为主处理单元(main processing unit,MPU)或路由处理卡(route processor card),主控板301用于完成系统管理、设备维护和协议处理等功能。主控板301上主要有3类功能单元:系统管理控制单元、系统时钟单元和系统维护单元。主控板301包括:中央处理器3011和存储器3012。Wherein, the main control board 301 is also called a main processing unit (main processing unit, MPU) or a route processing card (route processor card), and the main control board 301 is used to complete functions such as system management, equipment maintenance, and protocol processing. There are mainly three types of functional units on the main control board 301: a system management control unit, a system clock unit and a system maintenance unit. The main control board 301 includes: a CPU 3011 and a memory 3012 .
接口板302和303也称为线路接口单元卡(line processing unit,LPU)、线卡(line card)或业务板,接口板用于提供各种业务接口,并实现报文的转发。其中,接口板所提供的业务接口可以包括:基于SONET/SDH的数据包(packet over SONET/SDH,POS)接口、千兆以太网(gigabit Ethernet,GE)接口和异步传输模式(asynchronous transfer mode,ATM)接口等。 其中,SONET是指同步光纤网络(synchronous optical network),SDH是指同步数字体系(synchronous digital hierarchy)。主控板301、接口板302以及接口板303之间通过系统总线与系统背板相连以实现互通。如图9所示,接口板302上包括一个或多个中央处理器3021。中央处理器3021用于对接口板302进行控制管理并与主控板301上的中央处理器3011进行通信,以及接口板302。接口板302上的存储器3024用于存储转发表项,网络处理器3022可以通过查找存储器3024中存储的转发表项进行报文的转发。存储器3024还可以用于存储程序代码。The interface boards 302 and 303 are also called line interface unit cards (line processing unit, LPU), line cards (line card) or service boards, and the interface boards are used to provide various service interfaces and realize message forwarding. Wherein, the service interfaces provided by the interface board may include: SONET/SDH-based packet (packet over SONET/SDH, POS) interface, Gigabit Ethernet (gigabit Ethernet, GE) interface and asynchronous transfer mode (asynchronous transfer mode, ATM) interface, etc. Among them, SONET refers to synchronous optical network (synchronous optical network), and SDH refers to synchronous digital hierarchy (synchronous digital hierarchy). The main control board 301 , the interface board 302 and the interface board 303 are connected to the system backplane through a system bus to realize intercommunication. As shown in FIG. 9 , the interface board 302 includes one or more central processing units 3021 . The central processing unit 3021 is used to control and manage the interface board 302 and communicate with the central processing unit 3011 on the main control board 301 and the interface board 302 . The memory 3024 on the interface board 302 is used to store forwarding entries, and the network processor 3022 can forward packets by looking up the forwarding entries stored in the memory 3024 . Memory 3024 can also be used to store program codes.
该接口板302还包括一个或多个物理接口卡3023,该一个或多个物理接口卡3023用于接收上一跳节点发送的报文,并根据中央处理器3021的指示向下一跳节点发送处理后的报文。The interface board 302 also includes one or more physical interface cards 3023, the one or more physical interface cards 3023 are used to receive the message sent by the previous hop node, and send the message to the next hop node according to the instructions of the central processing unit 3021 processed message.
此外,可以理解的是,图9中的接口板302中的中央处理器3021和/或网络处理器3022可以是专用硬件或芯片,如可以采用ASIC来实现上述功能,这种实现方式即为通常所说的转发面采用专用硬件或芯片处理的方式。在另外的实施方式中,所述中央处理器3021和/或网络处理器3022也可以采用通用的处理器,如通用的CPU来实现以上描述的功能。In addition, it can be understood that the central processing unit 3021 and/or network processor 3022 in the interface board 302 in FIG. The forwarding plane is processed by dedicated hardware or chips. In another implementation manner, the central processing unit 3021 and/or the network processor 3022 may also use a general-purpose processor, such as a general-purpose CPU, to implement the functions described above.
此外应理解的是,主控板301可能有一块或多块,有多块的时候可以包括主用主控板和备用主控板。接口板可能有一块或多块,该网络设备的数据处理能力越强,提供的接口板越多。如图9所示,网络设备包括接口板302和接口板303。当采用分布式的转发机制时,接口板303的结构与接口板302的结构基本相同,且接口板303上的操作与接口板302的操作基本相似,为了简洁,不再赘述。网络设备具有多块接口板的情况下,该多块接口板之间可以通过一块或多块交换网板304通信,且可以实现负荷分担和冗余备份,以提供大容量的数据交换和处理能力。In addition, it should be understood that there may be one or more main control boards 301, and when there are multiple main control boards, it may include an active main control board and a standby main control board. There may be one or more interface boards. The stronger the data processing capability of the network device, the more interface boards it provides. As shown in FIG. 9 , the network device includes an interface board 302 and an interface board 303 . When the distributed forwarding mechanism is adopted, the structure of the interface board 303 is basically the same as that of the interface board 302 , and the operations on the interface board 303 are basically similar to those of the interface board 302 , which are not repeated for brevity. When the network device has multiple interface boards, the multiple interface boards can communicate through one or more switching fabric boards 304, and can realize load sharing and redundant backup to provide large-capacity data exchange and processing capabilities .
在集中式转发架构下,该网络设备可以不需要交换网板304,接口板承担整个系统的业务数据的处理功能。所以,分布式架构的网络设备的数据接入和处理能力要大于集中式架构的网络设备。具体采用哪种架构,取决于具体的组网部署场景,此处不做任何限定。Under the centralized forwarding architecture, the network device may not need the switching fabric board 304, and the interface board undertakes the processing function of the service data of the whole system. Therefore, the data access and processing capabilities of network devices with a distributed architecture are greater than those with a centralized architecture. Which architecture to use depends on the specific networking deployment scenario, and there is no limitation here.
在本申请实施例中,存储器3012和存储器3024可以是ROM或可存储静态信息和指令的其它类型的静态存储设备,也可以是RAM或者可存储信息和指令的其它类型的动态存储设备,还可以是EEPROM、只读光盘(compact disc read-only Memory,CD-ROM)或其它光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘或者其它磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其它介质,但不限于此。接口板302中的存储器3024可以是独立存在,并通过通信总线与中央处理器3021相连接;或者,存储器3024也可以和中央处理器3021集成在一起。主控板301中的存储器3012可以是独立存在,并通过通信总线与中央处理器3011相连接;或者,存储器3012也可以和中央处理器3011集成在一起。In this embodiment of the application, the memory 3012 and the memory 3024 can be ROM or other types of static storage devices that can store static information and instructions, or RAM or other types of dynamic storage devices that can store information and instructions, or Is EEPROM, compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), magnetic disk or other magnetic storage devices , or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory 3024 in the interface board 302 may exist independently and be connected to the central processing unit 3021 through a communication bus; or, the memory 3024 may also be integrated with the central processing unit 3021 . The memory 3012 in the main control board 301 can exist independently and be connected with the central processing unit 3011 through a communication bus; or, the memory 3012 can also be integrated with the central processing unit 3011 .
存储器3024中存储的程序代码,由中央处理器3021来控制执行,存储器3012存储的程序代码,由中央处理器3011来控制执行。该中央处理器3021和/或中央处理器3011可以通过执行程序代码来实现上述实施例所提供的流统计方法。存储器3024和/或存储器3012存储的程序代码中可以包括一个或多个软件单元。这一个或多个软件单元可以为图7所示实施例中的功能单元。例如,图7中的获取单元011、处理单元012和更新单元013均可以部署在转发板302中,统计单元014和输出单元015则可以部署于主控板301中。The program codes stored in the memory 3024 are executed under the control of the CPU 3021 , and the program codes stored in the memory 3012 are executed under the control of the CPU 3011 . The central processing unit 3021 and/or the central processing unit 3011 may implement the flow statistics method provided in the foregoing embodiments by executing program codes. One or more software units may be included in the program code stored in memory 3024 and/or memory 3012 . The one or more software units may be functional units in the embodiment shown in FIG. 7 . For example, the acquisition unit 011 , processing unit 012 and update unit 013 in FIG. 7 can all be deployed in the forwarding board 302 , and the statistics unit 014 and output unit 015 can be deployed in the main control board 301 .
在本申请实施例中,该物理接口卡3023,可以是使用任何收发器一类的装置,用于与其它设备或通信网络通信,如以太网,无线接入网(radio access network,RAN),无线局域网(wireless local area networks,WLAN)等。In the embodiment of the present application, the physical interface card 3023 may use any device such as a transceiver for communicating with other devices or communication networks, such as Ethernet, radio access network (radio access network, RAN), Wireless local area networks (wireless local area networks, WLAN), etc.
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当该指令被处理器执行时,可以实现上述方法实施例提供的流统计方法。The embodiment of the present application also provides a computer-readable storage medium, where an instruction is stored in the computer-readable storage medium, and when the instruction is executed by a processor, the flow statistics method provided by the foregoing method embodiment can be implemented.
本申请实施例还提供了一种包含指令的计算机程序产品,当该计算机程序产品中的指令被处理器执行时,可以实现上述方法实施例提供的流统计方法。The embodiment of the present application also provides a computer program product containing instructions. When the instructions in the computer program product are executed by a processor, the flow statistics method provided by the above method embodiment can be implemented.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by hardware, and can also be completed by instructing related hardware through a program. The program can be stored in a computer-readable storage medium. The above-mentioned The storage medium mentioned may be a read-only memory, a magnetic disk or an optical disk, and the like.
在本申请实施例中,术语“第一”、“第二”和“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性。In the embodiments of the present application, the terms "first", "second" and "third" are used for description purposes only, and cannot be understood as indicating or implying relative importance.
本申请中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。The term "and/or" in this application is only an association relationship describing associated objects, which means that there may be three relationships, for example, A and/or B, which can mean: A exists alone, A and B exist simultaneously, and A and B exist alone. There are three cases of B. In addition, the character "/" in this article generally indicates that the contextual objects are an "or" relationship.
以上所述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的构思和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above are only optional embodiments of the application, and are not intended to limit the application. Any modifications, equivalent replacements, improvements, etc. made within the concept and principles of the application shall be included in the protection of the application. within range.

Claims (26)

  1. 一种流统计方法,其特征在于,应用于网络设备,所述方法包括:A flow statistics method, characterized in that it is applied to a network device, the method comprising:
    获取目标报文;Get the target message;
    根据所述目标报文所属数据流的目标流标识获取目标流索引;Obtaining a target flow index according to the target flow identifier of the data flow to which the target packet belongs;
    根据所述目标流标识获取目标地址索引,所述目标地址索引用于指示所述网络设备的存储空间中的一个存储区域,所述存储区域包括多个存储单元,每个存储单元用于存储一个流索引,以及所述流索引指示的数据流的报文计数值;Obtain a target address index according to the target flow identifier, where the target address index is used to indicate a storage area in the storage space of the network device, where the storage area includes a plurality of storage units, and each storage unit is used to store a A flow index, and a packet count value of the data flow indicated by the flow index;
    根据所述目标流索引更新所述多个存储单元中第一存储单元中的流索引和/或报文计数值;updating the flow index and/or packet count value in the first storage unit among the plurality of storage units according to the target flow index;
    基于更新后的所述第一存储单元中的报文计数值,统计所述目标报文所属数据流的流量。Based on the updated packet count value in the first storage unit, count the traffic of the data flow to which the target packet belongs.
  2. 根据权利要求1所述的流统计方法,其特征在于,The flow statistics method according to claim 1, wherein,
    所述根据所述目标报文所属数据流的目标流标识获取目标流索引包括:将所述目标流标识作为所述目标流索引,或,通过第一映射函数处理所述目标流标识得到目标流索引;The acquiring the target flow index according to the target flow identifier of the data flow to which the target message belongs includes: using the target flow identifier as the target flow index, or processing the target flow identifier through a first mapping function to obtain the target flow index;
    所述根据所述目标流标识获取目标地址索引包括:通过第二映射函数处理所述目标流标识得到目标地址索引。The acquiring the target address index according to the target flow identifier includes: processing the target flow identifier through a second mapping function to obtain the target address index.
  3. 根据权利要求1或2所述的方法,其特征在于,所述根据所述目标流索引更新所述多个存储单元中第一存储单元中的流索引和/或报文计数值,包括以下任意一种:The method according to claim 1 or 2, wherein the updating the flow index and/or packet count value in the first storage unit among the plurality of storage units according to the target flow index includes any of the following A sort of:
    若所述多个存储单元中的第一存储单元中存储有所述目标流索引,则将所述第一存储单元中的报文计数值增加第一预设值;If the target stream index is stored in the first storage unit among the plurality of storage units, increasing the packet count value in the first storage unit by a first preset value;
    若所述多个存储单元中不存在已存储有所述目标流索引的存储单元,则在所述多个存储单元中的一个空闲存储单元中存储所述目标流索引和初始报文计数值,所述空闲存储单元为所述第一存储单元,所述空闲存储单元是指未存储流索引和报文计数值的存储单元;If there is no storage unit that has stored the target flow index in the plurality of storage units, storing the target flow index and the initial packet count value in a free storage unit among the plurality of storage units, The free storage unit is the first storage unit, and the free storage unit refers to a storage unit that does not store flow indexes and message count values;
    若所述多个存储单元中不存在已存储有所述目标流索引的存储单元,且不存在空闲存储单元,则将所述多个存储单元中报文计数值为初始值的一个存储单元中的流索引更新为所述目标流索引,所述报文计数值为初始值的存储单元为所述第一存储单元。If there is no storage unit in which the target flow index has been stored in the plurality of storage units, and there is no free storage unit, store the message count value in the plurality of storage units in a storage unit with an initial value The flow index of is updated to the target flow index, and the storage unit whose packet count value is an initial value is the first storage unit.
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:The method according to claim 3, characterized in that the method further comprises:
    若所述多个存储单元中不存在已存储有所述目标流索引的存储单元,且每个存储单元中的报文计数值均大于初始报文计数值,则将所述多个存储单元中报文计数值最少的存储单元中的报文计数值减少第一预设值。If there is no storage unit that has stored the target flow index in the plurality of storage units, and the packet count value in each storage unit is greater than the initial packet count value, then in the plurality of storage units The message count value in the storage unit with the smallest message count value is reduced by a first preset value.
  5. 根据权利要求1至4任一所述的方法,其特征在于,所述基于更新后的所述第一存储单元中的报文计数值,统计所述目标报文所属数据流的流量,包括:The method according to any one of claims 1 to 4, wherein the counting the traffic of the data flow to which the target message belongs based on the updated message count value in the first storage unit includes:
    若更新后的所述第一存储单元中的报文计数值满足统计条件,则将所述目标流标识上报至控制设备,以供所述控制设备将所述目标流标识指示的数据流的流量统计值增加第二预设值;或者,If the updated packet count value in the first storage unit satisfies the statistical condition, report the target flow identifier to the control device, so that the control device can report the flow rate of the data flow indicated by the target flow identifier the statistical value is incremented by a second preset value; or,
    若更新后的所述第一存储单元中的报文计数值满足统计条件,则将所述目标流标识指示的数据流的流量统计值增加第二预设值。If the updated packet count value in the first storage unit satisfies the statistical condition, the traffic statistical value of the data flow indicated by the target flow identifier is increased by a second preset value.
  6. 根据权利要求5所述的方法,其特征在于,所述统计条件包括:报文计数值为统计阈值的整数倍,所述统计阈值为大于1的整数。The method according to claim 5, wherein the statistical condition includes: the packet count value is an integer multiple of a statistical threshold, and the statistical threshold is an integer greater than 1.
  7. 根据权利要求5或6所述的方法,其特征在于,所述方法还包括:The method according to claim 5 or 6, wherein the method further comprises:
    输出流量统计值最高的前K个数据流的流标识;或者,Output the stream IDs of the top K data streams with the highest traffic statistics; or,
    输出流量统计值在设定时段内的变化量最高的前K个数据流的流标识;Output the stream identifiers of the top K data streams with the highest change in traffic statistics within a set period of time;
    K为大于或等于1的整数。K is an integer greater than or equal to 1.
  8. 根据权利要求1至7任一所述的方法,其特征在于,所述第二映射函数包括第一子映射函数和第二子映射函数;The method according to any one of claims 1 to 7, wherein the second mapping function comprises a first sub-mapping function and a second sub-mapping function;
    所述通过第二映射函数处理所述目标流标识进行映射得到目标地址索引,包括:The step of processing the target flow identifier through the second mapping function to map to obtain the target address index includes:
    通过所述第一子映射函数处理所述目标流标识得到第一子索引;Processing the target flow identifier through the first sub-mapping function to obtain a first sub-index;
    通过所述第二子映射函数处理所述目标流标识第二子索引,所述目标地址索引包括所述第一子索引和所述第二子索引;processing the target flow identification second sub-index by the second sub-mapping function, the target address index includes the first sub-index and the second sub-index;
    所述存储区域包括:所述第一子索引指示的第一子存储区域,以及所述第二子索引指示的第二子存储区域,所述多个存储单元包括所述第一子存储区域和所述第二子存储区域对应的存储单元。The storage area includes: a first sub-storage area indicated by the first sub-index, and a second sub-storage area indicated by the second sub-index, and the plurality of storage units include the first sub-storage area and the second sub-storage area A storage unit corresponding to the second sub-storage area.
  9. 根据权利要求1至8任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 8, wherein the method further comprises:
    若所述多个存储单元中的第二存储单元中的流索引和报文计数值超过设定时长未更新,则将所述第二存储单元中存储的流索引和报文计数值删除。If the flow index and the packet count value in the second storage unit among the plurality of storage units have not been updated beyond a set period of time, then delete the flow index and packet count value stored in the second storage unit.
  10. 根据权利要求1至9任一所述的方法,其特征在于,The method according to any one of claims 1 to 9, characterized in that,
    所述目标报文为所述网络设备接收到的任一报文,或者所述目标报文为所述网络设备待丢弃的报文。The target message is any message received by the network device, or the target message is a message to be discarded by the network device.
  11. 一种网络设备,其特征在于,所述网络设备包括:A network device, characterized in that the network device includes:
    获取单元,用于获取目标报文;an acquisition unit, configured to acquire the target message;
    处理单元,用于根据所述目标报文所属数据流的目标流标识获取目标流索引,以及,根据所述目标流标识获取目标地址索引,所述目标地址索引用于指示所述网络设备的存储空间中的一个存储区域,所述存储区域包括多个存储单元,每个存储单元用于存储一个流索引,以及所述流索引指示的数据流的报文计数值;A processing unit, configured to obtain a target flow index according to the target flow identifier of the data flow to which the target packet belongs, and obtain a target address index according to the target flow identifier, where the target address index is used to indicate the storage of the network device A storage area in the space, the storage area includes a plurality of storage units, each storage unit is used to store a flow index, and a packet count value of the data flow indicated by the flow index;
    更新单元,用于根据所述目标流索引更新所述多个存储单元中第一存储单元中的流索引和/或报文计数值;An updating unit, configured to update the flow index and/or packet count value in the first storage unit among the plurality of storage units according to the target flow index;
    统计单元,用于基于更新后的所述第一存储单元中的报文计数值,统计所述目标报文所属数据流的流量。A statistical unit, configured to count the traffic of the data flow to which the target message belongs based on the updated message count value in the first storage unit.
  12. 根据权利要求11所述的网络设备,其特征在于,The network device according to claim 11, characterized in that,
    当根据所述目标报文所属数据流的目标流标识获取目标流索引时,所述处理单元用于: 将所述目标流标识作为所述目标流索引,或,通过第一映射函数处理所述目标流标识得到目标流索引;When obtaining the target flow index according to the target flow identifier of the data flow to which the target packet belongs, the processing unit is configured to: use the target flow identifier as the target flow index, or process the The target flow identifier is obtained by the target flow index;
    当根据所述目标流标识获取目标地址索引时,所述处理单元用于:通过第二映射函数处理所述目标流标识得到目标地址索引。When obtaining the target address index according to the target flow identifier, the processing unit is configured to: process the target flow identifier through a second mapping function to obtain the target address index.
  13. 根据权利要求11或12所述的网络设备,其特征在于,所述更新单元,用于:The network device according to claim 11 or 12, wherein the updating unit is configured to:
    若所述多个存储单元中的第一存储单元中存储有所述目标流索引,则将所述第一存储单元中的报文计数值增加第一预设值;If the target stream index is stored in the first storage unit among the plurality of storage units, increasing the packet count value in the first storage unit by a first preset value;
    若所述多个存储单元中不存在已存储有所述目标流索引的存储单元,则在所述多个存储单元中的一个空闲存储单元中存储所述目标流索引和初始报文计数值,所述空闲存储单元为所述第一存储单元,所述空闲存储单元是指未存储流索引和报文计数值的存储单元;If there is no storage unit that has stored the target flow index in the plurality of storage units, storing the target flow index and the initial packet count value in a free storage unit among the plurality of storage units, The free storage unit is the first storage unit, and the free storage unit refers to a storage unit that does not store flow indexes and message count values;
    若所述多个存储单元中不存在已存储有所述目标流索引的存储单元,且不存在空闲存储单元,则将所述多个存储单元中报文计数值为初始值的一个存储单元中的流索引更新为所述目标流索引,所述报文计数值为初始值的存储单元为所述第一存储单元。If there is no storage unit in which the target flow index has been stored in the plurality of storage units, and there is no free storage unit, store the message count value in the plurality of storage units in a storage unit with an initial value The flow index of is updated to the target flow index, and the storage unit whose packet count value is an initial value is the first storage unit.
  14. 根据权利要求13所述的网络设备,其特征在于,所述更新单元,还用于:The network device according to claim 13, wherein the updating unit is further configured to:
    若所述多个存储单元中不存在已存储有所述目标流索引的存储单元,且每个存储单元中的报文计数值均大于初始报文计数值,则将所述多个存储单元中报文计数值最少的存储单元中的报文计数值减少第一预设值。If there is no storage unit that has stored the target flow index in the plurality of storage units, and the packet count value in each storage unit is greater than the initial packet count value, then in the plurality of storage units The message count value in the storage unit with the smallest message count value is reduced by a first preset value.
  15. 根据权利要求11至14任一所述的网络设备,其特征在于,所述统计单元,用于:The network device according to any one of claims 11 to 14, wherein the statistical unit is configured to:
    若更新后的所述第一存储单元中的报文计数值满足统计条件,则将所述目标流标识上报至控制设备,以供所述控制设备将所述目标流标识指示的数据流的流量统计值增加第二预设值;或者,If the updated packet count value in the first storage unit satisfies the statistical condition, report the target flow identifier to the control device, so that the control device can report the flow rate of the data flow indicated by the target flow identifier the statistical value is incremented by a second preset value; or,
    若更新后的所述第一存储单元中的报文计数值满足统计条件,则将所述目标流标识指示的数据流的流量统计值增加第二预设值。If the updated packet count value in the first storage unit satisfies the statistical condition, the traffic statistical value of the data flow indicated by the target flow identifier is increased by a second preset value.
  16. 根据权利要求15所述的网络设备,其特征在于,所述统计条件包括:报文计数值为统计阈值的整数倍,所述统计阈值为大于1的整数。The network device according to claim 15, wherein the statistical condition includes: the packet count value is an integer multiple of a statistical threshold, and the statistical threshold is an integer greater than 1.
  17. 根据权利要求15或16所述的网络设备,其特征在于,所述网络设备还包括输出单元,所述输出单元用于:The network device according to claim 15 or 16, wherein the network device further comprises an output unit, the output unit is used for:
    输出流量统计值最高的前K个数据流的流标识;或者,Output the stream IDs of the top K data streams with the highest traffic statistics; or,
    输出流量统计值在设定时段内的变化量最高的前K个数据流的流标识;Output the stream identifiers of the top K data streams with the highest change in traffic statistics within a set period of time;
    K为大于或等于1的整数。K is an integer greater than or equal to 1.
  18. 根据权利要求11至17任一所述的网络设备,其特征在于,所述第二映射函数包括第一子映射函数和第二子映射函数;所述处理单元,用于:The network device according to any one of claims 11 to 17, wherein the second mapping function includes a first sub-mapping function and a second sub-mapping function; the processing unit is configured to:
    通过所述第一子映射函数处理所述目标流标识得到第一子索引;Processing the target flow identifier through the first sub-mapping function to obtain a first sub-index;
    通过所述第二子映射函数处理所述目标流标识第二子索引,所述目标地址索引包括所述 第一子索引和所述第二子索引;processing the target flow identifier through the second sub-mapping function to identify a second sub-index, the target address index including the first sub-index and the second sub-index;
    所述存储区域包括:所述第一子索引指示的第一子存储区域,以及所述第二子索引指示的第二子存储区域,所述多个存储单元包括所述第一子存储区域和所述第二子存储区域对应的存储单元。The storage area includes: a first sub-storage area indicated by the first sub-index, and a second sub-storage area indicated by the second sub-index, and the plurality of storage units include the first sub-storage area and the second sub-storage area A storage unit corresponding to the second sub-storage area.
  19. 根据权利要求11至18任一所述的网络设备,其特征在于,所述更新单元,还用于:The network device according to any one of claims 11 to 18, wherein the updating unit is further configured to:
    若所述多个存储单元中的第二存储单元中的流索引和报文计数值超过设定时长未更新,则将所述第二存储单元中存储的流索引和报文计数值删除。If the flow index and the packet count value in the second storage unit among the plurality of storage units have not been updated beyond a set period of time, then delete the flow index and packet count value stored in the second storage unit.
  20. 根据权利要求11至19任一所述的网络设备,其特征在于,The network device according to any one of claims 11 to 19, characterized in that,
    所述目标报文为所述网络设备接收到的任一报文,或者所述目标报文为所述网络设备待丢弃的报文。The target message is any message received by the network device, or the target message is a message to be discarded by the network device.
  21. 一种流统计系统,其特征在于,所述流统计系统包括:如权利要求11-20任一所述的网络设备,和控制设备;A flow statistics system, characterized in that the flow statistics system comprises: the network device according to any one of claims 11-20, and a control device;
    所述网络设备,用于基于更新后的第一存储单元中的报文计数值,向控制设备上报目标流标识;The network device is configured to report the target flow identifier to the control device based on the updated message count value in the first storage unit;
    所述控制设备,用于基于接收到的所述目标流标识,统计所述目标流标识指示的数据流的流量。The control device is configured to, based on the received target flow identifier, collect statistics on the traffic of the data flow indicated by the target flow identifier.
  22. 根据权利要求21所述的流统计系统,其特征在于,The flow statistics system according to claim 21, wherein,
    所述网络设备,用于若更新后的所述第一存储单元中的报文计数值满足统计条件,则将所述目标流标识上报至所述控制设备;The network device is configured to report the target flow identifier to the control device if the updated packet count value in the first storage unit satisfies a statistical condition;
    所述控制设备,用于将所述目标流标识指示的数据流的流量统计值增加第二预设值。The control device is configured to increase the traffic statistics value of the data flow indicated by the target flow identifier by a second preset value.
  23. 根据权利要求21或22所述的流统计系统,其特征在于,所述控制设备还用于:The flow statistics system according to claim 21 or 22, wherein the control device is further used for:
    输出流量统计值最高的前K个数据流的流标识;或者,Output the stream IDs of the top K data streams with the highest traffic statistics; or,
    输出流量统计值在设定时段内的变化量最高的前K个数据流的流标识;Output the stream identifiers of the top K data streams with the highest change in traffic statistics within a set period of time;
    K为大于或等于1的整数。K is an integer greater than or equal to 1.
  24. 根据权利要求21-23中任意一项所述的流统计系统,其特征在于,所述网络设备为第一芯片,所述控制设备为第二芯片。The flow statistics system according to any one of claims 21-23, wherein the network device is a first chip, and the control device is a second chip.
  25. 一种网络设备,其特征在于,所述网络设备包括:存储器,处理器及存储在所述存储器上并能够在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如权利要求1至10任一所述的方法。A network device, characterized in that the network device includes: a memory, a processor, and a computer program stored on the memory and capable of running on the processor, and the processor implements the computer program when executing the computer program The method according to any one of claims 1 to 10.
  26. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有指令,当所述指令被处理器执行时,实现如权利要求1至10任一所述的方法。A computer-readable storage medium, characterized in that instructions are stored in the computer-readable storage medium, and when the instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.
PCT/CN2023/070981 2022-01-12 2023-01-06 Method for flow statistics, device, and system WO2023134574A1 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN202210029639 2022-01-12
CN202210029639.7 2022-01-12
CN202210195673.1A CN116471194A (en) 2022-01-12 2022-03-01 Stream statistics method, device and system
CN202210195673.1 2022-03-01

Publications (1)

Publication Number Publication Date
WO2023134574A1 true WO2023134574A1 (en) 2023-07-20

Family

ID=87174073

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/070981 WO2023134574A1 (en) 2022-01-12 2023-01-06 Method for flow statistics, device, and system

Country Status (2)

Country Link
CN (1) CN116471194A (en)
WO (1) WO2023134574A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117393013A (en) * 2023-12-09 2024-01-12 深圳星云智联科技有限公司 Efficient DDR control method and related device in statistical application

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003143226A (en) * 2001-10-30 2003-05-16 Ando Electric Co Ltd Probe apparatus for ip network and traffic statistic method
CN102833134A (en) * 2012-09-04 2012-12-19 中国人民解放军理工大学 Workload adaptation method for measuring flow of network data stream
US20130294249A1 (en) * 2012-04-23 2013-11-07 Huawei Technologies Co., Ltd. Method, apparatus, and system for flow measurement
CN108521351A (en) * 2018-03-21 2018-09-11 东软集团股份有限公司 Session traffic statistical method, processor core, storage medium, electronic equipment
US20190036794A1 (en) * 2016-03-29 2019-01-31 Huawei Technologies Co., Ltd. Control Method, Apparatus, and System for Collecting Traffic Statistics
CN112968784A (en) * 2021-01-29 2021-06-15 新华三信息安全技术有限公司 Flow charging method and device
CN113746692A (en) * 2021-07-21 2021-12-03 网宿科技股份有限公司 Network flow statistical method, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003143226A (en) * 2001-10-30 2003-05-16 Ando Electric Co Ltd Probe apparatus for ip network and traffic statistic method
US20130294249A1 (en) * 2012-04-23 2013-11-07 Huawei Technologies Co., Ltd. Method, apparatus, and system for flow measurement
CN102833134A (en) * 2012-09-04 2012-12-19 中国人民解放军理工大学 Workload adaptation method for measuring flow of network data stream
US20190036794A1 (en) * 2016-03-29 2019-01-31 Huawei Technologies Co., Ltd. Control Method, Apparatus, and System for Collecting Traffic Statistics
CN108521351A (en) * 2018-03-21 2018-09-11 东软集团股份有限公司 Session traffic statistical method, processor core, storage medium, electronic equipment
CN112968784A (en) * 2021-01-29 2021-06-15 新华三信息安全技术有限公司 Flow charging method and device
CN113746692A (en) * 2021-07-21 2021-12-03 网宿科技股份有限公司 Network flow statistical method, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117393013A (en) * 2023-12-09 2024-01-12 深圳星云智联科技有限公司 Efficient DDR control method and related device in statistical application
CN117393013B (en) * 2023-12-09 2024-04-09 深圳星云智联科技有限公司 Efficient DDR control method and related device in statistical application

Also Published As

Publication number Publication date
CN116471194A (en) 2023-07-21

Similar Documents

Publication Publication Date Title
JP7039685B2 (en) Traffic measurement methods, devices, and systems
US10541946B1 (en) Programmable visibility engines
CN111771358B (en) Packet programmable state set
JP3734704B2 (en) Packet classification engine
US8797869B2 (en) Flow-based rate limiting
CN113328902B (en) Network performance detection method and device and network equipment
US20220303217A1 (en) Data Forwarding Method, Data Buffering Method, Apparatus, and Related Device
US20050276230A1 (en) Communication statistic information collection apparatus
EP4024778A1 (en) Method for determining required bandwidth for data stream transmission, and devices and system
US10924374B2 (en) Telemetry event aggregation
US11165716B2 (en) Data flow processing method and device
EP4024146A1 (en) Method and apparatus for controlling data transmission, and storage medium
US9444756B2 (en) Path aggregation group monitor
US11050649B2 (en) Delay measurement method of network node device, apparatus, and network node device
WO2023134574A1 (en) Method for flow statistics, device, and system
WO2021244247A1 (en) Data message forwarding method, network node, system, and storage medium
US11218411B2 (en) Flow monitoring in network devices
US20230155947A1 (en) Method for identifying flow, and apparatus
CN115242892B (en) Stream identifier acquisition method, device, equipment and medium
WO2022152230A1 (en) Information flow identification method, network chip, and network device
CN114157595B (en) Communication system, data processing method and related equipment
CN113595809A (en) Flow monitoring method, related equipment and system
CN111614471B (en) DCQCN data transmission system and transmission method based on SDN
EP4429212A1 (en) Service processing method, apparatus, and system
CN118250229A (en) Method and device for reporting service flow information, storage medium and electronic device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23739917

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE