wiki:Haizea_sim

Unattended Simulated Mode


【0.架構】

  • Haizea Configuration File - 一個文字檔包含一些選項
  • Request Tracefile - 一個文字檔包含了租約的需求

【1.配置】

【1.1 Haizea Configuration File】

從上圖架構知道,要使用 Haiea 的第一步便是要撰寫一篇好的 Haizea Configuration File,官方文件說可以參考範例檔 /usr/share/haizea/etc/sample_trace.conf 和 sample_trace_barebones (兩個文件內容一樣,只差再第2份沒註解),文檔中要注意的地方是 option 的設定和配置
  • 以下面範例來解說 option,便是『模擬』 2006-11-25 下午1點開始執行任務在 4台有1顆CPU 和1G Ram 的機器上執行 ([simulation]->屬性名稱,startime、resources->屬性細部設定)
    [simulation]
    starttime: 2006-11-25 13:00:00
    resources: 4  CPU:100 Memory:1024
    
  • 參考的屬性值


【1.2 Tracefile File】

而 Tracefile 便是在 Haizea Configuration File 中的 [tracefile] 屬性指定
[tracefile]
tracefile: /usr/share/haizea/traces/sample.lwf
  • 此 Tracefile 範例檔的格式為 LWF/Lease Workload Format (類似 XML 的格式)
    <lease-workload name="sample">
      <description>
      A simple trace where an AR lease preempts a 
      best-effort lease that is already running. 
      </description>
    
      <lease-requests>
      
      <!-- The lease requests are initially commented out -->
      
      <!-- First lease request -->
      <!--
      ...
      -->
    
      <!-- Second lease request -->
      <!--
      ...
      -->
      
      </lease-requests>
    </lease-workload>
    
  • XML 格式參考

【2.開始模擬】

現在我們使用已寫好的範例 configuration(sample_trace.conf) 和 tracefile(sample.lwf),便可透過haizea 指令開始執行模擬 (參數 -c 為指定設定檔)

【2.1 範例一】

# haizea -c /usr/share/haizea/etc/sample_trace.conf
[2006-11-25 13:00:00.00] RM      Starting resource manager
[2006-11-25 13:00:00.00] TFILE   Loading tracefile /usr/share/haizea/traces/sample.lwf
[2006-11-25 13:00:00.00] TFILE   Loaded workload with 0 requests ()
[2006-11-25 13:00:00.00] CLOCK   Starting simulated clock
[2006-11-25 13:00:00.00] CLOCK   Simulated clock has stopped
[2006-11-25 13:00:00.00] RM      Stopping resource manager gracefully...
[2006-11-25 13:00:00.00] RM      --- Haizea status summary ---
[2006-11-25 13:00:00.00] RM      Number of leases (not including completed): 0
[2006-11-25 13:00:00.00] RM      Completed leases: 0
[2006-11-25 13:00:00.00] RM      ---- End summary ----

  • 此結果輸出主要有三類:RM(Resource Manager)、TFILE(TraceFile)、CLOCK
    • RM Starting resource manager:啟動資源管理者
    • TFILE Loading tracefile /usr/share/haizea/traces/sample.lwf:載入 tracefile
    • TFILE Loaded workload with 0 requests ():此範例檔並無租約要求
    • CLOCK Starting simulated clock:開始模擬的 clock
    • CLOCK Simulated clock has stopped:停止模擬的 clock

【2.2 範例一之版本1】

  • 現在我們修改 TraceFile (將註解的第18行和第34行打開)
    19         <lease-request arrival="00:00:00">
    20         <lease preemptible="true">
    21                 <nodes>
    22                         <node-set numnodes="1">
    23                                 <res type="CPU" amount="100"/>
    24                                 <res type="Memory" amount="1024"/>
    25                         </node-set>
    26                 </nodes>        
    27                 <start></start>
    28                 <duration time="01:00:00"/>
    29         <software>
    30           <disk-image id="foobar.img" size="1024"/>
    31         </software>
    32         </lease>
    33         </lease-request>
    
  • 再執行它
    # haizea -c /usr/share/haizea/etc/sample_trace.conf
    [2006-11-25 13:00:00.00] RM      Starting resource manager
    [2006-11-25 13:00:00.00] TFILE   Loading tracefile /usr/share/haizea/traces/sample.lwf
    [2006-11-25 13:00:00.00] TFILE   Loaded workload with 1 requests (1 Best-effort)
    [2006-11-25 13:00:00.00] CLOCK   Starting simulated clock
    [2006-11-25 13:00:00.00] LSCHED  Lease #1 has been requested.
    [2006-11-25 13:00:00.00] LSCHED  Lease #1 has been marked as pending.
    [2006-11-25 13:00:00.00] LSCHED  Queued best-effort lease request #1, 1 nodes for 01:00:00.00.
    [2006-11-25 13:00:00.00] LSCHED  Next request in the queue is lease 1. Attempting to schedule...
    [2006-11-25 13:00:00.00] VMSCHED Lease #1 has been scheduled on nodes [1] from 2006-11-25 13:00:00.00 to 2006-11-25 14:00:00.00
    [2006-11-25 13:00:00.00] VMSCHED Started VMs for lease 1 on nodes [1]
    [2006-11-25 14:00:00.00] VMSCHED Stopped VMs for lease 1 on nodes [1]
    [2006-11-25 14:00:00.00] VMSCHED Lease 1's VMs have shutdown.
    [2006-11-25 14:00:00.00] CLOCK   Simulated clock has stopped
    [2006-11-25 14:00:00.00] RM      Stopping resource manager gracefully...
    [2006-11-25 14:00:00.00] RM      --- Haizea status summary ---
    [2006-11-25 14:00:00.00] RM      Number of leases (not including completed): 0
    [2006-11-25 14:00:00.00] RM      Completed leases: 1
    [2006-11-25 14:00:00.00] RM      ---- End summary ----
    
  • 兩個 CLOCK 之間多了LSCHED(租約排程) 和 VMSCHED(VM排程)
    • LSCHED Lease #1 has been requested.
    • LSCHED Lease #1 has been marked as pending.
    • LSCHED Queued best-effort lease request #1, 1 nodes for 01:00:00.00.
    • LSCHED Next request in the queue is lease 1. Attempting to schedule...
    • VMSCHED Lease #1 has been scheduled on nodes [1] from 2006-11-25 13:00:00.00 to 2006-11-25 14:00:00.00
    • VMSCHED Started VMs for lease 1 on nodes [1]
    • VMSCHED Stopped VMs for lease 1 on nodes [1]
    • VMSCHED Lease 1's VMs have shutdown.
  • http://haizea.cs.uchicago.edu/manual/quickstart_leasegraph2.png<- 流程圖解:此 Best-effort 租約要求一台 node 在 13:00時,並持續擁有資源此 1小時

【2.2 範例一之版本2】

  • 繼續修改 TraceFile (再把註解的第37行和第55行打開)
    38         <lease-request arrival="00:15:00">
    39         <lease preemptible="false">
    40                 <nodes>
    41                         <node-set numnodes="4">
    42                                 <res type="CPU" amount="100"/>
    43                                 <res type="Memory" amount="1024"/>
    44                         </node-set>
    45                 </nodes>        
    46                 <start>
    47                         <exact time="00:30:00"/>
    48                 </start>
    49                 <duration time="00:30:00"/>
    50         <software>
    51           <disk-image id="foobar.img" size="1024"/>
    52         </software>
    53         </lease>
    54         </lease-request>
    
  • 執行它
    # haizea -c /usr/share/haizea/etc/sample_trace.conf
    [2006-11-25 13:00:00.00] RM      Starting resource manager
    [2006-11-25 13:00:00.00] TFILE   Loading tracefile /usr/share/haizea/traces/sample.lwf
    [2006-11-25 13:00:00.00] TFILE   Loaded workload with 2 requests (1 Best-effort + 1 AR)
    [2006-11-25 13:00:00.00] CLOCK   Starting simulated clock
    [2006-11-25 13:00:00.00] LSCHED  Lease #1 has been requested.
    [2006-11-25 13:00:00.00] LSCHED  Lease #1 has been marked as pending.
    [2006-11-25 13:00:00.00] LSCHED  Queued best-effort lease request #1, 1 nodes for 01:00:00.00.
    [2006-11-25 13:00:00.00] LSCHED  Next request in the queue is lease 1. Attempting to schedule...
    [2006-11-25 13:00:00.00] VMSCHED Lease #1 has been scheduled on nodes [1] from 2006-11-25 13:00:00.00 to 2006-11-25 14:00:00.00
    [2006-11-25 13:00:00.00] VMSCHED Started VMs for lease 1 on nodes [1]
    [2006-11-25 13:15:00.00] LSCHED  Lease #2 has been requested.
    [2006-11-25 13:15:00.00] LSCHED  Lease #2 has been marked as pending.
    [2006-11-25 13:15:00.00] LSCHED  Scheduling AR lease #2, 4 nodes from 2006-11-25 13:30:00.00 to 2006-11-25 14:00:00.00.
    [2006-11-25 13:15:00.00] LSCHED  Must preempt leases [1] to make room for lease #2
    [2006-11-25 13:15:00.00] LSCHED  Preempting lease #1...
    [2006-11-25 13:15:00.00] LSCHED  ... lease #1 will be suspended at 2006-11-25 13:30:00.00.
    [2006-11-25 13:15:00.00] LSCHED  AR lease #2 has been scheduled.
    [2006-11-25 13:29:28.00] VMSCHED Stopped VMs for lease 1 on nodes [1]
    [2006-11-25 13:29:28.00] VMSCHED Suspending lease 1...
    [2006-11-25 13:30:00.00] VMSCHED Lease 1 suspended.
    [2006-11-25 13:30:00.00] VMSCHED Started VMs for lease 2 on nodes [2, 3, 4, 1]
    [2006-11-25 13:30:00.00] LSCHED  Next request in the queue is lease 1. Attempting to schedule...
    [2006-11-25 13:30:00.00] VMSCHED Lease #1 has been scheduled on nodes [1] from 2006-11-25 14:00:00.00 (resuming) to 2006-11-25 14:31:04.00
    [2006-11-25 14:00:00.00] VMSCHED Stopped VMs for lease 2 on nodes [2, 3, 4, 1]
    [2006-11-25 14:00:00.00] VMSCHED Resuming lease 1...
    [2006-11-25 14:00:00.00] VMSCHED Lease 2's VMs have shutdown.
    [2006-11-25 14:00:32.00] VMSCHED Resumed lease 1
    [2006-11-25 14:00:32.00] VMSCHED Started VMs for lease 1 on nodes [1]
    [2006-11-25 14:31:04.00] VMSCHED Stopped VMs for lease 1 on nodes [1]
    [2006-11-25 14:31:04.00] VMSCHED Lease 1's VMs have shutdown.
    [2006-11-25 14:31:04.00] CLOCK   Simulated clock has stopped
    [2006-11-25 14:31:04.00] RM      Stopping resource manager gracefully...
    [2006-11-25 14:31:04.00] RM      --- Haizea status summary ---
    [2006-11-25 14:31:04.00] RM      Number of leases (not including completed): 0
    [2006-11-25 14:31:04.00] RM      Completed leases: 2
    [2006-11-25 14:31:04.00] RM      ---- End summary ----
    
  • http://haizea.cs.uchicago.edu/manual/quickstart_leasegraph3.png<- 流程圖解:第1個租約(Best-effort lease)要求一台 node 在 13:00時,並持續擁有資源此 1 小時,到了13:15分時,第2個租約(AR lease)要求出現,他需要 4 台 node 再 13:30開始執行,並持續擁有資源 30 分鐘 (因為AR lease 優先權高於 Best-effort lease,所以到了13:30時,將第1個租約先 suspend起來,等到13:30 第2個資約完成後,才resume回來繼續執行租約1)
Last modified 15 years ago Last modified on Jan 20, 2010, 10:52:32 AM

Attachments (2)

Download all attachments as: .zip