BOP: A Bitset-based Optimization Paradigm for Content-based Event Matching Algorithms (S)

Wei Liang, Wanghua Shi, Zhengyu Liao, Shiyou Qian, Zhonglong Zheng, Jian Cao, Guangtao XueSEKE 2023 · OpenReview

Abstract

Content-based Publish/Subscribe (CPS) systems require efficient event matching to handle millions of subscriptions in real-time. This paper presents the Bitset-based Optimization Paradigm (BOP), a general framework that accelerates matching by replacing expensive arithmetic operations with high-speed bitwise logic. By leveraging hardware-level parallelism and pre-calculating null predicates, BOP achieves a performance boost of over 60% for established algorithms like TAMA and REIN while significantly improving scalability and performance stability.

The Challenge of Event Matching

In a Content-based Publish/Subscribe (CPS) system, a broker must match incoming events against millions of user subscriptions in real-time. This process is the engine behind online advertising, mobile push notifications, and high-frequency financial routing. As these systems scale, the event matching process often becomes a massive bottleneck.

Existing algorithms generally fall into two categories:

  1. Forward Matching (e.g., TAMA): These count how many predicates (conditions) an event satisfies for each subscription, requiring a high volume of additions and counter-checks.
  2. Backward Matching (e.g., REIN): These look for "unsatisfied" predicates to rule out subscriptions, often involving traversing long lists and repetitive marking.

The authors identify that both approaches rely heavily on "non-logical" operations (additions, comparisons) that are computationally expensive at scale. BOP aims to transform these into "logical" operations (AND, OR, NOT) that modern CPUs can execute with extreme efficiency.

The BOP Framework

The core of BOP is the use of bitsets—compact arrays of bits where each bit represents a subscription's status. The paradigm introduces two main optimizations:

Logic Transformation

Instead of incrementing a counter for every satisfied predicate, BOP uses bitwise AND and OR operations. This leverages hardware-level parallelism (SIMD instructions) to process multiple subscriptions simultaneously. The authors formalized this into a general mathematical model:

$$B_{result} = \bigcap_{i=1}^d (B_{null}^i \cup B_{match}^i)$$

Where $d$ is the dimensionality, $B_{null}$ represents subscriptions without a predicate on attribute $i$, and $B_{match}$ represents those whose predicates are satisfied.

Pre-marking Null Predicates

In high-dimensional systems, a single subscription usually only cares about a few attributes. It has "null" predicates for everything else. BOP pre-calculates bitsets for these null attributes. During matching, the system only needs to process the few attributes actually present in the event, significantly reducing redundant work.

Experimental Evaluation

The researchers evaluated BOP using a synthetic benchmarking environment designed to simulate large-scale CPS workloads with up to 9 million subscriptions and 50 distinct attributes. Attributes were selected using a Zipf distribution to mimic real-world popularity patterns.

Key Results: Speed and Scalability

The authors applied BOP to two representative algorithms, creating TAMA-O and REIN-O. Both optimized versions reduced matching time by more than 60% on average.

Scalability of matching time as the number of subscriptions increases.

As shown in the figure above, as the number of subscriptions increased from 1M to 9M, the performance gap between the original and BOP-optimized versions widened, proving that BOP handles scale significantly better than traditional arithmetic-based approaches.

Performance Stability

One of the most critical findings is that BOP makes matching times more predictable. Standard algorithms fluctuate wildly based on how many predicates are satisfied; BOP’s bitwise approach remains consistent, ensuring a more reliable Quality of Service (QoS).

Matching performance across varying predicate widths.

As illustrated, REIN-O and TAMA-O maintain lower and more stable matching times across different predicate widths compared to their predecessors, which show much higher variance.

Conclusion and Future Work

BOP demonstrates that trading a modest amount of memory for bitwise logic can yield massive speedups. While REIN-O saw a memory usage increase of approximately 39%, TAMA-O's footprint remained nearly identical to the original. Future work will explore attribute grouping to further reduce memory overhead and potentially increase speed in extremely high-dimensional spaces.

Summary updated

BibTeX
@inproceedings{liang2023bop,
  author = {Wei Liang and Wanghua Shi and Zhengyu Liao and Shiyou Qian and Zhonglong Zheng and Jian Cao and Guangtao Xue},
  title = {{BOP: A Bitset-based Optimization Paradigm for Content-based Event Matching Algorithms (S)}},
  booktitle = {SEKE},
  year = {2023},
  url = {https://openreview.net/forum?id=xkdEYoQzPe},
}
Figure