25.01.2015 Views

Cost-Based Optimization of Integration Flows - Datenbanken ...

Cost-Based Optimization of Integration Flows - Datenbanken ...

Cost-Based Optimization of Integration Flows - Datenbanken ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.4 <strong>Cost</strong>-<strong>Based</strong> Vectorization for Multiple Plans<br />

Algorithm 4.4 Heuristic Multiple Plan Vectorization (A-HMPV)<br />

Require: plans P , maximum constraint K<br />

1: P ′ ← ∅, free ← K<br />

2: for i ← 1 to⌊h do // determine ⌋ local maximum constraints for each plan<br />

R<br />

3: K i ← 1 + i·W (P i )<br />

∑ · (K − h) h // 1 ≤ K<br />

j=1 R j·W (P j ) i ≤ K<br />

4: free ← free − K i<br />

5: for i ← 1 to h do // cost-based plan vectorization for each plan<br />

6: P i ′ i)<br />

7: if k i ′ ≤ K i then<br />

8: P ′ ← P ′ ∪ P i<br />

′<br />

9: P ← P − P i<br />

10: free ← free + (K i − k ′ )<br />

11: for i ← 1 to ⌈|P | do // distribute ⌉ remaining threads across remaining plans<br />

R<br />

12: K i ← 1 + i·W (P i )<br />

∑ · (free − |P |) h<br />

j=1 R j·W (P j )<br />

13: for i ← 1 to |P | do // plan vectorization restricting k ′ for each remaining plan<br />

14: if K i ≤ free then<br />

15: P i ′ i, K i )<br />

// restricted cost-based plan vectorization<br />

16: free ← free − K i<br />

17: else<br />

18: P i ′ i, free)<br />

// restricted cost-based plan vectorization<br />

19: free ← 0<br />

20: return P ′<br />

check that the number <strong>of</strong> free elements and hence, the global constraint, is not exceeded.<br />

We use the following example to illustrate this algorithm.<br />

Example 4.11 (Multiple Plan Vectorization). Recall Example 4.10 with the maximum<br />

constraint <strong>of</strong> K = 7 and assume the following monitored execution statistics:<br />

P a : W (P a ) = 8 ms, R a = 5 msg/s<br />

P b : W (P b ) = 17 ms, R b = 2.5 msg /s<br />

P c : W (P c ) = 16 ms, R c = 7 msg/s.<br />

In a first step, we compute the local maximum constraint for the individual plans:<br />

⌊ ⌋<br />

⌊ ⌋<br />

⌊ ⌋<br />

40<br />

42.5<br />

112<br />

P a : K a = 1+<br />

194.5 · 4 = 1, P b : K b = 1+<br />

194.5 · 4 = 1, P c : K c = 1+<br />

194.5 · 4 = 3.<br />

In a second step, we compute the cost-based vectorized plan <strong>of</strong> each deployed plan and<br />

check that the resulting number <strong>of</strong> execution buckets k i does not exceed K i . Figure 4.17(a)<br />

shows the result <strong>of</strong> this step. In detail, only P c is accepted. Hence, we reduce the number<br />

<strong>of</strong> free buckets from free = 7 to free = 4. Furthermore, in a third step, we distribute the<br />

remaining buckets with<br />

⌈ ⌉<br />

⌈ ⌉<br />

40<br />

42.5<br />

P a : K a = 1 +<br />

82.5 · 2 = 2, P b : K b = 1 +<br />

82.5 · 2 = 3.<br />

115

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!