TL;DR
RecStep is a high-performance, general-purpose Datalog engine built on top of a single-node parallel relational database (RDBMS). By implementing a suite of Datalog-to-SQL and system-level optimizations, the authors demonstrate that a relational backend can outperform specialized Datalog solvers by 4-6x, effectively bridging the performance gap between graph analytics and program analysis.
What Problem Does This Paper Address?
Datalog, a recursive query language, has seen a massive resurgence in fields like program analysis, graph analytics, and networking. However, a "domain divide" has emerged: tools optimized for program analysis (like Souffle) often lack the aggregation features needed for graph tasks, while graph-centric engines (like BigDatalog) struggle with the complex, non-linear recursion typical of program analysis.
Furthermore, there is a long-standing belief in the research community that traditional RDBMS backends are unsuitable for Datalog because the overhead of iterative SQL execution is too high. The authors challenge this assumption, asking if a single-node, parallel RDBMS can be transformed into a general-purpose engine that handles both domains efficiently.
Methods
The authors built RecStep on top of QuickStep, a parallel in-memory RDBMS. To make this work, they introduced several key optimizations:
- Unified IDB Evaluation (UIE): Instead of issuing separate SQL queries for every rule, RecStep groups subqueries into a single query using
UNION ALL. This maximizes multi-core utilization and reduces RDBMS call overhead. - Optimization On the Fly (OOF): Datalog is iterative. A query plan that is optimal in the first iteration (when the delta set is large) might be terrible in the tenth. RecStep re-optimizes query plans at every step using fresh table statistics.
- Dynamic Set Difference (DSD): Computing the "new" tuples at each step is a bottleneck. RecStep uses a cost model to choose between a one-phase or two-phase set difference based on the relative sizes of the tables.
- Evaluation as One Single Transaction (EOST): To avoid unnecessary I/O, RecStep treats the entire recursive evaluation as one transaction, keeping data in memory and only committing to disk at the final fixpoint.
- Fast Deduplication (FAST-DEDUP): A specialized, latch-free global hash table using compact concatenated keys to speed up the constant need for deduplication.
- Parallel Bit-Matrix Evaluation (PBME): For dense graphs, RecStep replaces hash tables with bit-matrices. This fuses the join and deduplication steps into one operation, drastically reducing memory footprint.
Datasets
The authors evaluated RecStep using a diverse battery of tests:
- Graph Analytics: Synthetic dense graphs ($G_{n,p}$), RMAT graphs (up to 128M vertices), and large-scale real-world graphs including livejournal, orkut, arabic, and twitter.
- Program Analysis: Seven synthetic datasets for Andersen’s Analysis, and real-world system code (Linux kernel, PostgreSQL, httpd) for context-sensitive dataflow (CSDA) and points-to (CSPA) analysis.
Key Insights and Ideas
- The RDBMS Myth Debunked: The paper proves that the perceived "slowness" of RDBMS for Datalog isn't inherent to the relational model, but rather a result of how the engine is managed. With careful scheduling and transaction management, the RDBMS becomes a powerful asset.
- Plan Stability is a Trap: In recursive processing, data distributions shift rapidly. The "Aha!" moment here is that "Optimization On the Fly" provides a ~2.5x speedup simply by acknowledging that the "best" way to join two tables changes as the recursion progresses.
- Density Dictates Data Structures: While hash tables are standard, bit-matrices are vastly superior for dense relations. By switching to PBME, RecStep could complete evaluations on dense graphs where every other system either timed out or crashed due to out-of-memory errors.
Key Results
- Superior Speed: RecStep generally outperforms state-of-the-art parallel Datalog engines by a 4-6x margin.
- Single-Node Power: RecStep on a single node often outperformed Distributed-BigDatalog running on a 15-node cluster (120 cores), proving that scale-up (better use of one node) can be more efficient than scale-out for many workloads.
- Robustness: RecStep was the only system capable of completing all graph analytics tasks (REACH, CC, SSSP) across all tested RMAT and real-world datasets.
- Scalability: The system scales linearly up to 16-20 physical cores, though speedup tapers off slightly due to synchronization overhead on shared hash tables.
Limitations and Future Work
- High-Iteration Overhead: For programs like CSDA that require ~1000 iterations with very small data changes per step, the overhead of query compilation and "analyze" calls becomes significant. In these specific cases, RecStep was outperformed by Souffle.
- Data Skew in PBME: While the bit-matrix approach is fast, the authors noted that data skew can lead to load imbalance between threads. They proposed an experimental coordination strategy (SG-PBME-COORD) to mitigate this, but noted it requires further study.
- Future Directions: The authors suggest exploring better coordination for parallel bit-matrix operations and further reducing the "startup" overhead for very short-running iterative queries.
Summary updated