TL;DR
TenGraph is a novel graph query engine that leverages tensor computation runtimes (TCRs), commonly used in deep learning, to accelerate graph query processing. By representing graph data and operations as tensors, TenGraph achieves significant speedups (up to 50-100x on GPU) over existing systems, even outperforming specialized graph databases.
What Problem Does This Paper Address?
Graph databases are crucial for managing and querying complex relationships, but graph queries are notoriously computationally intensive due to irregular access patterns. Existing systems often struggle to fully exploit modern hardware like GPUs or focus solely on subgraph matching, neglecting other essential query operations. This leaves a gap in efficient, hardware-accelerated graph query processing that can handle a broad range of operations.
Methods
TenGraph's core innovation lies in its tensor-based approach. Instead of traditional graph data structures, it uses tensors, the fundamental data unit in deep learning frameworks like PyTorch.
- Tensor Representation: Graph topology is represented using a novel "Compressed Unique Source" (CUS) format, which allows for efficient neighbor traversal and edge existence checks using tensor operations.
- Tensor Computation Runtime (TCR): TenGraph relies on existing TCRs (specifically PyTorch in their implementation) to handle the low-level hardware optimizations. This allows TenGraph to automatically benefit from advancements in CPU and GPU hardware without explicit low-level coding.
- Query Operations as Tensor Operations: Key graph query operations like expand, filter, projection, and aggregate are re-imagined and implemented as sequences of tensor operations. This includes specialized algorithms for neighbor traversal and edge existence checking that are optimized for tensor computation.
- Subgraph Matching: The paper details how subgraph matching, a core graph query operation, is handled by composing tensor operations, including support for more complex patterns like negative edge conditions and optional edges.
- Path and Tree Candidate Representation: Novel compressed data structures are introduced to represent intermediate results for path and tree patterns, enabling efficient filtering and projection.
Datasets
The paper evaluates TenGraph using two main benchmarks:
- LDBC SNB Business Intelligence (BI) workload: This benchmark uses directed labeled graphs mimicking social network data and includes complex, join-heavy, and aggregate-heavy queries. Datasets were generated at scale factors of 10 and 100.
- Labelled Subgraph Query Benchmark (LSQB): This benchmark, derived from LDBC SNB, specifically focuses on subgraph matching queries and includes features like optional and negative edges. A dataset with a scale factor of 1 was used.
Key Insights and Ideas
- Deep Learning Frameworks as Accelerators: The paper demonstrates that the highly optimized tensor operations within deep learning frameworks can be effectively repurposed for general graph query processing, offering significant performance gains.
- Unified Tensor Abstraction: Representing graph data and operations uniformly as tensors simplifies development and allows for automatic hardware acceleration without manual low-level optimization.
- CUS Format Efficiency: The proposed CUS format for graph structure representation is key to enabling efficient tensor-based neighbor traversal and edge checks, a bottleneck in many graph systems.
- Beyond Subgraph Matching: TenGraph's ability to handle a full spectrum of graph query operations (filter, projection, aggregate) using tensor operations, not just subgraph matching, is a significant advantage.
Key Results
- Massive Speedups: TenGraph achieves speedups of 50-100 times on the GPU compared to its CPU implementation.
- Outperforming Baselines: TenGraph significantly outperforms existing graph databases like Neo4j and TigerGraph, as well as other tensor-based systems like TQP*, on various benchmarks.
- GPU vs. CPU: TenGraph-GPU is consistently much faster than TenGraph-CPU, highlighting the benefits of GPU acceleration.
- Memory Efficiency: TenGraph shows lower peak memory costs for intermediate results compared to TQP* on selected queries.
- Broader Query Support: TenGraph handles more complex query types (e.g., negative edges, optional edges) than some specialized subgraph matching algorithms.
Limitations and Future Work
- Data Transfer Overhead: For large datasets (SF=100), the CPU-to-GPU data transfer time accounts for a significant portion (average 83.4%) of query processing time, suggesting a need for smarter data management strategies like CPU-GPU co-execution or keeping frequently used data on the GPU.
- DFS Performance: The current CPU-only implementation of Depth-First Search (DFS) in TenGraph is significantly slower than Neo4j, as it relies on Python loops. Parallelizing DFS using tensor operators is a future research direction.
- Worst-Case Optimality: TenGraph is not currently worst-case optimal for all operations, particularly edge existence checking, due to limitations in current TCR operator expressivity (e.g., lack of efficient set intersection over segments). Extending TCRs with new operators is a potential future work.
- TCR Operator Dependency: The performance and capabilities of TenGraph are inherently tied to the expressivity and efficiency of the underlying TCR.
Summary updated