Background technology
Along with the appearance of the increasingly extensive of network application and some new network technologies, network traffics control has become a problem demanding prompt solution, people to begin to seek the method that some solve allocated bandwidth and management with Bandwidth Management.
The general TC (Traffic Control) that adopts carries out flow control in the (SuSE) Linux OS, and TC realizes flow control by set up a formation at the output port place.The basic principle of the flow control of Linux as shown in Figure 1.
Fig. 1 is the schematic block diagram that the network traffics control device 10 (for example, network interface card) according to prior art is shown.Network traffics control device 10 according to prior art comprises input interface 11, flow restriction (Ingress Policing) module 12, input demultplexer (input De-Multiplexing) 13, forwarding module 14, output work queue's module 15 and output interface 16.
Input interface 11 receives the flow that comprises a plurality of packets and sends this flow to flow restriction module 12.Flow restriction module 12 abandons against regulation packet and sends remaining packet to input demultplexer 13.13 pairs of remaining packets of input demultplexer are judged, if the destination of packet is this main frame then sends this packet to upper strata 20 (TCP, UDP etc.) to handle; If not then packet being sent to forwarding module 14.Forwarding module 14 comes next redirect of specified data bag by checking routing table.In addition, forwarding module 14 also can be from this main frame upper strata 20 receives the bag that produces.15 pairs of packets of output work queue's module are arranged packet is sent to output interface 16.Output interface 16 output flows.
In the Linux of prior art flow control, generally can only limit the packet that network interface card sends, can not limit the packet that network interface card receives.
In addition, in the prior art, can not control by input interface and enter the flow that system transfers to the CPU processing, can not obtain Based Intelligent Control owing to enter the flow of CPU processing, so it is busy to cause CPU to continue easily.
Summary of the invention
In order to solve the above-mentioned problems in the prior art, the invention provides a kind of can the forwarding and handle the apparatus and method of carrying out elasticity control the flow of CPU.
According to embodiments of the invention, provide a kind of device of Controlled CPU flow.Described device comprises: input interface receives the flow that comprises a plurality of packets; The monitoring management module, the utilance of monitoring CPU, and determine the type of the packet that needs are transmitted and the type of the packet that need abandon based on the utilance of CPU; Flow-control module is judged the type of each packet in described a plurality of packet, and abandons the packet of the type that belongs to the packet that need abandon based on definite result of monitoring management module; Forwarding module is determined next redirect of remaining packet by checking routing table.
In addition, the monitoring management module determine with the type corresponding priorities of each packet and with the utilance corresponding priorities of described CPU, the flow-control module loss priority is lower than the packet with described cpu busy percentage corresponding priorities.
In addition, flow-control module is ranked to remaining packet according to the definite priority of monitoring management module.
In addition, flow-control module is judged the type of each packet according to the mapping relations of QoS.
In addition, monitoring management module is determined the type of the packet that needs abandon according to the size of flow.
A kind of method of Controlled CPU flow is provided according to another embodiment of the present invention.Described method comprises step: receive the flow that comprises a plurality of packets; The utilance of monitoring CPU, and determine the type of the packet that needs are transmitted and the type of the packet that need abandon based on the utilance of CPU; Judge the type of each packet in described a plurality of packet, and based on determining that the result abandons the packet of the type that belongs to the packet that need abandon; Determine next redirect of remaining packet by checking routing table.
In addition, described method also comprises step: determine with the type corresponding priorities of each packet and with the utilance corresponding priorities of described CPU; Loss priority is lower than the packet with described cpu busy percentage corresponding priorities.
In addition, described method also comprises step: according to the priority that the monitoring management module is determined, remaining packet is ranked.
In addition, judge the type of each packet according to the mapping relations of QoS.
In addition, determine the type of the packet that needs abandon according to the size of flow.
According to embodiments of the invention, the flow of CPU transmitted carried out elasticity control, thereby CPU is in heavy-duty service for a long time when having avoided the excessive or cpu busy percentage of flow higher, has improved the disposal ability of CPU to greatest extent.
Embodiment
Now the embodiment of the invention is described in detail, its example shown in the accompanying drawings, wherein, identical label is represented same parts all the time.Below with reference to the accompanying drawings embodiment is described to explain the present invention.
In the network equipment (for example, network interface card, router etc.), the processing of each functional module is all realized by software or hardware mode by CPU.Handle (for example, flow is transmitted) because the network equipment mainly carries out flow, transmitting in the processing so CPU mainly consumes.
Fig. 2 is the block diagram according to network traffics control device 100 of the present invention.Network traffics control device 100 according to the present invention comprises input interface 110, monitoring management module 120, flow-control module 130, forwarding module 140 and output interface 150.
Input interface 110 receives the flow that comprises a plurality of packets and sends this flow to flow-control module 120.
System status parameters such as the disposal ability of 120 pairs of systems of monitoring management module, performance index are monitored, and accept the configuration management on upper strata, and the processing policy of flow-control module is set.
Flow-control module 130 is ranked to packet based on the type of the packet in the flow or the functional module under the packet in the flow, and based on the processing policy that monitoring management module 120 is provided with the packet of queuing is handled.
Forwarding module 140 is by checking next redirect of routing table specified data bag.
Output interface 150 output flows.
Below, describe operation example in detail according to network traffics control device of the present invention.
Monitoring management module 120 determines that according to the utilance of CPU needs are transmitted and the type of the packet that needs abandon, flow-control module 130 abandons the packet of the type that belongs to the packet that needs abandon according to definite result of monitoring management module 120, and the packet that only will belong to the type of the packet that needs transmit sends forwarding module 140 to.
Input interface 110 receives the flow that comprises a plurality of packets.At this, for convenience of explanation, suppose to have comprised in the flow packet (perhaps two types packet) that belongs to two functional modules, described two functional modules are respectively functional module A and functional module B.
The utilance of monitoring management module 120 monitoring CPU, and according to the utilance of CPU or user's the priority that definite functional module is set, for example, functional module A>functional module B.In addition, monitoring management module 120 is the set handling strategy also, the processing policy that is provided with is: at the cpu busy percentage height (for example, be higher than 80%) situation under, abandon the functional module that belongs to low priority (that is) packet, functional module B, only handle belong to high priority functional module (promptly, functional module A) packet, thus the utilance of CPU reduced; And under the situation of cpu busy percentage low (for example, being lower than 50%), handle the packet (that is, all packets) that belongs to all functions module, thereby improve the utilance of CPU.
In this case, monitoring management module 120 will be monitored in real time to the cpu busy percentage of system, if cpu busy percentage is higher than 80%, then in order to reduce the flow that CPU handles, monitoring management module 120 need to be determined only to transmit the packet that belongs to functional module A, abandons the packet that belongs to functional module B.Flow of receiving in the flow-control module 130 monitoring certain hours and the type of judging the packet that comprises in the flow.The type of the packet that the needs that flow-control module 130 is determined according to the monitoring management module are transmitted abandons the packet that belongs to functional module B, and the packet that only will belong to functional module A sends forwarding module to.
At this, the type that flow-control module 130 can come the specified data bag by QoS (service quality) mapping relations.In addition, flow-control module 130 can come the judgment data bag to belong to which functional module by the flow receiving port number or the message format of functional module.
In addition, flow-control module 130 can be based on the type or the described functional module corresponding priorities of packet packet being ranked.For example, the priority of data packets that belongs to functional module A is higher than the priority of data packets that belongs to functional module B, thereby priority treatment belongs to the packet of functional module A under identical condition.
Like this, the processing pressure of CPU will reduce, and the utilance of CPU also can descend thereupon.When monitoring management module 120 monitors cpu busy percentage when being lower than 50%, in order to increase cpu busy percentage, monitoring management module 120 is determined to need to transmit to belong to the packet of all functions module and be notified to flow-control module 130.The packet that flow-control module 130 will belong to all functions module sends forwarding module 140 to.
In addition, monitoring management module 120 can be provided with the type corresponding priorities with each packet, and the utilance corresponding priorities of definite and CPU.Flow-control module 130 loss prioritys are lower than the packet with the utilance corresponding priorities of CPU.
Like this, carry out dynamic adjustments, realized Based Intelligent Control for the CPU flow by the packet in the flow that CPU is handled.Under the situation that CPU does, transmit the packet of high priority; And under the situation that CPU is not in a hurry, all packets can both obtain transmitting.
In the above-described embodiment, determined the type of the packet that needs abandon according to the utilance of CPU.According to another embodiment of the present invention, also can determine the type of the packet that needs abandon according to flow.For example, when flow is higher than first threshold, need abandon the packet that belongs to functional module B, otherwise, when flow is lower than first threshold, determine to need to transmit all packets.
Fig. 3 is the flow chart according to method for controlling network flow of the present invention.
At step S310, input interface 110 receives the flow that comprises a plurality of packets and sends this flow to flow-control module 120.
At step S320, the utilance of monitoring management module 120 monitoring CPU, and based on the type of the definite packet that need transmit of the utilance of CPU and the type of the packet that need abandon.
At step S330, flow-control module 130 is judged the type of the packet in the flow that receives, and based on the determining of monitoring management module 120, abandons the packet of the type that belongs to the packet that need abandon and send remaining packet to forwarding module 140.
At step S340, forwarding module 140 is determined from next redirect of the packet of flow-control module 130 receptions by checking routing table.
According to embodiments of the invention, the flow of CPU transmitted carried out elasticity control, thereby CPU is in heavy-duty service for a long time when having avoided the excessive or cpu busy percentage of flow higher, has improved the disposal ability of CPU to greatest extent.
Though represented and described some embodiments of the present invention, it should be appreciated by those skilled in the art that under the situation that does not break away from the principle of the present invention that limits its scope by claim and equivalent thereof and spirit, can make amendment to these embodiment.