Memory Performance Optimization Method, Electronic Device, and Storage Medium for Database
By using storage-level memory as a secondary cache, database memory management is optimized, and the frequent data swaps and out caused by small memory is solved, reducing hardware costs and improving database performance.
Patent Information
- Application Number
- CN202411748115.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2044-12-02
AI Technical Summary
The frequent exchange of common data caused by small memory of databases affects performance and is expensive.
Use storage-level memory (such as AEP) as the secondary cache, manage hot and cold data through predefined page replacement mechanisms and asynchronous threads, optimize memory usage, asynchronously write cold data in storage-level memory, and reduce frequent memory and disk exchanges.
Improves data performance, reduces frequent exchanges between memory and disk, reduces hardware costs, and improves database operation efficiency.
Smart Images

Figure CN119226324B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of database and memory optimization, and particularly relates to a method for optimizing the memory performance of a database, an electronic device, and a storage medium. Background Art
[0002] A database is a warehouse for storing and managing data, and memory plays an important role in database management. Because memory speeds up the reading and writing speeds of data, the response time is greatly reduced, enabling users to quickly obtain the required data. Usually, the data that is frequently read in the database is cached in memory, thus turning multiple write operations of these frequently read data into one write operation and reducing the dependence on disk I / O, thereby greatly improving the performance of the database. However, when the memory is too small, data will be frequently swapped in and out, releasing some data from memory and falling back to disk, which results in performance degradation and slower data processing. In addition, memory is more expensive and has a smaller capacity compared to disk. If one blindly pursues the performance of the database and deploys too much memory in terms of hardware, it will cost a high price and result in very low cost performance. Summary of the Invention
[0003] In view of the above problems, the present invention provides a method for optimizing the memory of a database, an electronic device, and a storage medium, in order to at least solve one of the above problems.
[0004] According to a first aspect of the present invention, there is provided a method for optimizing the memory performance of a database, including:
[0005] Mount the storage-class memory as a data memory heap, initialize the storage-class memory by calling the corresponding interface of the storage-class memory when starting a single-machine service through a database cluster, and set the working mode of the storage-class memory to the memory mode;
[0006] When reading the target data table for the first time, load the target data block in the target data table from disk into the data memory heap and mark the target data block as hot data. Based on a predefined page replacement mechanism, when the target data block exceeds the hot data memory threshold, convert some data in the target data block into cold data;
[0007] Monitor the cold data in the data memory heap by starting an asynchronous thread. Based on the obtained signal, read the cold data in the data memory heap through the asynchronous thread and asynchronously write the cold data in the data memory heap into the storage-class memory;
[0008] When the storage-class memory is full of data blocks, according to the predefined page replacement mechanism, clear the cold data in the storage-class memory and store the cleared cold data on disk;
[0009] When the target data table is read again, the data cache situations of the data memory heap and the storage-level memory are retrieved successively, and based on the retrieval results, the target data blocks in the target data table are read or reloaded from the disk into the data memory heap for processing.
[0010] According to an embodiment of the present invention, the above-mentioned predefined page replacement mechanism includes the LIRS mechanism, and the storage-level memory includes AEP.
[0011] According to an embodiment of the present invention, when the target data table is read for the first time, the target data blocks in the target data table are loaded from the disk into the data memory heap and the target data blocks are marked as hot data. Based on the predefined page replacement mechanism, when the target data blocks exceed the hot data memory threshold, converting some data in the target data blocks into cold data includes:
[0012] Create a node information table for each target data block loaded into the data memory heap to record the information of the target data block;
[0013] Write the node information table of the previous target data block into the node table, then write the node information table of the current target data block into the node table and delete the node information table of the previous target data block, where the node table is the collection of node information tables and is updated through the new node table;
[0014] During the process of loading the target data blocks in the target data table from the disk into the data memory heap, repeatedly execute the creation operation of the node information table and the update operation of the node table until the data caching in the target data table is completed;
[0015] When the data caching in the target data table is completed, according to the predefined page replacement mechanism, mark the data blocks exceeding the hot data memory threshold as cold data, and generate a temporary node information table for recording the data blocks marked as cold data.
[0016] According to an embodiment of the present invention, the above-mentioned node information table includes a table unique identifier, a column unique identifier, a data block unique identifier, and a data block pointer object.
[0017] According to an embodiment of the present invention, monitoring the cold data in the data memory heap by starting an asynchronous thread, and based on the obtained signal, reading the cold data in the data memory heap by the asynchronous thread and asynchronously writing the cold data in the data memory heap into the storage-level memory includes:
[0018] After a part of the data marked as cold data in the target data block emits a signal, start reading the cold data through the asynchronous thread of the database;
[0019] Read the cold data information from the temporary node information table through an asynchronous thread, find the corresponding cold data based on the obtained cold data information, and write the found cold data into the storage-class memory.
[0020] According to an embodiment of the present invention, the above-mentioned monitoring of cold data in the data memory heap by starting an asynchronous thread, based on the obtained signal, reading the cold data in the data memory heap through the asynchronous thread and asynchronously writing the cold data in the data memory heap into the storage-class memory further includes:
[0021] Release the memory by clearing the existing cold data in the data memory heap, and create a node information table identical to the target data block for the cold data written into the storage-class memory.
[0022] According to an embodiment of the present invention, when reading the target data table again, the above-mentioned sequential retrieval of the data cache situations of the data memory heap and the storage-class memory, and based on the retrieval results, reading the target data block in the target data table or reloading it from the disk into the data memory heap for processing includes:
[0023] First retrieve the data memory heap and then retrieve the storage-class memory to obtain the retrieval result;
[0024] In the case where the retrieval result is that there is a data cache of the target data table in the data memory heap or the storage-class memory, directly read the data cache in the data memory heap or the storage-class memory based on the node information table of the target data block in the target data table.
[0025] According to an embodiment of the present invention, when reading the target data table again, the above-mentioned sequential retrieval of the data cache situations of the data memory heap and the storage-class memory, and based on the retrieval results, reading the target data block in the target data table or reloading it from the disk into the data memory heap for processing further includes:
[0026] In the case where the retrieval result is that there is no data cache of the target data table in both the data memory heap and the storage-class memory, re-execute the loading operation of the target data block from the disk to the data memory heap, the reading and writing operations of the asynchronous thread, and the cleaning operation of the cold data.
[0027] According to a second aspect of the present invention, there is provided an electronic device, including:
[0028] One or more processors;
[0029] A storage device for storing one or more programs,
[0030] Wherein, when the one or more programs are executed by the one or more processors, the one or more processors are caused to execute a method for optimizing the memory performance of a database.
[0031] According to the third aspect of the present invention, there is provided a computer-readable storage medium having executable instructions stored thereon, which when executed by a processor cause the processor to execute a method for optimizing the memory performance of a database.
[0032] The above-mentioned method for optimizing the memory performance of a database provided by the present invention uses the storage-class memory as a secondary cache, solves the problem that frequently used data is swapped in and out due to small memory in the database, effectively improves the performance of data, and facilitates the user's operation of the database. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a flowchart of a method for optimizing the memory performance of a database according to an embodiment of the present invention;
[0034] Figure 2 Schematically shows a block diagram of an electronic device suitable for implementing a method for optimizing the memory performance of a database according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0035] To make the objectives, technical solutions, and advantages of the present invention clearer and more understandable, the following further describes the present invention in detail with reference to specific embodiments and the accompanying drawings.
[0036] The present invention provides a method of using the storage-class memory (such as AEP: Apache Pass Memory, Intel Optane Persistent Memory) as a secondary cache of the memory to expand the memory, and solve the problem that frequently used data is swapped in and out due to small memory, thus affecting the performance of the database. Due to the advantages of low price, large capacity, and similar read and write speeds to memory of AEP, using its memory storage mode to expand the memory can better solve the above technical problems.
[0037] Figure 1 is a flowchart of a method for optimizing the memory performance of a database according to an embodiment of the present invention.
[0038] As Figure 1 shown, the above-mentioned method for optimizing the memory performance of a database includes operations S110 to S150.
[0039] Operation S110 mounts the storage-class memory as a data memory heap, initializes the storage-class memory by calling the corresponding interface of the storage-class memory when starting a single-machine service through a database cluster, and sets the working mode of the storage-class memory to the memory mode.
[0040] The above-mentioned hot data represents data with a high access frequency; the above-mentioned cold data represents data with a low access frequency; the above-mentioned data memory heap is used to cache frequently used data and temporary data, i.e., the DC heap; the above-mentioned storage-class memory, optionally, includes AEP, i.e., Intel Optane Data Center Persistent Memory, and the AEP has three working modes: storage mode, memory mode, and hybrid mode.
[0041] Before performing the initialization work of the storage-class memory, the memory sizes of the hot and cold data can be set according to the user's needs, i.e., the thresholds of the cold data and the hot data. For example, when the user is using the gbase database, the size of the frequently used hot data can be set according to their own needs, or the default options of gbase can be directly used.
[0042] Taking AEP as the storage-class memory and the database selecting gbase, the above operation S110 can be described as: mounting AEP as the DC heap, when the gbase database cluster starts the gbased service, calling the corresponding interface of AEP, thereby performing initialization, setting the working mode of AEP to the memory mode, and defining the memory sizes of the hot and cold data at the same time.
[0043] For operation S120, when the target data table is read for the first time, the target data blocks in the target data table are loaded from the disk into the data memory heap and the target data blocks are marked as hot data. Based on the predefined page replacement mechanism, when the target data blocks exceed the hot data memory threshold, some of the data in the target data blocks are converted into cold data.
[0044] According to the embodiments of the present invention, the above-mentioned predefined page replacement mechanism includes the LIRS (Low Inter-reference Recency Set) mechanism, and the storage-class memory includes AEP.
[0045] Taking AEP as the storage-class memory and the database selecting gbase, the above operation S120 can be described as: when reading the data of a certain table for the first time, the data dc is loaded from the disk into the DC heap and marked as hot data. According to the LIRS mechanism, when the hot data memory is full, some of the data dc is converted into cold data.
[0046] For operation S130, the cold data in the data memory heap is monitored by starting an asynchronous thread. Based on the obtained signal, the cold data in the data memory heap is read by the asynchronous thread and the cold data in the data memory heap is asynchronously written into the storage-class memory.
[0047] Start an asynchronous thread to monitor the cold data in the DC heap. Release the signal, and the thread reads the cold data and writes it asynchronously into AEP.
[0048] Operation S140, when the storage-class memory is full of data blocks, according to a predefined page replacement mechanism, the cold data in the storage-class memory is cleared, and the cleared cold data is stored on the disk.
[0049] When the data dc in the AEP is full, the cold data dc is cleared according to the LIRS mechanism and landed on the disk.
[0050] Operation S150, when reading the target data table again, the data cache situations of the data memory heap and the storage-class memory are retrieved successively, and based on the retrieval results, the target data blocks in the target data table are read or reloaded from the disk into the data memory heap for processing.
[0051] When reading the data of a certain table again, first search the DC heap, then search the AEP. If there is its data cache, use it directly. If not, load it again from the disk, and loop to execute S120~S140.
[0052] The above-mentioned memory performance optimization method for databases provided by the present invention uses the storage-class memory as a secondary cache, solves the problem that the frequently used data is frequently swapped in and out due to the small memory of the database, effectively improves the performance of the data, and facilitates the user's operation of the database.
[0053] According to an embodiment of the present invention, when the target data table is read for the first time above, the target data blocks in the target data table are loaded from the disk into the data memory heap and the target data blocks are marked as hot data. Based on a predefined page replacement mechanism, when the target data blocks exceed the hot data memory threshold, converting some of the data in the target data blocks into cold data includes: creating a node information table for each target data block loaded into the data memory heap to record the information of the target data block; writing the node information table of the previous target data block into the node table, then writing the node information table of the current target data block into the node table and deleting the node information table of the previous target data block, where the node table is a collection of node information tables and is updated through a new node table; during the process of loading the target data blocks in the target data table from the disk into the data memory heap, repeatedly execute the creation operation of the node information table and the update operation of the node table until the data in the target data table is cached completely; when the data in the target data table is cached completely, according to a predefined page replacement mechanism, mark the data blocks that exceed the hot data memory threshold as cold data, and generate a temporary node information table for recording the data blocks marked as cold data.
[0054] According to an embodiment of the present invention, the above-mentioned node information table includes a table unique identifier, a column unique identifier, a data block unique identifier, and a data block pointer object.
[0055] The following is a further detailed description of the process of first reading the target data table through specific embodiments, with AEP as the storage-class memory and gbase as the database used.
[0056] In operation S120, a table_list table for recording data dc information is generated. The specific operations are as follows: For each data dc loaded into the DC heap, a new table_list table for recording DC information is created; first, the table_list information of the previous data dc loaded into the DC heap is written into the new table, and then this data dc information is written into the new table_list; the table_list table created by the previous data dc is deleted, and the above two steps, namely "for each data dc loaded into the DC heap, a new table_list table for recording DC information is created" and "first, the table_list information of the previous data dc loaded into the DC heap is written into the new table, and then this data dc information is written into the new table_list", are repeatedly executed until the data dc caching is completed; according to the lirs mechanism, the data dc is marked as cold data; at the same time, a temporary table_list table (tmp_list) for recording cold data dc is generated; further, the information of the created table_list table includes table id, column id, data dc_id, and data dc pointer object.
[0057] According to an embodiment of the present invention, the above-mentioned monitoring of cold data in the data memory heap by starting an asynchronous thread, based on the obtained signal, reading the cold data in the data memory heap by the asynchronous thread and asynchronously writing the cold data in the data memory heap into the storage-class memory includes: after a part of the data marked as cold data in the target data block emits a signal, starting to read the cold data through the asynchronous thread of the database; reading the cold data information by the asynchronous thread by reading the temporary node information table, and finding the corresponding cold data based on the obtained cold data information, and writing the found cold data into the storage-class memory; releasing the memory by clearing the existing cold data in the data memory heap, and creating a node information table identical to the target data block for the cold data written into the storage-class memory.
[0058] The following is a further detailed description of the related operation process of the above asynchronous thread through specific embodiments, with AEP as the storage-class memory and gbase as the database used.
[0059] Operation S130 is mainly used to detect the generated cold data: when the cold data exists, a signal is emitted, and the background thread starts to read the cold data. The thread reads the cold data dc information in tmp_list, finds the corresponding data, and writes it into AEP; clears the cold data in the DC heap to release the memory;
[0060] According to an embodiment of the present invention, when re-reading the target data table as described above, the data caching situations of the data memory heap and the storage-level memory are retrieved successively, and based on the retrieval results, the target data blocks in the target data table are read or reloaded from the disk into the data memory heap for processing, including: retrieving the data memory heap first and then the storage-level memory to obtain the retrieval results; in the case where the retrieval result is that there is a data cache of the target data table in the data memory heap or the storage-level memory, directly read the data cache in the data memory heap or the storage-level memory based on the node information table of the target data blocks in the target data table; in the case where the retrieval result is that there is no data cache of the target data table in both the data memory heap and the storage-level memory, re-execute the loading operation of the target data blocks from the disk to the data memory heap, the read and write operations of the asynchronous threads, and the cleaning operation of the cold data.
[0061] The following uses a specific embodiment, with AEP as the storage-level memory and gbase as the database used, to further elaborate on the related process of re-reading the target data table as described above.
[0062] The above operation S150 searches for data dc according to table_list in the memory: when there is a data cache in the DC heap and AEP and reading the data of a certain table, first read table_list in the DC heap, and then read table_list in AEP; first read the table id in table_list, followed by the column id and the data dc_id; if the data is found in the memory cache, directly read it. If the corresponding information is not found, it indicates that the data has been written to the disk, and the data should be loaded from the disk into the data memory.
[0063] The method for optimizing the memory performance of the database provided by the present invention effectively improves the hit rate of data in the memory cache. When reading a large amount of data into the memory, it will not mark the frequently used cached data as cold data and release it to the disk due to insufficient memory. Instead, it will asynchronously write it into AEP. When re-reading this cold data, it does not need to be loaded from the disk, but directly read from AEP, which improves the read and write speed of the data in the database. Thereby reducing the frequent swapping in and out of data between the memory and the disk, which may cause too long reading time and affect the performance.
[0064] The following further elaborates on the above-mentioned method for optimizing the memory of the database provided by the present invention through another embodiment.
[0065] First, install AEP on hardware such as a server, then restart the gbased service of the cluster. The program calls the relevant interfaces of AEP and initializes the AEP device to use its memory mode.
[0066] It should be noted that switch parameters are added to the code program. When a user logs in to the cluster, by setting the on and off of this parameter, it controls whether to cache data in AEP. At the same time, when initializing the AEP device, the sizes of the hot and cold memories of AEP are defined according to the corresponding ratio.
[0067] After initializing AEP, data caching can be carried out, which is mainly divided into three parts:
[0068] The first part: Memory DC heap caching. When a user logs in to the cluster and conducts the first data query on a certain table, the data is cached from the disk to the memory DC heap. The specific process is as follows:
[0069] (11) The user logs in to the cluster and selects an existing library table for query.
[0070] (12) The database cluster issues instructions to each node, selects the correct data dc, caches it in the memory DC heap, and simultaneously generates a table_list containing the data dc information.
[0071] (13) First, mark the data dc as hot data. Use the lirs mechanism. When the hot data memory is full, it is converted into cold data.
[0072] The second part: Cold data monitoring. When step (12) is executed, the background monitoring thread enters the waiting state. When hot data is transferred into cold data, a signal is sent, and the cold data is read and written into AEP. When cold data is transferred, a temporary table_list recording the cold data dc information is generated synchronously. If the cold data heap is empty or there is no available DC, it is in the waiting state.
[0073] It should be noted that the memory DC heap not only caches the data dc but also caches the data dc of the temporary table. However, the data dc of the temporary table is not allowed to be transferred into AEP. It is cleared after the task is completed, releasing the DC heap memory. Only the cold data dc can trigger the background thread, and the data dc of the temporary table cannot trigger it.
[0074] The third part: AEP caching. When cold data is written into AEP, according to the lirs mechanism, it is first marked as hot data. When the hot data memory is full, it is converted into cold data. When the cold data is full, the cold data is cleared and landed on the disk.
[0075] After the first data reading is cached in the memory and AEP, when reading this data again, the response time is significantly shortened. The specific process of reading the data is as follows: When the user queries the data of a certain table multiple times, the cluster issues instructions to a single machine; each node reads the table_list in the DC heap and AEP in turn, and finds the corresponding data dc information according to the conditions; if not found, it is judged that the data has been landed on the disk; then read from the disk again.
[0076] Meanwhile, a memory monitoring module is provided to facilitate users to understand the memory usage situation. The details are as follows: When a user logs in to a single-machine cluster and queries a memory table, the DC heap and AEP memory usage in the single-machine layer can be monitored. However, the query result is real-time and can only represent the current memory usage situation. The form of the table is shown in Table 1:
[0077] Table 1
[0078]
[0079] Figure 2 FIG. schematically shows a block diagram of an electronic device suitable for implementing a method for optimizing memory performance for a database according to an embodiment of the present invention.
[0080] As Figure 2 shown, the electronic device 200 according to an embodiment of the present invention includes a processor 201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 202 or a program loaded from a storage section 208 into a random access memory (RAM) 203. The processor 201 may include, for example, a general microprocessor (such as a CPU), an instruction set processor, and / or a related chipset, and / or a dedicated microprocessor (such as an application-specific integrated circuit (ASIC)), etc. The processor 201 may also include on-board memory for caching purposes. The processor 201 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.
[0081] In the RAM 203, various programs and data required for the operation of the electronic device 200 are stored. The processor 201, the ROM 202, and the RAM 203 are connected to each other through a bus 204. The processor 201 performs various operations of the method flow according to an embodiment of the present invention by executing the programs in the ROM 202 and / or the RAM 203. It should be noted that the program may also be stored in one or more memories other than the ROM 202 and the RAM 203. The processor 201 may also perform various operations of the method flow according to an embodiment of the present invention by executing the programs stored in one or more memories.
[0082] According to an embodiment of the present invention, the electronic device 200 may further include an input / output (I / O) interface 205, and the input / output (I / O) interface 205 is also connected to the bus 204. The electronic device 200 may further include one or more of the following components connected to the I / O interface 205: an input portion 206 including a keyboard, a mouse, etc.; an output portion 207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage portion 208 including a hard disk, etc.; and a communication portion 209 including a network interface card such as a LAN card, a modem, etc. The communication portion 209 performs communication processing via a network such as the Internet. The drive 210 is also connected to the I / O interface 205 as needed. A removable medium 211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 210 as needed so that a computer program read from it can be installed into the storage portion 208 as needed.
[0083] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist separately without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the one or more programs are executed, the method according to the embodiments of the present invention is implemented.
[0084] According to an embodiment of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium may be any tangible medium that contains or stores a program, and the program can be used by or combined with an instruction execution system, device, or apparatus. For example, according to an embodiment of the present invention, the computer-readable storage medium may include the ROM 202 and / or the RAM 203 described above and / or one or more memories other than the ROM 202 and the RAM 203.
[0085] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur in a different order than that noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and combinations of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0086] In the above specific embodiments, the objectives, technical solutions, and beneficial effects of the present invention have been further described in detail. It should be understood that the above are only specific embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for optimizing memory performance of a database, characterized in that: include: Mount the storage-level memory as a data memory heap, call the corresponding interface of the storage-level memory to complete the initialization of the storage-level memory when starting the stand-alone service through the database cluster, and set the working mode of the storage-level memory to the memory mode, wherein the user can monitor the data memory heap of the stand-alone layer in real time by querying the memory type, memory value, memory usage value and maximum data block; Creating a node information table for each target data block loaded into the data memory heap to record information of the target data block; Writing the node information table of the previous target data block into the node table, then writing the node information table of the current target data block into the node table and deleting the node information table of the previous target data block, wherein the node table is a collection of the node information tables and is updated through a new node table; In the process of loading the target data block in the target data table from the disk to the data memory heap, repeatedly performing the creation operation of the node information table and the update operation of the node table until the data in the target data table is completely cached; When the data in the target data table is completely cached, the data blocks exceeding the hot data memory threshold are marked as cold data according to a predefined page replacement mechanism, and a temporary node information table for recording the data blocks marked as cold data is generated; After a portion of the data marked as cold data in the target data block sends a signal, the cold data is started to be read through an asynchronous thread of the database; The information of the cold data is obtained by reading the temporary node information table through the asynchronous thread, and the corresponding cold data is found based on the obtained information of the cold data, and the found cold data is written into the storage-level memory; Freeing up memory by clearing out cold data already existing in the data memory heap, and creating a node information table identical to the target data block for the cold data written into the storage-level memory; When the storage-level memory is full of data blocks, according to the predefined page replacement mechanism, the cold data in the storage-level memory is cleaned up, and the cleaned up cold data is stored in the disk; When the target data table is read again, the data cache conditions of the data memory heap and the storage-level memory are searched successively, and based on the search results, the target data blocks in the target data table are read or reloaded from the disk to the data memory heap for processing.
2. The method according to claim 1, characterized in that The predefined page replacement mechanism includes a LIRS mechanism, and the storage-class memory includes an AEP.
3. The method according to claim 1, characterized in that The node information table includes a table unique identifier, a column unique identifier, a data block unique identifier, and a data block pointer object.
4. The method according to claim 1, characterized in that: When reading the target data table again, searching the data cache conditions of the data memory heap and the storage-level memory in sequence, and reading the target data block in the target data table or reloading it from the disk to the data memory heap for processing based on the search result includes: Firstly search the data memory heap and then search the storage level memory to obtain a search result; In the case where the retrieval result is that the data cache of the target data table exists in the data memory heap or the storage-level memory, the data cache in the data memory heap or the storage-level memory is directly read based on the node information table of the target data block in the target data table.
5. The method according to claim 4, characterized in that Also includes: When the retrieval result is that the data cache of the target data table does not exist in the data memory heap and the storage-level memory, the loading operation of the target data block from the disk to the data memory heap, the reading and writing operations of the asynchronous threads, and the cleaning operation of the cold data are re-executed.
6. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors execute the method according to any one of claims 1 to 5.
7. A computer-readable storage medium, characterized in that: Executable instructions are stored thereon, and when the instructions are executed by a processor, the processor executes the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Database storage performance optimization method and system, terminal and storage medium
CN114020720A