WO2017041509A1 - Packet sampling method and device based on multiple processing units - Google Patents
Packet sampling method and device based on multiple processing units Download PDFInfo
- Publication number
- WO2017041509A1 WO2017041509A1 PCT/CN2016/082356 CN2016082356W WO2017041509A1 WO 2017041509 A1 WO2017041509 A1 WO 2017041509A1 CN 2016082356 W CN2016082356 W CN 2016082356W WO 2017041509 A1 WO2017041509 A1 WO 2017041509A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- key
- processing unit
- processing
- sampling
- sampled
- Prior art date
Links
Images
Definitions
- This document relates to, but is not limited to, the field of communications, and relates to a message sampling method and apparatus based on multiple processing units.
- IP Internet Protocol layer packet sampling
- IPFLOW IP (Internet Protocol) layer packet sampling
- the processing unit is developed from a single to multiple processing units, and the processing units form a shared processing relationship.
- the current practice is to use a single sharing algorithm to share the processed traffic to each processing unit, but the IPFLOW-related collection is divided into key segments and non-key segments, which will make the same processor perform the key.
- the collection of fields will collect non-key fields, and the corresponding aggregation stream will also be formed for non-keywords, which will increase the processing capacity of the processing unit, reduce the processing efficiency of the processing unit, and result in the processing efficiency loss of the processing unit. .
- the embodiment of the invention provides a packet sampling method and device based on multiple processing units, which solves the problem of processing efficiency loss in the multi-processing unit sharing processing.
- An embodiment of the present invention provides a packet sampling method based on multiple processing units, including:
- the to-be-sampled message is allocated to the key processing unit for packet sampling processing.
- the key field includes at least one of a source address, a destination address, a source port number, a destination port number, a protocol type, a service type, and an incoming logical interface identifier.
- the allocating the to-be-sampling message to the key processing unit for packet sampling processing includes:
- All the packets to be sampled with the same key segment to be extracted are allocated to the same key processing unit for packet sampling processing;
- the packets to be sampled that have the key segment to be extracted are equally distributed to each key processing unit for packet sampling processing.
- the allocating the to-be-sampled message with the same key segment to be extracted to the same key processing unit for performing the packet sampling process includes: when the number of the key segments is less than or equal to the number of the key processing units A key processing unit is selected for each key field, and the to-be-sampling message corresponding to each key field is allocated to the key processing unit corresponding to the key field to perform packet sampling processing.
- the allocating the to-be-sampling message with the same key segment to be extracted to the same key processing unit for the packet sampling process includes: when the number of the key segment is greater than the number of the key processing unit, The packets to be sampled corresponding to the multiple key fields are allocated to the same key processing unit for packet sampling processing.
- the key processing unit includes a multi-core; the allocating the to-be-sampled message corresponding to the multiple key segments to the same key processing unit for packet sampling processing includes:
- All the packets to be sampled with the same key segment to be extracted are allocated to the same kernel for packet sampling processing;
- the packets to be sampled that have the key segment to be extracted are equally distributed to each core for packet sampling processing.
- the method further includes: selecting at least one processing unit from the plurality of processing units as the non-critical processing unit; when it is determined that there is no at least one key segment to be extracted in the to-be-sampled message, there is no need
- the to-be-sampled message of the extracted key segment is allocated to the non-critical processing list
- the element performs packet sampling processing.
- the embodiment of the invention further provides a message sampling device based on a multi-processing unit, comprising a selection module, a determination module and a sampling module:
- the selection module is configured to select at least one processing unit from the plurality of processing units as a key processing unit;
- the determining module is configured to determine whether there is at least one key segment that needs to be extracted in the to-be-sampling message
- the sampling module is configured to allocate the to-be-sampling message to the key processing unit for packet sampling processing if there is at least one key segment that needs to be extracted in the to-be-sampled message.
- the sampling module is configured to: allocate the to-be-sampled message to the key processing unit to perform packet sampling processing:
- All the packets to be sampled with the same key segment to be extracted are allocated to the same key processing unit for packet sampling processing;
- the packets to be sampled that have the key segment to be extracted are equally distributed to each key processing unit for packet sampling processing.
- the sampling module is configured to allocate the to-be-sampled message with the same key segment to be extracted to the same key processing unit for packet sampling processing: when the number of keywords is less than or equal to the key processing For the number of cells, a key processing unit is selected for each key segment, and the packet to be sampled corresponding to each key segment is allocated to the key processing unit corresponding to the key segment for packet sampling processing.
- the sampling module is configured to allocate the to-be-sampled message with the same key segment to be extracted to the same key processing unit for packet sampling processing: when the number of keywords is greater than the key processing unit The number of samples to be sampled of the same key segment is allocated to the same key processing unit for packet sampling processing.
- the key processing unit includes a multi-core; the sampling module is configured to allocate a plurality of packets of the same key segment to be sampled to the same key processing unit for message collection.
- All the packets to be sampled with the same key segment to be extracted are allocated to the same kernel for packet sampling processing;
- the packets to be sampled that have the key segment to be extracted are equally distributed to each core for packet sampling processing.
- the selecting module is further configured to select at least one processing unit from the plurality of processing units as the non-critical processing unit;
- the sampling module is further configured to: when determining that there is no at least one key that needs to be extracted in the to-be-sampled message In the case of the field, the to-be-sampled message of the key segment that does not need to be extracted is allocated to the non-critical processing unit for packet sampling.
- the embodiment of the present invention further provides a computer readable storage medium, where the computer readable storage medium stores computer executable instructions, and when the computer executable instructions are executed, implements a multi-processing unit based message sampling method.
- the multi-processing unit-based message sampling method and apparatus provided by the embodiment of the present invention firstly select at least one processing unit from a plurality of processing units as a key processing unit; and then determine whether at least one of the to-be-sampled messages needs to be extracted. Key segment; Finally, if present, the message to be sampled is assigned to the key processing unit for packet sampling processing. Compared with the related art, before the packet sampling, the sampled message is judged. If there is a key field, the designated key processing unit performs sampling processing, so that the key processing unit can only target the keyword. The segment is sampled, and the non-key segment can be sampled, which can improve the processing efficiency of the key segment and avoid the problem of processing the non-key segment causing loss of processing efficiency of the key processing unit.
- FIG. 1 is a flowchart of a packet sampling method based on multiple processing units according to Embodiment 1 of the present invention
- FIG. 2 is a flowchart of a packet sampling method based on multiple processing units according to Embodiment 2 of the present invention
- FIG. 3 is a schematic structural diagram of a message sampling apparatus based on multiple processing units according to Embodiment 3 of the present invention; intention.
- the multi-processing unit-based packet sampling method of the embodiment of the present application is as shown in FIG. 1 , and the method includes:
- Step S101 selecting at least one processing unit from a plurality of processing units as a key processing unit;
- the message sampling process of the key segment is mainly performed in order to select a processing unit from a plurality of processing units. For example, if there are three processing units, then one of them can be selected as the key processing unit, or two of them can be selected as the key processing unit.
- Step S102 determining whether there is at least one key segment to be extracted in the to-be-sampling message
- a preliminary identification process is performed on each packet to be sampled to see whether there is a key segment to be extracted, where the key field refers to a field that requires special attention, and optionally, some identification fields. And may include at least one of a source address, a destination address, a source port number, a destination port number, a protocol type, a service type, and an incoming logical interface identifier. For example, 1000 packets are sampled, and the target address A and/or the source address B are used as key fields to determine whether there are target addresses A and/or source addresses B among the 1000 messages.
- Step S103 If there is at least one key segment to be extracted in the to-be-sampling message, the to-be-sampled message is allocated to the key processing unit for packet sampling processing.
- a message having at least one key field to be extracted is allocated to the above-mentioned designated key processing unit for processing.
- the key segments in the 4 to-be-sampling messages are the destination addresses A and 6.
- the key segment existing in the to-be-sampling message is the source address B, and then the 10 samples to be sampled are allocated to the key processing unit for packet sampling processing.
- the process of the message to be sampled to the key processing unit for the message sampling process includes: allocating the to-be-sampled message with the same key segment to be extracted to the same key processing unit for packet sampling processing; or The packets to be sampled that have the key segment to be extracted are equally distributed to each key processing unit for packet sampling processing.
- processing unit 1 there are three processing units, such as the processing unit 1, the processing unit 2, and the processing unit 3; two of the processing units are designated as key processing units, for example, the processing unit 1 and the processing unit 2 are defined as Key processing unit.
- the 10 samples to be sampled that need to be extracted are allocated to the two processing units for packet sampling processing.
- the processing unit 1 and the processing unit respectively process 5 to-be-sampled messages, or the processing unit 1 processes 4 packets, that is, the key that needs to be extracted is processed.
- the field is the to-be-sampling message of the target address A, and the processing unit 2 processes the six packets, that is, the message to be sampled with the key segment to be extracted as the source address B; or only one of the key processing units
- the packet sampling process is performed, that is, the processing unit 1 performs packet sampling processing on the 10 to-be-sampling messages, or the processing unit 2 performs packet sampling processing on the 10 to-be-sampled messages.
- the allocation method is not limited to the above, and other allocation methods can also be used.
- the above technical solution allows each of the key processing units to specifically process the packet sampling of a key segment, so that a single aggregated stream can be formed well without superimposing the subsequent aggregated streams.
- allocating the to-be-sampled message with the same key segment to be extracted to the same key processing unit for packet sampling processing includes: when the number of key segments is less than or equal to the number of key processing units, A key processing unit is selected for each key field, and the to-be-sampling message corresponding to each key field is allocated to the key processing unit corresponding to the key field to perform packet sampling processing. That is to say, when the number of key processing units is greater than or equal to the number of key fields, in order to improve the processing efficiency, and to eliminate the subsequent aggregation of the aggregation streams, each key processing unit performs a keyword separately. The processing of the stream of segments.
- the number of key processing units is two, and the number of key fields is two, that is, the number of key fields is equal to the number of key processing units.
- the processing unit 1 processes the to-be-sampled message with the key segment as the target address A, that is, the processing unit 1 processes the four to-be-sampling messages; the processing unit 2 processes the to-be-sampled message whose source segment is the source address B, that is, processes 6 Packet to be sampled.
- the processing unit 1 can separately form the target address A aggregation stream, and the processing unit 2 can be separately The source address B aggregation stream is formed, so that the superposition of the target address A aggregation stream and the superposition of the source address B aggregation stream can be avoided.
- allocating the to-be-sampled message with the same key segment to be extracted to the same key processing unit for packet sampling processing includes: when the number of key segments is greater than the number of key processing units, multiple The packets to be sampled in the key segment are allocated to the same key processing unit for packet sampling processing. That is to say, when the number of key processing units is less than the number of key fields, the key processing unit must bear the packet sampling processing corresponding to multiple key fields.
- the processing unit 1 can process the to-be-sampled message corresponding to the target address A and the to-be-sampled message corresponding to the target address C, that is, process 8 to-be-sampled messages; and the processing unit 2 processes the key segment as the source.
- the packet to be sampled at address B that is, the six packets to be sampled.
- the processing unit 1 processes four messages, that is, processes the message whose key field is the target address A, and the processing unit 2 processes 10 messages, that is, the message with the key segment being the source address B and the target address C.
- the allocation method can be flexibly allocated according to specific situations.
- the key processing unit includes a multi-core; and the plurality of the same key segment to be sampled to be allocated to the same key processing unit for packet sampling processing includes: there are keywords that need to be extracted
- the packets to be sampled in the same segment are allocated to the same core for packet sampling processing; or the packets to be sampled in the key segment that need to be extracted are evenly distributed to each core for packet sampling processing. That is, the packet sampling processing of each key segment is allocated to the lowest processing object, so that it is possible to quickly know who is doing what processing, so that it is possible to quickly and accurately know where the specific aggregation stream is in the later use.
- the processing unit 1 is a dual core. It is worth noting that the processing unit herein may be a processor. If the processing unit 1 processes 8 packets, that is, the processing target segment is the to-be-sampled message corresponding to the target address A and the to-be-sampled message corresponding to the target address C, then one of the cores can process the target address A corresponding to the sample to be sampled. In the message, another core processes the packet to be sampled corresponding to the destination address C. It should be noted that the allocation may be determined according to the specific situation.
- the multi-processing unit-based packet sampling method in this embodiment further includes: selecting at least one processing unit from the plurality of processing units as the non-critical processing unit; and determining that there is no extraction required in the to-be-sampled message.
- the to-be-sampled message of the key segment that does not need to be extracted is allocated to the non-critical processing unit for packet sampling processing. That is, the non-critical processing unit specified therein is exclusively used for the processing of the non-key field, and optionally, a processing unit can be specified to perform the processing of the non-key field, so that more processing units can perform keywords.
- the adoption of the segment improves the sampling efficiency of the processing unit.
- An embodiment of the present application provides a packet sampling method based on multiple processing units. As shown in FIG. 2, the method includes:
- Step S201 The user sets the IPFLOW related configuration through the network management or OAM (Operation Administration and Maintenance) interface in the network deployment.
- OAM Operaation Administration and Maintenance
- the configuration includes a key segment that requires special attention in the packets in the sampling template, for example, a match item is configured.
- the configuration includes non-key fields that need attention but are not important in the packets in the sampling template, for example, configuring collect. Item; configure the output items in the sampling, that is, configure the output address, output the template parameters; configure the management items in the sampling, that is, the collection template, the output item; configure the sampling rate in the sampling, for example, the default is 1000:1, that is, 1000 reports Collect one in the text; configure the interface binding in the sampling, that is, bind the corresponding interface for traffic collection.
- Step S202 The traffic is distributed to each processing unit according to the key field in the template.
- the key fields in the template are obtained, and it is determined whether the processing unit is multiple, if not multiple, only sent to a single processing unit; if there are multiple, the foregoing multi-processing unit based message sampling
- the method is processed. Determine whether the number of sharing stages is single. If it is a single, directly process the key values by key fields. Otherwise, divide the number according to the number of stages, and divide the key values into several levels to process the key values for processing.
- the microcode query key values are shared. Processing, the microcode query here performs preliminary identification of the key segment for the sampled message, and then searches for the corresponding processing unit.
- the key value composed of the key fields herein refers to the correspondence between the key fields and the specific processing unit, that is, which processing unit is processed, and if the processing unit is a multi-core processing unit, the key value is The correspondence between the key field and the corresponding kernel.
- Step S203 The processing unit performs packet sampling.
- the processing unit extracts a required field for the message to form a required CFLOW message to be sent.
- the embodiment provides a message sampling device 30 based on multiple processing units.
- the method includes a selection module 301, a determination module 302, and a sampling module 303.
- the selection module 301 is configured to select at least one of the plurality of processing units.
- the processing unit is configured as a key processing unit;
- the determining module 302 is configured to determine whether there is at least one key field to be extracted in the to-be-sampled message;
- the sampling module 303 is configured to: if there is at least one keyword that needs to be extracted in the to-be-sampled message In the segment, the message to be sampled is allocated to the key processing unit for packet sampling processing.
- the sampling module 303 allocates the to-be-sampled message to the key processing unit to perform packet sampling processing: allocating the to-be-sampled message with the same key segment to be extracted to the same key processing.
- the unit performs packet sampling processing; or evenly distributes the to-be-sampled messages that have the key segments to be extracted to each key processing unit for packet sampling processing.
- the sampling module 303 further implements, by using the following manner, that the to-be-sampled message with the same key segment to be extracted is allocated to the same key processing unit for packet sampling processing: when the number of keywords is less than or equal to the key processing For the number of cells, a key processing unit is selected for each key segment, and the packet to be sampled corresponding to each key segment is allocated to the key processing unit corresponding to the key segment for packet sampling processing.
- the sampling module 303 is configured to allocate the to-be-sampled message with the same key segment to be extracted to the same key processing unit for packet sampling processing: when the number of keywords is greater than that of the key processing unit The number of samples to be sampled in the same key segment is allocated to the same key processing unit for packet sampling processing.
- the key processing unit includes a multi-core: the sampling module allocates multiple to-be-sampling messages of the same key segment to the same key processing unit for packet sampling processing in the following manner: there is a key segment that needs to be extracted.
- the same sample to be sampled is allocated to the same core for packet sampling processing; or the to-be-sampled message with the key segment to be extracted is evenly distributed to each core for packet sampling processing.
- the selecting module 301 is further configured to select at least one processing unit from the plurality of processing units as the non-critical processing unit; the sampling module 303 is further configured to: when determining that there is no at least one key segment to be extracted in the to-be-sampled message When the message to be sampled that does not need to be extracted is allocated to the non-critical processing unit for packet sampling processing.
- the embodiment of the present invention further provides a computer readable storage medium, where the computer readable storage medium stores computer executable instructions, and when the computer executable instructions are executed, implements a multi-processing unit based message sampling method.
- each module/unit in the above embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, executing a program stored in the memory by a processor. / instruction to achieve its corresponding function.
- This application is not limited to any specific combination of hardware and software.
- the foregoing technical solution can improve the processing efficiency of the key field, and avoid the problem of processing efficiency loss of the key processing unit caused by processing the non-key field.
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
A packet sampling method based on multiple processing units comprises: selecting at least one processing unit from multiple processing units as a key processing unit; determining whether a packet to be sampled contains at least one key field required to be extracted; and if so, then dispatching the packet to be sampled to the key processing unit for packet sampling processing. Compared with the related art, whether a packet to be sampled contains a key field is determined before performing packet sampling, and a packet containing the key field is sampled via a specified key processing unit in the present invention. In this way, the above technical solution can improve the efficiency of processing the key field via sampling targeted at only the key field using the key processing unit, thus preventing processing efficiency degradation of the key processing unit due to processing of non-key fields.
Description
本文涉及但不限于通信领域,涉及一种基于多处理单元的报文采样方法和装置。This document relates to, but is not limited to, the field of communications, and relates to a message sampling method and apparatus based on multiple processing units.
IP(Internet Protocol,网络互连协议)层报文采样(IPFLOW)技术,是对报文进行流量采集,采集流量中的字段,组成报文采样(CFLOW),输出到服务器或在路由器本身进行流量分析的技术。IP (Internet Protocol) layer packet sampling (IPFLOW) technology is used to collect traffic from packets, collect fields in traffic, form packet samples (CFLOW), and output them to the server or traffic on the router itself. Analytical technology.
对于IPFLOW采集来说,由于技术的发展,处理单元从单一向多个处理单元发展,处理单元之间形成分担处理的关系。目前普遍采用的做法是使用单一的分担算法,将处理的流量分担到每个处理单元,但IPFLOW相关的采集是划分为关键字段与非关键字段,而这样会让同一个处理器进行关键字段的采集又会对非关键字段进行采集,并且对于非关键字也会形成相应的聚合流,这样会增加处理单元的处理量,降低处理单元的处理效率,导致处理单元的处理效率损失。For IPFLOW acquisition, due to the development of technology, the processing unit is developed from a single to multiple processing units, and the processing units form a shared processing relationship. The current practice is to use a single sharing algorithm to share the processed traffic to each processing unit, but the IPFLOW-related collection is divided into key segments and non-key segments, which will make the same processor perform the key. The collection of fields will collect non-key fields, and the corresponding aggregation stream will also be formed for non-keywords, which will increase the processing capacity of the processing unit, reduce the processing efficiency of the processing unit, and result in the processing efficiency loss of the processing unit. .
发明内容Summary of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this document. This Summary is not intended to limit the scope of the claims.
本发明实施例提供一种基于多处理单元的报文采样方法和装置,解决了多处理单元分担处理过程中处理效率损失的问题。The embodiment of the invention provides a packet sampling method and device based on multiple processing units, which solves the problem of processing efficiency loss in the multi-processing unit sharing processing.
本发明实施例提供一种基于多处理单元的报文采样方法,包括:An embodiment of the present invention provides a packet sampling method based on multiple processing units, including:
从多个处理单元中选择至少一个处理单元作为关键处理单元;Selecting at least one processing unit from the plurality of processing units as a key processing unit;
判断待采样报文中是否存在需要提取的至少一个关键字段;Determining whether there is at least one key segment to be extracted in the to-be-sampled message;
如果所述待采样报文中存在需要提取的至少一个关键字段,则将所述待采样报文分配到所述关键处理单元进行报文采样处理。
If there is at least one key segment to be extracted in the to-be-sampling message, the to-be-sampled message is allocated to the key processing unit for packet sampling processing.
可选地,所述关键字段包括源地址、目的地址、源端口号、目的端口号、协议类型、服务类型和入逻辑接口标示符中的至少一个。Optionally, the key field includes at least one of a source address, a destination address, a source port number, a destination port number, a protocol type, a service type, and an incoming logical interface identifier.
可选地,所述将所述待采样报文分配到所述关键处理单元进行报文采样处理包括:Optionally, the allocating the to-be-sampling message to the key processing unit for packet sampling processing includes:
将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理;All the packets to be sampled with the same key segment to be extracted are allocated to the same key processing unit for packet sampling processing;
或,or,
将存在需要提取的关键字段的待采样报文平均分配到每个关键处理单元进行报文采样处理。The packets to be sampled that have the key segment to be extracted are equally distributed to each key processing unit for packet sampling processing.
可选地,所述将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理包括:当关键字段的个数小于或等于关键处理单元的个数时,为每个关键字段选择一个关键处理单元,将每个关键字段对应的待采样报文分配到该关键字段对应的关键处理单元进行报文采样处理。Optionally, the allocating the to-be-sampled message with the same key segment to be extracted to the same key processing unit for performing the packet sampling process includes: when the number of the key segments is less than or equal to the number of the key processing units A key processing unit is selected for each key field, and the to-be-sampling message corresponding to each key field is allocated to the key processing unit corresponding to the key field to perform packet sampling processing.
可选地,所述将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理包括:当关键字段的个数大于关键处理单元的个数时,将多个关键字段分别对应的待采样报文分配到同一个关键处理单元进行报文采样处理。Optionally, the allocating the to-be-sampling message with the same key segment to be extracted to the same key processing unit for the packet sampling process includes: when the number of the key segment is greater than the number of the key processing unit, The packets to be sampled corresponding to the multiple key fields are allocated to the same key processing unit for packet sampling processing.
可选地,所述关键处理单元包括多内核;所述将多个关键字段分别对应的待采样报文分配到同一个关键处理单元进行报文采样处理包括:Optionally, the key processing unit includes a multi-core; the allocating the to-be-sampled message corresponding to the multiple key segments to the same key processing unit for packet sampling processing includes:
将存在需要提取的关键字段相同的待采样报文分配到同一内核中进行报文采样处理;All the packets to be sampled with the same key segment to be extracted are allocated to the same kernel for packet sampling processing;
或,or,
将存在需要提取的关键字段的待采样报文平均分配到每个内核进行报文采样处理。The packets to be sampled that have the key segment to be extracted are equally distributed to each core for packet sampling processing.
可选地,所述方法还包括:从多个处理单元中选择至少一个处理单元作为非关键处理单元;当判断待采样报文中不存在需要提取的至少一个关键字段时,将不存在需要提取的关键字段的待采样报文分配到所述非关键处理单
元进行报文采样处理。Optionally, the method further includes: selecting at least one processing unit from the plurality of processing units as the non-critical processing unit; when it is determined that there is no at least one key segment to be extracted in the to-be-sampled message, there is no need The to-be-sampled message of the extracted key segment is allocated to the non-critical processing list
The element performs packet sampling processing.
本发明实施例还提供一种基于多处理单元的报文采样装置,包括选择模块、判断模块和采样模块:The embodiment of the invention further provides a message sampling device based on a multi-processing unit, comprising a selection module, a determination module and a sampling module:
所述选择模块设置为从多个处理单元中选择至少一个处理单元作为关键处理单元;The selection module is configured to select at least one processing unit from the plurality of processing units as a key processing unit;
所述判断模块设置为判断待采样报文中是否存在需要提取的至少一个关键字段;The determining module is configured to determine whether there is at least one key segment that needs to be extracted in the to-be-sampling message;
所述采样模块设置为如果所述待采样报文中存在需要提取的至少一个关键字段,则将所述待采样报文分配到所述关键处理单元进行报文采样处理。The sampling module is configured to allocate the to-be-sampling message to the key processing unit for packet sampling processing if there is at least one key segment that needs to be extracted in the to-be-sampled message.
可选地,所述采样模块通过如下方式实现所述将所述待采样报文分配到所述关键处理单元进行报文采样处理:Optionally, the sampling module is configured to: allocate the to-be-sampled message to the key processing unit to perform packet sampling processing:
将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理;All the packets to be sampled with the same key segment to be extracted are allocated to the same key processing unit for packet sampling processing;
或,or,
将存在需要提取的关键字段的待采样报文平均分配到每个关键处理单元进行报文采样处理。The packets to be sampled that have the key segment to be extracted are equally distributed to each key processing unit for packet sampling processing.
可选地,所述采样模块通过如下方式实现所述将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理:当关键字的个数小于等于关键处理单元的个数时,为每个关键字段选择一个关键处理单元,将每个关键字段对应的待采样的报文分配到该关键字段对应的关键处理单元进行报文采样处理。Optionally, the sampling module is configured to allocate the to-be-sampled message with the same key segment to be extracted to the same key processing unit for packet sampling processing: when the number of keywords is less than or equal to the key processing For the number of cells, a key processing unit is selected for each key segment, and the packet to be sampled corresponding to each key segment is allocated to the key processing unit corresponding to the key segment for packet sampling processing.
可选地,所述采样模块通过如下方式实现所述将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理:当关键字的个数大于关键处理单元的个数时,将多个相同关键字段的待采样报文分配到同一个关键处理单元进行报文采样处理。Optionally, the sampling module is configured to allocate the to-be-sampled message with the same key segment to be extracted to the same key processing unit for packet sampling processing: when the number of keywords is greater than the key processing unit The number of samples to be sampled of the same key segment is allocated to the same key processing unit for packet sampling processing.
可选地,所述关键处理单元包括多内核;所述采样模块通过如下方式实现将多个相同关键字段的待采样报文分配到同一个关键处理单元进行报文采
样处理:Optionally, the key processing unit includes a multi-core; the sampling module is configured to allocate a plurality of packets of the same key segment to be sampled to the same key processing unit for message collection.
Sample processing:
将存在需要提取的关键字段相同的待采样报文分配到同一内核中进行报文采样处理;All the packets to be sampled with the same key segment to be extracted are allocated to the same kernel for packet sampling processing;
或,or,
将存在需要提取的关键字段的待采样报文平均分配到每个内核进行报文采样处理。The packets to be sampled that have the key segment to be extracted are equally distributed to each core for packet sampling processing.
可选地,所述选择模块还设置为从多个处理单元中选择至少一个处理单元作为非关键处理单元;所述采样模块还设置为当判断待采样报文中不存在需要提取的至少一个关键字段时,将不存在需要提取的关键字段的待采样报文分配到所述非关键处理单元进行报文采样。Optionally, the selecting module is further configured to select at least one processing unit from the plurality of processing units as the non-critical processing unit; the sampling module is further configured to: when determining that there is no at least one key that needs to be extracted in the to-be-sampled message In the case of the field, the to-be-sampled message of the key segment that does not need to be extracted is allocated to the non-critical processing unit for packet sampling.
本发明实施例还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机可执行指令,所述计算机可执行指令被执行时实现基于多处理单元的报文采样方法。The embodiment of the present invention further provides a computer readable storage medium, where the computer readable storage medium stores computer executable instructions, and when the computer executable instructions are executed, implements a multi-processing unit based message sampling method.
本发明实施例的有益效果是:The beneficial effects of the embodiments of the present invention are:
本发明实施例提供的基于多处理单元的报文采样方法和装置,首先,从多个处理单元中选择至少一个处理单元作为关键处理单元;然后判断待采样报文中是否存在需要提取的至少一个关键字段;最后,如存在,将待采样报文分配到关键处理单元进行报文采样处理。与相关技术相比,在进行报文采样之前,会对待采样报文进行判断,如果是存在关键字段,则通过指定的关键处理单元进行采样处理,这样就可以让关键处理单元只针对关键字段进行采样,能够不对非关键字段进行采样,能够提高对关键字段的处理效率,避免处理非关键字段导致关键处理单元的处理效率损失的问题。The multi-processing unit-based message sampling method and apparatus provided by the embodiment of the present invention firstly select at least one processing unit from a plurality of processing units as a key processing unit; and then determine whether at least one of the to-be-sampled messages needs to be extracted. Key segment; Finally, if present, the message to be sampled is assigned to the key processing unit for packet sampling processing. Compared with the related art, before the packet sampling, the sampled message is judged. If there is a key field, the designated key processing unit performs sampling processing, so that the key processing unit can only target the keyword. The segment is sampled, and the non-key segment can be sampled, which can improve the processing efficiency of the key segment and avoid the problem of processing the non-key segment causing loss of processing efficiency of the key processing unit.
在阅读并理解了附图和详细描述后,可以明白其它方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
图1为本发明实施例一提供的基于多处理单元的报文采样方法流程图;1 is a flowchart of a packet sampling method based on multiple processing units according to Embodiment 1 of the present invention;
图2为本发明实施例二提供的基于多处理单元的报文采样方法流程图;2 is a flowchart of a packet sampling method based on multiple processing units according to Embodiment 2 of the present invention;
图3为本发明实施例三提供的基于多处理单元的报文采样装置的结构示
意图。FIG. 3 is a schematic structural diagram of a message sampling apparatus based on multiple processing units according to Embodiment 3 of the present invention;
intention.
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. The described embodiments are a part of the embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope are the scope of the present application.
实施例一Embodiment 1
本申请实施例的基于多处理单元的报文采样方法,如图1所示,该方法包括:The multi-processing unit-based packet sampling method of the embodiment of the present application is as shown in FIG. 1 , and the method includes:
步骤S101:从多个处理单元中选择至少一个处理单元作为关键处理单元;Step S101: selecting at least one processing unit from a plurality of processing units as a key processing unit;
在该步骤中,主要是为了从多个处理单元中选择处理单元来进行关键字段的报文采样处理。例如,有三个处理单元,那么可以从其中选择一个作为关键处理单元,也可以选择其中两个作为关键处理单元。In this step, the message sampling process of the key segment is mainly performed in order to select a processing unit from a plurality of processing units. For example, if there are three processing units, then one of them can be selected as the key processing unit, or two of them can be selected as the key processing unit.
步骤S102:判断待采样报文中是否存在需要提取的至少一个关键字段;Step S102: determining whether there is at least one key segment to be extracted in the to-be-sampling message;
在该步骤中,对每个待采样报文进行初步识别处理,看里面是否存在需要提取的关键字段,这里的关键字段是指需要特殊关注的字段,可选地,可以是一些标识字段,可以包括源地址、目的地址、源端口号、目的端口号、协议类型、服务类型和入逻辑接口标示符中的至少一个。例如,对1000个报文进行采样,以目标地址A和/或源地址B为关键字段,判断这1000个报文中是否有目标地址A和/或源地址B。In this step, a preliminary identification process is performed on each packet to be sampled to see whether there is a key segment to be extracted, where the key field refers to a field that requires special attention, and optionally, some identification fields. And may include at least one of a source address, a destination address, a source port number, a destination port number, a protocol type, a service type, and an incoming logical interface identifier. For example, 1000 packets are sampled, and the target address A and/or the source address B are used as key fields to determine whether there are target addresses A and/or source addresses B among the 1000 messages.
步骤S103:如果所述待采样报文中存在需要提取的至少一个关键字段,则将所述待采样报文分配到关键处理单元进行报文采样处理。Step S103: If there is at least one key segment to be extracted in the to-be-sampling message, the to-be-sampled message is allocated to the key processing unit for packet sampling processing.
在该步骤中,将存在需要提取的至少一个关键字段的报文分配到上述指定的关键处理单元进行处理。结合上述例子进行说明,如果1000个待采样报文中,有10个待采样报文中存在需要提取的关键字段,其中4个待采样报文中存在的关键字段是目标地址A、6个待采样报文中存在的关键字段是源地址B,那么就将这10个待采样报文分配到关键处理单元中进行报文采样处理。
In this step, a message having at least one key field to be extracted is allocated to the above-mentioned designated key processing unit for processing. According to the above example, if there are 10 key segments to be extracted in the 10 to-be-sampling messages, the key segments in the 4 to-be-sampling messages are the destination addresses A and 6. The key segment existing in the to-be-sampling message is the source address B, and then the 10 samples to be sampled are allocated to the key processing unit for packet sampling processing.
在上述步骤S103中,将待采样报文分配到关键处理单元进行报文采样处理包括:将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理;或将存在需要提取的关键字段的待采样报文平均分配到每个关键处理单元进行报文采样处理。In the above step S103, the process of the message to be sampled to the key processing unit for the message sampling process includes: allocating the to-be-sampled message with the same key segment to be extracted to the same key processing unit for packet sampling processing; or The packets to be sampled that have the key segment to be extracted are equally distributed to each key processing unit for packet sampling processing.
结合上述例子进行说明,并且存在三个处理单元,如处理单元1、处理单元2和处理单元3;将其中两个处理单元定为关键处理单元,例如,将处理单元1和处理单元2定为关键处理单元。即将10个存在需要提取的关键字段的待采样报文分配到这两个处理单元进行报文采样处理。可以是每个关键处理单元处理5个待采样报文,即处理单元1和处理单元分别处理5个待采样报文;也可以是处理单元1处理4个报文,即处理存在需要提取的关键字段为目标地址A的待采样报文,处理单元2处理6个报文,即处理存在需要提取的关键字段为源地址B的待采样报文;也可以是只由其中一个关键处理单元进行报文采样处理,即处理单元1对这10个待采样报文进行报文采样处理,或处理单元2对这10个待采样报文进行报文采样处理。分配方式不限于上述方式,还可以使用其他分配方式。上述技术方案可以让每个关键处理单元专门处理一个关键字段的报文采样,这样能够很好地形成单独一条的聚合流,不必进行后续聚合流的叠加处理。The above example is explained, and there are three processing units, such as the processing unit 1, the processing unit 2, and the processing unit 3; two of the processing units are designated as key processing units, for example, the processing unit 1 and the processing unit 2 are defined as Key processing unit. The 10 samples to be sampled that need to be extracted are allocated to the two processing units for packet sampling processing. The processing unit 1 and the processing unit respectively process 5 to-be-sampled messages, or the processing unit 1 processes 4 packets, that is, the key that needs to be extracted is processed. The field is the to-be-sampling message of the target address A, and the processing unit 2 processes the six packets, that is, the message to be sampled with the key segment to be extracted as the source address B; or only one of the key processing units The packet sampling process is performed, that is, the processing unit 1 performs packet sampling processing on the 10 to-be-sampling messages, or the processing unit 2 performs packet sampling processing on the 10 to-be-sampled messages. The allocation method is not limited to the above, and other allocation methods can also be used. The above technical solution allows each of the key processing units to specifically process the packet sampling of a key segment, so that a single aggregated stream can be formed well without superimposing the subsequent aggregated streams.
可选地,将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理包括:当关键字段的个数小于或等于关键处理单元的个数时,为每个关键字段选择一个关键处理单元,将每个关键字段对应的待采样报文分配到该关键字段对应的关键处理单元进行报文采样处理。也就是说,在关键处理单元个数大于或等于关键字段的个数时,为了便于提高处理效率,以及让后续不用再进行聚合流的叠加,让每个关键处理单元单独地进行一个关键字段的流的处理。Optionally, allocating the to-be-sampled message with the same key segment to be extracted to the same key processing unit for packet sampling processing includes: when the number of key segments is less than or equal to the number of key processing units, A key processing unit is selected for each key field, and the to-be-sampling message corresponding to each key field is allocated to the key processing unit corresponding to the key field to perform packet sampling processing. That is to say, when the number of key processing units is greater than or equal to the number of key fields, in order to improve the processing efficiency, and to eliminate the subsequent aggregation of the aggregation streams, each key processing unit performs a keyword separately. The processing of the stream of segments.
结合上述例子说明,关键处理单元的个数为2个,关键字段的个数为2个,也就是关键字段的个数等于关键处理单元的个数。处理单元1处理关键字段为目标地址A的待采样报文,即处理单元1处理4个待采样报文;处理单元2处理关键字段为源地址B的待采样报文,即处理6个待采样报文。这样,处理单元1就可以单独形成目标地址A聚合流,处理单元2就可以单独
形成源地址B聚合流,从而可以避免后续进行目标地址A聚合流的叠加和源地址B聚合流的叠加。Combined with the above example, the number of key processing units is two, and the number of key fields is two, that is, the number of key fields is equal to the number of key processing units. The processing unit 1 processes the to-be-sampled message with the key segment as the target address A, that is, the processing unit 1 processes the four to-be-sampling messages; the processing unit 2 processes the to-be-sampled message whose source segment is the source address B, that is, processes 6 Packet to be sampled. In this way, the processing unit 1 can separately form the target address A aggregation stream, and the processing unit 2 can be separately
The source address B aggregation stream is formed, so that the superposition of the target address A aggregation stream and the superposition of the source address B aggregation stream can be avoided.
可选地,将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理包括:当关键字段的个数大于关键处理单元的个数时,将多个关键字段分别的待采样报文分配到同一个关键处理单元进行报文采样处理。也就是说,在关键处理单元的个数小于关键字段的个数时,关键处理单元必然要承担多个关键字段对应的报文采样处理。Optionally, allocating the to-be-sampled message with the same key segment to be extracted to the same key processing unit for packet sampling processing includes: when the number of key segments is greater than the number of key processing units, multiple The packets to be sampled in the key segment are allocated to the same key processing unit for packet sampling processing. That is to say, when the number of key processing units is less than the number of key fields, the key processing unit must bear the packet sampling processing corresponding to multiple key fields.
结合上述例子说明,假如还存在4个关键字段为目标地址C的待采样报文,该示例中,关键字段的个数为3个,关键处理单元的个数为2个,也就是关键字段的个数大于关键处理单元的个数。那么可以分配处理单元1处理关键字段为目标地址A对应的待采样报文和目标地址C对应的待采样报文,也就是处理8个待采样报文;处理单元2处理关键字段为源地址B的待采样报文,也就是处理6个待采样报文。也可以是处理单元1处理4个报文,即处理关键字段为目标地址A的报文,处理单元2处理10个报文,即处理关键字段为源地址B的报文和目标地址C的报文。需要说明的是,分配方式可以根据具体的情况进行灵活分配。According to the above example, if there are four packets to be sampled with the target segment C as the target address C, in this example, the number of key segments is three, and the number of key processing units is two, which is the key. The number of fields is greater than the number of critical processing units. Then, the processing unit 1 can process the to-be-sampled message corresponding to the target address A and the to-be-sampled message corresponding to the target address C, that is, process 8 to-be-sampled messages; and the processing unit 2 processes the key segment as the source. The packet to be sampled at address B, that is, the six packets to be sampled. It is also possible that the processing unit 1 processes four messages, that is, processes the message whose key field is the target address A, and the processing unit 2 processes 10 messages, that is, the message with the key segment being the source address B and the target address C. Message. It should be noted that the allocation method can be flexibly allocated according to specific situations.
可选地,在本发明实施中,关键处理单元包括多内核;将多个相同关键字段的待采样报文分配到同一个关键处理单元进行报文采样处理包括:将存在需要提取的关键字段相同的待采样报文分配到同一内核中进行报文采样处理;或将存在需要提取的关键字段的待采样报文平均分配到每个内核进行报文采样处理。也就是将每个关键字段的报文采样处理分配最底层的处理对象,这样可以快速得知谁在进行什么处理,便于后期使用时能够快速准确地得知具体的聚合流在哪里。Optionally, in the implementation of the present invention, the key processing unit includes a multi-core; and the plurality of the same key segment to be sampled to be allocated to the same key processing unit for packet sampling processing includes: there are keywords that need to be extracted The packets to be sampled in the same segment are allocated to the same core for packet sampling processing; or the packets to be sampled in the key segment that need to be extracted are evenly distributed to each core for packet sampling processing. That is, the packet sampling processing of each key segment is allocated to the lowest processing object, so that it is possible to quickly know who is doing what processing, so that it is possible to quickly and accurately know where the specific aggregation stream is in the later use.
结合上述例子进行说明,假设处理单元1中为双内核,值得注意的是,这里的处理单元可以是处理器。假如处理单元1处理8个报文,即处理关键字段为目标地址A对应的待采样报文和目标地址C对应的待采样报文,那么可以让其中一个内核处理目标地址A对应的待采样报文,另外一个内核处理目标地址C对应的待采样报文,需要说明的是,分配情况可以根据具体情况而定。
In conjunction with the above examples, it is assumed that the processing unit 1 is a dual core. It is worth noting that the processing unit herein may be a processor. If the processing unit 1 processes 8 packets, that is, the processing target segment is the to-be-sampled message corresponding to the target address A and the to-be-sampled message corresponding to the target address C, then one of the cores can process the target address A corresponding to the sample to be sampled. In the message, another core processes the packet to be sampled corresponding to the destination address C. It should be noted that the allocation may be determined according to the specific situation.
可选地,本实施例中的基于多处理单元的报文采样方法还包括:从多个处理单元中选择至少一个处理单元作为非关键处理单元;当判断待采样报文中不存在需要提取的至少一个关键字段时,将不存在需要提取的关键字段的待采样报文分配到非关键处理单元进行报文采样处理。即让其中指定的非关键处理单元专门来进行非关键字段的采用处理,可选地,可指定一个处理单元来进行非关键字段的采用处理,这样可以让更多的处理单元进行关键字段的采用处理,提高处理单元的采样效率。Optionally, the multi-processing unit-based packet sampling method in this embodiment further includes: selecting at least one processing unit from the plurality of processing units as the non-critical processing unit; and determining that there is no extraction required in the to-be-sampled message. When at least one key field is used, the to-be-sampled message of the key segment that does not need to be extracted is allocated to the non-critical processing unit for packet sampling processing. That is, the non-critical processing unit specified therein is exclusively used for the processing of the non-key field, and optionally, a processing unit can be specified to perform the processing of the non-key field, so that more processing units can perform keywords. The adoption of the segment improves the sampling efficiency of the processing unit.
实施例二Embodiment 2
本申请实施例提供一种基于多处理单元的报文采样方法,如图2所示,该方法包括:An embodiment of the present application provides a packet sampling method based on multiple processing units. As shown in FIG. 2, the method includes:
步骤S201:用户在网络部署中通过网管或OAM(Operation Administration and Maintenance,操作管理维护)界面设定IPFLOW相关配置;Step S201: The user sets the IPFLOW related configuration through the network management or OAM (Operation Administration and Maintenance) interface in the network deployment.
在该步骤中,配置包括采样模板中的报文中需要特殊关注的关键字段,例如配置match项;配置包括采样模板中的报文中需要关注但不重要的非关键字段,例如配置collect项;配置采样中的输出项,即配置输出地址,输出模板参数;配置采样中的管理项,即集合模板,输出项;配置采样中的采样率,例如默认为1000:1,即1000个报文中采集1个;配置采样中的接口绑定,即绑定相应接口进行流量采集。In this step, the configuration includes a key segment that requires special attention in the packets in the sampling template, for example, a match item is configured. The configuration includes non-key fields that need attention but are not important in the packets in the sampling template, for example, configuring collect. Item; configure the output items in the sampling, that is, configure the output address, output the template parameters; configure the management items in the sampling, that is, the collection template, the output item; configure the sampling rate in the sampling, for example, the default is 1000:1, that is, 1000 reports Collect one in the text; configure the interface binding in the sampling, that is, bind the corresponding interface for traffic collection.
步骤S202:根据模板中的关键字段将流量分担到每个处理单元;Step S202: The traffic is distributed to each processing unit according to the key field in the template.
在该步骤中,获取模板中的关键字段,判断处理单元是否为多个,如果不是多个,则只发送到单个处理单元;如果为多个,则按前述基于多处理单元的报文采样方法进行处理。判断分担级数是否为单个,如果为单个,直接按关键字段组成键值进行处理,否则,按分担级数进行划分,分成几个级别来组装键值进行处理,微码查询键值做分担处理,这里的微码查询为对待采样报文进行关键字段初步识别,然后查找对应的处理单元。值得注意的是,这里的关键字段组成的键值是指关键字段与具体处理单元建立对应关系,即由哪个处理单元进行处理,如果该处理单元为多内核处理单元,那么该键值为关键字段与对应的内核的对应关系。
In this step, the key fields in the template are obtained, and it is determined whether the processing unit is multiple, if not multiple, only sent to a single processing unit; if there are multiple, the foregoing multi-processing unit based message sampling The method is processed. Determine whether the number of sharing stages is single. If it is a single, directly process the key values by key fields. Otherwise, divide the number according to the number of stages, and divide the key values into several levels to process the key values for processing. The microcode query key values are shared. Processing, the microcode query here performs preliminary identification of the key segment for the sampled message, and then searches for the corresponding processing unit. It is worth noting that the key value composed of the key fields herein refers to the correspondence between the key fields and the specific processing unit, that is, which processing unit is processed, and if the processing unit is a multi-core processing unit, the key value is The correspondence between the key field and the corresponding kernel.
步骤S203:处理单元进行报文采样。Step S203: The processing unit performs packet sampling.
在该步骤中,处理单元对报文提取需要字段,组成需要的CFLOW报文发送。In this step, the processing unit extracts a required field for the message to form a required CFLOW message to be sent.
实施例三Embodiment 3
本实施例提供基于多处理单元的报文采样装置30,如图3所示,包括选择模块301、判断模块302和采样模块303:其中,选择模块301设置为从多个处理单元中选择至少一个处理单元作为关键处理单元;判断模块302设置为判断待采样报文中是否存在需要提取的至少一个关键字段;采样模块303设置为如果所述待采样报文中存在需要提取的至少一个关键字段,则将待采样报文分配到关键处理单元进行报文采样处理。The embodiment provides a message sampling device 30 based on multiple processing units. As shown in FIG. 3, the method includes a selection module 301, a determination module 302, and a sampling module 303. The selection module 301 is configured to select at least one of the plurality of processing units. The processing unit is configured as a key processing unit; the determining module 302 is configured to determine whether there is at least one key field to be extracted in the to-be-sampled message; and the sampling module 303 is configured to: if there is at least one keyword that needs to be extracted in the to-be-sampled message In the segment, the message to be sampled is allocated to the key processing unit for packet sampling processing.
可选地,采样模块303通过如下方式实现将所述待采样报文分配到所述关键处理单元进行报文采样处理:将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理;或将存在需要提取的关键字段的待采样报文平均分配到每个关键处理单元进行报文采样处理。Optionally, the sampling module 303 allocates the to-be-sampled message to the key processing unit to perform packet sampling processing: allocating the to-be-sampled message with the same key segment to be extracted to the same key processing. The unit performs packet sampling processing; or evenly distributes the to-be-sampled messages that have the key segments to be extracted to each key processing unit for packet sampling processing.
可选地,采样模块还303通过如下方式实现所述将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理:当关键字的个数小于等于关键处理单元的个数时,为每个关键字段选择一个关键处理单元,将每个关键字段对应的待采样的报文分配到该关键字段对应的关键处理单元进行报文采样处理。Optionally, the sampling module 303 further implements, by using the following manner, that the to-be-sampled message with the same key segment to be extracted is allocated to the same key processing unit for packet sampling processing: when the number of keywords is less than or equal to the key processing For the number of cells, a key processing unit is selected for each key segment, and the packet to be sampled corresponding to each key segment is allocated to the key processing unit corresponding to the key segment for packet sampling processing.
可选地,采样模块303通过如下方式实现所述将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理:当关键字的个数大于关键处理单元的个数时,将多个相同关键字段的待采样报文分配到同一个关键处理单元进行报文采样处理。Optionally, the sampling module 303 is configured to allocate the to-be-sampled message with the same key segment to be extracted to the same key processing unit for packet sampling processing: when the number of keywords is greater than that of the key processing unit The number of samples to be sampled in the same key segment is allocated to the same key processing unit for packet sampling processing.
可选地,关键处理单元包括多内核:采样模块通过如下方式实现将多个相同关键字段的待采样报文分配到同一个关键处理单元进行报文采样处理:将存在需要提取的关键字段相同的待采样报文分配到同一内核中进行报文采样处理;或将存在需要提取的关键字段的待采样报文平均分配到各内核进行报文采样处理。
Optionally, the key processing unit includes a multi-core: the sampling module allocates multiple to-be-sampling messages of the same key segment to the same key processing unit for packet sampling processing in the following manner: there is a key segment that needs to be extracted. The same sample to be sampled is allocated to the same core for packet sampling processing; or the to-be-sampled message with the key segment to be extracted is evenly distributed to each core for packet sampling processing.
可选地,选择模块301还设置为从多个处理单元中选择至少一个处理单元作为非关键处理单元;采样模块303还设置为当判断待采样报文中不存在需要提取的至少一个关键字段时,将不存在需要提取的关键字段的待采样报文分配到非关键处理单元进行报文采样处理。Optionally, the selecting module 301 is further configured to select at least one processing unit from the plurality of processing units as the non-critical processing unit; the sampling module 303 is further configured to: when determining that there is no at least one key segment to be extracted in the to-be-sampled message When the message to be sampled that does not need to be extracted is allocated to the non-critical processing unit for packet sampling processing.
本发明实施例还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机可执行指令,所述计算机可执行指令被执行时实现基于多处理单元的报文采样方法。The embodiment of the present invention further provides a computer readable storage medium, where the computer readable storage medium stores computer executable instructions, and when the computer executable instructions are executed, implements a multi-processing unit based message sampling method.
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件(例如处理器)完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,例如通过集成电路来实现其相应功能,也可以采用软件功能模块的形式实现,例如通过处理器执行存储于存储器中的程序/指令来实现其相应功能。本申请不限制于任何特定形式的硬件和软件的结合。本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或者等同替换,而不脱离本申请技术方案的精神和范围,均应涵盖在本申请的权利要求范围当中。One of ordinary skill in the art will appreciate that all or a portion of the above steps may be performed by a program to instruct related hardware, such as a processor, which may be stored in a computer readable storage medium, such as a read only memory, disk or optical disk. Wait. Alternatively, all or part of the steps of the above embodiments may also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the above embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, executing a program stored in the memory by a processor. / instruction to achieve its corresponding function. This application is not limited to any specific combination of hardware and software. A person skilled in the art should understand that the technical solutions of the present application can be modified or equivalent, without departing from the spirit and scope of the technical solutions of the present application, and should be included in the scope of the claims of the present application.
上述技术方案能够提高对关键字段的处理效率,避免了为处理非关键字段导致的关键处理单元的处理效率损失的问题。
The foregoing technical solution can improve the processing efficiency of the key field, and avoid the problem of processing efficiency loss of the key processing unit caused by processing the non-key field.
Claims (13)
- 一种基于多处理单元的报文采样方法,包括:A packet sampling method based on multiple processing units, comprising:从多个处理单元中选择至少一个处理单元作为关键处理单元;Selecting at least one processing unit from the plurality of processing units as a key processing unit;判断待采样报文中是否存在需要提取的至少一个关键字段;Determining whether there is at least one key segment to be extracted in the to-be-sampled message;如果所述待采样报文中存在需要提取的至少一个关键字段,则将所述待采样报文分配到所述关键处理单元进行报文采样处理。If there is at least one key segment to be extracted in the to-be-sampling message, the to-be-sampled message is allocated to the key processing unit for packet sampling processing.
- 如权利要求1所述的基于多处理单元的报文采样方法,其中,所述关键字段包括源地址、目的地址、源端口号、目的端口号、协议类型、服务类型和入逻辑接口标示符中的至少一个。The multi-processing unit-based packet sampling method according to claim 1, wherein the key field includes a source address, a destination address, a source port number, a destination port number, a protocol type, a service type, and an incoming logical interface identifier. At least one of them.
- 如权利要求1所述的基于多处理单元的报文采样方法,其中,所述将所述待采样报文分配到所述关键处理单元进行报文采样处理包括:The multi-processing unit-based packet sampling method according to claim 1, wherein the allocating the to-be-sampled message to the key processing unit for packet sampling processing comprises:将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理;All the packets to be sampled with the same key segment to be extracted are allocated to the same key processing unit for packet sampling processing;或,or,将存在需要提取的关键字段的待采样报文平均分配到每个关键处理单元进行报文采样处理。The packets to be sampled that have the key segment to be extracted are equally distributed to each key processing unit for packet sampling processing.
- 如权利要求3所述的基于多处理单元的报文采样方法,其中,所述将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理包括:当关键字段的个数小于或等于关键处理单元的个数时,为每个关键字段选择一个关键处理单元,将每个关键字段对应的待采样报文分配到该关键字段对应的关键处理单元进行报文采样处理。The multi-processing unit-based packet sampling method according to claim 3, wherein the assigning the to-be-sampled message having the same key segment to be extracted to the same key processing unit for packet sampling processing includes: When the number of the fields is less than or equal to the number of the key processing units, a key processing unit is selected for each key field, and the to-be-sampled message corresponding to each key field is assigned to the key processing corresponding to the key field. The unit performs packet sampling processing.
- 如权利要求3所述的基于多处理单元的报文采样方法,其中,所述将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理包括:当关键字段的个数大于关键处理单元的个数时,将多个关键字段分别对应的待采样报文分配到同一个关键处理单元进行报文采样处理。The multi-processing unit-based packet sampling method according to claim 3, wherein the assigning the to-be-sampled message having the same key segment to be extracted to the same key processing unit for packet sampling processing includes: When the number of the fields is greater than the number of the key processing units, the packets to be sampled corresponding to the multiple key segments are allocated to the same key processing unit for packet sampling processing.
- 如权利要求5所述的基于多处理单元的报文采样方法,其中,所述关 键处理单元包括多内核;所述将多个关键字段分别对应的待采样报文分配到同一个关键处理单元进行报文采样处理包括:The multi-processing unit based message sampling method according to claim 5, wherein said off The key processing unit includes a multi-core; the allocating the to-be-sampled message corresponding to the multiple key fields to the same key processing unit for packet sampling processing includes:将存在需要提取的关键字段相同的待采样报文分配到同一内核中进行报文采样处理;All the packets to be sampled with the same key segment to be extracted are allocated to the same kernel for packet sampling processing;或,or,将存在需要提取的关键字段的待采样报文平均分配到每个内核进行报文采样处理。The packets to be sampled that have the key segment to be extracted are equally distributed to each core for packet sampling processing.
- 如权利要求1-6任一项所述的基于多处理单元的报文采样方法,所述方法还包括:从多个处理单元中选择至少一个处理单元作为非关键处理单元;当判断待采样报文中不存在需要提取的至少一个关键字段时,将不存在需要提取的关键字段的待采样报文分配到所述非关键处理单元进行报文采样处理。The multi-processing unit-based message sampling method according to any one of claims 1 to 6, wherein the method further comprises: selecting at least one processing unit from the plurality of processing units as a non-critical processing unit; When there is no at least one key field to be extracted, the message to be sampled that does not need to be extracted is allocated to the non-critical processing unit for packet sampling processing.
- 一种基于多处理单元的报文采样装置,包括选择模块、判断模块和采样模块:A message sampling device based on a multi-processing unit, comprising a selection module, a determination module and a sampling module:所述选择模块设置为从多个处理单元中选择至少一个处理单元作为关键处理单元;The selection module is configured to select at least one processing unit from the plurality of processing units as a key processing unit;所述判断模块设置为判断待采样报文中是否存在需要提取的至少一个关键字段;The determining module is configured to determine whether there is at least one key segment that needs to be extracted in the to-be-sampling message;所述采样模块设置为如果所述待采样报文中存在需要提取的至少一个关键字段,则将所述待采样报文分配到所述关键处理单元进行报文采样处理。The sampling module is configured to allocate the to-be-sampling message to the key processing unit for packet sampling processing if there is at least one key segment that needs to be extracted in the to-be-sampled message.
- 如权利要求8所述的基于多处理单元的报文采样装置,其中,所述采样模块通过如下方式实现所述将所述待采样报文分配到所述关键处理单元进行报文采样处理:The multi-processing unit-based packet sampling device of claim 8, wherein the sampling module realizes that the sampling to be sampled is allocated to the key processing unit for packet sampling processing:将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理;All the packets to be sampled with the same key segment to be extracted are allocated to the same key processing unit for packet sampling processing;或,or,将存在需要提取的关键字段的待采样报文平均分配到每个关键处理单元进行报文采样处理。 The packets to be sampled that have the key segment to be extracted are equally distributed to each key processing unit for packet sampling processing.
- 如权利要求9所述的基于多处理单元的报文采样装置,其中,所述采样模块通过如下方式实现所述将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理:当关键字的个数小于或等于关键处理单元的个数时,为每个关键字段选择一个关键处理单元,将每个关键字段对应的待采样的报文分配到该关键字段对应的关键处理单元进行报文采样处理。The multi-processing unit-based message sampling apparatus according to claim 9, wherein the sampling module realizes that the to-be-sampled message having the same key segment to be extracted is allocated to the same key processing unit by performing the following manner: Packet sampling processing: When the number of keywords is less than or equal to the number of key processing units, a key processing unit is selected for each key field, and the message to be sampled corresponding to each key field is allocated to the message segment. The key processing unit corresponding to the key field performs packet sampling processing.
- 如权利要求9所述的基于多处理单元的报文采样装置,其中,所述采样模块通过如下方式实现所述将存在需要提取的关键字段相同的待采样报文分配到同一关键处理单元进行报文采样处理:当关键字的个数大于关键处理单元的个数时,将多个相同关键字段的待采样报文分配到同一个关键处理单元进行报文采样处理。The multi-processing unit-based message sampling apparatus according to claim 9, wherein the sampling module realizes that the to-be-sampled message having the same key segment to be extracted is allocated to the same key processing unit by performing the following manner: Packet sampling processing: When the number of keywords is greater than the number of key processing units, multiple to-be-sampling messages of the same key segment are allocated to the same key processing unit for packet sampling processing.
- 如权利要求11所述的基于多处理单元的报文采样装置,其中,所述关键处理单元包括多内核;所述采样模块通过如下方式实现将多个相同关键字段的待采样报文分配到同一个关键处理单元进行报文采样处理:The multi-processing unit-based message sampling device of claim 11, wherein the key processing unit comprises a multi-core; the sampling module is configured to allocate a plurality of packets of the same key segment to be sampled to The same key processing unit performs packet sampling processing:将存在需要提取的关键字段相同的待采样报文分配到同一内核中进行报文采样处理;All the packets to be sampled with the same key segment to be extracted are allocated to the same kernel for packet sampling processing;或,or,将存在需要提取的关键字段的待采样报文平均分配到每个内核进行报文采样处理。The packets to be sampled that have the key segment to be extracted are equally distributed to each core for packet sampling processing.
- 如权利要求8-12任一项所述的基于多处理单元的报文采样装置,其中,所述选择模块还设置为从多个处理单元中选择至少一个处理单元作为非关键处理单元;所述采样模块还设置为当判断待采样报文中不存在需要提取的至少一个关键字段时,将不存在需要提取的关键字段的待采样报文分配到所述非关键处理单元进行报文采样。 The multi-processing unit-based message sampling apparatus according to any one of claims 8 to 12, wherein the selection module is further configured to select at least one processing unit from the plurality of processing units as a non-critical processing unit; The sampling module is further configured to: when it is determined that there is no at least one key segment to be extracted in the to-be-sampling message, allocate the to-be-sampling message that does not exist in the key segment to be extracted to the non-critical processing unit for packet sampling. .
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510566123.6A CN106506351A (en) | 2015-09-07 | 2015-09-07 | A kind of packet sampling method and apparatus based on multiplied unit |
CN201510566123.6 | 2015-09-07 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2017041509A1 true WO2017041509A1 (en) | 2017-03-16 |
Family
ID=58239119
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2016/082356 WO2017041509A1 (en) | 2015-09-07 | 2016-05-17 | Packet sampling method and device based on multiple processing units |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106506351A (en) |
WO (1) | WO2017041509A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111327445B (en) * | 2018-12-17 | 2023-09-12 | 中兴通讯股份有限公司 | Message sampling method, message unpacking method, node, system and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1964322A (en) * | 2006-11-24 | 2007-05-16 | 南京大学 | A method for kilomega NIDS parallel processing based on NP and BS |
CN101610209A (en) * | 2008-11-28 | 2009-12-23 | 北京网康科技有限公司 | A kind of Network method for stream processing and equipment of multi-core parallel concurrent |
US20110078249A1 (en) * | 2009-09-28 | 2011-03-31 | International Business Machines Corporation | Shared address collectives using counter mechanisms |
CN102497297A (en) * | 2011-12-13 | 2012-06-13 | 曙光信息产业(北京)有限公司 | System and method for realizing deep packet inspection technology based on multi-core and multi-thread |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101141390A (en) * | 2007-07-17 | 2008-03-12 | 武汉烽火网络有限责任公司 | Novel self-defining ethernet out-of-band data packet filtering method and device |
CN103957157B (en) * | 2014-03-25 | 2017-03-22 | 中国人民解放军国防科学技术大学 | Route method for network interface to define forwarding rule |
-
2015
- 2015-09-07 CN CN201510566123.6A patent/CN106506351A/en not_active Withdrawn
-
2016
- 2016-05-17 WO PCT/CN2016/082356 patent/WO2017041509A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1964322A (en) * | 2006-11-24 | 2007-05-16 | 南京大学 | A method for kilomega NIDS parallel processing based on NP and BS |
CN101610209A (en) * | 2008-11-28 | 2009-12-23 | 北京网康科技有限公司 | A kind of Network method for stream processing and equipment of multi-core parallel concurrent |
US20110078249A1 (en) * | 2009-09-28 | 2011-03-31 | International Business Machines Corporation | Shared address collectives using counter mechanisms |
CN102497297A (en) * | 2011-12-13 | 2012-06-13 | 曙光信息产业(北京)有限公司 | System and method for realizing deep packet inspection technology based on multi-core and multi-thread |
Also Published As
Publication number | Publication date |
---|---|
CN106506351A (en) | 2017-03-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10652155B2 (en) | Universal cloud classification [UCC]as a service | |
TWI430102B (en) | Network adapter resources allocating method,storage medium,and computer | |
US10110671B2 (en) | Method, system, and device for managing server hardware resources in a cloud scheduling environment | |
CN107079060B (en) | System and method for carrier-level NAT optimization | |
JP7085565B2 (en) | Intelligent thread management across isolated network stacks | |
EP3079313B1 (en) | Data splitting method and splitter | |
WO2019042110A1 (en) | Subscription publication method, and server | |
US20190196875A1 (en) | Method, system and computer program product for processing computing task | |
US20190306231A1 (en) | Container cluster management | |
US9910687B2 (en) | Data flow affinity for heterogenous virtual machines | |
US11848981B2 (en) | Secure multi-directional data pipeline for data distribution systems | |
JP2017194979A (en) | Providing virtual security appliance architecture to virtual cloud infrastructure | |
US9009782B2 (en) | Steering traffic among multiple network services using a centralized dispatcher | |
US10212083B2 (en) | Openflow data channel and control channel separation | |
US20220210005A1 (en) | Synchronizing communication channel state information for high flow availability | |
US20230370421A1 (en) | Scaling ip addresses in overlay networks | |
US11947534B2 (en) | Connection pools for parallel processing applications accessing distributed databases | |
US10423433B2 (en) | Scoped network address pool management | |
WO2017041509A1 (en) | Packet sampling method and device based on multiple processing units | |
US10791088B1 (en) | Methods for disaggregating subscribers via DHCP address translation and devices thereof | |
CN112714903A (en) | Scalable cell-based packet processing service using client-provided decision metadata | |
US10855612B2 (en) | Suppressing broadcasts in cloud environments | |
US9762661B1 (en) | Managing networks in a virtualization system | |
US11916741B1 (en) | Discovery of application relationships in clusters | |
JP6923510B2 (en) | Flow pinning on server-on-chip |
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: 16843447 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 16843447 Country of ref document: EP Kind code of ref document: A1 |