Abstract
In this paper, we present a MapReduce-based framework for evaluating SPARQL queries on GPU (named MapSQ) to handle large-scale RDF datasets efficiently. Firstly, we develop a MapReduce-based Join algorithm to handle SPARQL queries in a parallel way. Secondly, we present a coprocessing strategy to manage the process of evaluating queries where the CPU assigns subqueries and the GPU computes the join of subqueries. Finally, we implement our proposed framework and evaluate our proposal by comparing it with two popular SPARQL query engines, gStore and gStoreD, on the LUBM benchmark. The experiments demonstrate that our proposal MapSQ is highly efficient and effective, achieving up to a 50% speedup.
Introduction
The Resource Description Framework (RDF) has become the standard for representing data on the Semantic Web, with SPARQL serving as the primary language for querying this data. As RDF datasets expand into the billions of triples, traditional CPU-based query engines face significant performance challenges.
The primary bottleneck in SPARQL query evaluation is the join operation. When a query involves multiple conditions linked by shared variables, the engine must find all matches for each condition and join them. On a CPU, this is often a sequential or limited multi-threaded process. MapSQ addresses this by leveraging the massive parallelism of GPUs, which are inherently suited for the data-intensive nature of graph joins.
Methodology: The MapSQ Framework
MapSQ utilizes a hybrid "coprocessing" strategy that divides labor between the CPU and GPU to maximize efficiency. Rather than offloading the entire database, the framework targets the specific computational bottlenecks.
As shown in the architecture above, the system is divided into three layers:
- Core Functions: The CPU handles "Partial Matching" using the gStore engine to identify initial candidates for query components.
- Processing Engines: The GPU handles the heavy lifting of joining these partial results. This is managed via Mars, a MapReduce framework designed specifically for GPU execution.
- Co-Processor Layer: The CPU manages query assignment and subquery distribution, while the GPU executes the parallel join logic.
The MapReduce Join Algorithm
The join process on the GPU follows three distinct phases:
- Map Phase: Triples are split and assigned positional "flags" (left or right) based on the shared variable's location. This prevents unnecessary comparisons later.
- Sort Phase: Intermediate results are organized to optimize the final merge.
- Reduce Phase: Leveraging the GPU’s SIMD (Single Instruction Multiple Data) architecture, the system performs a parallel Cartesian product to merge results and filter duplicates. This phase significantly accelerates the most time-consuming part of the query process.
Performance Evaluation
The researchers evaluated MapSQ using the LUBM (Lehigh University Benchmark), testing it against five benchmark queries (Q1-Q5) of varying complexity. The performance was compared against gStore and its distributed counterpart, gStoreD.
Key Results
- Response Time: MapSQ consistently demonstrated lower response times across all queries compared to both CPU-based engines. For complex queries like Q5, the reduction in latency was substantial.
- Speedup: The framework achieved a speedup ranging from 15% to 50% over the baselines. In Query 4 (Q4), MapSQ reduced response time by approximately half compared to the CPU engines.
- Scalability: The results indicate that as dataset complexity increases, the performance gap between the GPU-accelerated MapSQ and traditional CPU engines widens, highlighting the GPU's advantage in large-scale data processing.
Conclusion
MapSQ demonstrates that a hybrid CPU-GPU approach, combined with the MapReduce programming model, can effectively overcome the join bottlenecks in SPARQL query evaluation. By offloading the most computationally expensive operations to the GPU's SIMD architecture, MapSQ provides a scalable and efficient solution for large-scale RDF datasets. Future work will focus on further optimizing the parallel join logic and exploring the impact of data transfer overhead between host and device memory.
Summary updated