A method and system for realizing intelligent storage table for NEWSQL database management system

By using ROCKSDB as the storage engine in the NewSQL database and automatically scheduling the storage method of user tables based on statistical information, the bottleneck problem of high concurrent read and write performance of small tables is solved, and efficient data concurrency operations and performance improvement are achieved.

CN111752931BActive Publication Date: 2024-09-20SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010616562.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-01
Publication Date
2024-09-20
Estimated Expiration
2040-07-01

AI Technical Summary

Technical Problem

There is a performance bottleneck in the existing distributed NewSQL database with high concurrent read and write access to small tables, which causes the cache mechanism of the storage engine to be destroyed. Frequent updates increase the burden of disk IO and affect business efficiency.

Method used

Adopt intelligent storage table implementation method, use ROCKSDB as the basic data kv storage engine, and automatically migrate user table data to the appropriate storage engine through statistical information scheduling of the memory table, release memory, perform pre-written log archive storage and snapshot backup, and ensure Data consistency and durability, while scheduling, downgrading or upgrading table status based on data access volume and storage type changes.

Benefits of technology

On the premise of ensuring that the ACID characteristics are not destroyed, the concurrency performance of writing and reading data is improved, the system IO contention is reduced, and the access efficiency and performance of the database are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111752931B
    Figure CN111752931B
Patent Text Reader

Abstract

The present invention discloses an intelligent storage table implementation method and system for NEWSQL database management system, belonging to the field of database storage computer technology; the method includes: S1 NEWSQL database management system uses ROCKSDB as a basic data kv storage engine; S2 collects data information of user tables; S3 schedules user tables according to statistical information of memory tables; the method of the present invention aims at the write-read operation scenarios that can be processed concurrently in the database, solves data IO performance problems such as conflicts between write-read data by memorizing user data tables, and realizes efficient concurrent data operations, while the memorized processing mechanism is not supported for tables with extremely large data volumes. Under the premise of ensuring that the ACID characteristics of the database are not destroyed, the concurrent performance of write-read data is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention discloses an intelligent storage table realization method and system for a NEWSQL database management system, and relates to the technical field of database storage computers. Background Art

[0002] As the name suggests, a memory table is a user table that stores user data in memory. Compared with ordinary user data tables, its main memory is the main memory. Rows in the table are read from the memory and written to the memory. However, like ordinary user tables, it supports all system SQL functions, multiple copies of data, ACID functions of transactions, data persistence and fault recovery.

[0003] The usage scenario of memory table is mainly for OLTP applications, where the number is not large, such as millions of records, but they are frequently added, deleted, modified and checked. This scenario will destroy the cache mechanism of the storage engine. New data is constantly added and modified, resulting in frequent cache updates, which increases the burden of disk IO and increases system congestion, greatly affecting the execution efficiency of the business. In order to solve the performance bottleneck problem of high concurrent read and write access of small tables in the existing distributed NewSQL database, an intelligent storage table implementation method and system for NEWSQL database management system are invented to solve the above problems. Summary of the invention

[0004] In view of the problems of the prior art, the present invention provides a method and system for realizing an intelligent storage table for a NEWSQL database management system. The technical solution adopted is:

[0005] A method for implementing an intelligent storage table for a NEWSQL database management system, characterized in that the method comprises:

[0006] S1NEWSQL database management system uses ROCKSDB as the basic data kv storage engine;

[0007] S2 collects data information of the user table;

[0008] S3 schedules user tables based on the statistical information of the memory table.

[0009] The specific steps of the S1NEWSQL database management system using ROCKSDB as the basic data kv storage engine include:

[0010] S101 memory is released through page linked lists;

[0011] S102 archives the write-ahead log;

[0012] S103 performs a snapshot backup of the entire valid data as basic data;

[0013] S104 clears the write-ahead log.

[0014] The specific steps of S2 collecting data information of the user table include:

[0015] S201 collects table data changes;

[0016] S202 collects data access volume and access times;

[0017] S203 collects changes in the storage type of table data.

[0018] The S3 performs downgrade and upgrade scheduling on the user table according to the statistical information of the memory table. The specific steps include:

[0019] S301 obtains the memory usage of the memory storage engine;

[0020] S302 reads user table statistics;

[0021] S303 calculates and obtains a user table with the lowest data access and a relatively large data volume;

[0022] S304 modifies the user table status and starts snapshot migration of the table to the disk storage engine.

[0023] An intelligent storage table implementation system for NEWSQL database management system, the system includes an engine construction module, an information statistics module and a data collection module:

[0024] Engine construction module: NEWSQL database management system uses ROCKSDB as the basic data kv storage engine;

[0025] Information statistics module: collects data information from user tables;

[0026] Data scheduling module: schedules the user table according to the statistical information of the memory table.

[0027] The engine construction module specifically includes a release module, a save module, a backup module and a clear module:

[0028] Release module: memory is released through page linked lists;

[0029] Saving module: archives and stores the write-ahead logs;

[0030] Backup module: Take snapshot backup of the overall valid data as basic data;

[0031] Clear module: clear the write-ahead log.

[0032] The information statistics module specifically includes a change collection module, an access collection module and a conversion collection module:

[0033] Change collection module: collects table data changes;

[0034] Access collection module: collects data access volume and access times;

[0035] Conversion collection module: collects changes in table data storage type.

[0036] The data scheduling module schedules downgrading and upgrading the user table according to the statistical information of the memory table collected by the statistical information collector, and specifically includes a usage acquisition module, a reading module, a calculation module and an execution module:

[0037] Usage acquisition module: obtains the memory usage of the memory storage engine;

[0038] Read module: read user table statistics;

[0039] Calculation module: calculates the user table with the lowest data access and relatively large data volume;

[0040] Execution module: Modify the user table status and start snapshot migration of the table to the disk storage engine.

[0041] The beneficial effects of the present invention are as follows: the method of the present invention aims at the write-read operation scenarios that can be processed concurrently in the database, solves data IO performance problems such as conflicts between write-read data by memorizing the user data table, and realizes efficient concurrent data operations, while the memorization processing mechanism is not supported for tables with extremely large data volumes. Under the premise of ensuring that the ACID characteristics of the database are not destroyed, the concurrent performance of write-read data is improved;

[0042] This solution realizes transparent use of memory tables by adding a memory storage engine and a multi-engine multi-scheduling mechanism. The memory storage engine is automatically mounted when the system starts. Users do not need to know the details of the memory table. The system automatically converts the user's ordinary table data into a memory table according to the size and popularity of the data, and stores the memory table data in the memory storage engine, which increases data access efficiency, reduces system IO contention, and thus improves database performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0044] Figure 1 is a flow chart of the method of the present invention; Figure 2 It is a structural schematic diagram of the system of the present invention; Figure 3 It is the original structural diagram of NEWSQL database management system; Figure 4 It is a schematic diagram of the structure of the NEWSQL database management system of the present invention. DETAILED DESCRIPTION

[0045] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.

[0046] In order to solve the problem of high concurrent read and write access performance bottleneck of small tables in the existing distributed NewSQL database, the present invention first explains the terms involved in the present invention:

[0047] KV storage: Each row of data in the table consists of two parts: key and value. The key consists of a timestamp and a search index for the value. Using the index of the data as a prefix, you can traverse all the data with the index, that is, the value.

[0048] Write ahead log (WAL): Before database data is actually written to the data storage file, some data will be kept in memory to ensure writing efficiency. The corresponding operation log will be stored to ensure data persistence and fault recovery.

[0049] Snapshot: captures a consistent view of the DB at the point in time it is created, and is a collection of all valid data currently stored in the storage engine.

[0050] Embodiment 1:

[0051] A method for implementing an intelligent storage table for a NEWSQL database management system, the method comprising:

[0052] S1NEWSQL database management system uses ROCKSDB as the basic data kv storage engine;

[0053] S2 collects data information of the user table;

[0054] S3 schedules the user table based on the statistical information of the memory table;

[0055] When the NEWSQL database management system is started, a memory mode ROCKSDB is automatically mounted as the storage engine of the memory table according to S1. The memory engine can provide the same behavior as the ordinary ROCKSDB, and can simulate the ordinary file object to realize the memory file object. The object uses the memory as the final medium for reading and writing to ensure the integrity of the SQL function. Then, the data information of the user table is collected according to S2. When the distributed NEWSQL database management system mounts the memory storage engine, the available memory size set by the user is fixed. When the memory usage is close to 90% of the set value, the data scheduler will intervene. Finally, according to the statistical information of the memory table, the user table is scheduled according to S3 to complete the implementation of the intelligent storage table.

[0056] The method of the present invention aims at the write-read operation scenarios that can be processed concurrently in the database. By memorizing the user data table, the data IO performance problems such as conflicts between write-read data are solved, and efficient concurrent data operations are achieved. However, the memorization processing mechanism is not supported for tables with extremely large data volumes. Under the premise of ensuring that the ACID characteristics of the database are not destroyed, the concurrent performance of write-read data is improved;

[0057] This solution realizes transparent use of memory tables by adding a memory storage engine and a multi-engine multi-scheduling mechanism. The memory storage engine is automatically mounted when the system starts. Users do not need to know the details of the memory table. The system automatically converts the user's ordinary table data into a memory table according to the size and popularity of the data, and stores the memory table data in the memory storage engine, which increases data access efficiency, reduces system IO contention, and thus improves database performance.

[0058] Furthermore, the specific steps of the S1NEWSQL database management system using ROCKSDB as the basic data kv storage engine include:

[0059] S101 memory is released through page linked lists;

[0060] S102 archives the write-ahead log;

[0061] S103 performs a snapshot backup of the entire valid data as basic data;

[0062] S104 clears the write-ahead log;

[0063] When the NEWSQL database management system uses ROCKSDB as the basic data kv storage engine according to S1, first, according to S101, the memory is used as a page linked list, and each page of 4k size is released in the same request, so that ROCKSDB directly uses the memory file instead when applying for the data file object. At the same time, to ensure the abnormal recovery of the memory number; then, according to S102, archive the pre-write log of ROCKSDB, and the log can be stored in a normal disk file; then, by using the snapshot backup function of ROCKSDB, according to S103, a snapshot of the entire valid data is backed up, and the backed-up data is used as the basic data. The backup time of the log and snapshot is 24 hours by default. Finally, the pre-write log before the basic data is cleared through S104 to save storage space;

[0064] Furthermore, the specific steps of S2 collecting data information of the user table include:

[0065] S201 collects table data changes;

[0066] S202 collects data access volume and access times;

[0067] S203 collects the data storage type change of the table;

[0068] When S2 collects data information of user tables, users modify and add data through SQL. When KV is decentralized, the data information of user tables is collected according to S201, and changes in table data are recorded; according to S202, the access volume and access times of user query table data through SQL are collected; according to S203, the storage type of table data changes when the memory is tight or there is too much free memory to migrate data; the storage location of the table is known, so as to determine whether the table data is in memory mode, which is convenient for positioning during query, and the limit of table data is known. To ensure efficiency, the data size does not need to be calculated in real time, and the number of data blocks is calculated regularly without the actual access degree of the table data;

[0069] Furthermore, the S3 schedules downgrading and upgrading the user table according to the statistical information of the memory table. The specific steps include:

[0070] S301 obtains the memory usage of the memory storage engine;

[0071] S302 reads user table statistics;

[0072] S303 calculates and obtains a user table with the lowest data access and a relatively large data volume;

[0073] S304 modifies the user table status and starts snapshot migration of the table to the disk storage engine;

[0074] First, the memory usage of the memory storage engine is obtained according to S301, and the data scheduler is triggered to start working. According to S302, the user table statistics are counted, and then according to S303, the user table with the lowest data access and relatively large data volume is calculated. The data scheduler modifies the user table status of the user table with a memory usage of 90% to a common magnetic disk according to S304, and migrates the table to the disk storage engine by snapshot to achieve data migration; the data scheduler modifies the user status of the memory table with a memory usage of less than 50% to a memory table according to S304, and migrates the table to the memory storage engine by snapshot to achieve data migration; thereby ensuring the utilization rate of the memory storage engine;

[0075] In summary, the memory table implemented by the present invention is a global intelligent memory table. The ordinary table created by the user is automatically upgraded to a memory table by default. The table structure is stored uniformly, and the table data is stored in the memory storage engine by default. At the same time, the access frequency of the table data, the data volume and other statistical information are automatically collected. When the memory storage engine reaches 90%, the data scheduler starts to work, and the table with low access frequency and large data volume is automatically downgraded to an ordinary table by snapshot, and migrated to the hard disk storage engine. In this way, the high concurrent access efficiency of the user's high-heat small table can be intelligently solved in the end, thereby reducing the frequent IO operations of high-heat data and improving the access performance of the database.

[0076] Embodiment 2:

[0077] An intelligent storage table implementation system for NEWSQL database management system, the system includes an engine construction module, an information statistics module and a data collection module:

[0078] Engine construction module: NEWSQL database management system uses ROCKSDB as the basic data kv storage engine;

[0079] Information statistics module: collects data information from user tables;

[0080] Data scheduling module: schedules the user table according to the statistical information of the memory table;

[0081] When the NEWSQL database management system is started, a memory mode ROCKSDB is automatically added and mounted as the storage engine of the memory table through the engine construction module. The memory engine can provide the same behavior as the ordinary ROCKSDB, and can simulate the ordinary file object to realize the memory file object. The object uses the memory as the final medium for its reading and writing to ensure the integrity of the SQL function. Then the data information of the user table is collected through the information statistics module. When the distributed NEWSQL database management system mounts the memory storage engine, the available memory size set by the user is fixed. When the memory usage is close to 90% of the set value, the data scheduler will intervene. Finally, according to the statistical information of the memory table, the user table is scheduled by the data scheduling module to complete the implementation of the intelligent storage table.

[0082] The system of the present invention aims at the write-read operation scenarios that can be processed concurrently in the database. By memorizing the user data table, the conflicts between write-read data and other data IO performance issues are resolved, and efficient concurrent data operations are achieved. However, the memorization processing mechanism is not supported for tables with extremely large data volumes. Under the premise of ensuring that the ACID characteristics of the database are not destroyed, the concurrent performance of write-read data is improved;

[0083] This solution realizes transparent use of memory tables by adding a memory storage engine and a multi-engine multi-scheduling mechanism. The memory storage engine is automatically mounted when the system starts. Users do not need to know the details of the memory table. The system automatically converts the user's ordinary table data into a memory table according to the size and popularity of the data, and stores the memory table data in the memory storage engine, which increases data access efficiency, reduces system IO contention, and thus improves database performance.

[0084] Furthermore, the engine construction module specifically includes a release module, a save module, a backup module and a clear module:

[0085] Release module: memory is released through page linked lists;

[0086] Saving module: archives and stores the write-ahead logs;

[0087] Backup module: Take snapshot backup of the overall valid data as basic data;

[0088] Clear module: clear the write-ahead log;

[0089] When the NEWSQL database management system uses ROCKSDB as the basic data kv storage engine through the engine construction module, the memory is first released in the form of a page linked list according to the release module, and each page of 4k size is released in the same request, so that ROCKSDB directly uses the memory file instead when applying for the data file object. At the same time, to ensure the abnormal recovery of the memory number; then the pre-write log of ROCKSDB is archived according to the preservation module, and the log can be stored in an ordinary disk file; then, by using the snapshot backup function of ROCKSDB, the snapshot of the entire valid data is backed up through the backup module, and the backed-up data is used as the basic data. The backup time of the log and snapshot is 24 hours by default. Finally, the pre-write log before the basic data is cleared by the clearing module to save storage space;

[0090] Furthermore, the information statistics module specifically includes a change collection module, an access collection module and a conversion collection module:

[0091] Change collection module: collects table data changes;

[0092] Access collection module: collects data access volume and access times;

[0093] Conversion collection module: collects changes in table data storage type;

[0094] When the information statistics module collects data information of the user table, the user modifies and adds data through SQL. When KV is decentralized, the change collection module is used to collect data information of the user table and record changes in table data; the access collection module collects the access volume and access times of the user querying the table data through SQL; the conversion collection module changes the storage type of the table data when the memory is tight or there is too much free memory to migrate data; the storage location of the table is known, so as to determine whether the table data is in memory mode, which is convenient for positioning during query, and the limit of the table data is known. To ensure efficiency, the data size does not need to be calculated in real time, and the calculation of the number of data blocks captured regularly does not require the actual access degree of the table data;

[0095] Furthermore, the data scheduling module performs downgrade and upgrade scheduling on the user table according to the statistical information of the memory table collected by the statistical information collector, and specifically includes a usage acquisition module, a reading module, a calculation module and an execution module:

[0096] Usage acquisition module: S301 acquires the memory usage of the memory storage engine;

[0097] Reading module: S302 reads user table statistical information;

[0098] Calculation module: S303 calculates and obtains a user table with the lowest data access and a relatively large data volume;

[0099] Execution module: S304 modifies the user table status and starts snapshot migration of the table to the disk storage engine;

[0100] First, the memory usage of the memory storage engine is obtained through the usage acquisition module, which triggers the data scheduler to start working. The user table statistics are counted through the reading module, and then the user table with the lowest data access and relatively large data volume is calculated through the calculation module. The data scheduler uses the execution module to modify the user table status of the user table with a memory usage of 90% to a common magnetic disk, and snapshot migrates the table to the disk storage engine to achieve data migration; the data scheduler uses the execution module to modify the user status of the memory table with a memory usage of less than 50% to a memory table, and snapshot migrates the table to the memory storage engine to achieve data migration; thereby ensuring the utilization rate of the memory storage engine;

[0101] In summary, the memory table implemented by the present invention is a global intelligent memory table. The ordinary table created by the user is automatically upgraded to a memory table by default. The table structure is stored uniformly, and the table data is stored in the memory storage engine by default. At the same time, the access frequency of the table data, the data volume and other statistical information are automatically collected. When the memory storage engine reaches 90%, the data scheduler starts to work, and the table with low access frequency and large data volume is automatically downgraded to an ordinary table by snapshot, and migrated to the hard disk storage engine. In this way, the high concurrent access efficiency of the user's high-heat small table can be intelligently solved in the end, thereby reducing the frequent IO operations of high-heat data and improving the access performance of the database.

[0102] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for implementing an intelligent storage table for a NEWSQL database management system, characterized in that The method steps include: S1NEWSQL database management system uses ROCKSDB as the basic data kv storage engine; S2 collects data information of the user table; The specific steps of S2 collecting data information of the user table include: S201 collects table data changes; S202 collects data access volume and access times; S203 collects the data storage type change of the table; S3 schedules the user table based on the statistical information of the memory table; The S3 performs downgrade and upgrade scheduling on the user table according to the statistical information of the memory table. The specific steps include: S301 obtains the memory usage of the memory storage engine; S302 reads user table statistics; S303 calculates and obtains a user table with the lowest data access and a relatively large data volume; S304 modifies the user table status and starts snapshot migration of the table to the disk storage engine.

2. The method for implementing an intelligent storage table for a NEWSQL database management system according to claim 1, characterized in that The specific steps of the S1NEWSQL database management system using ROCKSDB as the basic data kv storage engine include: S101 memory is released through page linked lists; S102 archives the write-ahead log; S103 performs a snapshot backup of the entire valid data as basic data; S104 clears the write-ahead log.

3. An intelligent storage table implementation system for NEWSQL database management system, characterized by The system includes an engine construction module, an information statistics module and a data collection module: Engine construction module: NEWSQL database management system uses ROCKSDB as the basic data kv storage engine; Information statistics module: collects data information from user tables; The information statistics module specifically includes a change collection module, an access collection module and a conversion collection module: Change collection module: collects table data changes; Access collection module: collects data access volume and access times; Conversion collection module: collects changes in table data storage type; Data scheduling module: schedules the user table according to the statistical information of the memory table; The data scheduling module schedules downgrading and upgrading the user table according to the statistical information of the memory table collected by the statistical information collector, and specifically includes a usage acquisition module, a reading module, a calculation module and an execution module: Usage acquisition module: obtains the memory usage of the memory storage engine; Read module: read user table statistics; Calculation module: calculates the user table with the lowest data access and relatively large data volume; Execution module: Modify the user table status and start snapshot migration of the table to the disk storage engine.

4. The intelligent storage table implementation system for NEWSQL database management system according to claim 3 is characterized in that The engine construction module specifically includes a release module, a save module, a backup module and a clear module: Release module: memory is released through page linked lists; Saving module: archives and stores the write-ahead logs; Backup module: Take snapshot backup of the overall valid data as basic data; Clear module: clear the write-ahead log.