Table of Contents
Fetching ...

Optimizations and extensions for fair join pattern matching

Ioannis Karras

TL;DR

This work addresses the efficiency of fair join pattern matching for actors by optimizing the stateful tree-based algorithm. It introduces a suite of optimizations (including lazy matching, cache-friendly data structures, multithreaded execution, and guard-based filtering) that yield up to ~10x speedups and bring performance closer to Rete on regular benchmarks while preserving strong performance on heavy-guard variants. In addition, the benchmark suite is extended with new tests, a less ambiguous operator syntax, and dynamic pattern switching, plus a real-world microservice use case. The results show that a native, optimized tree-based approach can rival hand-tuned Rete solutions in common scenarios while maintaining advantages in guard-heavy workloads, offering a practical alternative to manually adapting Rete for join-pattern benchmarks.

Abstract

Join patterns are an underexplored approach for the programming of concurrent and distributed systems. When applied to the actor model, join patterns offer the novel capability of matching combinations of messages in the mailbox of an actor. Previous work by Philipp Haller et al. in the paper "Fair Join Pattern Matching for Actors" (ECOOP 2024) explored join patterns with conditional guards in an actor-based setting with a specification of fair and deterministic matching semantics. Nevertheless, the question of time efficiency in fair join pattern matching has remained underexplored. The stateful tree-based matching algorithm of Haller et al. performs worse than an implementation that adapts the Rete algorithm to the regular version of a join pattern matching benchmark, while outperforming on a variant with heavy conditional guards, which take longer to evaluate. Nevertheless, conforming Rete to the problem of join pattern matching requires heavy manual adaptation. In this thesis, we enhance and optimize the stateful tree-based matching algorithm of Haller et al. to achieve up to tenfold performance improvements on certain benchmarks, approaching the performance of Rete on regular benchmarks while maintaining the advantages of versatility and performance with heavy guards. We also enhance the benchmark suite, adding new features and enhancing its extensibility and user-friendliness. We extend the join pattern implementation with a less ambiguous syntax as well as dynamic pattern switching. Finally, we present a new complex model use case for join patterns, showing their applicability in a microservice web architecture.

Optimizations and extensions for fair join pattern matching

TL;DR

This work addresses the efficiency of fair join pattern matching for actors by optimizing the stateful tree-based algorithm. It introduces a suite of optimizations (including lazy matching, cache-friendly data structures, multithreaded execution, and guard-based filtering) that yield up to ~10x speedups and bring performance closer to Rete on regular benchmarks while preserving strong performance on heavy-guard variants. In addition, the benchmark suite is extended with new tests, a less ambiguous operator syntax, and dynamic pattern switching, plus a real-world microservice use case. The results show that a native, optimized tree-based approach can rival hand-tuned Rete solutions in common scenarios while maintaining advantages in guard-heavy workloads, offering a practical alternative to manually adapting Rete for join-pattern benchmarks.

Abstract

Join patterns are an underexplored approach for the programming of concurrent and distributed systems. When applied to the actor model, join patterns offer the novel capability of matching combinations of messages in the mailbox of an actor. Previous work by Philipp Haller et al. in the paper "Fair Join Pattern Matching for Actors" (ECOOP 2024) explored join patterns with conditional guards in an actor-based setting with a specification of fair and deterministic matching semantics. Nevertheless, the question of time efficiency in fair join pattern matching has remained underexplored. The stateful tree-based matching algorithm of Haller et al. performs worse than an implementation that adapts the Rete algorithm to the regular version of a join pattern matching benchmark, while outperforming on a variant with heavy conditional guards, which take longer to evaluate. Nevertheless, conforming Rete to the problem of join pattern matching requires heavy manual adaptation. In this thesis, we enhance and optimize the stateful tree-based matching algorithm of Haller et al. to achieve up to tenfold performance improvements on certain benchmarks, approaching the performance of Rete on regular benchmarks while maintaining the advantages of versatility and performance with heavy guards. We also enhance the benchmark suite, adding new features and enhancing its extensibility and user-friendliness. We extend the join pattern implementation with a less ambiguous syntax as well as dynamic pattern switching. Finally, we present a new complex model use case for join patterns, showing their applicability in a microservice web architecture.

Paper Structure

This paper contains 11 sections, 1 figure.

Figures (1)

  • Figure 1: The evolution of an initially empty matching tree as the message indices 1, 2, and 3 are added to it