Embodiment
In order to make the embodiment of the invention clearer; Earlier expandable route is made brief account: consult Fig. 1; A plurality of control units (Control Element; CE) and a plurality of retransmission unit (ForwardingElement FE) becomes a router through the inner high speed network interconnection, and 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 said 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 BGP task and RTM task take Different control unit (being that BGP task and RTM task respectively take an independently control unit), 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 said 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 implementation example that its concrete route task in the said 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; Through CPU average holding time with reference to control unit in the 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 through the inner high speed network interconnection, a plurality of routers are constituted the expandable route of distributed control plane through 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 the information such as CPU holding time and memory size of this control unit, 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 in expandable route, communicating by letter, 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.
Show that through real network measurement and analysis the BGP task of most of router need take for 60% CPU processing time when carrying out, 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, the time spent of SPF) calculating 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, under the ideal situation, 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 except that BGP task and the route task the 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, inspection route task type, prediction are removed BGP task and the holding time of RTM task route task in addition to 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 remove BGP task and all route tasks beyond 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; Use the route task of being calculated to the CPU holding time and total, obtain the CPU average holding time of control unit in the expandable route divided by the control unit of above-mentioned acquisition.
403,,, confirm allocation order except that BGP and the route task the RTM task according to the order of successively decreasing to the holding time of CPU to except that BGP and the route task the 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, do 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 minimum control unit (being the minimum control unit of CPU holding time) of load 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 following:
Initialize(T
i,m)
{
for(all?T
i∈T)do
{
The inspection task type;
If (task is BGP or RTM) then
They are distributed in same control unit P separately
r
m--;
else?{
According to the order of successively decreasing, to except that BGP and RTM to the holding time of CPU
Each route task sorts;
Calculate L
Av
}
end?if
}
end?for
// will be except that the n-2 BGP and the RTM task (T
1, T
2..., T
N-2) distribute to a remaining m-1 CE;
for(all?T
i∈T)do
{
for(i=1,i≤m-1,i++)do
By the CPU holding time et (P of incremental order to each control unit
j) sort;
end?for
if(et(T
i)>=L
av&&min?et(P
j)=0)then
{
With route task T
iGive control unit P separately
j
Recomputate control unit P after the allocating task
jHolding time et (P
j)=et (T
i);
}
else?if(et(T
i)>=L
av)then
{
From all control units, select the minimum control unit P of CPU holding time
j
With task T
iDistribute to this control unit P;
Recomputate control unit P
jCPU holding time et (P
j);
}
else
{
With task T
iDistribute to control unit P
j
Recomputate control unit P
jCPU holding time et (P
j);
endif
}
end?for
}
In the process of expandable route actual motion, according to the actual needs of 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 (Routinginformation Protocol, RIP) task; Independent multicast agreement (protocol independentmulticast, PIM) task dispatching.For these situation, 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 minimum control unit of CPU holding time, 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 searches the minimum control unit of CPU holding time (being the lightest control unit of load) from expandable route when each real-time route Task Distribution, 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 said control unit according to the CPU holding time of newly assigned route task.
Increasing perhaps from control unit quantity as follows, quantity reduces by two route task adjustment in the aspects explanation expandable route:
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 in operation BGP task and all control units RTM task number of tasks number greater than 1 control unit; With said 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 CPU holding time of route task control unit of moving out and the control unit that has the route task to move into.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 following:
Adaptiveadjust(Ti,m)
{
If (minimizing of control unit quantity) then
{
With all task T that move on the disabled control unit
iBy to the holding time of CPU
The order of successively decreasing sorts;
While (task T
iDo not distribute) do;
{
The order of control unit in the system by load growth sorted;
Each minimum control unit P of CPU holding time that from system, selects
j, distribute
T
i;
Recomputate this control unit P
jCPU holding time et (P
j);
}
end?while;
end?if;
If (increase of control unit quantity) then
{
For (original all control units in the system) do;
{
If (number of tasks on the control unit>1) then
{
If (moving on the control unit of task is BGP or RTM) then
Select next control unit;
end?if;
Number of tasks is total greater than all tasks on all control units of 1 in the computing system
CPU holding time et (Po)
}
end?if;
}
end?for;
Recomputate number of tasks greater than 1 with new average load of inserting control unit
Ln=et(Po)/(Po+Pn);
For (each et (P
jThe control unit of)>Ln) do
{
If (moving on the control unit of task is BGP or RTM) then
Select next control unit;
end?if;
Select in all tasks of operation from it the longest task of CPU holding time;
This task is given in all control units minimum control unit CPU running time;
Recomputate CPU et running time (Pi) of this control unit;
Select next control unit;
}
end?for;
end?if;
}
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 said route set of tasks is except that Border Gateway Protocol (BGP) task and the route task the 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 said 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 said expandable route control unit, and the route task in the said 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 said expandable route of control unit deducts 1 in the expandable route that the route task takies in the said 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 said expandable route of control unit deducts 2 in the expandable route that the route task takies in the said route set of tasks.
Concrete, first allocation units 504 comprise:
Ordering subelement 5041 is used for confirming the allocation order of each route task in the said route set of tasks according to the non-decreasing order of route set of tasks route task to the holding time of CPU;
Confirm subelement 5042, be used for allocation order, confirm current route task to be allocated according to said route set of tasks route task;
First judgment sub-unit 5043, be used for judging said route task to be allocated to the holding time of CPU whether greater than the CPU average holding time of said expandable route control unit;
Second judgment sub-unit 5044 is used for the control unit of judging that whether said 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 said route Task Distribution to be allocated to the said 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 said route Task Distribution to be allocated CPU holding time in the said expandable route is minimum.
Optional, 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 said 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 said expandable route; Sequencing according to the route task ranking on the said disabled control unit; A route task on the said disabled control unit is migrated on the control unit that is found; Continue to carry out and from said expandable route, search the minimum control unit of CPU holding time, distribute the next route task on the said disabled control unit, till the route Task Distribution on the said disabled control unit is intact.
Optional; This expandable route also comprises: the second average load computing unit 508; Be used for when said 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 with; 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, and with said and divided by the number of said route task quantity greater than 1 control unit, obtains the CPU average holding time of control unit in the current expandable route; Second migration units 509; Be used for searching the control unit of CPU holding time greater than the CPU average holding time of said 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.
Optional; 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 said CPU holding time said 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 accomplish through 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 carried out detailed introduction; Used concrete example among this paper 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 on embodiment and range of application, all can change, in sum, this description should not be construed as limitation of the present invention.