Skip to content

WorkflowSim Framework and How to Add Your Algorithm

Weiwei Chen edited this page Jun 17, 2013 · 13 revisions

First of all, we should be aware that WorkflowSim (and other real workflow management systems) has a hierarchical framework. From top to bottom, we have:

  1. Workflow Planner. It calls Workflow Parser to parse a xml file and create a list of tasks (or cloudlets in CloudSim) and then submits this list to Clustering Engine.

  2. Clustering Engine. It merges tasks into jobs (a group of task) based on the algorithm a user specifies (horizontal, vertical, random, or more). If not specified, Clustering Engine would not merge at all and just submits the list of jobs to Workflow Engine. From now on, we have jobs even though they may have just one task actually.

  3. Workflow Engine. It releases jobs based on the dependency and assures every job can only be submitted to Workflow Scheduler when all of its parent jobs have completely successfully.

  4. Workflow Scheduler. It matches VMs with jobs based on the algorithm a user specified (scheduler.method). Currently we may MINMIN_SCH, MAXMIN_SCH, MCT_SCH and etc. The HEFT_SCH is there but not implemented.

Now we come back to the original question: how to add your own algorithm?

There are two types of algorithms. The first one is for scheduling free jobs. I usually call it dynamic or runtime scheduling algorithm since it happens right before the execution of the jobs. Free means they are working at the Workflow Scheduler level and all of their parent jobs have completely successfully and thus you don't need to worry about the dependency issues at this level.

The second one is for scheduling all tasks/jobs. I usually call it static scheduling algorithm because you set the mapping relation between VMs and jobs in the Workflow Planner and should not change in Workflow Scheduler.

For the first one, it is easy to add a new algorithm. Follow the steps below:

  1. Create your own algorithm implementation under org.workflowsim.scheduler. similar to MinMinScheduler.java. Assuming you call it PSOScheduler.java.

If you take a look at MinMinScheduler.java, the key steps of implementing a scheduling is

92 for (int j = 0; j < vmSize; j++) { 93 CondorVM vm = (CondorVM) getVmList().get(j); 94 if ((vm.getState() == WorkflowSimTags.VM_STATUS_IDLE) 95 && vm.getCurrentRequestedTotalMips() > firstIdleVm.getCurrentRequestedTotalMips()) 96{ 97 firstIdleVm = vm; 98 99 } 100 } 101 firstIdleVm.setState(WorkflowSimTags.VM_STATUS_BUSY); 102 minCloudlet.setVmId(firstIdleVm.getId()); 103 getScheduledList().add(minCloudlet); You have at least three steps. First determine whether a VM is free (line 94) and set it to be busy (line 101). Second, set the VM id for a cloudlet (it is actually a job) (line 102). Third, add the cloudlet (line 103) to the getScheduledList() such that it will be submitted for execution.

  1. In org.workflowsim.utils.Parameters.SCHMethod , add a new value to it, i.e. PSO_SCH
  2. In org.workflosim.WorkflowSimScheduler.getScheduler(), add a new case, for example case PSO_SCH: scheduler = new PSOScheduler() break; And then you when you run WorkflowSim, just set the scheduler.method = PSO_SCH in your config file. Then you are done.