Message processing method and network security device
By monitoring the CPU usage rate of the processing core in the network security device and carrying out packet-by-package load sharing processing, the problem of packet processing capacity reduction caused by a single large-traffic attack is solved, ensuring the stable operation of the device and the timely processing of data flow.
Patent Information
- Application Number
- CN202210650753.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-10
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2042-06-10
AI Technical Summary
When a network security device faces a single large traffic attack, the CPU usage rate of a single processing core is too high, resulting in a decrease in packet processing capacity and exhaustion of hardware cache resources, affecting the normal forwarding of other processing cores.
By monitoring the CPU usage rate of each processing core on the control plane, when the alarm condition is reached, an alarm event is sent to the driver and a packet-by-packet load sharing process is performed in the forwarding plane, the data flow of the target processing core is transferred to other processing cores for processing. , alleviate the pressure on hardware cache resources.
Effectively alleviates the decline in packet processing capabilities caused by large traffic attacks by a single processing core, avoids the problem of packet loss caused by insufficient resources of other processing cores, and ensures timely processing of data flows and network security equipment. Stable operation.
Smart Images

Figure CN115277057B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a message processing method and a network security device. Background Art
[0002] Deep Packet Inspection (DPI) is a deep inspection technology based on the data packets of each flow. It performs deep inspection on different network application layer loads (such as HTTP, DNS, etc.) and determines the legitimacy of the message by inspecting the payload of the message. Since the inspection is performed on the payload of a flow, the message forwarding mode is based on the core load sharing of the flow, that is, all messages of a flow of the same five-tuple must be reported to the same processing core, so that the processing core can process the received messages of the flow one by one.
[0003] Since DPI detection consumes a lot of computing resources because it detects the depth of message payload, after the network security device starts the DPI detection service, when a sudden single large flow attack occurs, it will exceed the seven-layer throughput capacity of the DPI service of a processing core in the network security device for a short time, causing the processing core to process traffic overload, and the driver will continuously receive messages but cannot get timely processing from the processing core, which will lead to a large number of cached messages consuming the memory resource mbuf within a certain period of time. Since mbuf resources are shared by all processing cores (limited by the underlying hardware architecture, it is impossible to configure independent mbuf resources for each processing core used for forwarding), when normal traffic arrives on other processing cores, the other processing cores cannot apply for mbuf resources and have to drop packets, thus affecting the forwarding of all processing cores.
[0004] Therefore, how to effectively deal with a single large flow and solve the problem of reduced message processing capability of a network security device due to a single processing core in the network security device being attacked by large flow is one of the technical issues worth considering. Summary of the invention
[0005] In view of this, the present application provides a message processing method and a network security device to effectively deal with a single large flow and solve the problem of reduced message processing capability of the network security device due to a single processing core in the network security device being attacked by a large flow.
[0006] Specifically, the present application is implemented through the following technical solutions:
[0007] According to a first aspect of the present application, a message processing method is provided, which is applied to a network security device, wherein the network security device includes an operating system, a driver, and multiple processing cores, and the method includes:
[0008] In the control plane, the operating system determines the CPU utilization of each processing core;
[0009] When the operating system detects that the CPU usage of the target processing core among the multiple processing cores meets the first alarm condition, the operating system sends an alarm event to the driver;
[0010] After the driver receives the alarm event on the control plane, if it is confirmed that the resource utilization rate of the current hardware cache resources meets the second alarm condition, the data flow corresponding to the target processing core is load-shared on a packet-by-packet basis on the forwarding plane, so that the data flow corresponding to the target processing core can be processed by other processing cores.
[0011] According to a second aspect of the present application, a network security device is provided, including an operating system, a driver, and multiple processing cores, wherein:
[0012] The operating system is used for determining the CPU usage of each processing core in the control plane; when it is detected that the CPU usage of a target processing core among the multiple processing cores meets the first alarm condition, sending an alarm event to the driver;
[0013] The driver is used to perform packet-by-packet load sharing processing on the data flow corresponding to the target processing core in the forwarding plane after the control plane receives the alarm event, if it is confirmed that the resource utilization rate of the current hardware cache resources meets the second alarm condition, so that the data flow corresponding to the target processing core can be processed by other processing cores.
[0014] Beneficial effects of the embodiments of the present application:
[0015] In the message processing method and network security device provided by the embodiment of the present application, in the control plane, the operating system determines the CPU usage of each processing core; then, when it is detected that the CPU usage of the target processing core among the multiple processing cores meets the first alarm condition, an alarm event is sent to the driver; in this way, after the driver receives the alarm event in the control plane, if it is confirmed that the resource usage of the current hardware cache resources meets the second alarm condition, the data flow corresponding to the target processing core is subjected to packet-by-packet load sharing processing in the forwarding plane, so that the data flow corresponding to the target processing core is processed by other processing cores. In this way, when the CPU usage of the target processing core in the network security device reaches the first alarm condition and the utilization rate of the hardware cache resources reaches the second alarm condition, that is, when the message processing pressure of the network security device is relatively large, the driver performs packet-by-packet load sharing processing on the data flow sent to the target processing core in the forwarding plane, so that other processing cores process the data flow, thereby alleviating the message processing pressure of the target processing core, and at the same time enabling the data flow to be processed in a timely manner, effectively solving the problem of the reduced message processing capability of the network security device caused by a single processing core in the network security device being attacked by large traffic. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a flowchart of a message processing method provided in an embodiment of the present application;
[0017] Figure 2 It is a flowchart of another message processing method provided in an embodiment of the present application;
[0018] Figure 3 It is a structural schematic diagram of a network security device provided in an embodiment of the present application;
[0019] Figure 4 It is a structural diagram of another network security device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application.
[0021] The terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more corresponding listed items.
[0022] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0023] The message processing method provided by this application is described in detail below.
[0024] See also Figure 1 , Figure 1 This is a flow chart of a message processing method provided by the present application, which is applied to a network security device, the network security device includes an operating system, a driver and multiple processing cores, and the interaction process between the operating system and the driver may include the following steps:
[0025] S101. On the control plane, the operating system determines the CPU usage of each processing core.
[0026] At present, network security devices are connected in series in the network. When IPS (intrusion prevention detection), AV (anti-virus) and application audit services are enabled, network security devices need to continuously perform in-depth detection on the traffic flowing through the device, and this detection mode is based on data flow, that is, security detection must be performed for each data flow. The device forwarding mode is generally based on the core load sharing mode of the data flow. Once the load pressure of a single processing core is too large, the mbuf resources of the entire network security device will be consumed, thereby affecting the message service processing and message forwarding performance of the network security device. In view of this, this step proposes that in the control plane, the operating system of the network security device monitors each processing core, that is, determines the CPU usage of each processing core.
[0027] S102: When the operating system detects that the CPU usage of a target processing core among the multiple processing cores meets a first alarm condition, the operating system sends an alarm event to the driver.
[0028] In this step, when the operating system detects that the CPU usage of the target processing core meets the alarm condition, it indicates that the current business processing volume of the target processing core is large, that is, it may encounter a scenario with a large data flow, which may cause more hardware cache resources mbuf to be occupied in the process of processing the business of the target processing core, and may cause other processing cores to be unable to process the business normally. In order to avoid this situation, this embodiment proposes that when it is determined that the CPU usage of the target processing core reaches the first alarm condition, an alarm event is sent to the driver.
[0029] Optionally, the first alarm condition may be, but is not limited to, that the CPU usage reaches a first set threshold, and the specific value of the first set threshold may be determined according to actual conditions.
[0030] It should be noted that when the operating system detects that the CPU usage of each processing core does not meet the alarm condition, the process of step S101 continues to be executed. The operating system can periodically execute step S101, that is, when the detection period arrives, execute the message processing process provided in this embodiment.
[0031] Optionally, the detection period may be, but is not limited to, set in seconds, and may be specifically configured according to actual conditions. This embodiment does not limit the specific value of the detection period.
[0032] It should be noted that the above-mentioned target processing core can be any processing core in the security network device.
[0033] S103. After the driver receives the alarm event on the control plane, if it is confirmed that the resource utilization rate of the current hardware cache resources meets the second alarm condition, the data flow corresponding to the target processing core is load-shared packet by packet on the forwarding plane so that the data flow corresponding to the target processing core can be processed by other processing cores.
[0034] In this step, after the driver receives the alarm event sent by the operating system, in order to avoid insufficient hardware cache resources and affect the message processing performance of the processing core in the network security device, this step proposes that the driver first confirms the resource utilization rate of the current hardware cache resources. When it is confirmed that the resource utilization rate meets the second alarm condition, it indicates that the current hardware cache resource utilization rate of the network security device is relatively high, and there may be insufficient hardware cache resources, which in turn affects the message processing performance of the processing core. In view of this, this embodiment proposes that when the driver confirms that the resource utilization rate of the hardware cache resources meets the second alarm condition, the data flow that is originally to be sent to the target processing core is load-shared on a packet-by-packet basis on the forwarding plane, so that other processing cores can forward the data flow corresponding to the target processing core. In this way, the data flow of the target processing core is prevented from occupying too many hardware cache resources, and at the same time, other processing cores and the target processing core on the network security device that are assigned to process the traffic of the target processing core can process the data flow of the target processing core in a timely manner, thereby ensuring that the hardware cache resources are gradually released, relieving the message cache pressure of the hardware cache resources, and at the same time avoiding the problem of the network security device's message processing capability being reduced due to a large flow attack on a single processing core of the network security device. At the same time, the mbuf resources occupied by the target processing core are reduced, thereby avoiding the occurrence of packet loss problems caused by insufficient available mbuf resources in other processing cores.
[0035] It is worth noting that the second alarm condition may be, but is not limited to, the resource usage rate reaching a second set threshold. The value of the second set threshold may be configured according to actual conditions, and this embodiment does not limit its value.
[0036] It should be noted that the data stream corresponding to the above-mentioned target processing core can be understood as the data stream that needs to be sent to the target processing core after the driver reads the data stream from the network card and identifies it.
[0037] By implementing the message processing method provided by the present application, in the control plane, the operating system determines the CPU usage of each processing core; then, when it is detected that the CPU usage of the target processing core among the multiple processing cores meets the first alarm condition, an alarm event is sent to the driver; in this way, after the driver receives the alarm event in the control plane, if it is confirmed that the resource usage of the current hardware cache resources meets the second alarm condition, the data flow corresponding to the target processing core is subjected to packet-by-packet load sharing processing in the forwarding plane, so that the data flow corresponding to the target processing core is processed by other processing cores. In this way, when the CPU usage of the target processing core in the network security device reaches the first alarm condition and the utilization rate of the hardware cache resources reaches the second alarm condition, that is, when the message processing pressure of the network security device is relatively large, the driver performs packet-by-packet load sharing processing on the data flow sent to the target processing core in the forwarding plane, so that other processing cores process the data flow, thereby alleviating the message processing pressure of the target processing core, and enabling the data flow to be processed in a timely manner, effectively solving the problem of the reduced message processing capability of the network security device caused by a single processing core in the network security device being attacked by large traffic.
[0038] Optionally, when the forwarding plane performs packet-by-packet load sharing processing on the data flow corresponding to the target processing core so that the data flow corresponding to the target processing core is processed by other processing cores, the CPU usage of each processing core in the current situation can be determined, and then the processing core with a CPU usage lower than a third set threshold is allowed to process the data flow corresponding to the target processing core. Specifically, the data flow sent to the target processing core can be cached in a public message queue, so that other processing cores can poll and read the network message of the data flow in the public message queue, and then perform corresponding processing on the network message.
[0039] Optionally, based on the above embodiment, the message processing method provided in this embodiment may also include the following process: driving to set a first mark for the target processing core, wherein the first mark is used to indicate that a packet-by-packet load sharing method is adopted for the data flow of the target processing core.
[0040] On this basis, the data stream corresponding to the target processing core can be load shared packet by packet in the forwarding plane in step S103 according to the following process, so that the data stream corresponding to the target processing core can be processed by other processing cores: if the driver receives the data stream, if it is confirmed that the processing core corresponding to the data stream is the target processing core, then when the first mark of the target processing core is read, the data stream is processed separately by other processing cores using packet by packet load sharing.
[0041] Specifically, when the operating system sends an alarm event, in order to facilitate the driver to know which processing core has a high usage rate, the core identifier of the target processing core will be written in the alarm event; in this way, in the control plane, when the driver receives the alarm event, it can parse the core identifier from the alarm event, and then set the first tag for the processing core corresponding to the core identifier, that is, the target processing core, to characterize the packet-by-packet load sharing; in this way, when forwarding data streams in the forwarding plane, the driver can identify the data stream after receiving the data stream, and after identifying the processing core that needs to process the data stream, it can determine whether the first tag corresponding to the processing core can be read. When the first tag is read, it indicates that the current CPU usage rate of the processing core is high and the resource usage rate of the hardware cache resources is also high. In order to better process the data stream of the processing core, the data stream sent to the processing core can be shared to other processing cores in a packet-by-packet load sharing manner, so that the data stream can be processed by other processing cores.
[0042] Specifically, each processing core corresponds to a storage space, and the first mark of the processing core can be recorded at the corresponding position of the storage space, that is, when the driver receives the alarm event of the target processing core, when it is confirmed that the resource utilization rate of the hardware cache resources meets the second alarm condition, the first mark can be written into the storage space corresponding to the target processing core. In this way, in the forwarding plane, when the driver receives the data stream, it can identify the data stream information to identify the processing core used to process the data stream. If the identified processing core is the target processing core, it is confirmed from the corresponding position of the storage space corresponding to the target processing core whether the first mark can be read. When the first mark is read, the data stream corresponding to the target processing core is subjected to packet-by-packet load sharing processing in the forwarding plane, so that the data stream corresponding to the target processing core can be processed by other processing cores. In this way, the data flow of the target processing core can be processed in a timely manner, thereby not causing the problem of decreased message processing performance in the network security device. Moreover, since the data flow of the target processing core is shared by other processing cores and the target processing core, the processing is timely enough, which can also alleviate the cache pressure of the hardware cache resources, thereby avoiding the situation where the hardware cache resources cannot cache the messages of other processing cores.
[0043] In addition, in order to facilitate the forwarding plane's processing of the data flow of the target processing core, the driver can also maintain a tag list, and then record the correspondence between the core identifier of the processing core that generates the alarm and the first tag in the tag list. That is, when the operating system determines that the CPU usage of the target processing core reaches the first alarm condition, when sending an alarm event to the driver, it can carry the core identifier of the target processing core in the alarm event. In this way, after receiving the alarm event, the driver can parse the core identifier from the alarm event, and then write the correspondence between the core identifier of the target processing core and the first tag in the tag list.
[0044] On this basis, on the forwarding plane, after receiving the data stream, if the driver confirms that the processing core corresponding to the data stream is the target processing core, it can first read from the tag list whether the target processing core has the first tag. When the first tag of the target processing core is successfully read, the data stream is processed separately by other processing cores in a packet-by-packet load sharing manner.
[0045] It should be noted that the specific value of the above-mentioned first mark can be configured according to actual conditions, and this application does not limit its specific value.
[0046] Optionally, based on any of the above embodiments, in this embodiment, it is also possible to execute Figure 2 The process of the message processing method shown is:
[0047] S201: On the control plane, the operating system reconfirms the CPU usage of the target processing core.
[0048] In this step, since each processing core has its own traffic to process, it will generally not process the data flow of other processing cores under normal circumstances. In view of this, in order to avoid the situation where other processing cores need to always process the data flow of the target processing core, this embodiment provides that the operating system will continue to confirm the CPU usage of the target processing core in the control plane.
[0049] S202: When the operating system detects that the CPU usage of the target processing core does not satisfy the first alarm condition, the operating system sends a recovery event to the driver.
[0050] In this step, when the operating system confirms that the CPU usage of the target processing core does not meet the first alarm condition after a period of time, it indicates that the target processing core is executing Figure 1 After the process shown, the CPU usage of the target processing core is alleviated, indicating that the target processing core can process the data stream that is originally required to be processed by the target processing core. At this time, the operating system will send a recovery event for the target processing core to the driver.
[0051] It should be noted that, when it is confirmed that the CPU usage of the target processing core is not higher than the first set threshold, it can be confirmed that the CPU usage of the target processing core does not meet the first alarm condition.
[0052] It should be noted that the operating system detects the CPU usage of the target processing core while also detecting the CPU usage of other processing cores. When the CPU usage of other processing cores meets the first alarm condition, the operation is executed. Figure 1When the CPU usage of other processing cores does not meet the first alarm condition, the other processing cores that do not meet the alarm condition are the above-mentioned target processing cores, and the execution process can refer to the processing process for the target processing core, that is, Figure 2 The processes shown will not be described in detail here.
[0053] S203: After receiving the recovery event, if the driver determines that the resource usage rate of the current hardware cache resources does not meet the second alarm condition, the driver performs flow-by-flow load balancing processing on the data flow corresponding to the target processing core in the forwarding plane.
[0054] In this step, after receiving the recovery event for the target processing core, the driver can also confirm whether the resource utilization rate of the current hardware cache resources meets the second alarm condition. When the second alarm condition is not met, it indicates that the hardware cache resources in the network security device are relatively idle, and the network messages of the data streams that need to be processed by each processing core in the network security device can continue to be cached. Then, in the forwarding plane, after receiving the data stream, if the driver identifies that the processing core of the data stream is the target processing core, the data stream can be load-shared by stream, that is, the received data stream is processed by the target processing core. In this way, when the hardware cache resources of the network security device are sufficient and the CPU utilization rate of the target processing core is not high, the data stream originally processed by the target processing core continues to be forwarded to the target processing core by stream, thereby ensuring the full utilization of each processing core and avoiding the situation where one processing core has a large load sharing, and also better ensuring the normal processing of the data streams of each processing core, thereby ensuring the message processing performance of the network security device and maximizing the full utilization of the hardware cache resources therein without causing a large cache burden.
[0055] In addition, if it is confirmed that the resource utilization rate of the current hardware cache resources meets the second alarm condition, the data flow corresponding to the target processing core continues to be load-shared packet by packet on the forwarding plane so that the data flow corresponding to the target processing core can be processed by other processing cores.
[0056] Specifically, when it is confirmed that the resource utilization rate of the current hardware cache resources meets the second alarm condition, it indicates that the current hardware cache resources are still insufficient. At this time, in order to further alleviate the hardware cache resources, the target processing core and other processing cores can continue to jointly process the data flow of the target processing core, thereby further releasing the hardware cache resources. At the same time, the driver will wait for the set time. When the set time is reached, the resource utilization rate of the hardware cache resources can be confirmed again. When the resource utilization rate of the hardware cache resources does not meet the second alarm condition, the data flow corresponding to the target processing core is load-shared on a stream-by-stream basis in the forwarding plane. This can better ensure the processing performance of messages in network security devices and the full use of hardware cache resources.
[0057] Optionally, based on the above embodiments, the message processing method proposed in this embodiment may also include the following process: driving to clear the first mark of the target processing core and setting a second mark for the target processing core, wherein the second mark is used to indicate that a packet-by-packet load sharing method is adopted for the data flow of the target processing core.
[0058] On this basis, the step of performing flow-by-flow load balancing processing on the data flow corresponding to the target processing core in the forwarding plane in step S203 can be executed according to the following process: after receiving the data flow, if the driver confirms that the processing core corresponding to the data flow is the target processing core, then when the second mark of the target processing core is read, the data flow is processed by flow-by-flow load balancing.
[0059] Specifically, in one embodiment, when the driver maintains a tag list, when the operating system sends a recovery event, it will carry the core identifier of the target processing core. In this way, after receiving the recovery event, the driver can parse the core identifier from the recovery event, and then delete the corresponding relationship between the core identifier and the first tag in the tag list, thereby clearing the first tag, and at the same time write the corresponding relationship between the core identifier and the second tag in the tag list, which is equivalent to replacing the first tag with the second tag, thereby achieving the purpose of setting the second tag for the target processing core.
[0060] On this basis, after receiving the data stream, if the driver confirms that the processing core corresponding to the data stream is the target processing core, it can first read from the tag list whether the target processing core has the second tag, that is, based on the core identifier of the target processing core, confirm whether the corresponding second tag can be read from the tag list. When the second tag is read, it indicates that the current CPU usage of the target processing core is not high. At this time, the data stream is processed by stream-by-stream load sharing. In this way, it is ensured that the same data stream is shared to the target processing core in a stream-by-stream manner, thereby ensuring the continuity of the data stream; in addition, it can also relieve the message processing pressure of other processing cores, or when the CPU usage of the target processing core is not high, it can also bear the data stream of other processing cores, thereby ensuring the message processing performance of the network security device and relieving the cache pressure of the hardware cache resources.
[0061] In another embodiment, when the first mark of the target processing core is written to the storage space corresponding to the target processing core, after the driver parses the core identifier from the received recovery event, the first mark stored in the storage space corresponding to the target processing core corresponding to the core identifier can be cleared, and the second mark can be written at the corresponding position. On this basis, after receiving the data stream, if the driver confirms that the processing core corresponding to the data stream is the target processing core, it can first confirm whether the second mark can be read from the storage space corresponding to the target processing core. When the second mark is read, it indicates that the current CPU usage of the target processing core is not high. At this time, the data stream is processed in a stream-by-stream load sharing manner. In this way, it is ensured that the same data stream is shared to the target processing core in a stream-by-stream manner, thereby ensuring the continuity of the data stream; in addition, it can also alleviate the message processing pressure of other processing cores, or when the CPU usage of the target processing core is not high, it can also bear the data stream of other processing cores, thereby ensuring the message processing performance of the network security device, and at the same time alleviating the cache pressure of the hardware cache resources.
[0062] When the second tag is not read, or the first tag can still be read, the data flow corresponding to the target processing core continues to be processed in a packet-by-packet load sharing manner.
[0063] Optionally, based on any of the above embodiments, in this embodiment, if the operating system confirms that the CPU usage of the target processing core does not meet the first alarm condition, when the waiting time reaches the set time, the step of determining the CPU usage of each processing core is performed again;
[0064] Furthermore, on the forwarding plane, after receiving the data flow, if the driver confirms that the data flow is a data flow sent to the target processing core, it confirms whether the resource utilization rate of the current hardware cache resources meets the second alarm condition; if the second alarm condition is met, the data flow of the target processing core is load-balanced on a flow-by-flow basis on the forwarding plane, and the data flows of other processing cores whose CPU utilization rates meet the first alarm condition are processed; if the second alarm condition is not met, the data flow of the target processing core is load-balanced on a flow-by-flow basis on the forwarding plane.
[0065] Specifically, after executing step S101, if it is confirmed that the CPU usage of each processing core in the network security device does not meet the first alarm condition, it indicates that the CPU of each processing core currently has sufficient capacity to process the data flow. At this time, the operating system will wait for execution. When the waiting time reaches the set time, it will execute step S101 again. On this basis, after the forwarding plane receives the data flow, it can continue to confirm whether the resource utilization rate of the current hardware cache resources reaches the second alarm condition. When the second alarm condition is reached, since the current CPU utilization rate of the target processing core is not high, the data flow can be written into the message cache queue corresponding to the target processing core at this time, and then the target processing core processes the data flow; at the same time, since the CPU utilization rate of the target processing core is not high, and the current resource utilization rate of the hardware cache resources is relatively high, the target processing core can process the data flow of other processing cores whose CPU utilization rate meets the first alarm condition at this time, that is, the target processing core can read the data flow from the public cache queue while processing the message in its own message cache queue, so as to realize the processing of the data flow of other processing cores with relatively high CPU utilization, thereby alleviating the cache pressure of the hardware cache resources, and at the same time ensuring the timely processing of the data flow of other processing cores. When the CPU usage of each processing core in the network security device is not high (does not meet the first alarm condition) and the resource usage of the current hardware cache resources is not high (does not meet the second alarm condition), each processing core processes the data flow that needs to be processed in the forwarding plane. In this way, the processing performance of the message in the network security device is guaranteed while ensuring sufficient CPU resources and hardware cache resources, and the hardware cache resources are fully utilized, and there is no cache pressure on the hardware cache resources.
[0066] Based on the same inventive concept, the present application also provides a network security device for implementing the above message processing method. Figure 3 , Figure 3 is a schematic diagram of a network security device provided by an exemplary embodiment of the present application, including: an operating system 301, a driver 302 and multiple processing cores (refer to Figure 3 Processing core 1 to processing core n), where:
[0067] The operating system 301 is used in the control plane, wherein the operating system determines the CPU usage of each processing core; when it is detected that the CPU usage of a target processing core among the multiple processing cores meets the first alarm condition, an alarm event is sent to the driver;
[0068] The above-mentioned driver 302 is used to perform packet-by-packet load sharing processing on the data flow corresponding to the target processing core in the forwarding plane after the control plane receives the alarm event, if it is confirmed that the resource utilization rate of the current hardware cache resources meets the second alarm condition, so that the data flow corresponding to the target processing core can be processed by other processing cores.
[0069] Optionally, the above driver includes a control module 3021 of the control plane and a service processing module 3022 of the forwarding plane, please refer to Figure 4 As shown, where:
[0070] The operating system 301 is specifically used to send an alarm event to the control module 3021, wherein the alarm event includes a core identifier of the target processing core;
[0071] The control module 3021 is used to set a first mark for the target processing core based on the core identifier, wherein the first mark is used to indicate that a packet-by-packet load sharing mode is adopted for the data flow of the target processing core;
[0072] The business processing module 3022 is used to, after receiving the data flow on the forwarding plane, if it is confirmed that the processing core corresponding to the data flow is the target processing core, then when the first mark of the target processing core is read, the data flow is processed separately by other processing cores in a packet-by-packet load sharing manner.
[0073] Specifically, after the control plane receives the alarm event, the control module 3021 will parse the core identifier of the target processing core from the alarm event, and then set a first tag for the target processing core, and then write the correspondence between the core identifier of the target processing core and the first tag into the tag list, or write the first tag of the target processing core into the storage space corresponding to the target processing core. The storage space can be applied for and maintained in advance for each processing core by the control module 3021. On this basis, after the business processing module 3022 receives the data stream in the forwarding plane, when it is confirmed that the data stream is a data stream sent to the target processing core, it can read the first tag from the tag list or the storage space corresponding to the target processing core. When the first tag is successfully read, the data stream is processed by other processing cores respectively in a packet-by-packet load sharing manner.
[0074] Optionally, based on any of the above embodiments, in this embodiment, the above operating system 301 is further used to reconfirm the CPU usage of the target processing core on the control plane; when it is detected that the CPU usage of the target processing core does not meet the first alarm condition, send a recovery event to the driver;
[0075] The driver 302 is further configured to, after receiving the recovery event, perform flow-by-flow load balancing processing on the data flow corresponding to the target processing core in the forwarding plane if it is confirmed that the resource utilization rate of the current hardware cache resources does not meet the second alarm condition.
[0076] Specifically, the processing process of the operating system 301 and the driver 302 is the specific implementation process of the above-mentioned corresponding method embodiment, and will not be described in detail here.
[0077] Optionally, based on the above embodiment, the driver 302 in this embodiment includes a control module 3021 of the control plane and a service processing module 3022 of the forwarding plane, and also refer to Figure 4 shown.
[0078] On this basis, the operating system 301 is specifically used to send the recovery event to the control module 3021, and the recovery event includes the core identifier of the target processing core;
[0079] The control module 3021 is used for clearing the first mark of the target processing core and setting a second mark for the target processing core after the control plane receives the recovery event, based on the core identifier in the recovery event, wherein the second mark is used to indicate that a packet-by-packet load sharing mode is adopted for the data flow of the target processing core;
[0080] The business processing module 3022 is used to process the data flow in a flow-by-flow load sharing manner after the forwarding plane receives the data flow and confirms that the processing core corresponding to the data flow is the target processing core, and then when the second tag of the target processing core is read.
[0081] Specifically, after the control plane receives the recovery event, the control module 3021 will parse the core identifier of the target processing core from the recovery event, and then clear the correspondence between the core identifier of the target processing core and the first tag in the tag list, and write the correspondence between the core identifier of the target processing core and the second tag; or, clear the first tag from the storage space corresponding to the target processing core, and write the second tag. In this way, after the business processing module 3022 receives the data stream on the forwarding plane, if it identifies the processing core of the data stream as the target processing core, it can read the second tag from the tag list or the storage space corresponding to the target processing core. When the second tag is read, the data stream is processed in a stream-by-stream load sharing manner. For detailed description, please refer to the corresponding description in the method embodiment, which will not be described in detail here.
[0082] Optionally, based on the above embodiment, in this embodiment, the above driver 302 is also used to continue to perform packet-by-packet load sharing processing on the data flow corresponding to the target processing core in the forwarding plane if it is confirmed that the resource utilization rate of the current hardware cache resources meets the second alarm condition, so that the data flow corresponding to the target processing core can be processed by other processing cores.
[0083] Specifically, when the driver 302 includes Figure 4 When the control module 3021 and the business processing module 3022 are shown, after receiving the recovery event, the control module 3021 confirms that the resource utilization rate of the current hardware cache resources meets the second alarm condition, which indicates that the cache pressure of the current hardware cache resources is relatively large. At this time, the data stream corresponding to the target processing core continues to be load shared packet by packet, so that other processing cores can process the data stream corresponding to the target processing core, thereby reducing the cache pressure of the hardware cache resources.
[0084] Optionally, based on any of the above embodiments, in this embodiment, the above operating system 301 is further used for, if it is confirmed that the CPU usage of the target processing core does not meet the first alarm condition, when the waiting time reaches a set time, again executing the step of determining the CPU usage of each processing core;
[0085] The driver 302 is also used to, after receiving the data stream, if it is confirmed that the data stream is a data stream sent to the target processing core, confirm whether the resource utilization rate of the current hardware cache resources meets the second alarm condition; if the second alarm condition is met, the data stream of the target processing core is load-balanced on a stream-by-stream basis in the forwarding plane, and the data streams of other processing cores whose CPU utilization rates meet the first alarm condition are processed; if the second alarm condition is not met, the data stream of the target processing core is load-balanced on a stream-by-stream basis in the forwarding plane.
[0086] Specifically, when the driver 302 includes Figure 4 In the control module 3021 and the service processing module 3022 shown, when the CPU utilization rate of the target processing core is not high, there may be a situation where the CPU utilization rate of other processing cores is relatively high, which leads to a relatively high resource utilization rate of the hardware cache resources. Based on this, the control module 3021 will regularly confirm the resource utilization rate of the current hardware cache resources in the network security device. When the resource utilization rate is high, the third mark can be configured for the target processing core to indicate that the target processing core processes the data streams of other processing cores. In this way, in the forwarding plane, when the service processing module 3022 confirms that the received data stream is the data stream of the target processing core, it can confirm whether the mark can be read. When the third mark is read, the data stream is written to the message queue corresponding to the target processing core, so that the target processing core processes the data stream stream by stream. At the same time, since the CPU utilization rate of the target processing core is not high, at this time, the target processing core can read the data stream from the public message queue to relieve the message processing pressure of other processing cores and the cache pressure of hardware cache resources. When no tag is read, the data stream is written into the message queue corresponding to the target processing core, so that the target processing core processes the data stream stream by stream.
[0087] By providing the above-mentioned security network device, not only the situation of occupying more mbuf resources when the CPU usage of the processing core is high is avoided, but also the purpose of effectively coping with a single large flow is achieved. At the same time, the problem of the reduced message processing capability of the network security device caused by a single processing core in the network security device being attacked by a large flow is solved. At the same time, the ability of the network security device to resist single-core attacks is strengthened, avoiding the situation where the forwarding of the entire network is blocked due to an attack on a single core of the network security device.
[0088] Based on the same inventive concept, this embodiment also provides a machine-readable storage medium, which stores a computer program. When called and executed by an operating system and / or a driver, the computer program prompts the processor to execute the message processing method provided in any of the above embodiments of the present application.
[0089] The machine-readable storage medium may be a memory, which may include a random access memory (RAM), a DDR SRAM (Double Data Rate Synchronous Dynamic Random Access Memory), or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor.
[0090] As for the machine-readable storage medium embodiment, since the method content involved is basically similar to the aforementioned method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0091] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0092] The implementation process of the functions and effects of each unit / module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0093] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are merely schematic, wherein the units / modules described as separate components may or may not be physically separated, and the components displayed as units / modules may or may not be physical units / modules, that is, they may be located in one place, or they may be distributed on multiple network units / modules. Some or all of the units / modules may be selected according to actual needs to achieve the purpose of the present application. A person of ordinary skill in the art can understand and implement it without creative work.
[0094] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A message processing method, It is characterized in that Applied to a network security device, the network security device includes an operating system, a driver, and multiple processing cores, and the method includes: In the control plane, the operating system determines the CPU utilization of each processing core; When the operating system detects that the CPU usage of the target processing core among the multiple processing cores meets the first alarm condition, the operating system sends an alarm event to the driver; After the driver receives the alarm event on the control plane, if it is confirmed that the resource utilization rate of the current hardware cache resources meets the second alarm condition, the data flow corresponding to the target processing core is load-shared on a packet-by-packet basis on the forwarding plane, so that the data flow corresponding to the target processing core is processed by the target processing core and other processing cores.
2. The method according to claim 1, It is characterized in that Also includes: The driver sets a first mark for the target processing core, where the first mark is used to indicate that a packet-by-packet load sharing mode is adopted for the data flow of the target processing core; Performing packet-by-packet load sharing processing on the data flow corresponding to the target processing core on the forwarding plane, so that the data flow corresponding to the target processing core is processed by the target processing core and other processing cores, including: If the driver receives a data stream and confirms that the processing core corresponding to the data stream is the target processing core, then when the first mark of the target processing core is read, the target processing core and other processing cores will process the data stream respectively using a packet-by-packet load sharing method.
3. The method according to claim 1, It is characterized in that Also includes: On the control plane, the operating system reconfirms the CPU usage of the target processing core; When the operating system detects that the CPU usage of the target processing core does not meet the first alarm condition, the operating system sends a recovery event to the driver; After receiving the recovery event, if the driver determines that the resource usage rate of the current hardware cache resources does not meet the second alarm condition, the driver performs flow-by-flow load balancing processing on the data flow corresponding to the target processing core in the forwarding plane.
4. The method according to claim 3, It is characterized in that Also includes: The driver clears the first mark of the target processing core and sets a second mark for the target processing core, wherein the second mark is used to indicate that a flow-by-flow load sharing mode is adopted for the data flow of the target processing core; Performing flow-by-flow load balancing processing on the data flow corresponding to the target processing core on the forwarding plane includes: After receiving the data stream, if the driver confirms that the processing core corresponding to the data stream is the target processing core, then when the second tag of the target processing core is read, the driver processes the data stream in a stream-by-stream load sharing manner.
5. The method according to claim 3, It is characterized in that If it is confirmed that the resource utilization rate of the current hardware cache resources meets the second alarm condition, the data flow corresponding to the target processing core continues to be load-shared packet by packet on the forwarding plane, so that the data flow corresponding to the target processing core is processed by the target processing core and other processing cores.
6. The method according to claim 1, It is characterized in that If the operating system determines that the CPU usage of the target processing core does not meet the first alarm condition, when the waiting time reaches the set time, the step of determining the CPU usage of each processing core is performed again; After receiving the data stream, if the driver confirms that the data stream is a data stream sent to the target processing core, then confirming whether the resource usage rate of the current hardware cache resource meets the second alarm condition; If the second alarm condition is not met, performing flow-by-flow load sharing processing on the data flow of the target processing core in the forwarding plane, so that the target processing core processes the data flow, and the target processing core processes the data flow of other processing cores whose CPU usage meets the first alarm condition; If the second alarm condition is met, a packet-by-packet load balancing process is performed on the data flow of the target processing core on the forwarding plane.
7. A network security device, It is characterized in that Includes operating system, driver and multiple processing cores, including: The operating system is used for determining the CPU usage of each processing core in the control plane; when it is detected that the CPU usage of a target processing core among the multiple processing cores meets the first alarm condition, sending an alarm event to the driver; The driver is used to perform packet-by-packet load sharing processing on the data flow corresponding to the target processing core in the forwarding plane after the control plane receives the alarm event, if it is confirmed that the resource utilization rate of the current hardware cache resources meets the second alarm condition, so that the data flow corresponding to the target processing core can be processed by the target processing core and other processing cores.
8. The network security device according to claim 7, It is characterized in that The driver includes a control module of the control plane and a service processing module of the forwarding plane; The operating system is specifically used to send an alarm event to the control module, wherein the alarm event includes a core identifier of the target processing core; The control module is used to set a first mark for the target processing core based on the core identifier, wherein the first mark is used to indicate that a packet-by-packet load sharing mode is adopted for the data flow of the target processing core; The business processing module is used to, after receiving the data flow on the forwarding plane, if it is confirmed that the processing core corresponding to the data flow is the target processing core, then when the first mark of the target processing core is read, the data flow is processed respectively by the target processing core and other processing cores in a packet-by-packet load sharing manner.
9. The network security device according to claim 7, It is characterized in that The operating system is further used to reconfirm the CPU usage of the target processing core on the control plane; when it is detected that the CPU usage of the target processing core does not meet the first alarm condition, send a recovery event to the driver; The driver is also used to, after receiving the recovery event, perform flow-by-flow load balancing processing on the data flow corresponding to the target processing core in the forwarding plane if it is confirmed that the resource utilization rate of the current hardware cache resources does not meet the second alarm condition.
10. The network security device according to claim 9, It is characterized in that The driver includes a control module of the control plane and a service processing module of the forwarding plane; The operating system is specifically used to send the recovery event to the control module, wherein the recovery event includes a core identifier of the target processing core; The control module is used for clearing the first mark of the target processing core and setting a second mark for the target processing core after the control plane receives the recovery event, based on the core identifier in the recovery event, wherein the second mark is used to indicate that a flow-by-flow load sharing mode is adopted for the data flow of the target processing core; The service processing module is used to process the data flow in a flow-by-flow load sharing manner after the forwarding plane receives the data flow and confirms that the processing core corresponding to the data flow is the target processing core. When the second tag of the target processing core is read, the data flow is processed.
11. The network security device according to claim 9, It is characterized in that The driver is also used to continue to perform packet-by-packet load sharing processing on the data flow corresponding to the target processing core in the forwarding plane if it is confirmed that the resource utilization rate of the current hardware cache resources meets the second alarm condition, so that the data flow corresponding to the target processing core can be processed by the target processing core and other processing cores.
12. The network security device according to claim 7, It is characterized in that The operating system is further configured to, if it is confirmed that the CPU usage of the target processing core does not meet the first alarm condition, execute again the step of determining the CPU usage of each processing core when the waiting time reaches a set time; The driver is also used to, after receiving the data stream, if it is confirmed that the data stream is a data stream sent to the target processing core, confirm whether the resource utilization rate of the current hardware cache resources meets the second alarm condition; if the second alarm condition is not met, then the data stream of the target processing core is load-balanced on a stream-by-stream basis in the forwarding plane, so that the target processing core processes the data stream, and the target processing core processes the data streams of other processing cores whose CPU utilization rates meet the first alarm condition; if the second alarm condition is met, then the data stream of the target processing core is load-balanced on a packet-by-packet basis in the forwarding plane.
