Disclosure of Invention
Aiming at the defects existing in the prior art, the invention provides a DAG real-time task unloading optimization method based on edge calculation, which comprises the following steps:
S1: the SDN controller receives real-time tasks to be offloaded sent by a user, constructs a DAG real-time task flow chart, and constructs a task earliest completion time model according to the DAG real-time task flow chart;
S2: calculating the execution time of the task on different servers to obtain a primary task unloading strategy; according to the primary task unloading strategy, all tasks are unloaded to a waiting queue in a server;
S3: executing real-time tasks with dependency relations in the waiting queue according to the earliest task completion time model;
S4: calculating the residual tolerance time delay of the tasks, sequencing the residual real-time tasks in a waiting queue in the server according to the residual tolerance time delay, and constructing a task set to be secondarily offloaded;
s5: obtaining a secondary unloading strategy according to the residual tolerance time delay of the real-time task in the secondary unloading task set, and executing task secondary unloading according to the secondary unloading strategy;
S6: and the server executes the real-time tasks in the waiting queue to finish the unloading execution of the DAG real-time tasks. Preferably, the task earliest completion time model is expressed as:
Fi=min{Fmax_i+Di+pi}
Wherein, F i represents the earliest completion time of task R i, F max_i represents the earliest completion time of the largest precursor task of task R i, D i represents the transmission delay of the task, and p i represents the computation delay of the task.
Preferably, the process of obtaining the primary task offloading policy includes:
periodically acquiring the execution rate of each server and the data size of unfinished tasks by the SDN controller; and calculating the execution time of the real-time task on different servers according to the data size of the real-time task, the execution rate of the servers and the data size of the unfinished task, and selecting the server with the minimum execution time as an unloading server.
Further, the formula for calculating the execution time of the task on the server is:
wherein T i,j represents the execution time of task R i on server ES j, p i,j represents the computation delay of task R i on server ES j, W j represents the size of task data outstanding on server ES j, and q j represents the execution rate of server ES j.
Preferably, the process of constructing the task set to be secondarily offloaded includes: and selecting real-time tasks which cannot be completed within the limited tolerance time delay from the residual real-time tasks, and sequencing the real-time tasks which cannot be completed according to the residual tolerance time delay to obtain a task set to be subjected to secondary unloading.
Preferably, the process of obtaining the secondary offloading policy includes: judging whether each server meets the time delay condition according to the residual tolerance time delay of the real-time tasks in the secondary unloading task set, and if so, selecting the server with the minimum sum of the transmission time delay and the calculation time delay as the unloading server.
Further, the time delay condition is:
Wherein, p i,k represents the calculation time delay of the task R i on the server ES k, d i represents the data amount required to be processed by the task R i, v j,k represents the data transmission rate between the server ES j and the server ES k, W k represents the unfinished task data size on the server ES k, and q k represents the execution rate of the server ES k; t i' represents the remaining tolerable delay for task R i.
The beneficial effects of the invention are as follows:
(1) Under the condition of meeting the real-time processing of the task, the invention optimizes the data communication time delay of the DAG task; and processing according to the data dependence among the tasks, adopting an integer programming mode, taking real-time requirements as limiting conditions, minimizing real-time task completion time, obtaining an optimized unloading decision, and effectively mapping the server and the DAG real-time tasks.
(2) According to the invention, the multi-server cooperative processing is adopted in the unloading scene of the edge environment facing a large number of real-time tasks, so that the utilization rate of the system is improved, the congestion of the server when a large number of tasks are executed is reduced, and the real-time processing of the tasks is satisfied.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The invention provides a DAG real-time task unloading optimization method based on edge calculation, which is shown in fig. 1 and comprises the following steps:
S1: the SDN controller receives real-time tasks to be offloaded sent by a user, builds a DAG real-time task flow chart, and builds a task earliest completion time model according to the DAG real-time task flow chart.
Periodically obtaining initial information of edge computing server nodes by SDN controller, and using a full graphRepresenting a communication relationship between edge servers within an edge computing environment, wherein a complete graph Gt vertex es= { ES 1,...,ESj,...,ESJ } is an edge server computing node,For the collection of Gt edges,Element e x,y of ES x、ESy represents an edge connecting two vertices of ES x、ESy, v is the weight of the Gt edge, that is, the transmission rate v= { v 1,...,vj,…,vJ},ESj between edge server computing nodes and the data transmission rate to ES y is v i,y, and meanwhile, waiting queue information of the edge computing server nodes is obtained.
The user sends real-time tasks to the SDN, and the SDN controller receives the real-time tasks to be offloaded sent by the user and constructs a DAG real-time task flow chart with I nodes. Specific: analyzing the dependency relationship of the tasks to obtain the data amount to be transmitted by the precursor task and the precursor task of each task, wherein the dependency matrix is represented by a matrix pro with a size IxI, wherein pro i,x=ux represents that the task R i needs to receive the transmission data u x from the precursor task R x, and when pro i,x =0, R i does not need to receive the transmission data of R x, i.e. R x is not the precursor task of R i; one task is provided with a plurality of precursor tasks, and the current task can be started to be executed after all the precursor tasks are executed; constructing a DAG real-time task flow chart according to the dependency relationship of the tasks, introducing a virtual starting task R 0 to be linked to each actual starting task, and simulating the actual requirements by a virtual ending task R I+1 to which each actual ending task needs to be pointed; the processing time of the virtual start task and the virtual end task is 0, and the virtual start task and the virtual end task are placed on the same server.
Constructing a task earliest completion time model according to the DAG real-time task flow chart, and specifically:
The task earliest completion time model is expressed as:
Fi=min{Fmax_i+Di+pi}
Wherein F i represents the earliest completion time of task R i, D i represents the transmission delay of the task, p i represents the computation delay of the task, and F max_i represents the earliest completion time of the largest precursor task of task R i:
Fmax_i=max{Fx|proi,x>0}
Wherein F x represents the earliest completion time of the precursor task R x.
S2: calculating the execution time of the task on different servers to obtain a primary task unloading strategy; and unloading all tasks to a waiting queue in the server according to the primary task unloading strategy.
The DAG real-time task offload policy is x= { X 1,...,Xi,...,Xn }, where X i={x1,...,xj,...,xm},xj e {0,1},0 represents no offload, 1 represents offload. The SDN controller periodically acquires the execution rate of each server and the data size of the unfinished task, and calculates the execution time of the real-time task on different servers according to the data size of the real-time task, the execution rate of the servers and the data size of the unfinished task; task R i is executed on server ES j for the following time:
Wherein, p i,j represents the calculation delay of the task R i, W j represents the data size of the task which is not completed on the server ES j, d i represents the data size of the task R i, and q j represents the execution rate of the server ES j.
And selecting the server with the minimum execution time as an unloading server to obtain a primary task unloading strategy. Therefore, in the primary task offloading policy, the execution time of the task on the offload server is:
Where T i represents the execution time of task R i, m represents the number of servers, and X i,j represents whether task R i is offloaded to server ES j.
And unloading all tasks to a waiting queue in the server according to the primary task unloading strategy. The real-time task enters a waiting queue with a queue length L in a target edge server computing node to wait for execution, wherein the queue length L=L' +1 of the updated waiting queue represents the queue length before being updated.
S3: and executing the real-time tasks with the dependency relationship in the waiting queue according to the earliest task completion time model.
And acquiring an execution sequence corresponding to the real-time tasks with the dependency relationships according to the earliest task completion time model, and executing the real-time tasks with the dependency relationships by the server.
S4: calculating the residual tolerance time delay of the tasks, sequencing the residual real-time tasks in the waiting queue in the server according to the residual tolerance time delay, and constructing a task set to be secondarily offloaded.
After the primary unloading execution, tasks from different DAG flowcharts or tasks without data dependency relationship exist in a waiting queue of the same server, and the tasks can be optimized for the execution sequence again in the actual unloading; specific:
Calculating the residual tolerance time delay of the task:
Ti′=θi-Di
Where T i' represents the remaining tolerable delay of task R i, θ i represents the defined tolerable delay of task R i, and D i represents the transmission delay of task R i.
And sequencing the residual real-time tasks in the waiting queue in the server according to the residual tolerance time delay, wherein the sequencing is more forward when the residual tolerance time delay is smaller. And selecting real-time tasks which cannot be completed within the limited tolerance time delay from the residual real-time tasks, and sequencing the real-time tasks which cannot be completed according to the residual tolerance time delay (the residual tolerance time delay is smaller and the sequencing is more forward), so as to obtain a task set to be subjected to secondary unloading.
S5: and obtaining a secondary unloading strategy according to the residual tolerance time delay of the real-time task in the secondary unloading task set, and executing task secondary unloading according to the secondary unloading strategy.
Acquiring real-time information of each server so as to calculate task calculation time delay, task residual tolerance time delay and transmission time delay among the servers; screening servers meeting the time delay conditions according to the residual tolerance time delay of the real-time tasks in the secondary unloading task set, and selecting a server with the minimum sum of the transmission time delay and the calculation time delay as an unloading server to obtain a secondary unloading strategy; and if the server meeting the condition does not exist, canceling the secondary unloading. Preferably, the delay conditions are:
Wherein, p i,k represents the calculation time delay of the task R i on the server ES k, d i represents the data amount required to be processed by the task R i, v j,k represents the data transmission rate between the server ES j and the server ES k, W k represents the unfinished task data size on the server ES k, and q k represents the execution rate of the server ES k; t i' represents task R i.
And executing task secondary unloading according to the secondary unloading strategy, and sequentially unloading real-time tasks in the secondary unloading task set to the waiting queues of the corresponding target servers.
S6: and the server executes the real-time tasks in the waiting queue to finish the unloading execution of the DAG real-time tasks.
And the server executes the real-time tasks in the waiting queue, finishes the unloading execution of the DAG real-time tasks, and obtains the minimum time delay after the DAG real-time tasks are optimized, wherein the minimum completion time of the DAG real-time tasks is the completion time of the ending tasks in the DAG real-time task flow chart.
In summary, in the large-scale DAG real-time task unloading scene of edge computing processing, the task unloading efficiency is improved, the transmission delay of the task in the unloading process is considered, the task with large computing capacity or low priority is cooperatively processed with other servers on the edge server with limited resources, congestion is avoided, and real-time processing of the task is ensured.
While the foregoing is directed to embodiments, aspects and advantages of the present invention, other and further details of the invention may be had by the foregoing description, it will be understood that the foregoing embodiments are merely exemplary of the invention, and that any changes, substitutions, alterations, etc. which may be made herein without departing from the spirit and principles of the invention.