Universal datax plug-in with excellent performance

By designing the PostgresYMWriter plug-in and using the NewIP protocol stack and machine learning load balancing algorithm, we solved the problem of low efficiency when synchronizing data to GPDB, achieved efficient heterogeneous data processing and data integrity verification, and improved the user experience.

CN118778932AInactive Publication Date: 2024-10-15江西裕民银行股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410922779.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-10-15
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing technology is inefficient when synchronizing a large amount of data from other data sources or files to GPDB, especially due to the writing efficiency problem of the PostgreSQL main database, which results in a low data synchronization rate.

Method used

A universal datax plug-in with excellent performance, PostgresYMWriter, is designed. It uses the NewIP protocol stack and machine learning-enhanced load balancing algorithm, combined with the adaptive flow control algorithm, to optimize the data transmission process, dynamically adjust traffic distribution and server load, and improve synchronization efficiency.

Benefits of technology

It significantly improves the efficiency of data synchronization to GPDB, realizes efficient heterogeneous data processing, improves user experience, and verifies data integrity through hash functions, reducing error detection and retransmissions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118778932A_ABST
    Figure CN118778932A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data transmission, and particularly discloses a universal datax plug-in with excellent performance, the datax plug-in comprises an int unit, a prepart unit, a getCopySql unit and an excteCopySql unit, the init unit reads and verifies configuration information in the plug-in, a copyJob is initialized, the prepart unit generates database jdbc connection according to the configuration information in the plug-in, whether the jdbc connection is normally accessed or not is tested, preSql in configuration is obtained, and the preSql is executed; according to the method, the COPY characteristic of the GPDB is utilized, an efficient PostgresYMWriter plug-in is originally achieved under a framework system of the alibaa data x to replace an official PostgresqlWriter plug-in of the alibaa data x, meanwhile, a NewIP protocol stack is applied to enable the PostgresYMWriter plug-in to be capable of processing heterogeneous data of different sources, and real-time monitoring and adjusting of loads and flow in the data transmission process are combined.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of data transmission, and in particular relates to a universal datax plug-in with excellent performance. Background Art

[0002] During data processing, a large amount of data needs to be synchronized from other data sources or files to GPDB (short for GreenPlum, an open source data warehouse based on open source PostgreSQL, mainly used to handle large-scale data analysis tasks). The underlying layer of GPDB is a PostgreSQL cluster composed of multiple PostgreSQL (an open source, object-relational database with a full range of features, and also supports NoSql document storage) databases, with a master to manage and a standby master. When general etl tools import data to GPDB, they will go through the master, and then the master will distribute it, which is extremely inefficient.

[0003] In the prior art, the PostgresqlWriter plug-in in Alibaba's official datax (Alibaba Datax, an open source offline data synchronization tool / platform that implements efficient data synchronization between multiple heterogeneous data sources) version implements the function of writing data to the destination table of the PostgreSQL main library. In the underlying implementation, PostgresqlWriter connects to the remote PostgreSQL database through JDBC and executes the corresponding insert into...sql statement to write data to PostgreSQL, and the data will be submitted to the database in batches internally. The GPDB server has imposed such a restriction on the CSV format of COPYFROM that a single tuple must not be larger than 4MB. In our data development process, we have not encountered a single tuple size exceeding 4MB, so this restriction is negligible for us.

[0004] Therefore, it is necessary to propose a universal datax plug-in with excellent performance to solve the data synchronization rate performance problem in the process of synchronizing large amounts of data from other data sources or files to GPDB.

[0005] The above information disclosed in this background technology is only used to increase the understanding of the background technology of the present invention and therefore, it may include information that does not constitute the prior art known to ordinary technicians in this field. Summary of the invention

[0006] The purpose of the present invention is to provide a universal datax plug-in with excellent performance: PostgresYMWriter, which replaces the official PostgresqlWriter plug-in of Alibaba datax to solve the problems raised in the above background technology.

[0007] To achieve the above object, the present invention provides the following technical solutions:

[0008] A universal datax plug-in with excellent performance includes: an int unit, a prepare unit, a getCopySql unit, and an executeCopySql unit. The init unit reads and verifies the configuration information in the plug-in and initializes copyJob. The prepare unit generates a database jdbc connection according to the configuration information in the plug-in, tests whether the jdbc connection is normally accessed, obtains the preSql in the configuration, and executes preSql. The getCopySql unit splices copy from statements according to the table name and field name configured in the plug-in. The executeCopySql unit generates a jdbc connection according to the configuration information in the plug-in and executes the executeCopySql operation in the target database.

[0009] Preferably, the plug-in quickly writes data from Butter into the GPDB database cluster by configuring library information, table and field information. The upper layer of the plug-in establishes a data connection with Oracle Reader through buffer, and the lower layer establishes a data connection with the GPDB database cluster.

[0010] Preferably, the Oracle Reader reads the corresponding library table field data content from Oracle (source database) by configuring library information, table and field information, and the buffer is between the Oracle Reader and the plug-in to control and coordinate the reading and writing rates of the Oracle Reader and the plug-in.

[0011] Preferably, the plug-in applies the NewIP protocol stack to speed up the synchronization process of large amounts of data and improve data transmission efficiency when connecting to the buffer and GPDB database cluster, and uses a machine learning enhanced load balancing algorithm to predict and respond to changes in server load and dynamically adjust traffic distribution.

[0012] Use machine learning to enhance the load balancing algorithm prediction and the corresponding server load change process: First, collect information about server performance, network latency, request type, historical load, etc., and remove duplicate, missing or erroneous data to ensure data quality. Then convert and extract the collected data to extract effective feature user training models, such as server CPU usage, memory usage, response time, etc., reorganize the obtained data with features as the core, and then divide the data into different data sets;

[0013] Use the partitioned data set to train the machine learning model (the model is built using the RNN architecture). The model will learn how to predict the optimal load distribution of the server based on different features, prevent the model from overfitting through L2 regularization, and optimize the model parameter values ​​through cross-validation and loss functions to ensure that the model can effectively predict the load distribution. Then use the machine learning model to monitor the status and performance of the server in real time, and use new real-time monitoring data to input the model for prediction, generate new prediction results and dynamically adjust the load distribution strategy.

[0014] Preferably, the plug-in calculates the checksum of the data by a hash function before transmission, and the receiving end verifies the integrity of the data, thereby reducing error detection and retransmission.

[0015] Preferably, the plug-in adjusts the data transmission speed and strategy in real time according to the network status and server load through an adaptive flow control algorithm to optimize data transmission efficiency and ensure service quality.

[0016] Adaptive flow control analyzes and adjusts the network status and load: a flow control mechanism is started according to the initial sending rate, such as a sliding window protocol (such as TCP's slow start and congestion avoidance algorithm), and then the sender (such as a server) starts sending data packets. Each data packet carries a sequence number. Each data packet also contains a receiving window size, which indicates the number of unconfirmed data packets that the receiver can receive. After that, the receiver (such as the client) receives the data packet, confirms that it has been received, and returns a confirmation containing an update to the receiving window, which may decrease or increase, depending on the network status. If the receiver does not receive enough confirmations within a period of time, or the number of confirmations received decreases, it may indicate network congestion. The sender adjusts the sending rate based on the receiver's feedback and network status. If the network status improves, the congestion window will gradually increase and the sending rate will also increase. If the data packet is lost or erroneous, the sender may need to retransmit the data packet and adjust the sending strategy accordingly.

[0017] Compared with the prior art, the present invention has the following beneficial effects:

[0018] The present invention utilizes the COPY feature of GPDB and implements an efficient PostgresYMWriter plug-in under the framework system of Alibaba Datax to replace the official PostgresqlWriter plug-in of Alibaba Datax. At the same time, the NewIP protocol stack is applied to enable the PostgresYMWriter plug-in to process heterogeneous data from different sources, and combined with real-time monitoring and adjustment of the load and flow of the data transmission process, the efficiency of the entire synchronous transmission process is improved, bringing a better user experience to users.

[0019] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present invention will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is the plug-in technology principle diagram of the present invention;

[0021] Figure 2 This is a plug-in interaction sequence diagram of the present invention. DETAILED DESCRIPTION

[0022] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0023] Example:

[0024] See also Figure 1-Figure 2 As shown, a general datax plug-in with excellent performance includes: an int unit, a prepare unit, a getCopySql unit, and an executeCopySql unit. The init unit reads and verifies the configuration information in the plug-in, initializes copyJob, the prepare unit generates a database jdbc connection according to the configuration information in the plug-in, tests whether the jdbc connection is accessed normally, obtains the preSql in the configuration, and executes preSql. The getCopySql unit splices the copy from statement according to the table name and field name configured in the plug-in. The executeCopySql unit generates a jdbc connection according to the configuration information in the plug-in, and executes the executeCopySql operation in the target database.

[0025] The plug-in quickly writes data from Butter to the GPDB database cluster by configuring library information, table and field information. The upper layer of the plug-in establishes a data connection with Oracle Reader through buffer, and the lower layer establishes a data connection with the GPDB database cluster.

[0026] The PostgresYMWriter plugin mainly uses GPBD's copy mechanism to efficiently implement data synchronization. COPY is used to copy data between the plugin's table and the standard file system file. COPY TO can copy the contents of a table to a file, COPY FROM can copy data from a file to a table (data is stored in the form of append), and COPYTO can also copy the results of a SELECT query to a file. If a column list is specified, COPY will only copy the data of the specified columns to the file or copy data from the file to the specified columns. If there are columns in the table that are not in the column list, COPYFROM will insert default values ​​for those columns.

[0027] Oracle Reader reads the corresponding library table field data content from Oracle (source database) by configuring library information, table and field information. The buffer is between Oracle Reader and the plug-in and is used to control and coordinate the reading and writing rates of Oracle Reader and the plug-in.

[0028] When connecting to the buffer and GPDB database clusters, the plug-in applies the NewIP protocol stack to speed up the synchronization of large amounts of data and improve data transmission efficiency. It also uses a machine learning-enhanced load balancing algorithm to predict and respond to changes in server load and dynamically adjust traffic distribution.

[0029] The plug-in calculates the checksum of the data through a hash function before transmission, and the receiving end verifies the data integrity to reduce error detection and retransmission.

[0030] Hash verification operation process:

[0031] 1. Source database operation: Select a suitable hash function according to the amount of data to be transferred (MD5 is suitable for file transfers with small amounts of data, and SHA-256 is suitable for file transfers with large amounts of data). Then use the selected hash function to calculate the hash value of the source data, and send the source data and the calculated hash value together to the target database;

[0032] 2. Transmission process: Ensuring data integrity and security through encrypted transmission with adaptive flow control and load adjustment;

[0033] 3. Target database operation: After receiving the data and hash value from the source database, recalculate the hash value of the transmitted data, and compare the received hash value with the recalculated hash value. If the two values ​​are the same, it means that the data has not been tampered with during transmission and the hash check is successful. If the two values ​​are different, it means that the data has been tampered with and the hash check fails.

[0034] The plug-in uses an adaptive flow control algorithm to adjust the data transmission speed and strategy in real time according to network conditions and server load to optimize data transmission efficiency and ensure service quality.

[0035] Synchronize from files or databases to GPDB. Select three tables with large data volumes from the online system. The performance is shown in the following table:

[0036]

[0037]

[0038] From the above table, we can see that the maximum write speed is 330,000 records per second, the maximum write rate is 25MB per second, and it takes less than 13 minutes to synchronize a file with 229 million data items and a total size of 16.97GB.

[0039] From the above, it can be seen that the present invention utilizes the COPY feature of GPDB and originally implements an efficient PostgresYMWriter plug-in under the framework system of alibaba datax to replace the official PostgresqlWriter plug-in of alibaba datax. At the same time, the NewIP protocol stack is applied to enable the PostgresYMWriter plug-in to process heterogeneous data from different sources, and combined with real-time monitoring and adjustment of the load and traffic of the data transmission process, the efficiency of the entire synchronous transmission process is improved, bringing a better user experience to users.

[0040] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.

[0041] In the drawings of the embodiments disclosed in the present invention, only the structures involved in the embodiments disclosed in the present invention are involved, and other structures can refer to the general design. In the absence of conflict, the same embodiment and different embodiments of the present invention can be combined with each other.

[0042] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A universal datax plug-in with excellent performance, characterized in that: include: int unit, prepare unit, getCopySql unit, executeCopySql unit, the init unit reads and verifies the configuration information in the plug-in, initializes copyJob, the prepare unit generates a database jdbc connection according to the configuration information in the plug-in, tests whether the jdbc connection is accessed normally, obtains the preSql in the configuration, and executes preSql, the getCopySql unit splices the copy from statement according to the table name and field name configured in the plug-in, the executeCopySql unit generates a jdbc connection according to the configuration information in the plug-in, and executes the executeCopySql operation in the target database.

2. A universal datax plug-in with excellent performance according to claim 1, characterized in that: The plug-in quickly writes data from Butter into the GPDB database cluster by configuring library information, table and field information. The upper layer of the plug-in establishes a data connection with Oracle Reader through buffer, and the lower layer establishes a data connection with the GPDB database cluster.

3. A universal datax plug-in with excellent performance according to claim 2, characterized in that: The OracleReader reads the corresponding library table field data content from Oracle by configuring library information, table and field information. The buffer is between the Oracle Reader and the plug-in and is used to control and coordinate the reading and writing rates of the Oracle Reader and the plug-in.

4. A universal datax plug-in with excellent performance according to claim 3, characterized in that: When connecting to the buffer and GPDB database cluster, the plug-in applies the NewIP protocol stack to speed up the synchronization process of large amounts of data, improve data transmission efficiency, and uses a machine learning-enhanced load balancing algorithm to predict and respond to changes in server load and dynamically adjust traffic distribution.

5. A universal datax plug-in with excellent performance according to claim 4, characterized in that: The plug-in calculates the checksum of the data through a hash function before transmission, and the receiving end verifies the integrity of the data, reducing error detection and retransmission.

6. A universal datax plug-in with excellent performance according to claim 5, characterized in that: The plug-in uses an adaptive flow control algorithm to adjust the data transmission speed and strategy in real time according to network conditions and server load to optimize data transmission efficiency and ensure service quality.