Project

General

Profile

Revision 632

Merged TP2.0/0.9 branch into trunk.

View differences:

quickstart.tex
22 22
\begin{wideshellverbatim}
23 23
[simulation]
24 24
starttime: 2006-11-25 13:00:00
25
nodes: 4
26
resources: CPU,1;Mem,1024;Net (in),100;Net (out),100;Disk,20000
25
resources: 4  CPU:100 Memory:1024
27 26
\end{wideshellverbatim}
28 27

  
29
These options are used to describe the characteristics of our simulated cluster. In particular, we're using a 4-node cluster, each node with 1 CPU, 1024 MB of memory, 20GB of disk space, and 100Mbps of inbound/outbound network bandwidth. In this document, we will represent this cluster over time like this:
28
These options are used to describe the characteristics of our simulated cluster. In particular, we're using a 4-node cluster, each node with 1 CPU, 1024 MB of memory. In this document, we will represent this cluster over time like this:
30 29

  
31 30
\begin{center}
32 31
\includegraphics{images/quickstart_leasegraph1.png}
......
49 48
tracefile: /usr/share/haizea/traces/sample.lwf 
50 49
\end{wideshellverbatim}
51 50

  
52
The default value is a sample tracefile included with Haizea. If you copy the file to a different location, make sure to update the \texttt{tracefile} option accordingly. The format of this file is LWF (Lease Workload Format), which is particular to Haizea. The sample file includes documentation on the file format, and several sample workloads. You can also find details on the LWF format in Appendix~\ref{app:lwf}. For now, we will focus on the first workload, "PREEMPT":
51
The default value is a sample tracefile included with Haizea. If you copy the file to a different location, make sure to update the \texttt{tracefile} option accordingly. The format of this file is LWF (Lease Workload Format), an XML format which is particular to Haizea. For now, don't worry about parsing the trace format in detail; it is fairly human-readable and you can also find details on the LWF format in Appendix~\ref{app:lwf}.
53 52

  
54 53
\begin{wideshellverbatim}
55
# 0   -1   3600 3600 1 1 1024 0 foobar.img 1024
56
# 900 1800 1800 1800 4 1 1024 0 foobar.img 1024
57
\end{wideshellverbatim}
54
<lease-workload name="sample">
55
	<description>
56
	A simple trace where an AR lease preempts a 
57
	best-effort lease that is already running. 
58
	</description>
58 59

  
59
For now, don't worry about parsing the trace format in detail. The above represents two lease requests:
60
	<lease-requests>
61
	
62
	<!-- The lease requests are initially commented out -->
63
	
64
	<!-- First lease request -->
65
	<!--
66
	...
67
	-->
60 68

  
61
\begin{itemize}
62
\item The first line is a request for a best-effort lease, requested at time 0 (right at the start of the simulation), requiring 1 hour (3600 seconds), and only one node.
63
\item The second line is an advance reservation (AR) lease, requested 15 minutes into the simulation (900 seconds), starting 30 minutes into the simulation (1800 seconds), requiring 30 minutes (1800 seconds), and all four nodes in the cluster. Since the start time of the simulation is set to 13:00, this means the lease request is received at 13:15, and that the lease must run from 13:30 to 14:00.
64
\end{itemize}
69
	<!-- Second lease request -->
70
	<!--
71
	...
72
	-->
73
	
74
	</lease-requests>
75
</lease-workload>
76
\end{wideshellverbatim}
65 77

  
66
Both leases require 1 CPU per node, 1024 MB of memory, a disk image called "foobar.img" (which uses up 1024MB of disk space). The \# characters are used to comment out the lease requests. Do not change this for now.
78
As you can see, there are two lease requests in the file, but they are initially commented out. We will take a closer look at each of these requests next.
67 79

  
68 80
\section{Running the simulator}
69 81

  
......
77 89

  
78 90
\begin{wideshellverbatim}
79 91
[2006-11-25 13:00:00.00] TFILE   Loading tracefile /usr/share/haizea/traces/sample.lwf
80
[2006-11-25 13:00:00.00] TFILE   Loaded workload with 0 requests (0 best-effort + 0 AR)
92
[2006-11-25 13:00:00.00] TFILE   Loaded workload with 0 requests ()
81 93
[2006-11-25 13:00:00.00] RM      Starting resource manager
82 94
[2006-11-25 13:00:00.00] CLOCK   Starting simulated clock
83
[2006-11-25 13:00:00.00] CLOCK   Stopping simulated clock
95
[2006-11-25 13:00:00.00] CLOCK   Simulated clock has stopped
96
[2006-11-25 13:00:00.00] RM      Stopping resource manager gracefully...
84 97
[2006-11-25 13:00:00.00] RM      --- Haizea status summary ---
85 98
[2006-11-25 13:00:00.00] RM      Number of leases (not including completed): 0
86 99
[2006-11-25 13:00:00.00] RM      Completed leases: 0
......
93 106
[2006-11-25 13:00:00.00] RM      ---- End summary ----
94 107
\end{wideshellverbatim}
95 108

  
96
Now that you've seen the tracefile, you can see why the simulator starts up and immediately stops: all the lease requests in the tracefile are commented out, and there's nothing to schedule. Go ahead and uncomment only the first lease request and run Haizea again. You should now see the following:
109
Now that you've seen the tracefile, you can see why the simulator starts up and immediately stops: all the lease requests in the tracefile are commented out, and there's nothing to schedule. Go ahead and uncomment the first lease request, which looks like this:
97 110

  
98 111
\begin{wideshellverbatim}
112
<lease-request arrival="00:00:00">
113
<lease preemptible="true">
114
	<nodes>
115
		<node-set numnodes="1">
116
			<res type="CPU" amount="100"/>
117
			<res type="Memory" amount="1024"/>
118
		</node-set>
119
	</nodes>	
120
	<start></start>
121
	<duration time="01:00:00"/>
122
	<software>
123
		<disk-image id="foobar.img" size="1024"/>
124
	</software>
125
</lease>
126
</lease-request>
127
\end{wideshellverbatim}
128

  
129
This is a request for a best-effort lease (notice how the starting time is left empty, meaning it's up to Haizea to determine the start time), requested at time 00:00:00 (right at the start of the simulation), requiring 1 hour, and only one node. Now run Haizea again. You should now see the following:
130

  
131
\begin{wideshellverbatim}
99 132
[2006-11-25 13:00:00.00] TFILE   Loading tracefile /usr/share/haizea/traces/sample.lwf
100
[2006-11-25 13:00:00.00] TFILE   Loaded workload with 1 requests (1 best-effort + 0 AR)
133
[2006-11-25 13:00:00.00] TFILE   Loaded workload with 1 requests (1 Best-effort)
101 134
[2006-11-25 13:00:00.00] RM      Starting resource manager
102 135
[2006-11-25 13:00:00.00] CLOCK   Starting simulated clock
103
[2006-11-25 13:00:00.00] LSCHED  Lease #1 has been requested and is pending.
136
[2006-11-25 13:00:00.00] LSCHED  Lease #1 has been requested.
137
[2006-11-25 13:00:00.00] LSCHED  Lease #1 has been marked as pending.
104 138
[2006-11-25 13:00:00.00] LSCHED  Queued best-effort lease request #1, 1 nodes for 01:00:00.00.
105 139
[2006-11-25 13:00:00.00] LSCHED  Next request in the queue is lease 1. Attempting to schedule...
106 140
[2006-11-25 13:00:00.00] VMSCHED Lease #1 has been scheduled on nodes [1] 
......
131 165

  
132 166
A best-effort request is received at 13:00 and, since the cluster is empty, it is scheduled immediately. Notice how the VMs for the lease start at 13:00 and stop at 14:00. For now, we're assuming that the disk images are predeployed on the physical nodes (we will modify this option in the next section).
133 167

  
134
So, what would happen if we also added the AR lease? Since it requires all the cluster resources from 13:30 to 14:00, the best-effort lease will be unable to run in that time interval. Since the leases are implemented as VMs, Haizea will still schedule the best-effort lease to start at 13:00, but will suspend it before the AR lease starts, and will resume it once the AR lease has finished. In effect, we want the schedule to look like this:
168
Now go ahead and uncomment the second lease request, which looks like this:
135 169

  
170
\begin{wideshellverbatim}
171
<lease-request arrival="00:15:00">
172
<lease preemptible="false">
173
	<nodes>
174
		<node-set numnodes="4">
175
			<res type="CPU" amount="100"/>
176
			<res type="Memory" amount="1024"/>
177
		</node-set>
178
	</nodes>
179
	<start>
180
		<exact time="00:30:00"/>
181
	</start>
182
	<duration time="00:30:00"/>
183
	<software>
184
		<disk-image id="foobar.img" size="1024"/>
185
	</software>
186
</lease>
187
</lease-request>
188
\end{wideshellverbatim}
189

  
190
This is a request for an advance reservation lease (notice how there is an exact starting time specified), requesting all four nodes for 30 minutes. So, what would happen if we also added this AR lease? Since it requires all the cluster resources from 13:30 to 14:00, the best-effort lease will be unable to run in that time interval. Since the leases are implemented as VMs, Haizea will still schedule the best-effort lease to start at 13:00, but will suspend it before the AR lease starts, and will resume it once the AR lease has finished. In effect, we want the schedule to look like this:
191

  
136 192
\begin{center}
137 193
\includegraphics{images/quickstart_leasegraph3.png}
138 194
\end{center}
......
140 196
Uncomment the AR lease request, and run Haizea again. You should now see the following:
141 197

  
142 198
\begin{wideshellverbatim}
143
[2006-11-25 13:00:00.00] TFILE   Loading tracefile /home/haizea/sample.lwf
144
[2006-11-25 13:00:00.00] TFILE   Loaded workload with 2 requests (1 best-effort + 1 AR)
199
[2006-11-25 13:00:00.00] TFILE   Loading tracefile /usr/share/haizea/traces/sample.lwf
200
[2006-11-25 13:00:00.00] TFILE   Loaded workload with 2 requests (1 Best-effort + 1 AR)
145 201
[2006-11-25 13:00:00.00] RM      Starting resource manager
146 202
[2006-11-25 13:00:00.00] CLOCK   Starting simulated clock
147
[2006-11-25 13:00:00.00] LSCHED  Lease #1 has been requested and is pending.
203
[2006-11-25 13:00:00.00] LSCHED  Lease #1 has been requested.
204
[2006-11-25 13:00:00.00] LSCHED  Lease #1 has been marked as pending.
148 205
[2006-11-25 13:00:00.00] LSCHED  Queued best-effort lease request #1, 1 nodes for 01:00:00.00.
149 206
[2006-11-25 13:00:00.00] LSCHED  Next request in the queue is lease 1. Attempting to schedule...
150 207
[2006-11-25 13:00:00.00] VMSCHED Lease #1 has been scheduled on nodes [1] 
......
152 209
                                   to 2006-11-25 14:00:00.00
153 210
[2006-11-25 13:00:00.00] VMSCHED Started VMs for lease 1 on nodes [1]
154 211

  
155
[2006-11-25 13:15:00.00] LSCHED  Lease #2 has been requested and is pending.
212
[2006-11-25 13:15:00.00] LSCHED  Lease #2 has been requested.
213
[2006-11-25 13:15:00.00] LSCHED  Lease #2 has been marked as pending.
156 214
[2006-11-25 13:15:00.00] LSCHED  Scheduling AR lease #2, 4 nodes
157 215
                                 from 2006-11-25 13:30:00.00 
158 216
                                   to 2006-11-25 14:00:00.00.
......
160 218
[2006-11-25 13:15:00.00] LSCHED  Preempting lease #1...
161 219
[2006-11-25 13:15:00.00] LSCHED  ... lease #1 will be suspended 
162 220
                                     at 2006-11-25 13:30:00.00.
163
[2006-11-25 13:15:00.00] LSCHED  AR lease #2 has been accepted.
221
[2006-11-25 13:15:00.00] LSCHED  AR lease #2 has been scheduled.
164 222

  
165
[2006-11-25 13:29:39.00] VMSCHED Stopped VMs for lease 1 on nodes [1]
166
[2006-11-25 13:29:39.00] VMSCHED Suspending lease 1...
223
[2006-11-25 13:29:28.00] VMSCHED Stopped VMs for lease 1 on nodes [1]
224
[2006-11-25 13:29:28.00] VMSCHED Suspending lease 1...
167 225

  
168 226
[2006-11-25 13:30:00.00] VMSCHED Lease 1 suspended.
169 227
[2006-11-25 13:30:00.00] VMSCHED Started VMs for lease 2 on nodes [2, 3, 4, 1]
170 228
[2006-11-25 13:30:00.00] LSCHED  Next request in the queue is lease 1. Attempting to schedule...
171 229
[2006-11-25 13:30:00.00] VMSCHED Lease #1 has been scheduled on nodes [1]
172
                                 from 2006-11-25 14:00:21.00 (resuming) 
173
                                   to 2006-11-25 14:30:42.00
230
                                 from 2006-11-25 14:00:00.00 (resuming) 
231
                                   to 2006-11-25 14:31:04.00
174 232

  
175 233
[2006-11-25 14:00:00.00] VMSCHED Stopped VMs for lease 2 on nodes [2, 3, 4, 1]
176 234
[2006-11-25 14:00:00.00] VMSCHED Resuming lease 1...
177 235
[2006-11-25 14:00:00.00] VMSCHED Lease 2's VMs have shutdown.
178 236

  
179
[2006-11-25 14:00:21.00] VMSCHED Resumed lease 1
180
[2006-11-25 14:00:21.00] VMSCHED Started VMs for lease 1 on nodes [1]
237
[2006-11-25 14:00:32.00] VMSCHED Resumed lease 1
238
[2006-11-25 14:00:32.00] VMSCHED Started VMs for lease 1 on nodes [1]
181 239

  
182
[2006-11-25 14:30:42.00] VMSCHED Stopped VMs for lease 1 on nodes [1]
183
[2006-11-25 14:30:42.00] VMSCHED Lease 1's VMs have shutdown.
184
[2006-11-25 14:30:42.00] CLOCK   Simulated clock has stopped
185
[2006-11-25 14:30:42.00] RM      Stopping resource manager gracefully...
240
[2006-11-25 14:31:04.00] VMSCHED Stopped VMs for lease 1 on nodes [1]
241
[2006-11-25 14:31:04.00] VMSCHED Lease 1's VMs have shutdown.
242
[2006-11-25 14:31:04.00] CLOCK   Simulated clock has stopped
243
[2006-11-25 14:31:04.00] RM      Stopping resource manager gracefully...
186 244
\end{wideshellverbatim}
187 245

  
188 246
Notice how the above corresponds to the previous figure. In particular, notice the following:
......
233 291
\begin{wideshellverbatim}
234 292
[general]
235 293
...
236
lease-deployment: imagetransfer
294
lease-preparation: imagetransfer
237 295
...
238 296
\end{wideshellverbatim}
239 297

  
......
300 358
                     -c 1 -m 512 -i foobar.img -z 600 
301 359
\end{wideshellverbatim}
302 360

  
361
Additionally, you can also write a lease request using the XML format seen previous, save it to a file, and have \texttt{haizea-request-lease} command parse it:
362

  
363
\begin{wideshellverbatim}
364
haizea-request-lease -f request.xml
365
\end{wideshellverbatim}
366

  
303 367
You can find more details on this command's parameters by running \texttt{haizea-request-lease -h} or taking a look at Appendix~\ref{app:cli}. Once you've submitted the lease, you should see the following:
304 368

  
305 369
\begin{wideshellverbatim}
......
316 380
You should see the following:
317 381

  
318 382
\begin{wideshellverbatim}
319
 ID   Type  State      Starting time           Duration      Nodes  
320
 1    AR    Scheduled  2008-09-24 14:24:47.00  00:10:00.00   1       
383
 ID   Type          State      Starting time           Duration      Nodes  
384
 1    AR            Scheduled  2009-08-04 11:25:57.00  00:10:00.00   1        
321 385
\end{wideshellverbatim}
322 386

  
323 387
Note: You may not see your lease right away, since Haizea has to ``become aware'' of it (which won't happen until it wakes up to check if there are any new requests). Future versions of Haizea will enable it to be notified immediately of incoming requests.
......
325 389
Remember that the lease has been requested one minute into the future, so it will remain in a ``Scheduled'' state for a couple seconds. If you run \texttt{haizea-list-leases} periodically, you should see it pass through a couple other states. If image transfers are still enabled, it will first transition to the ``Preparing'' state:
326 390

  
327 391
\begin{wideshellverbatim}
328
 ID   Type  State      Starting time           Duration      Nodes  
329
 1    AR    Preparing  2008-09-24 14:24:47.00  00:10:00.00   1       
392
 ID   Type          State      Starting time           Duration      Nodes  
393
 1    AR            Preparing  2009-08-04 11:25:57.00  00:10:00.00   1       
330 394
\end{wideshellverbatim}
331 395

  
332 396
And then to the ``Active'' state:
333 397

  
334 398
\begin{wideshellverbatim}
335
 ID   Type  State      Starting time           Duration      Nodes  
336
 1    AR    Active     2008-09-24 14:24:47.00  00:10:00.00   1       
399
 ID   Type          State      Starting time           Duration      Nodes  
400
 1    AR            Active     2009-08-04 11:25:57.00  00:10:00.00   1       
337 401
\end{wideshellverbatim}
338 402

  
339 403
Now let's request a best-effort lease:
......
346 410
The list of leases will now look like this:
347 411

  
348 412
\begin{wideshellverbatim}
349
 ID   Type  State      Starting time           Duration      Nodes  
350
 1    AR    Active     2008-09-24 14:24:47.00  00:10:00.00   1       
351
 2    BE    Scheduled  None                    00:10:00.00   4       
413
 ID   Type          State      Starting time           Duration      Nodes  
414
 1    AR            Active     2009-08-04 11:25:57.00  00:10:00.00   1       
415
 2    Best-effort   Scheduled  Unspecified             00:10:00.00   4       
352 416
\end{wideshellverbatim}
353 417

  
354
Note how, for best-effort leases, the starting time is set to ``None'', which means this time is not specified by the user, but instead determined on a best-effort basis by the scheduler. Since the lease is in a ``Scheduled'' state, that means that it has been assigned a starting time (although that information is currently not available through the command-line interface; it can be seen in the Haizea log).
418
Note how, for best-effort leases, the starting time is set to ``Unspecified'', which means this time is not specified by the user, but instead determined on a best-effort basis by the scheduler. Since the lease is in a ``Scheduled'' state, that means that it has been assigned a starting time (although that information is currently not available through the command-line interface; it can be seen in the Haizea log).
355 419

  
356 420
Now try to rerun the \texttt{haizea-request-lease} command a couple times (i.e., lets submit a couple more best-effort requests). The scheduler won't be able to schedule them, since they require all the available nodes, and the AR lease is using up one of them. The previous best-effort lease was scheduled because Haizea's default behaviour is to schedule at most one best-effort lease in the future if resources cannot be found right away (this is due to Haizea's use of backfilling algorithms; for now, don't worry if you don't know what they are). Anyway, the list of leases should now look like this:
357 421

  
358 422
\begin{wideshellverbatim}
359 423
 ID   Type  State      Starting time           Duration      Nodes  
360
 1    AR    Active     2008-09-24 14:24:47.00  00:10:00.00   1       
361
 2    BE    Scheduled  None                    00:10:00.00   4       
362
 3    BE    Queued     None                    00:10:00.00   4       
363
 4    BE    Queued     None                    00:10:00.00   4       
364
 5    BE    Queued     None                    00:10:00.00   4       
365
 6    BE    Queued     None                    00:10:00.00   4       
424
 1    AR            Active     2009-08-04 11:25:57.00  00:10:00.00   1       
425
 2    Best-effort   Scheduled  Unspecified             00:10:00.00   4       
426
 3    Best-effort   Queued     Unspecified             00:10:00.00   4       
427
 4    Best-effort   Queued     Unspecified             00:10:00.00   4       
428
 5    Best-effort   Queued     Unspecified             00:10:00.00   4       
429
 6    Best-effort   Queued     Unspecified             00:10:00.00   4       
366 430
\end{wideshellverbatim}
367 431

  
368 432
Notice how the extra best-effort requests have been queued. If you only want to see the contents of the queue, you can use the following command:
......
374 438
This should show the following:
375 439

  
376 440
\begin{wideshellverbatim}
377
 ID   Type  State      Sched. Start time       Duration      Nodes  
378
 3    BE    Queued     None                    00:10:00.00   4       
379
 4    BE    Queued     None                    00:10:00.00   4       
380
 5    BE    Queued     None                    00:10:00.00   4       
381
 6    BE    Queued     None                    00:10:00.00   4       
441
 ID   Type          State      Starting time           Duration      Nodes  
442
 3    Best-effort   Queued     Unspecified             00:10:00.00   4       
443
 4    Best-effort   Queued     Unspecified             00:10:00.00   4       
444
 5    Best-effort   Queued     Unspecified             00:10:00.00   4       
445
 6    Best-effort   Queued     Unspecified             00:10:00.00   4       
382 446
\end{wideshellverbatim}
383 447

  
384 448
When you're done, you can shut Haizea down cleanly by running the following:
......
392 456

  
393 457
At this point, we have seen how to run simple simulations with Haizea. However, there is a lot more that Haizea can do:
394 458

  
395
When not running in simulation, Haizea runs as a daemon that can accept requests (e.g., through a command-line interface) and sends out enactment commands ("start VM", "stop VM", etc.) to the appropriate enactment module. For example, when running OpenNebula with Haizea as a scheduling backend, Haizea is in charge of processing the requests received by OpenNebula, coming up with a schedule, and then instructing OpenNebula on when VMs should be start/stop/suspend/resume on what physical nodes.
396

  
397 459
\begin{description}
398 460
\item[Run on real hardware] First and foremost, almost everything you just saw above in simulation can be done on real hardware. This is accomplished by using Haizea with the OpenNebula virtual infrastructure manager. So, if you have a Xen or KVM cluster, you can just install OpenNebula and Haizea to enable your users to request VM-based leases on your cluster. This is explained in Chapter~\ref{chap:opennebula}.
399 461
\item[Run complex simulations] This chapter concerned itself mostly with scheduling two leases on a 4-node cluster during a span of roughly 2 hours. \emph{Boring}. Haizea can handle more complex simulations, and also provides the necessary tools for you to easily run multiple simulations with different profiles. For example, in the Haizea paper ``Combining Batch Execution and Leasing Using Virtual Machines'' (see the Haizea publication page: \url{http://haizea.cs.uchicago.edu/pubs.html}) we simulated running 72 30-day workloads in six different configurations, or 36 years of lease scheduling. Running multiple simulations is explained in Section~\ref{sec:multiplesim}

Also available in: Unified diff