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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5 Multi-Flow <strong>Optimization</strong><br />

example partition tree <strong>of</strong> height h = 2. On the first index level, the messages are partitioned<br />

according to customer names ba 1 (m i ), and on the second level, each partition is divided<br />

according to the range <strong>of</strong> order total prices ba 2 (m i ). Horizontal partitioning with the<br />

temporal order <strong>of</strong> partitions reason the outrun <strong>of</strong> single messages. However, the messages<br />

within an individual partition are still sorted according to their incoming order.<br />

<strong>Based</strong> on the partition tree data structure, there are two fundamental maintenance<br />

procedures <strong>of</strong> such a horizontally partitioned message queue:<br />

• The enqueue operation is invoked by the inbound adapters whenever a message was<br />

received and transformed into the internal representation. During message transformation,<br />

partitioning attributes are extracted with low cost as well. Algorithm 5.1<br />

describes the enqueue operation. We use a thread monitor approach for synchronization<br />

<strong>of</strong> those enqueue and dequeue operations in order to avoid any busy waiting.<br />

Subsequently, if a partition with ba l (m i ) = ba(b i ) already exists, the message is inserted;<br />

otherwise, a new partition is created and added at the end <strong>of</strong> the list. The<br />

recursive insert operation depends on the partition type, where we distinguish node<br />

partitions (index levels 1 to h − 1) and leaf partitions (last index level that contains<br />

the messages). In case <strong>of</strong> a node partition, the algorithm part line 3 to line 13 is<br />

used recursively, while in case <strong>of</strong> a leaf partition, the message is simply added to the<br />

end <strong>of</strong> the list <strong>of</strong> messages in this partition.<br />

• The process engine then periodically invokes the dequeue operation according to the<br />

computed waiting time ∆tw. This dequeue operation removes and returns the first<br />

top-level partition with b − ← b 1 . The removed partition exhibits the property <strong>of</strong><br />

being the oldest partition within the partition tree with t c (b 1 ) = min |b|<br />

i=1 t c(b i ), which<br />

ensures that starvation <strong>of</strong> messages is impossible.<br />

The operations enqueue and dequeue are invoked for each individual message. Therefore,<br />

it is meaningful to discuss the worst-case complexity for both operations. Let sel(ba i )<br />

Algorithm 5.1 Partition Tree Enqueue (A-PTE)<br />

Require: message m i , partitioning attribute values ba(m i ), index level l<br />

initialized counter c ← 0, boolean SEB (serialized external behavior)<br />

1: while ∑ |b|<br />

j=1 |b j| > q do // ensure maximum queue constraint q<br />

2: wait // wait for notifying dequeue() (without busy waiting)<br />

3: for j ← |b| to 1 do // for each partition<br />

4: if ba l (m i ) = ba(b j ) then // if partition already exists<br />

5: b + ← b j<br />

6: break<br />

7: else if SEB then<br />

8: c ← c + |b j | // count outrun messages for later serialization<br />

9: if b + = NULL then // if partition does not exist<br />

10: b + ← create partition with t c (b + ) ← t i (m i )<br />

11: b |b|+1 ← b + // add as last partition<br />

12: m i .c ← c // zero in case <strong>of</strong> newly created partitions or for disabled SEB<br />

13: b + .insert(m i , ba(m i ), l − 1) // recursive insert<br />

14: notify // notify waiting dequeue()<br />

136

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

Saved successfully!

Ooh no, something went wrong!