A method and device for accelerating reading column storage files based on data processing unit

Directly read and calculate columnar storage files in parallel through the data processing unit, avoiding transmission and conversion, solving the problems of data transmission and conversion in the SparkSQL hardware acceleration solution, and improving performance and throughput.

CN117573699BActive Publication Date: 2024-09-27YUSUR TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311422165.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-30
Publication Date
2024-09-27
Estimated Expiration
2043-10-30

AI Technical Summary

Technical Problem

In the existing SparkSQL hardware acceleration solution, file data needs to be transferred and copied in large quantities through the memory and bus, which consumes a lot of time. Spark cannot read file data in parallel, and row-column conversion adds extra time.

Method used

The data processing unit directly reads columnar storage files in parallel and performs calculations to avoid data transmission copying and row-column conversion. The Spark layer is used to read file information and pass it to the data processing platform layer for row-column conversion processing.

Benefits of technology

It reduces time consumption, improves overall solution performance, saves host processor, memory and network transmission resources, and improves system throughput and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117573699B
    Figure CN117573699B
Patent Text Reader

Abstract

The present invention provides an acceleration method and device based on reading column storage files by a data processing unit, including: reading file information of a column storage file based on a Spark layer, and passing the file information to a data processing platform layer; the data processing platform layer reads the corresponding column storage file according to the file information; reading the column storage file in parallel based on a data processing unit board, and performing calculations, and sending the calculation results to the data processing platform layer; the data processing platform layer performs row-column conversion processing on the calculation results of the column storage file, and outputs and displays the processed calculation results. The acceleration method provided by the present invention directly reads and calculates the column storage file in parallel by the data processing unit, avoiding a large number of data copies, improving the overall solution performance, and reducing data transmission at the same time, saving host processor, memory, and network transmission resources, and improving system throughput.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of hardware acceleration technology, and in particular to an acceleration method and device based on reading column storage files by a data processing unit. Background Art

[0002] SparkSQL is a module in the Apache Spark project that provides a high-level data processing interface for structured data processing. It allows developers to query, analyze, and process structured data using the SQL query language or DataFrame API.

[0003] The mainstream hardware-accelerated query solutions for SparkSQL in the industry currently usually use a Graphic Processing Unit (GPU) for calculations, or a Data Processing Unit (DPU) acceleration device to accelerate specific query operations.

[0004] As a general platform layer, Hados_Race connects to Spark in the Kernel Processing Unit (KPU) framework to offload specific query calculations to hardware to implement a general hardware acceleration solution. KPU is an advanced computing framework designed by Beijing Zhongke Yusu Technology Co., Ltd. based on FPGA (Field Programmable Gate Array) hardware, focusing on improving the computing performance of FPGA. Hados_Race is based on the KPU framework as a high-performance data processing acceleration card.

[0005] The DPU board is a programmable logic device that can be configured and reconfigured as needed during design or runtime. It can implement parallel computing and hardware acceleration, providing highly customized computing capabilities for data processing.

[0006] The existing commonly used acceleration solutions are based on Hados_Race and DPU implementation, and mainly include the following steps: first, convert the query statement into a mode that can be executed by Hados; then transfer the data to be processed to the data processing platform layer (Hados_Race) through the memory bus or other high-bandwidth interfaces; Hados_Race uses hardware for parallel calculations; finally, transfer the calculated results back to the host memory.

[0007] Existing acceleration solutions can provide efficient data processing and computing capabilities at the hardware level, thereby accelerating the execution of query operations. However, when reading files through Spark, they need to be transferred to Hados_Race through memory first, and then Hados_Race will unload the data to the hardware for calculation. The data is copied and transferred in large quantities through memory and bus, which greatly increases the time consumption. At the same time, the existing Spark can only read files serially and cannot read in parallel; because Spark is row-based reading and Hados_Race is column-based computing, the data read by Spark needs to be converted from row to column when it is transferred to Hados_Race, which increases additional time consumption. Summary of the invention

[0008] In view of this, an embodiment of the present invention provides an acceleration method and device for reading columnar storage files based on a data processing unit, so as to eliminate or improve one or more defects existing in the prior art, and solve the problems of the existing acceleration scheme that a large amount of time is consumed due to the need to transfer and copy a large amount of file data through memory and bus, Spark cannot read file data in parallel, and extra time is consumed due to the conversion of row and column formats in file data processing.

[0009] On the one hand, the present invention provides an acceleration method for reading a column-based storage file based on a data processing unit, the method comprising the following steps:

[0010] Based on the Spark layer, file information of the column storage file is read, and the file information is transmitted to the data processing platform layer; the data processing platform layer reads the corresponding column storage file according to the file information; the file information at least includes a file path and data structure definition information;

[0011] Based on the data processing unit board, the column storage file is read in parallel, and calculation is performed, and the calculation result is sent to the data processing platform layer;

[0012] The data processing platform layer performs row-column conversion processing on the calculation results of the column storage file, and outputs and displays the processed calculation results.

[0013] In some embodiments of the present invention, the column storage file is a Parquet file.

[0014] In some embodiments of the present invention, reading file information of a columnar storage file based on a Spark layer further includes:

[0015] The Spark layer uses a preset Spark query language module to read the column storage file;

[0016] The header information of the column-type storage file is obtained, and metadata information is extracted; the file path and the data structure definition information are obtained according to the metadata information; the data structure definition information includes at least data fields, field types, and field order.

[0017] In some embodiments of the present invention, the file information is transmitted to the data processing platform layer, further comprising:

[0018] The Spark layer transfers the file information of the column storage file to the data processing platform layer through a Java native interface.

[0019] In some embodiments of the present invention, the column storage file is read in parallel based on the data processing unit board, and calculation is performed, and the calculation result is sent to the data processing platform layer, which also includes:

[0020] Presetting an application program on the data processing unit board;

[0021] Using multithreading or parallel tasks in the application to read multiple columnar storage files in parallel;

[0022] According to the preset calculation logic, the corresponding calculation operation is performed on the data processing unit board to generate the calculation result; and the calculation result is sent to the data processing platform layer.

[0023] In some embodiments of the present invention, the data processing platform layer performs row-column conversion processing on the calculation result of the column storage file, and further includes:

[0024] The calculation results are converted from columns to rows using a preset function to obtain row-based data.

[0025] On the other hand, the present invention provides an acceleration device for reading column storage files based on a data processing unit, the device comprising:

[0026] Spark layer, the Spark layer is used to read file information of column storage files and pass the file information to the data processing platform layer;

[0027] A data processing unit, the data processing unit is used to read the column storage files in parallel, perform calculations, and send calculation results to the data processing platform layer;

[0028] The data processing platform layer is used to receive the file information of the columnar storage file and the calculation result, and perform row-to-column conversion processing on the calculation result to obtain row data; and output and display the row data.

[0029] In some embodiments of the present invention, the calculation result is transmitted by setting a network transmission protocol between the data processing unit and the data processing platform layer.

[0030] In some embodiments of the present invention, a Java native interface is established between the Spark layer and the data processing platform layer to call each other's functions and transmit file information of the column storage file.

[0031] On the other hand, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of an acceleration method for reading a columnar storage file based on a data processing unit as described in any one of the items mentioned above.

[0032] The beneficial effects of the present invention are at least:

[0033] The present invention provides an acceleration method and device for reading columnar storage files based on a data processing unit, including: reading file information of a columnar storage file based on a Spark layer, and passing the file information to a data processing platform layer; the data processing platform layer reads the corresponding columnar storage file according to the file information; reading the columnar storage file in parallel based on a data processing unit board, and performing calculations, and sending the calculation results to the data processing platform layer; the data processing platform layer performs row-column conversion processing on the calculation results of the columnar storage file, and outputs and displays the processed calculation results. The acceleration method provided by the present invention directly reads and calculates the columnar storage file in parallel by the data processing unit, avoiding a large number of data copies; further, the data processing unit directly reads the columnar storage file without the need for row-column conversion, which greatly reduces time consumption and improves the performance of the overall solution; further, by reducing data transmission, the host processor, memory, and network transmission resources are saved, and the system throughput and performance are improved.

[0034] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention may be achieved and obtained by the structures specifically indicated in the specification and the accompanying drawings.

[0035] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of the present application, and do not constitute a limitation of the present invention. In the drawings:

[0037] Figure 1 The figure is a schematic diagram of the steps of an acceleration method for reading column-based storage files based on a data processing unit in one embodiment of the present invention.

[0038] Figure 2 The figure is a schematic diagram of a method flow of an existing acceleration solution in one embodiment of the present invention.

[0039] Figure 3 The figure is a flow chart of an acceleration method for reading column-based storage files based on a data processing unit in one embodiment of the present invention. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0041] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.

[0042] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.

[0043] It should also be noted that, unless otherwise specified, the term “connection” herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.

[0044] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.

[0045] It should be emphasized here that the step marks mentioned below are not intended to limit the order of the steps, but it should be understood that the steps can be executed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be executed simultaneously.

[0046] In order to solve the problems of the existing acceleration scheme that the file data needs to be copied and transferred in large quantities through the memory and bus, resulting in a lot of time consumption, Spark cannot read the file data in parallel, and the row-column conversion in the file data processing causes extra time consumption, the present invention proposes an acceleration method based on the data processing unit to read the column storage file, such as Figure 1 As shown, the method includes the following steps S101 to S103:

[0047] Step S101: Read the file information of the column storage file based on the Spark layer, and pass the file information to the data processing platform layer; the data processing platform layer reads the corresponding column storage file according to the file information. The file information at least includes the file path and data structure definition information.

[0048] Step S102: Read the column storage file in parallel based on the data processing unit board, perform calculations, and send the calculation results to the data processing platform layer.

[0049] Step S103: The data processing platform layer performs row-column conversion processing on the calculation results of the column storage file, and outputs and displays the processed calculation results.

[0050] For ease of understanding, the existing acceleration scheme is first explained, such as Figure 2 As shown, it is a method flow chart of the existing acceleration solution, and the existing acceleration solution includes the following steps:

[0051] Spark directly reads the columnar storage file and transfers it to the data processing platform layer (Hados_Race) through memory copy. However, considering that Spark reads rows and Hados_Race performs columnar calculations, before Spark transfers the columnar storage file to Hados_Race, it needs to convert the read columnar storage file from row data to column data.

[0052] The data processing platform layer transmits the column data to the data processing unit (DPU), which performs calculations to obtain calculation results and returns the calculation results to the data processing platform layer.

[0053] The data processing platform layer then converts the calculation results from columns to rows, and after converting the calculation results from columnar data to row data, it is output and displayed.

[0054] The columnar storage file may be a Parquet file. Parquet files are a columnar storage format for storing structured data. They store data in columns rather than rows, which helps improve query performance. Parquet files have become the preferred storage format for many big data processing frameworks, such as Apache Hadoop, Apache Spark, and Apache Hive. They can be used for data import, export, conversion, and analysis, providing data scientists and engineers with powerful tools for processing large-scale structured data.

[0055] Based on the above existing acceleration scheme steps and defects, the present invention proposes an acceleration method based on reading column storage files by a data processing unit, such as Figure 3As shown, specifically:

[0056] In step S101, the data processing platform layer (Hados_Race) reads the file information of the column storage file through the Spark layer, and the data processing platform layer then reads the corresponding column storage file according to the file information, avoiding the need to transmit through the memory and the row-column conversion operation of the data in the existing acceleration solution.

[0057] Among them, the file information at least includes the file path and data structure definition information. Data structure definition information (Schema) in computer science refers to the specification that defines and describes data structure, data type, field name and relationship. It provides a way to organize and manage data to ensure the consistency, integrity and validity of data. The Schema of the Parquet file defines the structure and type information of the data stored in the file. It is a text file in JSON format, usually called Parquet schema or Parquet metadata. When reading a Parquet file, the application can use the Schema to parse the data in the file and convert it to the corresponding data type.

[0058] In some embodiments, reading file information of a columnar storage file based on a Spark layer includes the following steps:

[0059] The Spark layer uses the preset SparkSQL (StructuredQueryLanguage) module to read the column storage file. The SparkSQL module needs to be imported in advance, a SparkSession object is created, the column storage file is loaded using the SparkSession, and a DataFrame object is returned, which contains the data read from the column storage file.

[0060] Get the header information of the column storage file and extract the metadata information.

[0061] The file path and data structure definition information (Schema) are obtained by parsing the metadata information.

[0062] In some embodiments, the Spark layer passes the file information of the column storage file read to the data processing platform layer through the Java Native Interface (JNI). For example, an implementation method is provided:

[0063] A Java class is defined in Spark, which is used to call the JNI interface and pass the required parameters. In the present invention, the parameters include file path and data structure definition information.

[0064] Compile the Java class and generate a dynamic link library (DLL) file, and load the generated dynamic link library file in Spark.

[0065] Write a JNI library in the data processing platform layer to receive the file path and data structure definition information passed by Spark and perform corresponding data processing operations.

[0066] In step S102, compared with the existing acceleration scheme, the present invention uses the data processing unit board to directly read the column storage file to achieve parallel reading. After reading the column storage file, the calculation is directly performed in the data processing unit, and the calculation result is sent to the data processing platform layer.

[0067] In some embodiments, the data processing unit board reads the column storage file in parallel, performs calculations, and sends the calculation results to the data processing platform layer, which specifically includes the following steps:

[0068] An application is pre-set on the data processing unit board. The application can use a suitable library, such as Apache Arrow, to read the column storage file. This can effectively utilize the characteristics of the column storage file and achieve efficient data access.

[0069] In the application, multiple threads or parallel tasks are used to read multiple column storage files in parallel. For example, the concurrency level and task allocation strategy can also be adjusted according to actual needs to maximize the computing power of the data processing unit board.

[0070] The calculation logic is pre-designed according to actual needs, and the corresponding calculation operations are performed on the data processing unit board according to the calculation logic to generate calculation results, and the calculation results are sent to the data processing platform layer. Exemplarily, the calculation logic includes but is not limited to aggregation, filtering and conversion.

[0071] In some embodiments, the calculation results are sent from the data processing unit to the data processing platform layer, and network transmission protocols such as HTTP, TCP / IP, etc. can be used for transmission to ensure the security and integrity of the data during the data transmission process.

[0072] In step S103, the data processing platform layer performs row-column conversion processing on the calculation results of the column storage file, and outputs and displays the processed calculation results.

[0073] In some embodiments, the data processing platform layer uses a preset function to convert the calculation results into rows and columns, and then outputs and displays the row data.

[0074] In some embodiments, data visualization tools or customized display logic are used to display row data in the form of charts, tables, dashboards, etc. to facilitate understanding.

[0075] Corresponding to the acceleration method based on data processing unit reading column storage files, the present invention also provides an acceleration device based on data processing unit reading column storage files, which includes a Spark layer, a data processing unit (DPU) and a data processing platform layer (Hados_Race).

[0076] The Spark layer is used to read the file information of the columnar storage file and pass the file information to the data processing platform layer.

[0077] The data processing unit is used to read column storage files in parallel, perform calculations, and send the calculation results to the data processing platform layer.

[0078] The data processing platform layer is used to receive the file information and calculation results of the columnar storage files, and perform row-to-column conversion on the calculation results to obtain row data; the row data is output and displayed.

[0079] In some embodiments, a network transmission protocol, such as HTTP, TCP / IP, etc., is set between the data processing unit and the data processing platform layer to transmit the calculation results.

[0080] In some embodiments, a Java Native Interface (JNI) is established between the Spark layer and the data processing platform layer to call each other's functions and transfer file information of column storage files.

[0081] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of an acceleration method based on reading a column-type storage file by a data processing unit are implemented.

[0082] Corresponding to the above method, the present invention also provides a device, which includes a computer device, the computer device includes a processor and a memory, the memory stores computer instructions, the processor is used to execute the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the device implements the steps of the method described above.

[0083] The embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned edge computing server deployment method are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.

[0084] In summary, the present invention provides an acceleration method and device for reading columnar storage files based on a data processing unit, including: reading file information of a columnar storage file based on a Spark layer, and passing the file information to a data processing platform layer; the data processing platform layer reads the corresponding columnar storage file according to the file information; reading the columnar storage file in parallel based on a data processing unit board, and performing calculations, and sending the calculation results to the data processing platform layer; the data processing platform layer performs row-column conversion processing on the calculation results of the columnar storage file, and outputs and displays the processed calculation results. The acceleration method provided by the present invention directly reads and calculates the columnar storage file in parallel by the data processing unit, avoiding a large number of data copies; further, the data processing unit directly reads the columnar storage file without the need for row-column conversion, which greatly reduces time consumption and improves the performance of the overall solution; further, by reducing data transmission, the host processor, memory, and network transmission resources are saved, and the system throughput and performance are improved.

[0085] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.

[0086] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.

[0087] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.

[0088] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. An acceleration method for reading column storage files based on a data processing unit, characterized in that: The method comprises the following steps: Read file information of the column storage file based on the Spark layer, and pass the file information to the data processing platform layer; the file information of the data processing platform layer is used for the data processing unit board to read the corresponding column storage file; the file information at least includes the file path and data structure definition information; Based on the data processing unit board, the column storage file is read in parallel, and calculation is performed, and the calculation result is sent to the data processing platform layer; The data processing platform layer performs row-column conversion processing on the calculation results of the column storage file, and outputs and displays the processed calculation results.

2. The acceleration method for reading column-based storage files based on a data processing unit according to claim 1, characterized in that: The column storage file is a Parquet file.

3. The acceleration method for reading column-based storage files based on a data processing unit according to claim 1, characterized in that: The file information of columnar storage files read based on the Spark layer also includes: The Spark layer uses a preset Spark query language module to read the column storage file; The header information of the column-type storage file is obtained, and metadata information is extracted; the file path and the data structure definition information are obtained according to the metadata information; the data structure definition information includes at least data fields, field types, and field order.

4. The acceleration method for reading column-based storage files based on a data processing unit according to claim 1, characterized in that: The file information is transmitted to the data processing platform layer, and further includes: The Spark layer transfers the file information of the column storage file to the data processing platform layer through a Java native interface.

5. The acceleration method for reading column-based storage files based on a data processing unit according to claim 1, characterized in that: Based on the data processing unit board, the column storage file is read in parallel, and calculation is performed, and the calculation result is sent to the data processing platform layer, and it also includes: Presetting an application program on the data processing unit board; Using multithreading or parallel tasks in the application to read multiple columnar storage files in parallel; According to the preset calculation logic, the corresponding calculation operation is performed on the data processing unit board to generate the calculation result; and the calculation result is sent to the data processing platform layer.

6. The acceleration method for reading column-based storage files based on a data processing unit according to claim 1, characterized in that: The data processing platform layer performs row-column conversion processing on the calculation result of the column storage file, and further includes: The calculation results are converted from columns to rows using a preset function to obtain row-based data.

7. An acceleration device for reading column storage files based on a data processing unit, characterized in that: The device comprises: Spark layer, the Spark layer is used to read file information of column storage files and pass the file information to the data processing platform layer; A data processing unit, the data processing unit is used to read the column storage files in parallel, perform calculations, and send calculation results to the data processing platform layer; A data processing platform layer, the data processing platform layer is used to receive the file information of the column storage file so that the data processing unit can read the column storage file. The data processing platform layer is also used to receive the calculation results, and perform row-column conversion processing on the calculation results to obtain row data; and output and display the row data.

8. The acceleration device for reading column-type storage files based on a data processing unit according to claim 7, characterized in that: The calculation result is transmitted by setting a network transmission protocol between the data processing unit and the data processing platform layer.

9. The acceleration device for reading column-type storage files based on a data processing unit according to claim 7, characterized in that: A Java native interface is established between the Spark layer and the data processing platform layer to call each other's functions and transmit file information of the column storage file.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the acceleration method based on reading column storage files by a data processing unit as described in any one of claims 1 to 6 are implemented.