Join Query Optimization Techniques for Complex Event Processing Applications

Ilya Kolchinsky, Assaf Schuster · DOI

Introduction

Complex Event Processing (CEP) systems are designed to detect patterns within high-velocity data streams, such as stock market feeds or security logs. A critical challenge in CEP is determining the most efficient order in which to "join" incoming events to identify a match. As the number of events in a pattern increases, the number of possible evaluation plans grows exponentially. This paper bridges the gap between CEP and traditional Database Management Systems (DBMS) by demonstrating that finding an optimal detection plan is mathematically equivalent to the well-studied problem of Join Query Plan Generation (JQPG).

Theoretical Equivalence and Framework

The core contribution of this research is the formal proof that the CEP Plan Generation (CPG) problem for conjunctive patterns is NP-complete, mirroring the complexity of database join optimization. By establishing this link, the authors enable the application of 40 years of database research to the CEP domain.

To handle the diverse requirements of CEP, the authors developed a framework to transform complex constructs into a "pure conjunctive" form suitable for database optimizers:

  • Sequences: Temporal sequences (e.g., Event A followed by Event B) are modeled as standard joins with a temporal constraint (A.timestamp < B.timestamp).
  • Kleene Closures: Patterns involving "one or more" instances of an event are modeled using a power set event type with adjusted arrival rates.
  • Nested Patterns: These are decomposed into hierarchical structures that can be optimized recursively.
Evolution from (a, b) state-based automata to (c) tree-based detection plans.

Optimization Strategies

The researchers adapted several classic database algorithms to generate efficient CEP plans. A key insight is the performance difference between "order-based" (linear) and "tree-based" (bushy) plans. While native CEP engines often rely on linear automata, bushy trees allow the system to combine rare events early, filtering out irrelevant data more effectively.

Comparison of (a) Left-Deep and (b) Bushy join trees for event pattern evaluation.
  1. Dynamic Programming (DP): Used to find provably optimal bushy or left-deep plans. While highly effective, the computational overhead becomes significant for patterns exceeding 15–20 events.
  2. Iterative Improvement (II): A local search heuristic that starts with a random plan and iteratively swaps events to find a better configuration.
  3. Greedy Cost-Based Search: A fast heuristic that builds plans step-by-step based on immediate cost, providing near-optimal results in under a second for large patterns.

Experimental Results

The approach was evaluated using a real-world dataset of over 80.5 million NASDAQ stock market records and 500 synthetic patterns. The results demonstrate significant performance gains over state-of-the-art native CEP frameworks like ZStream:

  • Throughput: JQPG-based bushy tree plans achieved up to a 7.6x increase in throughput for patterns with seven events.
  • Memory Efficiency: The adapted database methods reduced memory usage by up to 4x compared to native CEP-tree approaches.
  • Cost Model Reliability: The authors confirmed a strong correlation between their theoretical cost function and actual system performance, validating the use of database-style cost models in streaming environments.

Conclusion

By treating event pattern detection as a join optimization problem, this research provides a robust theoretical and practical foundation for high-performance CEP. The transition from simple heuristics to sophisticated database optimization techniques allows CEP engines to handle complex patterns with significantly higher throughput and lower memory overhead. Future work will focus on dynamic adaptivity to handle changing stream statistics on-the-fly.

Summary updated

BibTeX
@article{kolchinsky2018join,
  author = {Ilya Kolchinsky and Assaf Schuster},
  title = {{Join Query Optimization Techniques for Complex Event Processing Applications}},
  journal = {Proc. VLDB Endow.},
  year = {2018},
  doi = {10.14778/3236187.3236189},
}
Figure