<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Towards Elastic Stream Processing: Patterns and Infrastructure</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Kai-Uwe Sattler</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Felix Beier</string-name>
          <email>felix.beier@tu-ilmenau.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Ilmenau University of Technology</institution>
          ,
          <addr-line>Ilmenau</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Distributed, highly-parallel processing frameworks as Hadoop are deemed to be state-of-the-art for handling big data today. But they burden application developers with the task to manually implement program logic using lowlevel batch processing APIs. Thus, a movement can be observed that high-level languages are developed which allow to declaratively model data ows that are automatically optimized and mapped to the batch-processing backends. However, most of these systems are based on programming models as MapReduce that provide elasticity and fault-tolerance in a natural manner since intermediate results are materialized and, therefore, processes can simply be restarted and scaled with partitioning input datasets. For continuous query processing on data streams, these concepts cannot be applied directly since it must be guaranteed that no data is lost when nodes fail. Usually, these long running queries contain operators that maintain state information which depends on the data that has already been processed and hence they cannot be restarted without information loss. This also is an issue when streaming tasks should be scaled. Therefore, integrating elasticity and fault-tolerance in this context is a challenging task which is subject of this paper. We show how common patterns from parallel and distributed algorithms can be applied to tackle these problems and how they are mapped to the Mesos cluster management system.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. INTRODUCTION</title>
      <p>Processing and analyzing big data is one of todays big
challenges. A popular de nition from a Gartner report
names the three 'V' s { volume, velocity, and variety as the
main characteristics of big data. Among them, velocity refers
to the analytics of dynamic data even in (near) realtime.</p>
      <p>Several approaches and techniques have been developed
in the past to process dynamic data. Data stream
management systems (DSMS) like STREAM, Aurora, IBM
InfosThis work is partially funded by an IBM PhD Fellowship.
phere Streams or our own AnduIN engine provide
abstractions to process continuous and possibly in nite streams
of data instead of disk-resident datasets. Typically, this
includes standard (relational) query operators, window-based
operators for computing joins and aggregations as well as
more advanced data analytics and data mining operators
working on portions of the stream, e.g. windows or synopses
of data. Complex Event Processing systems (CEP)
particularly support the identi cation of event patterns in
(temporal) streams of data such as a sequence of speci c event
types within a given time interval. Typically, systems of both
classes provide a declarative interface, either in form of
SQLlike query languages like CQL for DSMS, event languages
like SASE, or in the form of data ow speci cations like SPL
in IBM Infosphere Streams.</p>
      <p>Recently, several new distributed stream computing
platforms have been developed, aiming at providing scalable and
fault-tolerant operation in cluster environments. Examples
are Apache S4 or Storm. In contrast to DSMS or CEP
engines theses platforms do not (yet) provide declarative
interfaces and, therefore, require to program applications instead
of writing queries. Developers of these systems argue that
they provide the same for stream processing what Hadoop
did for batch processing { which raises the hope of a similar
movement towards higher-level languages as we can see with
Pig, Jaql etc. for MapReduce.</p>
      <p>However, there are some challenges in scalable and elastic
stream processing which are di erent from batch processing
with Hadoop. Whereas in Hadoop, input data as well as
intermediate results are materialized on disk and, therefore,
both, map and reduce tasks can be restarted arbitrarily
in case of failures until the entire job is nished,
since computation state is saved, the number of nodes
assigned to map and reduce tasks can be simply adjusted
by partitioning input and intermediate results.</p>
      <p>This is more di cult when processing dynamic data { even
with platforms as S4 or Storm which to some extent support
a reliable and scalable operation. The main di erences are:
(1) Partitioning of streams for data-parallel processing is not
always easily possible, for example in case of
windowor sequence-based operators including CEP operators.
Also, elastic operation by adding new nodes at runtime
of a query requires at least rerouting of data.
(2) Stream queries are typically long running queries which
cannot be simply restarted without losing data.
Furthermore, because of this, the deployment and resource
allocation (placement of queries on nodes, allocating
memory and CPUs) are much more critical.</p>
      <p>In this paper, we try to answer the question how to bridge
the gap between an easy-to-use, high-level declarative
interface for data stream analytics and scalable cluster-based
stream computing platforms in order to address these
challenges. The contribution of this paper is twofold:
Based on a basic data ow model for stream queries we
describe patterns for fault-tolerant and scalable query
processing and discuss constraints of their application.
We show the implementation and deployment of these
patterns using our distributed stream and CEP engine
AnduIN and the Mesos cluster infrastructure by describing
techniques supporting exible and elastic deployment.
Though, we use the AnduIN system for describing and
implementing the concepts, we think the ideas and patterns
are applicable to other platforms, too.
2.</p>
    </sec>
    <sec id="sec-2">
      <title>RELATED WORK</title>
      <p>The relevant work related to this paper can be classi ed
into the main categories: continuous query processing and
scalable data ow platforms.</p>
      <p>Continuous query processing is usually implemented in
data stream management systems (DSMS). Pioneered by
systems like STREAM, Borealis, and Telegraph, several
approaches and systems have been developed in the last
decade including commercial products such as IBM
InfoSphere Streams and StreamBase. Typically, these systems
provide a SQL-like query language enhanced by features for
dealing with continuous queries such as sliding windows.</p>
      <p>
        Partitioning, distributed processing, and fault tolerance
have been studied to some extent, e.g., in Borealis [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] by
introducing replicated processing nodes as well as several new
tuple types such as punctuation tuples and control tuples
like undo tentative (tuples resulting from processing a
subset of the input which can be corrected later) and done tuples
indicating that state reconciliation nished. State
reconciliation is the process of stabilizing the output result, e.g.,
by replacing previously tentative results. In this way, this
approach aims at fault-tolerance but not at partitioning.
      </p>
      <p>
        Another approach in the form of a programming model
has been proposed in [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] as so-called discretized streams
(DStreams). This idea is based on resilient distributed datasets
which are storage abstractions used for rebuilding lost data.
      </p>
      <p>
        An approach addressing load balancing issues by
partitioning while providing fault tolerance for pipelined
data ows is Telegraph's FluX [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. FluX is a data ow
operator extending the idea of the exchange operator form parallel
query processing. The operator encapsulates state
partitioning and tuple routing and allows to repartition even stateful
operators while executing the data ow pipeline.
      </p>
      <p>
        Scalable data ow platforms try to extend the
applicability of the MapReduce paradigm for large-scale parallel batch
processing to pipeline processing and continuous query
support. One example is HOP (Hadoop Online Prototype) [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
In HOP, map tasks maintain TCP sockets to reducers for
pipelining their output. In addition, pipelining is also
supported between jobs by sending the output of reducers
directly to mappers of a subsequent job. Further, distributed
data ow systems are Twitter's Storm and Apache S4. Storm
implements fault detection at task level and guaranteed
message passing, whereas in S4 messages can be lost. Storm runs
so-called topologies { subsets of these topologies are assigned
to worker processes of a cluster. However, these systems only
o er a simple programming model and, therefore, operators
and topologies have to be implemented in a programming
language like Java or Python. Furthermore, state recovery
and partitioning have to be implemented manually, too.
      </p>
      <p>
        Optimus [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] is a framework for dynamic rewriting of
execution plans for data-parallel computing, e.g.,
formulated in DryadLINQ. The framework supports rewriting of
MapReduce programs at runtime, addressing issues like
repartitioning, fault tolerance, and handling data skew. But
the required algorithms have to be implemented by the user.
3.
      </p>
    </sec>
    <sec id="sec-3">
      <title>PATTERNS FOR SCALABLE PROCESS</title>
    </sec>
    <sec id="sec-4">
      <title>ING OF DATA STREAM QUERIES</title>
      <p>
        In the following we assume a simple processing model for
data stream queries: a query is represented by a data ow
graph which is a common model in literature [
        <xref ref-type="bibr" rid="ref11 ref9">9, 11</xref>
        ].
      </p>
      <p>
        In such a directed acyclic graph, nodes represent query
operators and edges describe the tuple ow between them.
Query nodes can be arbitrary pipeline operators of a stream
query algebra [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] like lter, projection etc. as well as
windowor synopsis-based operators as sliding window joins and
aggregations, but also more complex data analytics operators
including CEP and data mining. Communication between
query operators is performed either directly by invoking
operator functions or via bu ers/queues. Obviously, this
represents a very generic execution model to which a wide range
of declarative query languages like CQL, data ow speci
cations such as IBM's SPL, or implementation-oriented
approaches as used in S4 or Storm can be mapped. This model
can be easily extended to the distributed case by inserting
network reader/writer nodes which use appropriate
communication protocols and APIs, e.g., TCP/UDP sockets or
more advanced solutions like ZeroMQ.
      </p>
      <p>There are two main reasons for distributing query nodes:
increasing processing reliability by introducing redundancy,
and increasing performance and/or scalability by load
distribution. The following patterns support these goals to di
erent degrees. In this discussion, we use the term \query task"
as the unit of distribution/scheduling for both, elementary
algebra operators, and for data ow (sub-)graphs with
wellde ned properties (input/output, stateless vs. statefulness).
Pattern 1: Simple standby: For a critical query node N
a standby node S is maintained on a separate compute unit
which is activated if N fails. This requires monitoring of N ,
e.g. by a combination of heartbeats and cluster coordination
service such as ZooKeeper as well as rerouting the input
tuple stream to S. Since in case of a failure the state of N
is lost, this pattern is applicable only for stateless nodes.
Pattern 2: Checkpointing: This pattern is similar to
pattern 1 but supports stateful operators. Failover is achieved
by periodically checkpointing the state of the critical node N
to a shared disk and restarting the standby node S from the
checkpoint. Examples of such checkpoints are the content of
sliding windows or hash tables for joins and aggregations.
Pattern 3: Hot standby: If the failover time of pattern
2 is not acceptable, a hot standby approach can be chosen
where redundant query nodes S are kept actively. To achieve
this, the input stream has to be sent to all redundant nodes,
either by using multicast strategies at the network or at the
application level. This pattern works both with stateless and
stateful query operators but requires a special node to
eliminate duplicate results, e.g., a stream selector node which
forwards the input from only one of multiple streams.
failover
Pattern 4: Stream partitioning: This pattern exploits
data parallelism by partitioning the input stream. It can be
implemented by a splitter node redirecting each input tuple
to one of the query nodes N1 : : : Nk or by a multicast writer
with an additional partitioning node P1 : : : Pk for ltering
the input stream according to the partitioning scheme.
Finally, the results are merged into a single stream.
Pattern 5: Stream pipelining: In contrast to pattern 4
this pattern exploits task parallelism by splitting a complex
query node N into a sequence of query nodes N1 : : : Nk and
placing them on separate compute units.</p>
      <p>
        Usually, multiple patterns will be applied in order to
achieve certain quality of service (QoS) guarantees as fault
tolerance (patterns 1-3) or elasticity for adapting resource
consumption (patterns 4-5) according to the needs of the
applications. Of course this pattern list does not claim
completeness. There are several others that are applicable under
certain circumstances, e.g., parallelization through
aggregation trees for commutative and associative aggregation
operators [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. Nevertheless, these basic patterns described here
are well-known in distributed and parallel algorithms, and
{ with slight modi cations { cover various use cases 1.
      </p>
      <p>
        In the following we will describe how these patterns can
be utilized in a data ow framework to dynamically
restructure the physical representation of the graph in a continuous
query context that is executed in a cluster infrastructure.
The restructuring is achieved with a simple set of rewriting
rules that are automatically applied on the graph without
the need to manually code them as in existing approaches
[
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] while guaranteeing that no state information is lost
during the restructuring phase. We present the algorithms based
on our AnduINv2 stream processing engine but highlight
that they are also applicable on other frameworks as Dryad
with slight modi cations to achieve streaming semantics.
      </p>
    </sec>
    <sec id="sec-5">
      <title>QUERY DEPLOYMENT INFRASTRUC</title>
    </sec>
    <sec id="sec-6">
      <title>TURE</title>
      <p>1Actually, aggregation trees are just combinations of
partitioning and pipelining patterns.</p>
      <p>AnduINv2 queries are deployed as separate processes in
Mesos which are just-in-time compiled using the system's
C++ compiler. This provides an easy mechanism to plug-in
user de ned operators and exchange operator
implementations. During deployment, processes are interlinked by query
channels which simply represent an abstraction over network
connections (TCP/UDP sockets, ZeroMQ connections).</p>
      <p>
        Query tasks can be shared among multiple queries when
they share some common (sub)streams or operators as
described in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Further, a query can be implemented as a set
of tasks which are distributed across multiple nodes in the
cluster. Therefore, the logical query tree is partitioned into
smaller subtrees that are translated separately. We will use
these mechanisms for implementing the elasticity patterns.
4.1
      </p>
      <p>Dataflow Graph Rewriting
data ows are speci ed in an XML format which can be
seen as an intermediate representation, allowing to use
different frontends such as CQL or graphical tools. A data ow
speci cation consists of stream type de nitions and operator
de nitions with name, type, type-speci c parameters as well
as input and output channels. These channels are typed and
are used to interconnect operators to form a graph. The
following example shows a simple data ow speci cation. (We
omitted the XML notation for better readability).
type name = "aStreamType" f</p>
      <p>column name = "x", type = "int" . . .
g
operator name = "source", type = "reader" f</p>
      <p>output name = "aStream", type ="aStreamType"
g
operator name = "myFilter", type = " lter" f
input name = "aStream"
param condition = "aStream.x &lt; 42"
output name = " lteredStream", type = "aStreamType"
g
operator name = "sink", type = "writer" f</p>
      <p>input name = " lteredStream"
g</p>
      <p>Task
Query
executor
Mesos
slave</p>
      <p>Query</p>
      <p>Query
operator</p>
      <p>Query task
deploy
Query
scheduler
Query 1: t1, t2, t3, ...</p>
      <p>Query 2: ...</p>
      <p>Query 3: ...</p>
      <p>Mesos
master
Task
Query
executor
Mesos
slave
&lt;t1, cores, mem, ports, …&gt;
&lt;t2, cores, mem, ports, …&gt;</p>
      <p>...</p>
      <p>Standby
master
Task
Query
executor
Mesos
slave</p>
      <p>Task
Query
executor
Mesos
slave
s
l
e
n
n
a
h
C
t
u
p
n</p>
      <p>I
I~(t)</p>
      <p>Parameters (Meta-Query)
Query Task</p>
      <p>Task State</p>
      <p>P~(t)
⌧ i</p>
      <p>⌧ p
S~(t)</p>
      <p>T
Input Queue Operator States Output Queue</p>
      <p>T T
...
future tuples</p>
      <p>...
processed tuples</p>
      <p>O
u
t
p
u
t
C
h
a
n
n
e
l
s
O~(t)
P2
Pk
N2</p>
      <p>Nk</p>
      <p>Note, that apart from stream input and possible output
no communication operators have to be speci ed as part
of the query. Such operators are added during rewriting if
necessary. For formulating rewriting rules we use a simple
notation. A data ow as given above is written as
sink := writer(f := lter(src := reader))
where writer, lter, and reader are operator types and the
optional sink, f, and src names denote operator instances.</p>
      <p>During rewriting, graph patterns have to be matched and
constraints are checked. For this purpose, the pseudo-type
any is used as a placeholder for any possible type, and any*
represents a data ow of arbitrary operator types. The
following pattern matches a data ow subgraph containing a
stateless lter operator (which is the case for any lter):
a2 := any(f := lter(a1 := any*))[stateless(f)]
To apply the patterns, a rewriting rule can be speci ed:
) a2(stream-selector(failover(writer(f(reader(multicast(a1)))))))
| @{pz1 } | @{pz } | @{pz2 }</p>
      <p>Besides inserting or replacing operators (such as
streamselector, failover, and multicast operators in the previous
example), operator nodes are also annotated with placement
information where pi; pj with i 6= j denote distinct compute
nodes and p denotes an arbitrary number of nodes.
4.2</p>
    </sec>
    <sec id="sec-7">
      <title>Failover Handling</title>
      <p>With these rewriting rules, internal data management
nodes and di erent operator implementations can be
transparently injected into the query plan without impacting the
application. This allows to re-schedule a query task to
another node in case of a failure (pattern 1), use an operator
implementation that automatically integrates snapshotting
(pattern 2), or replicate a task to implement hot standby.</p>
      <p>The actual ow of data through query channels during
runtime is controlled by special operator parameters { e.g.,
target IP addresses and ports { that can be adjusted through
a concept we call meta queries (cf. Sect. 4.5). To detect and
react on failures, query tasks are instrumented with
monitoring interfaces that inform the query scheduler about the
nodes' health and performance measures as tuple processing
rates. The scheduler then triggers a graph rewriting.</p>
      <p>
        When a rewritten graph needs to be deployed, it has to be
guaranteed that no information of the tuple stream is lost.
To analyze the necessary steps, we reduce a query task to a
nite state machine model (cf. Fig. 6) which is common for
implementing CEP operators [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] but can also be applied for
general data ow transformations. The query task receives a
stream of input tuples I~(t), applies its logical operation(s)
{ e.g., a lter or a join { to generate an output stream
O~ (t). (We use vectorial representations here to combine all
channels into a single quantity.) The output might depend
on the task's state S~(t), i.e., the state of all internal
operators which can basically include anything that is required
for implementing the operators (e.g., hash tables, or sliding
      </p>
      <p>N1</p>
      <p>N2</p>
      <p>Nk
windows) and are updated with each incoming tuple through
a state transition function i 2. The meta query extension is
represented by special input channels P~ (t) that modify the
operator state through p.</p>
      <p>
        To guarantee that a node failure does not lead to an
information loss it is necessary that all results which have not
been consumed by the following target can be reproduced
from the possibly in nite input stream. Therefore, the
operator state needs to be snapshotted after each input tuple,
or { if this is too expensive { the input tuples need to be
persisted in order to reproduce this state with just
'replaying' the input. Which tuples are still required for a possible
replay can be controlled by special tuple messages that are
exchanged between tuple producers and consumers as in the
Borealis system [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Note when frameworks as ZeroMQ are
used to implement query channels, reliable message delivery
can be guaranteed without the need to modify operators.
      </p>
      <p>
        In order to implement fault tolerance with transferring
stateful query tasks to other computing nodes, a simple
protocol as presented in [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] is su cient:
(1) quiesce all input streams,
(2) replicate the task state to the target node,
(3) redirect the input streams to the target node,
(4) unquiesce all input streams.
4.3
      </p>
    </sec>
    <sec id="sec-8">
      <title>Elasticity Handling</title>
      <p>
        The same algorithm can be used to replace query tasks
with their rewritten versions that compute the same logical
transformation but use di erent operator implementations
and/or partitioning schemes of the query graph into tasks
for implementing the elasticity patterns 4 and 5.
Rewriting Cost Model: Usually, there are several
possibilities for rewriting data ow graphs. In order to make right
decisions which tasks shall be replaced and how many nodes
should be allocated, a cost model is required taking
possible rewriting bene ts into account as well as costs for the
restructuring, e.g., for transferring states or costs for
additional resources from the cluster infrastructure. Discussing
elaborate decision models is not in the focus of this paper
and is left for future work. We outline a rate-based model
that is suitable to nd hot spots in data ows and is used in
related literature [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ].
      </p>
      <p>
        Rewritings should be done when a query task is detected
that cannot process its incoming tuples with a rate higher
than the arrival rate, e.g., when the computational
complexity or the memory consumption is too high and therefore the
task accumulates an increasing backlog. Such a task
represents the critical path in the data ow, limiting the overall
throughput. For nding these paths, a rate-based
optimization approach is suitable that scans the data ows starting
at source nodes and detects such bottlenecks based on
monitoring information gathered during the execution [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. After
hot spots have been identi ed, one or multiple of the
following methods can be applied for alleviating these bottlenecks.
2Usually, the separation of
both functions are combined.
and
is only conceptual and
|{tA1z} |{tB2z} |{tC3z}(t4t5t6) |{tD7z}
|{tA1z} t|2t{3Btz4t}5 |{tC6z} |{tD7z}
t4 t5 t6 t7
|{Az} |{Bz} |{Cz} |{Dz}
Task sharing (Pattern 5): When multiple queries share
the same (sub)graph to increase data locality [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] and the
shared graph is on the critical path, this path can be
replicated, sharing groups can be repartitioned, and tuples
distributed to all replicas. This is the easiest way to remove
burden from the critical path since inputs of sharing groups
are independent from each other and no special data ow
transformations need to be performed.
      </p>
      <p>
        Inter-operator parallelism (Pattern 4): Usually, it is
better to keep data ow operations on few nodes in order
to avoid costly transfer operations. Hence, initially
compiled queries will comprise few tasks consisting of large
ow (sub)graphs. However, when the computational
complexity exceeds a certain threshold or memory limits for
keeping state information are exceeded, a distributed
processing pipeline will yield better performance. Large graphs
are partitioned, recompiled, and distributed on additional
nodes in the cluster. Moreover, splitting large costly tasks
into smaller distributed ones increases fault-tolerance since
it will become cheaper to recover from node failures [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ].
Intra-operator parallelism (Pattern 4+5): When the
previous patterns not applicable, e.g., when operators are
not shared or the graph has already been split into base
operators, the last possibility to increase parallelism is
partitioning input streams and processing each partition
independent from each other with multiple operator instances.
Unfortunately, this pattern is the most di cult to implement
since its applicability depends on the actual operator type.
Partitions in input streams need to be found, distributed to
the operator instances, and their (partial) results have to be
merged afterwards. Further, this pattern is prone to data
skews and, therefore, some sort of load balancing has to be
implemented, e.g., by monitoring the load of each partition
and dynamically re-schedule partitions as proposed in [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
This concept seamlessly integrates with the graph rewriting
patterns described in this paper but again involves
additional costs for transferring partitions among cluster nodes.
      </p>
      <p>The most challenging problem in this context is nding
suitable partitioning schemes for the operators that shall
be deployed in the framework, especially when they are
not stateless. In the following, we will present a
parallelization scheme in the complex event processing (CEP) context
which is prominent in stream processing.</p>
      <p>
        The task of CEP is nding complex patterns in a stream
of base patterns. These patterns are de ned through
certain properties of incoming tuples, usually described through
predicates and additional correlations of their arrival time.
Mostly, sequences and repetitions are used which can be
expressed with regular expressions [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ]. We demonstrate the
parallelization on the 'tick-shaped' pattern example from [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]
which is illustrated in Fig. 7. In the original publication, the
task for detecting such patterns is originated in stock
exchange trading, but it could also be applied for burst
detection. A 'tick-shape' can be expressed by AB+CD+ where:
pipeline
      </p>
      <p>1
partition
P</p>
      <p>P
A matches any incoming tuple
B+ matches all following tuples with decreasing value
C matches the rst tuple with increasing value after B
but with a value less than the previous one of A
D+ matches following tuples with increasing values &gt; A
For parallelization, we focus on the +-operator since it
is challenging for three reasons: First, like a join, it can
produce multiple output tuples per input tuple. Second, it
needs to store state information for extending existing
patterns to longer ones. Since each tuple is possibly multiplying
the number of results it is likely that { due to memory
constraints { such operators will become critical in the data ow
graph. Third, in most cases the behavior of the stream is not
predictable, rendering static allocations infeasible.</p>
      <p>Fig. 8 illustrates how the operator can be distributed
dynamically to multiple nodes with simply applying graph
patterns 4 and 5. The P +-operator comprises two parts: a
pattern matcher P , and a +-operator which maintains all
previously matched patterns as state and concatenates them with
subsequent matches. The output of + is the output for the
entire operator and serves as input for + again to construct
longer matches. On memory over ow, the operator state can
be partitioned and distributed to multiple instances where
all instances receive the original input stream. Two di erent
behaviors of the operator are required to avoid duplicates.
The rst instance processes the input directly, i.e., all
matching tuples serve as new patterns of length 1. Those matches
must not be reproduced by other instances that simply serve
as targets for over owing patterns that do not t into the
local state but are independent from each other and hence
can be processed on separate nodes. When the complexity
of the matching algorithm P is critical, elasticity can also be
achieved with implementing a pipeline. It exploits the fact
that P + can be expressed through P _(P P +), i.e., a pipeline
of arbitrary length is constructed for matching incoming
tuples in parallel, emitting them as output, and forwarding
them to the next stage for extension.</p>
      <p>
        Since such parallelization schemes depend on operator
semantics, the framework provides them to automatically scale
up and down required resources for built-in operators. For
all user de ned functions which are treated as black boxes
by AnduINv2, the parallelization needs to be implemented
by the user as in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] or are provided through libraries that
are linked as plugin to the execution environment.
4.4
      </p>
    </sec>
    <sec id="sec-9">
      <title>Mesos Integration</title>
      <p>
        Mesos [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] is a cluster management software for resource
isolation and sharing. In Mesos, a master daemon
(possibly supported by additional standby masters) manages a
set of slaves nodes. An application (called framework) runs
tasks on these slaves which is initiated by so-called
executors. Scheduling and resource assignments are managed by
an application-speci c scheduler. In order to support stream
queries we implemented our own framework (cf. Fig. 6),
providing an executor for running query executables (query
tasks) on slave nodes and a query scheduler which gets
resource o ers from the Mesos master (available cores,
memory, and network ports) and requests for executing AnduIN
queries. Each query deployment request is described by a
unique ID, the executable, and a speci cation of resource
requirements, i.e., CPU cores, memory, and a list of query
channels which have to be mapped to network ports. This
speci cation is used by the scheduler to choose a slave node
providing the requested resources for execution. Currently,
only a simple strategy is implemented selecting the rst o er
providing the requested resources { more advanced
strategies are subject of future work. If the scheduler has chosen
an appropriate node, the request is forwarded to the
corresponding executor. The scheduler assigns physical network
ports to query channels and tracks these assignments to be
able to connect subsequent queries referring to the same
logical channel. In this way, a query implemented by one or
more tasks can be deployed to one or more cluster nodes.
4.5
      </p>
    </sec>
    <sec id="sec-10">
      <title>Meta Queries</title>
      <p>Though, Mesos provides mechanisms to deploy processes,
it does not support elastic operation for stream queries. In
Hadoop, it is the task of the job tracker to partition the work
across a set of map and reduce tasks. In case of data streams
the situation is a bit di erent, because we cannot simply
stop and continue/restart queries without loosing data. The
only way to achieve elasticity is to change query behavior at
runtime. Therefore, we introduce the idea of meta queries: in
each (adjustable) query task an additional query is running
on a control stream consisting of tuples of the form:
hquery id; operator id; parameter; valuei</p>
      <p>The control stream is produced by the query scheduler
which monitors resource utilization and implements
strategies for dynamic reallocation. Meta queries are particular
useful for implementing the patterns described in Sect. 3.
For instance, for failover without publish-subscribe (pattern
1 and 2), the network writer has to be informed about the
network address of the newly activated standby node S. For
this purpose, the network writer provides a parameter
targetaddr for the target address. A control stream tuple like
received by the query task triggers sending the tuple stream
to the standby node node2. Similarly, for implementing
pattern 3, the stream selector node can be informed about
switching to the stream produced by query node S.</p>
      <p>For partitioning patterns like pattern 4 it is either required
to modify the tuple distribution strategy of multicast writers
or to adjust partitioning predicates Pi in Fig. 3. Both can be
easily implemented by sending appropriate control tuples.
5.</p>
    </sec>
    <sec id="sec-11">
      <title>CONCLUSION AND FUTURE WORK</title>
      <p>We presented basic concepts how fault-tolerance and
elasticity can be achieved in the context of continuous query
processing by combining techniques that have proven
applicability in other scenarios. These approaches are currently
being integrated into AnduINv2, but can be applied in other
platforms, too. Our main questions we would like to answer
with future experiments are:</p>
      <p>While the rst questions intent to pave the way for a
streaming-as-a-service infrastructure, answering the last one
is needed to keep up with current hardware development
trends. We believe that parallel and specialized processors
as many-core CPUs, GPUs, or FPGAs will nd their way
into future computing centers to provide the most e cient
computing platforms for dedicated tasks { an important
aspect to tackle the big data challenge.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>D. J.</given-names>
            <surname>Abadi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Ahmad</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Balazinska</surname>
          </string-name>
          , et al.
          <article-title>The Design of the Borealis Stream Processing Engine</article-title>
          .
          <source>In CIDR '05</source>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>A.</given-names>
            <surname>Arasu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Babu</surname>
          </string-name>
          , and
          <string-name>
            <surname>J. Widom.</surname>
          </string-name>
          <article-title>CQL: A language for continuous queries over streams and relations</article-title>
          .
          <source>In Database Programming Languages</source>
          . Springer,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>J.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. J.</given-names>
            <surname>DeWitt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Tian</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Y.</given-names>
            <surname>Wang. NiagaraCQ:</surname>
          </string-name>
          <article-title>a scalable continuous query system for Internet databases</article-title>
          .
          <source>SIGMOD Rec</source>
          .,
          <volume>29</volume>
          :
          <fpage>379</fpage>
          {
          <fpage>390</fpage>
          ,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>T.</given-names>
            <surname>Condie</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Conway</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Alvaro</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. M.</given-names>
            <surname>Hellerstein</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Elmeleegy</surname>
          </string-name>
          , and
          <string-name>
            <given-names>R.</given-names>
            <surname>Sears</surname>
          </string-name>
          .
          <article-title>MapReduce online</article-title>
          .
          <source>In NSDI</source>
          , pages
          <volume>21</volume>
          {
          <fpage>21</fpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>N.</given-names>
            <surname>Dindar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P. M.</given-names>
            <surname>Fischer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Soner</surname>
          </string-name>
          , and
          <string-name>
            <given-names>N.</given-names>
            <surname>Tatbul</surname>
          </string-name>
          .
          <article-title>E ciently correlating complex events over live and archived data streams</article-title>
          .
          <source>In DEBS '11. ACM</source>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>M.</given-names>
            <surname>Eckert</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Bry</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Brodt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Poppe</surname>
          </string-name>
          , and
          <string-name>
            <given-names>S.</given-names>
            <surname>Hausmann</surname>
          </string-name>
          .
          <article-title>A CEP Babel sh: Languages for Complex Event Processing and Querying Surveyed</article-title>
          .
          <source>In Reasoning in Event-Based Distributed Systems</source>
          . Springer,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>B.</given-names>
            <surname>Hindman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Konwinski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Zaharia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Ghodsi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. D.</given-names>
            <surname>Joseph</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Katz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Shenker</surname>
          </string-name>
          ,
          <string-name>
            <surname>and I. Stoica.</surname>
          </string-name>
          <article-title>Mesos: A platform for ne-grained resource sharing in the data center</article-title>
          .
          <source>In NSDI</source>
          , pages
          <volume>22</volume>
          {
          <fpage>22</fpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>S.</given-names>
            <surname>Hirte</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Schubert</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Seifert</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Baumann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Klan</surname>
          </string-name>
          , and
          <string-name>
            <given-names>K.</given-names>
            <surname>Sattler.</surname>
          </string-name>
          Data3
          <article-title>- A Kinect Interface for OLAP using Complex Event Processing</article-title>
          .
          <source>In ICDE</source>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>M.</given-names>
            <surname>Isard</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Budiu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Yu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Birrell</surname>
          </string-name>
          , and
          <string-name>
            <given-names>D.</given-names>
            <surname>Fetterly</surname>
          </string-name>
          .
          <article-title>Dryad: distributed data-parallel programs from sequential building blocks</article-title>
          .
          <source>SIGOPS</source>
          ,
          <volume>41</volume>
          :
          <fpage>59</fpage>
          {
          <fpage>72</fpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>M. S.</given-names>
            <surname>Joseph</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. M.</given-names>
            <surname>Hellerstein</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Ch</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M. J.</given-names>
            <surname>Franklin</surname>
          </string-name>
          .
          <article-title>Flux: An Adaptive Partitioning Operator for Continuous Query Systems</article-title>
          . In ICDE,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>Q.</given-names>
            <surname>Ke</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Isard</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Y.</given-names>
            <surname>Yu</surname>
          </string-name>
          .
          <article-title>Optimus: a dynamic rewriting framework for data-parallel execution plans</article-title>
          .
          <source>In EuroSys</source>
          , pages
          <volume>15</volume>
          {
          <fpage>28</fpage>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>D.</given-names>
            <surname>Klan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Karnstedt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Hose</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Ribe-Baumann</surname>
          </string-name>
          , and
          <string-name>
            <given-names>K.</given-names>
            <surname>Sattler</surname>
          </string-name>
          .
          <article-title>Stream engines meet wireless sensor networks: cost-based planning and processing of complex queries in AnduIN</article-title>
          .
          <source>Distrib. and Parallel Databases</source>
          ,
          <volume>29</volume>
          :
          <fpage>151</fpage>
          {
          <fpage>183</fpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>S. D.</given-names>
            <surname>Viglas</surname>
          </string-name>
          and
          <string-name>
            <given-names>J. F.</given-names>
            <surname>Naughton</surname>
          </string-name>
          .
          <article-title>Rate-based query optimization for streaming information sources</article-title>
          .
          <source>In SIGMOD '02. ACM</source>
          ,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>M.</given-names>
            <surname>Zaharia</surname>
          </string-name>
          ,
          <string-name>
            <surname>T. Das</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          <string-name>
            <surname>Li</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Shenker</surname>
            ,
            <given-names>and I. Stoica.</given-names>
          </string-name>
          <article-title>Discretized streams: an e cient and fault-tolerant model for stream processing on large clusters</article-title>
          .
          <source>In HotCloud '12. USENIX Association</source>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>F.</given-names>
            <surname>Zemke</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Witkowski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Cherniak</surname>
          </string-name>
          , and
          <string-name>
            <given-names>L.</given-names>
            <surname>Colby</surname>
          </string-name>
          .
          <article-title>Pattern matching in sequences of rows</article-title>
          .
          <source>Technical report, ANSI Standard Proposal</source>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>