20.01.2015 Views

Performance Modeling and Benchmarking of Event-Based ... - DVS

Performance Modeling and Benchmarking of Event-Based ... - DVS

Performance Modeling and Benchmarking of Event-Based ... - DVS

SHOW MORE
SHOW LESS

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

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

60 CHAPTER 4. PERFORMANCE ENGINEERING OF EVENT-BASED SYSTEMS<br />

Depending on the availability <strong>of</strong> <strong>Event</strong> tokens in the depository <strong>of</strong> the Broker, either mode 2-I<br />

(<strong>Event</strong> available) or mode 2-II (no <strong>Event</strong> token) is chosen:<br />

1. If an <strong>Event</strong> token exists the consumer pulls it (transition 3-I ) <strong>and</strong> disconnects. He will<br />

not reconnect before the <strong>Event</strong> token is processed.<br />

2. If no <strong>Event</strong> token exists the consumer disconnects <strong>and</strong> waits for a specified time interval.<br />

Then, a new Trigger token is generated by transition 3-II <strong>and</strong> the consumer tries to pull<br />

an <strong>Event</strong>.<br />

Number <strong>of</strong> Service Places (Parellel <strong>Event</strong>s) <strong>and</strong> Issues The pattern <strong>of</strong>fers a simple way<br />

to set the maximum number <strong>of</strong> <strong>Event</strong>s processed in parallel by defining the initial number <strong>of</strong><br />

Trigger tokens.<br />

However, there is a drawback <strong>of</strong> this approach: Imagine a scenario where we set the number<br />

<strong>of</strong> parallel events processed by the consumer to two. For the case that no <strong>Event</strong> token was<br />

available at the broker, two Trigger tokens were transformed to Sleep tokens <strong>and</strong> moved to<br />

the Timer. After the specified time interval one <strong>of</strong> the Sleep tokens is processed by the Timer<br />

<strong>and</strong> transformed back to a Trigger token by transition T3-II : the consumer ’wakes up’ <strong>and</strong><br />

establishes a connection to the broker. In the meantime two new <strong>Event</strong> tokens arrived in the<br />

depository <strong>of</strong> the Broker. Since there is one Trigger token, only a single <strong>Event</strong> is moved to the<br />

consumer. The second <strong>Event</strong> token remains in the depository <strong>of</strong> the broker until the second<br />

sleep token has been processed by the timer, even if the Consumer has enough resources to<br />

process both <strong>Event</strong>s.<br />

Another approach is presented in Pattern 7, where the consumer pulls as many <strong>Event</strong>s at once<br />

as free resources are available. This avoids opening several connections <strong>and</strong> allows processing<br />

them as fast as possible.<br />

How to Modify Pattern 6 to Model Thread Pool<br />

By removing the Timer place <strong>and</strong> transitions T2-II <strong>and</strong> T3-II the underlying idea <strong>of</strong> this<br />

approach is made suitable for modeling a thread pool. As illustrated in Figure 4.15, all we need<br />

to implement such a pool are Thread tokens <strong>and</strong> a Thread Pool ordinary place (corresponding<br />

to Thread tokens, respectively Thread Store).<br />

QPN Definition<br />

Places:<br />

Place Type Description<br />

Producer S Publishes events.<br />

Broker S Stores all incoming events.<br />

Timer Q Timer queue (scheduling strategy: infinite server).<br />

Trigger Store O Stores trigger tokens.<br />

Consumer S Consumes incoming events.<br />

Colors:<br />

Color<br />

<strong>Event</strong><br />

Trigger<br />

Sleep<br />

Description<br />

Represents the published event.<br />

Triggers pull comm<strong>and</strong>s.<br />

Exists for time between an unsuccessful pull attempt <strong>and</strong> a reconnect.

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

Saved successfully!

Ooh no, something went wrong!