A GPU-based Spark SQL acceleration method

By introducing a GPU acceleration module and communication management into Spark SQL, and utilizing GPUs for data exchange optimization and parallel processing, the inefficiency of CPUs in large-scale data queries is solved, resulting in performance improvement and cost savings.

CN116303550BActive Publication Date: 2026-01-02JIANGSU ELECTRIC POWER INFORMATION TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310417348.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-19
Publication Date
2026-01-02
Estimated Expiration
2043-04-19

AI Technical Summary

Technical Problem

In existing technologies, general-purpose processors (CPUs) are unable to meet the complex computational needs of large-scale data science research, resulting in inefficient data query processes. A more efficient data acceleration method is needed.

Method used

By introducing a GPU communication management module and a GPU acceleration module, Spark SQL is accelerated by utilizing GPUs for data exchange optimization and parallel processing. This includes optimizing table operations and managing collaboration between the CPU and GPU. CUDA programming and a double-row sorting algorithm are used to optimize data storage and reduce data interaction between the CPU and GPU.

Benefits of technology

It improves Spark SQL performance by 2-10 times under the same hardware environment, saves hardware investment and system maintenance costs, and improves the efficiency and stability of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116303550B_ABST
    Figure CN116303550B_ABST
Patent Text Reader

Abstract

The application discloses a GPU-based Spark SQL acceleration method, which comprises the following steps: Spark SQL is composed of projection, data and condition, which respectively correspond to result, data and operation in the SQL query process, and a SQL statement is described in the order of result, data and operation; the read-in SQL statement is parsed to distinguish the keywords and expressions in the SQL statement, so that whether the SQL statement is standard is judged, and then an execution tree is formed, the execution tree and a data dictionary are bound and executed, and an optimal plan is selected from the plans for execution; and the GPU uses Cuda statements to realize common data combination and sorting operations in the SQL, so that the data query and other operations are greatly accelerated. The application combines the GPU with the Spark platform, transfers the operation operation of the SQL from the CPU to the GPU for execution, and realizes the speedup of the Spark SQL operation. No application code modification is needed, no additional server node is needed, and the hardware investment and system maintenance cost can be directly saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer technology and relates to a GPU-based method for accelerating Spark SQL. Background Technology

[0002] As machine learning and web services grow exponentially, the processing power of general-purpose processors (CPUs) is increasingly struggling to meet the massive and complex computational demands. Because a general-purpose CPU execution unit can execute arbitrary instructions, it requires instruction memory, a decoder, various instruction arithmetic logic units (ALUs), and branch / jump logic. This gives the CPU general-purpose processing capabilities but also sacrifices some computational power.

[0003] Large-scale data science research typically requires clusters of thousands of servers, and running workloads and queries can take hours or days. Running the same scale workloads on GPU-accelerated servers requires only a fraction of that infrastructure and yields results in minutes or even seconds.

[0004] In large-scale data queries, the most common method is using SQL queries. From standard relational databases to big data frameworks like Hadoop and Spark, SQL is widely used. GPUs can use CUDA statements to perform common SQL operations such as data combination and sorting, thus significantly accelerating data querying. Therefore, there is an urgent need to develop a new data acceleration method to meet the needs of practical work. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a GPU-based Spark SQL acceleration method to overcome the deficiencies in the production of similar products and meet the needs of practical use.

[0006] To achieve the above objectives, the present invention provides the following technical solution:

[0007] A GPU-based method for accelerating Spark SQL includes the following steps:

[0008] S1, Spark SQL consists of projection, data, and conditions, which correspond to the results, data, and operations in the SQL query process, respectively. The SQL statement is described in the order of results, data, and operations.

[0009] S2 parses the read SQL statement, identifies keywords, expressions, etc. in the SQL statement, and determines whether the SQL statement is standard. Then, it forms an execution tree, binds the execution tree to the data dictionary, and executes it. It selects the optimal plan from these plans to execute.

[0010] S3, based on Spark SQL architecture, introduces GPU communication management module and GPU acceleration module to realize acceleration of SQL processing through GPU, mainly including cooperation management between CPU and GPU, data exchange optimization, scalable distributed dataset RDD (Resilient Distributed Dataset) execution operation optimization and table operation through Cuda programming, and specific to table operation, including connection, scanning and sorting operation, Cuda is adopted to realize acceleration of table operation.

[0011] In the application, the Spark GPU adaptation module is used to discover system GPU resources, support the cluster deployed in the spark standalone mode, discover the GPU resources existing in the worker node, and the worker node exists GPU resources are discovered by the spark task scheduler when executing the spark SQL task, and the GPU is preferentially scheduled to complete the computing task.

[0012] The GPU communication management module is used to realize the communication work between GPU and CPU, and the GPU and CPU exchange data through the PCIe bus, the process is that the GPU opens the device memory, the CPU copies the data to be calculated in the memory to the GPU, runs the GPU kernel function and executes the operation in parallel, and after the operation is completed, the calculation result is copied from the GPU memory to the host memory through the PCIe bus by the DMA mode.

[0013] The Scan, Join and Group by three types of SQL operations are realized in the GPU kernel function, and the operation request is combined in the execution process to reduce the data interaction between CPU and GPU.

[0014] The GPU acceleration module is used, the Join realizes the connection operation of the table in the GPU, including inline, left connection and right connection, the implementation algorithm includes two connection algorithms of Nestloop and hash, the Sort sorting algorithm uses the double strip sorting algorithm, that is, the sorting method independent of the order and data, so it is particularly suitable for parallel processing of GPU. The specific process is to cut a double monotone sequence into two halves, the monotonicity of each section is uniform, then the two sections are stacked, and two-by-two comparison is performed, so that a double monotone sequence is obtained on the left and right sections, and all elements in the double monotone sequence on the left are smaller than all elements in the double monotone sequence on the right. Iterating this process, each time the sequence is divided into two sub-double monotone sequences, until the length of the sub-double monotone sequence is 2, which becomes a monotone sub-sequence. After the process is sorted, the original long double monotone sequence becomes ordered.

[0015] The spark RDD in the host memory is stored in the memory in a row-by-row manner, columnar storage is used, off-heap is used instead of heap memory, and the change of the object storage position in the memory by the java garbage collection is avoided.

[0016] The application combines the GPU with the Spark platform, transfers the operation operation of SQL from the CPU to the GPU for execution, and realizes the speedup of the Spark SQL operation. Without the need of application modification code, the database performance can be improved, the performance can be improved by 2-10 times by using the GPU acceleration in the same number of server cluster environment, the server nodes do not need to be additionally increased, and the hardware investment and system maintenance cost can be directly saved. BRIEF DESCRIPTION OF DRAWINGS

[0017] Figure 1 A generation plan schematic diagram of the GPU-based Spark SQL acceleration method of the application is shown in the figure.

[0018] Figure 2 A memory relationship schematic diagram of the GPU-based Spark SQL acceleration method of the application is shown in the figure. DETAILED DESCRIPTION

[0019] The technical solutions of the application will be described clearly and completely in combination with the drawings of the application. Obviously, the described embodiments are only part of the embodiments of the application, rather than all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor belong to the protection scope of the application.

[0020] As shown in Figure 1 A GPU-based Spark SQL acceleration method, comprising the following steps:

[0021] S1, the Spark SQL is composed of projection, data and condition, respectively corresponding to the result, data and operation in the SQL query process, and the SQL statement is described in the order of result, data and operation;

[0022] S2, the read-in SQL statement is parsed, the keywords, expressions and the like in the SQL statement are distinguished, whether the SQL statement is standard is judged, and then an execution tree is formed, the execution tree and the data dictionary are bound and executed, and an optimal plan is selected from the plans for execution;

[0023] S3, based on the Spark SQL architecture, introduces GPU scheduling management and GPU acceleration modules to accelerate the processing of SQL through GPUs, mainly including the cooperative management between CPU and GPU, data exchange optimization, optimization of RDD execution operations and implementation of table operations through Cuda programming.

[0024] In the application, the Spark GPU adaptation module is used to discover system GPU resources, support the cluster deployed in the spark standalone mode, discover the GPU resources existing in the worker node, and the worker node exists GPU resources when the spark task scheduler executes the spark SQL task, and the GPU is preferentially scheduled to complete the computing task.

[0025] The GPU communication management module is used to realize the communication work between the GPU and the CPU, the GPU and the CPU exchange data through the PCIe bus, the process is that the GPU opens the device memory, the CPU copies the data to be calculated in the memory to the GPU, runs the GPU kernel function and executes the operation in parallel, and after the operation is completed, the calculation result is copied from the GPU memory to the host memory through the PCIe bus by the DMA mode.

[0026] The Scan, Join and Group by three types of SQL operations are realized in the GPU kernel function, and the operation requests are combined in the execution process to reduce the data interaction between the CPU and the GPU.

[0027] The GPU acceleration module is used to realize the connection operation of the table in the GPU, including inline, left connection and right connection, the implementation algorithm includes two connection algorithms of Nestloop and hash, the double strip sorting algorithm is used for the Sort sorting algorithm, that is, the sorting method independent of the order and data, the spark RDD in the host memory is stored in the form of row in the memory, and is columnar storage, off-heap is used instead of heap memory to avoid the change of object storage position in the memory caused by java garbage collection.

[0028] The sort algorithm uses a double strip sort algorithm, that is, a comparison order independent of data, so it is particularly suitable for parallel processing of a GPU. The specific process is to cut a double monotone sequence into two halves, unify the monotonicity of each segment, then stack the two segments, and compare them two by two. In this way, a double monotone sequence can be obtained on the left and right segments, and all elements in the double monotone sequence on the left are smaller than all elements in the double monotone sequence on the right. Iterating this process, each time the sequence can be divided into two sub-double monotone sequences, until the length of the sub-double monotone sequence is 2, that is, it becomes a monotone subsequence. After this process, the original long double monotone sequence becomes ordered.

[0029] The application has good universality, strong data processing capacity, can effectively meet the needs of accelerating processing of various data storage operations, and improves the work efficiency of data processing and transmission operations; on the other hand, in the data processing acceleration process, the data acceleration efficiency is high, the data processing stability is good, and the data acceleration control automation, intelligence degree and control precision are high, thereby greatly improving the work efficiency and quality of data processing.

[0030] The above is only a specific embodiment of the application, but the protection scope of the application is not limited thereto, any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the application, which should be covered within the protection scope of the application. Therefore, the protection scope of the application should be subject to the protection scope of the claims.

Claims

1.A GPU-based Spark SQL acceleration method, characterized in that, Comprise the following steps: S1, Spark SQL is composed of projection, data and condition, corresponding to the result, data and operation in the SQL query process respectively, and the SQL statement is described in the order of result, data and operation; S2, the read SQL statement is parsed, the key words and expressions in the SQL statement are distinguished, whether the SQL statement is standard is judged, and then the execution tree is formed, the execution tree and the data dictionary are bound and executed, and an optimal plan is selected from the plans; S3, based on the Spark SQL architecture, GPU communication management module and GPU acceleration module are introduced to accelerate the processing of SQL through GPU, including the cooperation management between CPU and GPU, data exchange optimization, scalable distributed dataset RDD execution operation optimization and table operation through Cuda programming, specific to the table operation including join, scan and sort operation, Cuda is used to realize the acceleration of table operation; GPU communication management module is used to realize the communication between GPU and CPU, GPU and CPU exchange data through PCIe bus, the process is that GPU opens device memory, CPU copies the data to be calculated in memory to GPU, runs GPU kernel function and executes operation in parallel, and after operation is completed, the calculation result is copied from GPU memory to host memory through DMA mode through PCIe bus; GPU acceleration module is used to realize the join operation of table in GPU, including inline, left join and right join, the algorithms include Nestloop and hash two kinds of join algorithm, and Sort sorting algorithm uses double strip sorting algorithm, that is, the sorting method independent of order and data, and the spark RDD in host memory is stored in row mode in memory, which is columnar storage, off-heap is used instead of heap memory to avoid java garbage collection changing the object storage location in memory. 2.The GPU-based Spark SQL acceleration method of claim 1, wherein: GPU adaptation module is used to discover the GPU resources of the system, support the cluster deployed in spark standalone mode, find the GPU resources existing in the worker node, and the GPU resources existing in the worker node are found when the spark task scheduler executes the spark SQL task. 3.The GPU-based Spark SQL acceleration method of claim 1, wherein: Scan, join and group by three kinds of SQL operations are realized in GPU kernel function, and the operation requests are combined in the execution process to reduce the data interaction between CPU and GPU. 4.The GPU-based Spark SQL acceleration method of claim 1, wherein: Sort algorithm uses double strip sorting algorithm, the specific process is: cut a double monotone sequence into two halves, the monotonicity of each section is uniform, then stack the two sections, compare them two by two, so that the left and right sections can get a double monotone sequence respectively, and all elements in the left double monotone sequence are less than all elements in the right double monotone sequence; iterate this process, each time the sequence can be divided into two sub double monotone sequences, until the length of the sub double monotone sequence is 2, which becomes a monotone subsequence, and the original long double monotone sequence becomes ordered after this process.

Citation Information

Patent Citations

  • OLAP star connection query optimizing method under CPU and GPU mixing framework

    CN103309958A

  • Method for optimizing Spark SQL execution workflow

    CN108763489A