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.

3.4 <strong>Optimization</strong> Techniques<br />

Assign (o1)<br />

[out: msg1]<br />

Invoke (o2)<br />

[service s6, in: msg1]<br />

4ms<br />

21ms<br />

subsequence 1<br />

Assign (o3)<br />

[out: msg2]<br />

3ms<br />

Assign (o1)<br />

[out: msg1]<br />

4ms<br />

Assign (o4)<br />

[out: msg3]<br />

4ms<br />

Invoke (o2)<br />

[service s6, in: msg1]<br />

21ms<br />

Invoke (o5)<br />

[service s6, in: msg2, out: msg4]<br />

Invoke (o6)<br />

[service s6, in: msg3, out: msg5]<br />

74ms<br />

131ms<br />

subsequence 2<br />

3ms<br />

Assign (o3)<br />

[out: msg2]<br />

Fork (o-1)<br />

max(81ms+3ms, 140ms+6ms)<br />

Assign (o4)<br />

[out: msg3]<br />

4ms<br />

Assign (o7)<br />

[in: msg4, out: msg6]<br />

4ms<br />

74ms<br />

Invoke (o5)<br />

[service s6, in: msg2, out: msg4]<br />

Invoke (o6)<br />

[service s6, in: msg3, out: msg5]<br />

131ms<br />

Assign (o8)<br />

[in: msg5, out: msg7]<br />

5ms<br />

4ms<br />

Assign (o7)<br />

[in: msg4, out: msg6]<br />

Assign (o8)<br />

[in: msg5, out: msg7]<br />

5ms<br />

Invoke (o9)<br />

[service s7, in: msg6]<br />

Invoke (o10)<br />

[service s7, in: msg7]<br />

98ms<br />

156ms<br />

subsequence 3<br />

Invoke (o9)<br />

[service s7, in: msg6]<br />

Invoke (o10)<br />

[service s7, in: msg7]<br />

98ms<br />

156ms<br />

(a) Plan P 8<br />

(b) Optimized Plan P ′ 8<br />

Figure 3.13: Example Rewriting Sequences to Parallel <strong>Flows</strong><br />

Figure 3.13(a). The costs are estimated as Ŵ (P 8) = 500 ms. Figure 3.13(b) illustrates<br />

the optimized plan P 8 ′ . During rewriting, the operator sequence was split by the writing<br />

interactions o 2 (after o 2 because it is the first interaction) and o 9 (before o 9 in order to<br />

avoid executing it in parallel to o 6 ) into three subsequences due to Rule 3 <strong>of</strong> Definition 3.1<br />

(no parallel interactions with the same external system if one is a writing interaction).<br />

Furthermore, for the second subsequence, we created a Fork operator with two subflows. If<br />

we assume k = 2 logical processors and a thread start time <strong>of</strong> W (Start Thread) = 3 ms, we<br />

estimate the costs <strong>of</strong> the Fork operator as follows: W (o −1 ) = max((81 ms+3 ms), (140 ms+<br />

2 · 3 ms)) = 146 ms As a result, we reduced the estimated plan costs to Ŵ (P 8 ′ ) = 425 ms,<br />

while ensuring semantic correctness at the same time. There, the Invoke operators o 5 and<br />

o 6 can be executed in parallel because they are both reading interactions.<br />

This optimization technique <strong>of</strong>fers high optimization opportunities. With regard to<br />

maximal optimization opportunities, this technique should be applied before the techniques<br />

WC1 (rescheduling parallel flows) and WC4 (merging parallel flows). In order to<br />

prevent the special case <strong>of</strong> local suboptima, we directly evaluate the techniques WC1 and<br />

WC4 for the resulting plan (e.g., P 8 ′ from Example 3.10) if the parallel execution exhibits<br />

higher estimated costs than the serial execution.<br />

Rewriting Iterations to Parallel <strong>Flows</strong><br />

Similar to rewriting sequences, the technique WC3: Rewriting Iterations to Parallel <strong>Flows</strong><br />

rewrites an Iteration with r loops to a Fork operator with r concurrent subflows. This<br />

is applicable if there are no dependencies between operators <strong>of</strong> different iteration loops.<br />

However, foreach semantics without such dependencies are typical for integration flows.<br />

The core idea is to use, similar to loop unrolling <strong>of</strong> programming language compilers<br />

for parallel environments, the estimated number <strong>of</strong> iterations in order to determine the<br />

63

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

Saved successfully!

Ooh no, something went wrong!