بررسی نحوه زمانبندی مبتنی بر رایانش ابری، با اجرای الگوریتم min-min در محیط شبیه ساز CloudSim به همراه کد برنامه
سه شنبه 10 مرداد 1396هدف کلی الگوریتم min-min : هدف کلی این الگوریتم، بهبود طول زمان بندی اجرا میباشد. الگوریتم پیشنهادی سعی دارد برای اجرای کارهای کوچک قبل ازکارهای بزرگ با کمترین تاخیر و ایجاد تعادل بار بیشتر استفاده کند درحقیقت هدف ازپیشنهاد این الگوریتم ایجاد تعادل بار (Load Balancing) بیشتر و اجرای موازی کارها و کاهش تاخیر کارهای کوچک می باشد.
توضیح1 : در این برنامه از بسته org.workflowsim.examples.scheduling; استفاده شده است.
توضیح 2: این برنامه برای اجرا در سایت github تنظیم شده است، اما با تنظیم آدرس فیزیکی متغیرdaxpath به آدرس
String daxPath = "D:/cloud simulator/WorkflowSim-1.0-master/config/dax/Montage_100.xml"; بر روی سیستم محلی قابل اجرا می گردد.
توضیح 3: این برنامه دارای یک DataCenter و دو Storage میباشد.
توضیح 4: تعداد ماشین های مجازی برابر 5 است.
توضیح 5: استفاده از کلاس پارامترهای سیستم عامل.
مراحل اجرای برنامه:
گام اول : ایجاد یک DataCenter و یک Storage.
گام دوم : ایجاد Vm ها.
گام سوم : ایجاد موجودیت ها از کلاسهای WorkflowPlanner و schedulers.
گام چهارم : ایجاد موجودیت از کلاس WorkflowEngine.
گام پنجم : ایجاد لیست userid هر vm برای کنترل vm توسط schedulers.
گام ششم : ارسال لیست WorkflowEngine ها به Vm ها.
گام هفتم: انجام کنترلهای لازم مانند کنترل سربار و خوشه بندی.
گام هشتم: اتصال data centers با scheduler.
گام نهم: شروع شبیه سازی
گام آخر: پایان شبیه سازی و نمایش نتایج و خروجی ها.
بخش اول : متن کد جاوا
/** * Copyright 2012-2013 University Of Southern California * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package org.workflowsim.examples.scheduling; import java.io.File; import java.util.Calendar; import java.util.List; import org.cloudbus.cloudsim.Log; import org.cloudbus.cloudsim.core.CloudSim;
وارد کردن فایلهای کتابخانه ای آماده ء کلاودسیم
import org.workflowsim.CondorVM; import org.workflowsim.WorkflowDatacenter; import org.workflowsim.Job; import org.workflowsim.WorkflowEngine; import org.workflowsim.WorkflowPlanner; import org.workflowsim.utils.ClusteringParameters; import org.workflowsim.utils.OverheadParameters; import org.workflowsim.utils.Parameters; import org.workflowsim.utils.ReplicaCatalog; /** * This MINMIN Scheduling Algorithm * * @author Weiwei Chen * @since WorkflowSim Toolkit 1.1 * @date Nov 9, 2013 */ public class MINMINSchedulingAlgorithmExample extends DataAwareSchedulingAlgorithmExample { ////////////////////////// STATIC METHODS /////////////////////// /** * Creates main() to run this example This example has only one datacenter * and one storage */ public static void main(String[] args) { try { // First step: Initialize the WorkflowSim package. /** * However, the exact number of vms may not necessarily be vmNum If * the data center or the host doesn't have sufficient resources the * exact vmNum would be smaller than that. Take care. */ int vmNum = 5;//number of vms; /** * Should change this based on real physical path */ String daxPath = "D:/cloud simulator/WorkflowSim-1.0-master/config/dax/Montage_100.xml"; File daxFile = new File(daxPath); if (!daxFile.exists()) { Log.printLine("Warning: Please replace daxPath with the physical path in your working environment!"); return; } /** * Since we are using HEFT planning algorithm, the scheduling * algorithm should be static such that the scheduler would not * override the result of the planner */ Parameters.SchedulingAlgorithm sch_method = Parameters.SchedulingAlgorithm.MINMIN; Parameters.PlanningAlgorithm pln_method = Parameters.PlanningAlgorithm.INVALID; ReplicaCatalog.FileSystem file_system = ReplicaCatalog.FileSystem.LOCAL; /** * No overheads */ OverheadParameters op = new OverheadParameters(0, null, null, null, null, 0); /** * No Clustering */ ClusteringParameters.ClusteringMethod method = ClusteringParameters.ClusteringMethod.NONE; ClusteringParameters cp = new ClusteringParameters(0, 0, method, null); /** * Initialize static parameters */ Parameters.init(vmNum, daxPath, null, null, op, cp, sch_method, pln_method, null, 0); ReplicaCatalog.init(file_system); // before creating any entities. int num_user = 1; // number of grid users Calendar calendar = Calendar.getInstance(); boolean trace_flag = false; // mean trace events // Initialize the CloudSim library CloudSim.init(num_user, calendar, trace_flag); WorkflowDatacenter datacenter0 = createDatacenter("Datacenter_0"); /** * Create a WorkflowPlanner with one schedulers. */ WorkflowPlanner wfPlanner = new WorkflowPlanner("planner_0", 1); /** * Create a WorkflowEngine. */ WorkflowEngine wfEngine = wfPlanner.getWorkflowEngine(); /** * Create a list of VMs.The userId of a vm is basically the id of * the scheduler that controls this vm. */ List<CondorVM> vmlist0 = createVM(wfEngine.getSchedulerId(0), Parameters.getVmNum()); /** * Submits this list of vms to this WorkflowEngine. */ wfEngine.submitVmList(vmlist0, 0); /** * Binds the data centers with the scheduler. */ wfEngine.bindSchedulerDatacenter(datacenter0.getId(), 0); CloudSim.startSimulation(); List<Job> outputList0 = wfEngine.getJobsReceivedList(); CloudSim.stopSimulation(); printJobList(outputList0); } catch (Exception e) { Log.printLine("The simulation has been terminated due to an unexpected error"); } } }
بخش دوم : خروجی برنامه
Initialising...
Starting CloudSim version 3.0
Datacenter_0 is starting...
Starting WorkflowSim 1.1.0
planner_0 is starting...
planner_0_Merger_ is starting...
planner_0_Merger__Engine_0 is starting...
planner_0_Merger__Engine_0_Scheduler_0 is starting...
Entities started.
0.0: planner_0_Merger__Engine_0_Scheduler_0: Cloud Resource List received with 1 resource(s)
0.0: planner_0_Merger__Engine_0_Scheduler_0: Trying to Create VM #0 in Datacenter_0
0.0: planner_0_Merger__Engine_0_Scheduler_0: Trying to Create VM #1 in Datacenter_0
0.0: planner_0_Merger__Engine_0_Scheduler_0: Trying to Create VM #2 in Datacenter_0
0.0: planner_0_Merger__Engine_0_Scheduler_0: Trying to Create VM #3 in Datacenter_0
0.0: planner_0_Merger__Engine_0_Scheduler_0: Trying to Create VM #4 in Datacenter_0
0.1: planner_0_Merger__Engine_0_Scheduler_0: VM #0 has been created in Datacenter #2, Host #0
0.1: planner_0_Merger__Engine_0_Scheduler_0: VM #1 has been created in Datacenter #2, Host #0
0.1: planner_0_Merger__Engine_0_Scheduler_0: VM #2 has been created in Datacenter #2, Host #0
0.1: planner_0_Merger__Engine_0_Scheduler_0: VM #3 has been created in Datacenter #2, Host #0
0.1: planner_0_Merger__Engine_0_Scheduler_0: VM #4 has been created in Datacenter #2, Host #0
600.238542895014: planner_0_Merger__Engine_0_Scheduler_0: Destroying VM #0
600.238542895014: planner_0_Merger__Engine_0_Scheduler_0: Destroying VM #1
600.238542895014: planner_0_Merger__Engine_0_Scheduler_0: Destroying VM #2
600.238542895014: planner_0_Merger__Engine_0_Scheduler_0: Destroying VM #3
600.238542895014: planner_0_Merger__Engine_0_Scheduler_0: Destroying VM #4
planner_0_Merger__Engine_0_Scheduler_0 is shutting down...
Simulation: No more future events
CloudInformationService: Notify all CloudSim entities for shutting down.
Datacenter_0 is shutting down...
planner_0 is shutting down...
planner_0_Merger_ is shutting down...
planner_0_Merger__Engine_0 is shutting down...
planner_0_Merger__Engine_0_Scheduler_0 is shutting down...
Simulation completed.
Simulation completed.
========== OUTPUT ==========
Job ID Task ID STATUS Data center ID VM ID Time Start Time Finish Time Depth
100 Stage-in SUCCESS 2 0 0.12 0.1 0.22 0
1 2, SUCCESS 2 0 14.59 0.22 14.81 1
4 5, SUCCESS 2 1 15.7 0.22 15.92 1
13 14, SUCCESS 2 0 14.87 14.81 29.68 1
2 3, SUCCESS 2 1 16.01 15.92 31.92 1
37 38, SUCCESS 2 1 12.58 31.92 44.5 2
10 11, SUCCESS 2 0 15.08 29.68 44.75 1
68 69, SUCCESS 2 0 11.8 44.75 56.56 2
35 36, SUCCESS 2 1 12.55 44.5 57.05 2
55 56, SUCCESS 2 0 11.65 56.56 68.2 2
60 61, SUCCESS 2 1 12.52 57.05 69.57 2
14 15, SUCCESS 2 2 78.37 0.22 78.59 1
27 28, SUCCESS 2 0 11.87 68.2 80.07 2
59 60, SUCCESS 2 1 12.78 69.57 82.35 2
6 7, SUCCESS 2 4 82.36 0.22 82.59 1
61 62, SUCCESS 2 0 11.88 80.07 91.96 2
5 6, SUCCESS 2 1 16.18 82.35 98.53 1
43 44, SUCCESS 2 0 11.62 91.96 103.58 2
40 41, SUCCESS 2 1 12.54 98.53 111.07 2
38 39, SUCCESS 2 0 11.59 103.58 115.17 2
57 58, SUCCESS 2 1 12.53 111.07 123.61 2
22 23, SUCCESS 2 0 11.77 115.17 126.94 2
3 4, SUCCESS 2 3 126.89 0.22 127.11 1
39 40, SUCCESS 2 1 12.62 123.61 136.23 2
69 70, SUCCESS 2 0 11.86 126.94 138.8 2
72 73, SUCCESS 2 2 64.23 78.59 142.82 2
56 57, SUCCESS 2 1 12.57 136.23 148.8 2
33 34, SUCCESS 2 0 11.81 138.8 150.61 2
29 30, SUCCESS 2 1 12.8 148.8 161.61 2
12 13, SUCCESS 2 0 15.16 150.61 165.76 1
15 16, SUCCESS 2 4 84.42 82.59 167.01 1
8 9, SUCCESS 2 1 16.26 161.61 177.86 1
7 8, SUCCESS 2 0 15.19 165.76 180.95 1
32 33, SUCCESS 2 1 12.52 177.86 190.38 2
74 75, SUCCESS 2 0 11.72 180.95 192.67 2
34 35, SUCCESS 2 1 12.56 190.38 202.94 2
44 45, SUCCESS 2 0 11.72 192.67 204.4 2
21 22, SUCCESS 2 2 63.39 142.82 206.2 2
51 52, SUCCESS 2 1 12.58 202.94 215.52 2
31 32, SUCCESS 2 0 11.74 204.4 216.13 2
65 66, SUCCESS 2 0 11.79 216.13 227.92 2
67 68, SUCCESS 2 1 12.6 215.52 228.12 2
30 31, SUCCESS 2 3 104.21 127.11 231.32 2
71 72, SUCCESS 2 4 64.92 167.01 231.92 2
47 48, SUCCESS 2 0 11.78 227.92 239.7 2
58 59, SUCCESS 2 1 12.64 228.12 240.76 2
46 47, SUCCESS 2 0 11.82 239.7 251.52 2
73 74, SUCCESS 2 1 12.7 240.76 253.46 2
77 78, SUCCESS 2 0 11.85 251.52 263.37 2
50 51, SUCCESS 2 1 12.7 253.46 266.15 2
28 29, SUCCESS 2 2 62.92 206.2 269.13 2
52 53, SUCCESS 2 0 11.87 263.37 275.24 2
26 27, SUCCESS 2 1 12.72 266.15 278.88 2
49 50, SUCCESS 2 0 11.89 275.24 287.13 2
66 67, SUCCESS 2 1 12.78 278.88 291.66 2
75 76, SUCCESS 2 4 65.99 231.92 297.91 2
23 24, SUCCESS 2 0 11.95 287.13 299.08 2
41 42, SUCCESS 2 1 12.84 291.66 304.5 2
9 10, SUCCESS 2 0 15.24 299.08 314.32 1
11 12, SUCCESS 2 1 16.47 304.5 320.97 1
0 1, SUCCESS 2 0 15.41 314.32 329.73 1
24 25, SUCCESS 2 3 101.35 231.32 332.67 2
36 37, SUCCESS 2 2 63.57 269.13 332.7 2
42 43, SUCCESS 2 1 12.48 320.97 333.45 2
63 64, SUCCESS 2 0 11.52 329.73 341.25 2
76 77, SUCCESS 2 1 12.48 333.45 345.93 2
48 49, SUCCESS 2 0 11.66 341.25 352.91 2
53 54, SUCCESS 2 1 12.58 345.93 358.51 2
54 55, SUCCESS 2 0 11.75 352.91 364.66 2
70 71, SUCCESS 2 4 66.98 297.91 364.89 2
45 46, SUCCESS 2 1 12.6 358.51 371.11 2
16 17, SUCCESS 2 0 11.76 364.66 376.42 2
18 19, SUCCESS 2 1 12.61 371.11 383.72 2
17 18, SUCCESS 2 0 11.79 376.42 388.21 2
62 63, SUCCESS 2 2 62.31 332.7 395.01 2
64 65, SUCCESS 2 1 12.7 383.72 396.42 2
19 20, SUCCESS 2 0 11.84 388.21 400.04 2
25 26, SUCCESS 2 4 65.85 364.89 430.74 2
20 21, SUCCESS 2 3 99.75 332.67 432.42 2
78 79, SUCCESS 2 0 5.52 432.42 437.94 3
79 80, SUCCESS 2 0 5.94 437.94 443.88 4
85 86, SUCCESS 2 0 11.67 443.88 455.55 5
82 83, SUCCESS 2 1 12.65 443.88 456.53 5
88 89, SUCCESS 2 0 11.92 455.55 467.47 5
83 84, SUCCESS 2 1 12.79 456.53 469.32 5
94 95, SUCCESS 2 0 11.94 467.47 479.41 5
90 91, SUCCESS 2 1 12.8 469.32 482.12 5
92 93, SUCCESS 2 0 11.95 479.41 491.35 5
87 88, SUCCESS 2 1 12.82 482.12 494.94 5
95 96, SUCCESS 2 0 11.99 491.35 503.35 5
84 85, SUCCESS 2 2 63.41 443.88 507.28 5
89 90, SUCCESS 2 1 12.95 494.94 507.89 5
91 92, SUCCESS 2 4 66.48 443.88 510.35 5
80 81, SUCCESS 2 0 12.1 503.35 515.45 5
81 82, SUCCESS 2 1 13.07 507.89 520.96 5
93 94, SUCCESS 2 3 102.03 443.88 545.91 5
86 87, SUCCESS 2 2 64.89 507.28 572.17 5
96 97, SUCCESS 2 0 8.78 572.17 580.95 6
97 98, SUCCESS 2 0 10.68 580.95 591.63 7
98 99, SUCCESS 2 0 7.69 591.63 599.32 8
99 100, SUCCESS 2 0 0.92 599.32 600.24 9
آموزش asp.net mvc
- ASP.net MVC
- 3k بازدید
- 1 تشکر