Embodiment
In order to make the embodiment of the invention clearer, earlier expandable route is done simple the introduction: consult Fig. 1, a plurality of control units (Control Element, CE) and a plurality of retransmission unit (Forwarding Element, FE) become a router by the inner high speed network interconnection, a plurality of routers are formed an expandable route.Method for allocating tasks that the follow-up embodiment of the invention proposes and device are based on this expandable route.
Embodiment one:
Consult Fig. 2, the embodiment of the invention one provides a kind of method for allocating tasks of expandable route distributed control plane, and this method comprises:
201, obtain each route task in the route set of tasks to the holding time sum of CPU, route task in the described route set of tasks is to remove border gateway protocol (Border Gateway Protocol, BGP) task and routing table management (Router Table Management, RTM) the route task beyond the task.
Wherein, the executive agent of each step of present embodiment can be SCE, when the SCE fault, is then carried out by BCE.
202, obtain the sum of control unit in the expandable route that the route task in the route set of tasks takies.
The control unit sum that route task in this step in the route set of tasks should take is the number that the sum of control unit in the expandable route deducts the shared control unit of BGP task and RTM task.
If the BGP task takies different control unit (being that BGP task and RTM task respectively take an independently control unit) with the RTM task, then the control unit sum that takies of the route task in the route set of tasks is that the control unit sum deducts 2 in the expandable route;
If BGP task and RTM task take same control unit (being that BGP task and RTM task take an independently control unit jointly), then the control unit sum that takies of the route task in the route set of tasks is that the sum of control unit deducts 1 in the expandable route.
203, according to the holding time sum of each route task, and the sum of control unit in the expandable route that takies, calculate the CPU average holding time of control unit in the expandable route to CPU.
The CPU average holding time of control unit equals the route task to the holding time sum of the CPU sum divided by control unit in its expandable route that takies in the expandable route in this step.
204, according to the CPU average holding time of control unit in the expandable route, the route task in the described route set of tasks is distributed.
SCE is with Task Distribution to the control unit of expandable route the time in this step, can therefore can guarantee the load balancing of each control unit of expandable route with the CPU average holding time of control unit in the expandable route as a reference.The mode subsequent embodiment that its concrete route task in the described route set of tasks is distributed will be described in detail.
The embodiment of the invention one is calculated the CPU average holding time of control unit in the expandable route, CPU average holding time by control unit in the reference expandable route, with a plurality of route Task Distribution to each control unit, guarantee the load balancing of each control unit in the expandable route, and do not need network manager's manual allocation task, save human resources.
Embodiment two:
Consult Fig. 3, the embodiment of the invention two provides a kind of method for allocating tasks of expandable route distributed control plane, and this method comprises:
301, the expandable route of configuring distributed control plane.
A plurality of control units and a plurality of retransmission unit are configured to a complete router by the inner high speed network interconnection, a plurality of routers are constituted the expandable route of distributed control plane by the inner high speed network interconnection.For example, can make up an expandable route that comprises four control units and 16 retransmission units, wherein each unit has an interface to be used for interconnected, and other interface is used for normal data forwarding.
302, a plurality of control units exchange resource each other, it comprises information such as the CPU holding time of this control unit and memory size, SCE and BCE are elected in inside.
Wherein, SCE is responsible for the route Task Distribution to each control unit in the embodiment of the invention, and administers and maintains whole expandable route; When the SCE fault, BCE replaces SCE to carry out the route Task Distribution, and administers and maintains whole expandable route.
303, SCE and all retransmission units obtain the interface message of each retransmission unit alternately, the IP address of the interface quantity of each retransmission unit, interface type and each retransmission unit and external device communication for example, and notify each retransmission unit IP address that it is used for communicating by letter in expandable route, so that retransmission unit is reported information to SCE.
304, the parallel operation router of each control unit in the control expandable route supports task.
The parallel operation router support task of each control unit in this step control expandable route is in order to guarantee that each control unit all has the function of router.
Wherein, router support task comprises: socket (socket), router functionalities such as message communicating, configuration management (being interface management), memory management, communication between plates, task management and IP transmitting-receiving support task.
305, budget route task is to the resource requirement and the degree of coupling of CPU in the expandable route.
The frequent degree that whether executive process communicated with one another and communicate with one another when wherein, the degree of coupling between the route task was meant two or more route tasks of execution.
Measure and the analysis showed that the BGP task of most of router need take for 60% CPU processing time when carrying out by real network, and when carrying out the BGP task, need frequently communicate by letter with RTM; Ospf (Open Shortest Path First, the holding time of CPU was lower than 5% when OSPF) task was carried out, its shortest-path first algorithm (Shortest Path First, SPF) time spent of Ji Suaning also is a Millisecond; For other route tasks, such as Intermediate System to Intermediate System (Intermediate System-to-Intermediate System, ISIS) (Simple Network Management Protocol, SNMP) task is all less relatively to the holding time of CPU for task, Simple Network Management Protocol.
306, calculate all the route tasks remove outside BGP task and the RTM task holding time sum to CPU, obtain the sum of control unit in the expandable route that these route tasks should take, the sum of control unit in the expandable route that all route tasks outside the above-mentioned BGP of removing task and the RTM task should be taken divided by these route tasks the holding time sum of CPU, obtain the CPU average holding time of control unit in the expandable route, can expand the average load of router.
307,,, perhaps, BGP task and RTM task are assigned to one independently on the control unit together with BGP task and RTM Task Distribution to two control unit independently for BGP task and RTM task; According to the CPU average holding time of control unit in the expandable route, the route task beyond BGP task and the RTM task is distributed.
The route task distributed need follow following principle:
1, because the BGP task is longer to the holding time of CPU, generally can surpass the CPU average holding time of control unit in the expandable route, therefore, the BGP task is assigned to separately on the CE; Perhaps, during owing to execution RTM task and BGP task, RTM task executive process need frequently be communicated by letter with BGP task executive process, in order to reduce the expense of bringing owing to intercommunication, on a RTM task and BGP Task Distribution to a control unit.
2, for the route task except that BGP task and RTM task, the route task that will be greater than or equal to the CPU average holding time of control unit in the expandable route to the holding time of CPU is assigned to separately on the control unit; For the holding time of CPU route task less than the CPU average holding time of control unit in the expandable route, on a plurality of route Task Distribution to a control unit, but need guarantee as far as possible that these route tasks are not more than the CPU average holding time of control unit in the expandable route to the summation of the holding time of CPU.
In order to make the embodiment of the invention clearer, earlier the Task Distribution strategy based on knapsack algorithm is introduced:
Suppose n task T
1, T
2, T
3... ..T
nNeed be assigned on m the control unit, this m control unit is respectively P
1, P
2, P
3... ..P
m, wherein, m<n.If et is (T
i) i task T of expression
iThe time that takies.So, when n Task Distribution arrived m control unit, the average load of expandable route (can expand the CPU average holding time of control unit in the router) was expressed as:
Be assigned to j control unit P
jK task, can be expressed as T
J1..., T
Jk, these tasks are to control unit P
jOn total holding time of CPU be expressed as:
For the expandable route distributed control plane, allocation strategy is the load balancing that guarantees between these control units preferably, reduces the intercommunication expense, improves the performance of system.Therefore, ideally, the expandable route task allocation algorithms can make the CPU holding time of each control unit in the system equal the average load of expandable route:
et(P
1)=et(P
2)=et(P
3)=.......=et(P
m)=L
av
If route task is to the holding time of the CPU average load Lav greater than expandable route, so, this route task will be assigned to a control unit separately.If route task so can be with a plurality of route Task Distribution to same control unit to the holding time of the CPU average load Lav less than whole expandable route.Fig. 4 shows for the route task except that BGP task and RTM task, the flow chart of the task allocation algorithms of expandable route distributed control plane.This route task allocation algorithms has realized the load balancing between the expandable route control unit effectively, improves the parallel performance of system, has shortened the processing time of route protocol packet, thereby shortens the convergence time of network.
Consult Fig. 4, the task allocation algorithms of expandable route distributed control plane specifically comprises:
401, check the route task type, prediction is removed route task beyond BGP task and the RTM task to the holding time of CPU.
402, calculate the average load of expandable route, can expand the CPU average holding time of control unit in the router.
The method of calculating the average load of expandable route comprises: calculate all route tasks of removing beyond BGP task and the RTM task to the CPU holding time and, remove the control unit control unit sum in addition that BGP task and RTM task take in the acquisition expandable route, with the route task of being calculated to the CPU holding time and divided by the control unit sum of above-mentioned acquisition, obtain the CPU average holding time of control unit in the expandable route.
403,,, determine allocation order to the route task except that BGP and RTM task according to the order of successively decreasing to the holding time of CPU to the route task except that BGP and RTM task.
In proper order the route task is sorted follow-up will the distribution the route task in this step according to this order according to successively decreasing of holding time to CPU.
404, i=1 is about to distribute route task T
1
405, by the CPU holding time et (P of incremental order to each control unit
j) sort.
406, judge current route task T to be allocated
iTo the holding time of CPU whether greater than the average load of expandable route, if carry out 407; If not, carry out 410.
407, judge whether to exist the control unit that does not have the route task, if, carry out 408, if not, carry out 409.
408, with this route task T
iBe assigned on the control unit that does not have the route task, at this moment, this route task T
iTake a control unit separately, and i=i+1 is set, return and carry out 405, carry out the distribution of next task.
409, with current route task T to be allocated
iGive the control unit (being the minimum control unit of CPU holding time) of load minimum in the expandable route, i=i+1 is set, return and carry out 405, carry out the distribution of next task.
410, with current route task T to be allocated
iGive on the minimum control unit of CPU holding time, i=i+1 is set, return and carry out 405, carry out the distribution of next task.
The embodiment of the invention two is distributed the route task according to the CPU average holding time of control unit in the expandable route, can make full use of the resource in the expandable route, realizes the parallel processing of different task, improves the performance of expandable route; On route Task Distribution to a control unit that BGP task and the RTM task dispatching degree of coupling is higher, can reduce the communication overhead between the task process when executing the task, improve the handling property of expandable route and the constringency performance of network; The reasonable distribution of route task can effectively be avoided single control unit overload, reduces the network concussion, improves the stability of expandable route.
Concrete, expandable route task allocation algorithms program is as follows:
In the process of expandable route actual motion, actual needs according to network, some control unit inefficacy (promptly unavailable) in the expandable route may appear, perhaps in expandable route, increase new control unit, perhaps increase some new route tasks, for example: routing information protocol (Routing information Protocol, RIP) task, independent multicast agreement (protocol independent multicast, PIM) task dispatching.For these situations, we can regard SCE as banker, and the resource of the control unit that SCE managed is equivalent to the fund of banker's management, and the route task is equivalent to the user to SCE request Resources allocation and provides a loan to the banker.SCE according to the CPU holding time of each route task prediction with each route Task Distribution to the control corresponding unit.When a route task is applied for resource first, this route task of prediction of result that SCE measures according to existing network is to the holding time of CPU, when if the cpu idle time of a plurality of control units all is greater than or equal to this route task to the holding time of CPU in the expandable route, then in these control units, select the lightest control unit of load, promptly select the minimum control unit of CPU holding time; If the cpu idle time of a plurality of control units is all less than this route task during to the holding time of CPU in the expandable route, then select a control unit that load is the lightest to distribute, promptly select the control unit of CPU holding time minimum, this route task is given this control unit.
Concrete, for expandable route some route tasks, for example RIP task, PIM task dispatching according to the demand real time execution of network.In order to accelerate the system response time of expandable route, the load balancing of maintenance system, SCE is when each real-time route Task Distribution, from expandable route, search the minimum control unit of CPU holding time (being the lightest control unit of load), with this route Task Distribution to the minimum control unit of CPU holding time that is found, after distributing, SCE will recomputate the CPU total holding time of described control unit according to the CPU holding time of newly assigned route task.
Following route tasks in the increase of control unit quantity or two aspects explanations of quantity minimizing expandable route are adjusted:
1, when the control unit quantity in the expandable route increases, the route task adjustment process in the expandable route comprises:
A, calculate route task all the route tasks in addition remove BGP task, RTM task and independently to take a control unit to the holding time of CPU and, obtain in the current expandable route the number of number of tasks in all control units except operation BGP task and RTM task greater than 1 control unit, with described and, obtain the CPU average holding time (being the average load of current expandable route) of control unit in the current expandable route divided by the number of above-mentioned number of tasks greater than 1 control unit;
B, search the control unit of CPU holding time,, then this control unit is not carried out the task adjustment if having only a task on this control unit greater than the average load of current expandable route; If two above tasks are arranged on this control unit, the longest route task of CPU holding time in this control unit is migrated on the minimum control unit of CPU holding time in the expandable route, recomputate the control unit that the route task moves out and the CPU holding time of the control unit that the route task moves into is arranged.Can return and carry out above-mentioned steps B, continue to carry out above-mentioned process of searching, till the load balancing of the control unit in expandable route.
2, when the control unit quantity in the expandable route reduces, the route task adjustment process in the expandable route comprises:
A, the dynamic task of disabled control unit is sorted according to the order of successively decreasing to the holding time of CPU.
B, from expandable route, search the minimum control unit of CPU holding time, sequencing according to ordering migrates into a route task on the disabled control unit on the control unit that is found, recomputate the CPU holding time of this control unit, return execution in step B, till the Task Distribution on the disabled CE is intact.
Wherein, the specific procedure section of the adjustment of the route task in the expandable route is as follows:
When the control unit quantity in the expandable route changed, SCE adjusted the task quantity on each control unit automatically, avoided the load of the caused control unit of manual configuration task unbalanced, guaranteed that the efficient parallel of system's route task is handled.
Embodiment three:
Consult Fig. 5, the embodiment of the invention three provides a kind of task allocation apparatus of expandable route distributed control plane, and it comprises:
Time calculating unit 501 is used for obtaining the holding time sum of each route task of route set of tasks to CPU; Route task in the described route set of tasks is the route task except that Border Gateway Protocol (BGP) task and routing table management RTM task;
Acquiring unit 502 is used for obtaining the sum of control unit in the expandable route that route set of tasks route task takies;
The first average load computing unit 503, be used for according to the holding time sum of each route task of route set of tasks CPU, reach the sum of control unit in the expandable route that described acquiring unit obtained, calculate the CPU average holding time of control unit in the expandable route;
First allocation units 504 are used for the CPU average holding time according to described expandable route control unit, and the route task in the described route set of tasks is distributed.
Preferably, this expandable route also comprises:
Second allocation units 505, be used for Border Gateway Protocol (BGP) task and routing table are managed the RTM Task Distribution to the same control unit of expandable route, at this moment, the sum that adds up to control unit in the described expandable route of control unit deducts 1 in the expandable route that the route task takies in the described route set of tasks.
Perhaps, these second allocation units 505 with BGP task and RTM Task Distribution in the expandable route on the different control unit; At this moment, the sum that adds up to control unit in the described expandable route of control unit deducts 2 in the expandable route that the route task takies in the described route set of tasks.
Concrete, first allocation units 504 comprise:
Ordering subelement 5041 is used for determining the allocation order of each route task in the described route set of tasks according to the non-decreasing order of route set of tasks route task to the holding time of CPU;
Determine subelement 5042, be used for allocation order, determine current route task to be allocated according to described route set of tasks route task;
First judgment sub-unit 5043, be used for judging described route task to be allocated to the holding time of CPU whether greater than the CPU average holding time of described expandable route control unit;
Second judgment sub-unit 5044 is used for the control unit of judging that whether described expandable route exists does not have the route task;
Distribute subelement 5045, be used for when the judged result of first judgment sub-unit 5043 for be and second judgment sub-unit 5044 when being, with described route Task Distribution to be allocated to the described control unit that does not have a route task; When the judged result of first judgment sub-unit for be and second judgment sub-unit for not the time, on the control unit that described route Task Distribution to be allocated CPU holding time in the described expandable route is minimum.
Optionally, this expandable route also comprises: sequencing unit 506, be used for when the control unit of expandable route is unavailable, and according to the order of successively decreasing the route task on the described disabled control unit is sorted to the CPU holding time; First migration units 507, be used for searching the minimum control unit of CPU holding time from described expandable route, sequencing according to the route task ranking on the described disabled control unit, a route task on the described disabled control unit is migrated on the control unit that is found, continue to carry out and from described expandable route, search the minimum control unit of CPU holding time, distribute the next route task on the described disabled control unit, till the route Task Distribution on the described disabled control unit is intact.
Optionally, this expandable route also comprises: the second average load computing unit 508, be used for when described expandable route has the control unit that increases newly, calculate each route task in the route set of tasks to the holding time of CPU and, route task quantity is greater than the number of 1 control unit in the shared control unit of the route task in the route set of tasks obtained, with described and, obtain the CPU average holding time of control unit in the current expandable route divided by the number of described route task quantity greater than 1 control unit; Second migration units 509, be used for searching the control unit of CPU holding time greater than the CPU average holding time of described current expandable route control unit, if at least two tasks are arranged on the control unit that is found, the longest route task of CPU holding time in the control unit that is found is migrated on the minimum control unit of CPU holding time in the expandable route.
Optionally, this expandable route also comprises: the 3rd allocation units 510, be used for when expandable route increases new route task, search the minimum control unit of CPU holding time in the expandable route, give the minimum control unit of described CPU holding time described new route Task Distribution.
The embodiment of the invention three is distributed the route task according to the CPU average holding time of control unit in the expandable route, can make full use of the resource in the expandable route, realizes the parallel processing of different task, improves the performance of expandable route; On route Task Distribution to a control unit that BGP task and the RTM task dispatching degree of coupling is higher, can reduce the communication overhead between the task process when executing the task, improve the handling property of expandable route and the constringency performance of network; The reasonable distribution of route task can effectively be avoided single control unit overload, reduces the network concussion, improves the stability of expandable route; When the control unit quantity in the expandable route changed, SCE adjusted the task quantity on each control unit automatically, avoided the load of the caused control unit of manual configuration task unbalanced, guaranteed that the efficient parallel of system's route task is handled.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to finish by program, described program can be stored in a kind of computer-readable recording medium, read-only memory for example, disk or CD etc.
More than the method for allocating tasks and the device of the expandable route distributed control plane that the embodiment of the invention provided is described in detail, used specific case herein principle of the present invention and execution mode are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.