Data processing method, storage engine, and electronic device
By introducing a two-tier storage architecture into the cloud storage system and migrating data to the buffer pool using a faster first storage device, the problem of low access efficiency when the buffer pool does not cache data is solved, achieving more efficient data access and throughput.
Patent Information
- Application Number
- CN202311162819.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-08
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-09-08
AI Technical Summary
In existing cloud storage systems, data access efficiency is low, especially when data is not cached in the buffer pool, resulting in slow disk access speeds and thus low data access efficiency.
A two-tier storage architecture is introduced, including a buffer pool and two types of storage devices. The first storage device has a faster data access speed. Access efficiency is improved by migrating the target data to the buffer pool, and data is read from the faster storage device first.
It improved data access efficiency, reduced data access latency, and increased data throughput while controlling costs, achieving a balance between storage costs and access capabilities.
Smart Images

Figure CN117289861B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and in particular to a data processing method, a storage engine, and an electronic device. Background Technology
[0002] With the continuous development of cloud computing infrastructure, the cloud provides a variety of storage services. Currently, in cloud storage services, databases generally consist of a two-layer storage architecture: a buffer pool and a data file layer. The buffer pool mechanism caches frequently accessed data, avoiding constant access to data files on the disk, which would otherwise lead to low data access efficiency.
[0003] However, disk access for storing data files is relatively slow. When the data to be accessed is not cached in the buffer pool, accessing it from the disk still results in low data access efficiency. Therefore, how to further improve data access efficiency is an urgent problem to be solved. Summary of the Invention
[0004] This application provides a data processing method, storage engine, and electronic device to improve data access efficiency.
[0005] In a first aspect, embodiments of this application provide a data processing method applied to a storage engine. The storage engine includes a buffer pool and storage devices. The storage devices include a first storage device and a second storage device. The data access speed of the first storage device is higher than that of the second storage device. The method includes: obtaining an access request for target data; when the target data is not present in the buffer pool, migrating the target data from the storage device to the buffer pool; and outputting the target data from the buffer pool. The step of migrating the target data from the storage device to the buffer pool includes: if the target data exists in the first storage device, migrating the target data from the first storage device to the buffer pool; and if the target data is not present in the first storage device, migrating the target data from the second storage device to the buffer pool.
[0006] Secondly, embodiments of this application provide a storage engine, including a buffer pool and a storage device. The storage device includes a first storage device and a second storage device, wherein the data access speed of the first storage device is higher than that of the second storage device. A processing module in the storage engine is used to: obtain an access request for target data; and when the target data is not present in the buffer pool, migrate the target data from the storage device to the buffer pool. The migration of the target data from the storage device to the buffer pool includes: if the target data exists in the first storage device, migrating the target data from the first storage device to the buffer pool; and if the target data is not present in the first storage device, migrating the target data from the second storage device to the buffer pool.
[0007] Thirdly, embodiments of this application provide an electronic device, including: at least one processor and a memory; the memory stores computer execution instructions; the at least one processor executes the computer execution instructions stored in the memory, causing the at least one processor to perform the method as described in the first or second aspect.
[0008] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method provided in the first or second aspect.
[0009] Fifthly, embodiments of this application provide a computer program product including computer instructions that, when executed by a processor, implement the method provided in the first or second aspect.
[0010] In this embodiment, when the target data does not exist in the buffer pool, the storage engine can prioritize reading data from the first storage device with faster data access speed, thereby improving data access efficiency. Furthermore, under the premise of cost control, it can increase data throughput and reduce data access latency, achieving a balance between storage cost and access capability. Attached Figure Description
[0011] Figure 1 A schematic diagram illustrating an application scenario 100 provided in an embodiment of this application;
[0012] Figure 2 A schematic diagram of a storage engine 200 provided in this application;
[0013] Figure 3 A schematic diagram of a storage engine 300 provided in an embodiment of this application;
[0014] Figure 4 A flowchart illustrating a data processing method 400 provided in an embodiment of this application;
[0015] Figure 5 A flowchart illustrating another data processing method provided in an embodiment of this application;
[0016] Figure 6 This is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of this application. Detailed Implementation
[0017] The embodiments of this application can be applied to any data access scenario, and are particularly suitable for scenarios involving access to a large number of data pages. The embodiments of this application can be applied to data access in various fields, such as games, e-commerce, and online forums.
[0018] Figure 1 This is a schematic diagram illustrating an application scenario 100 provided in an embodiment of this application. For example... Figure 1 As shown, the data requester 110 can interact with the data provider 120 to access data. For example, the data requester 110 can send a data access request to the data provider 120 to request operations such as reading, writing, deleting, and modifying data.
[0019] The data demand terminal 110 can be any user terminal, or it can be deployed on any user terminal. User terminals can be, for example, mobile phones, tablets, desktop computers, or terminal devices in industrial control. In this embodiment, the terminal device can also be a wearable device, also known as a wearable smart device. Wearable devices are a general term for devices that utilize wearable technology to intelligently design and develop everyday wearables, such as glasses, gloves, watches, clothing, and shoes. Wearable devices are portable devices that are worn directly on the body or integrated into the user's clothing or accessories.
[0020] The data provider 120 can be implemented as a database, or a data service system within a database, such as MySQL. The database can be implemented as a server or server cluster, or the application service can be deployed on a server or server cluster. This server or server cluster can be a cloud server or a server cluster.
[0021] The data demand side 110 and the data supply side 120 can be deployed in a distributed manner or in a centralized manner; this application does not impose any restrictions on this. When the data demand side 110 and the data supply side 120 are deployed in a centralized manner, they can be deployed in the cloud or on-premises.
[0022] This application embodiment does not limit the number of data demand terminals 110 and data provider terminals 120.
[0023] Figure 2 This is a schematic diagram of a storage engine 200 provided in this application. (See diagram below.) Figure 2 As shown, Storage Engine 200 can be deployed in a database, such as... Figure 1 The data supply side 120 is used for data storage. The storage engine 200 is used to implement data storage and create indexes for the stored data, thereby enabling data updates, queries, and so on.
[0024] Storage engine 200 includes processing module 210, which can be used to implement transaction management of the storage engine, such as a transaction system, and can also be used to implement the storage structure of the storage engine, such as B-treeAccess.
[0025] Storage engine 200 also includes storage device 220. Storage device 220 can store tablespaces (or data files), each tablespace may include one or more data pages. Storage device 220 can be implemented as a disk in hardware. Storage device 220 can be implemented as any file system in software, such as a file system based on Elastic Block Store (EBS), a file system based on Elastic Object Storage Service (OSS), etc.
[0026] Storage device 220 can store all the data that the storage engine needs to store.
[0027] It should be noted that both EBS and OSS have significant data access latency. Therefore, data access efficiency is low when the processing module 210 accesses the storage device 220. Optionally, the processing module 210 can interact with the storage device 220 via a file interface to achieve data access.
[0028] Storage engine 200 also includes a buffer pool 230. The buffer pool 230 caches some frequently accessed data in storage device 220 to improve data access speed. However, if the accessed data is not cached in the buffer pool 230, data access still needs to be performed in storage device 220.
[0029] In order to further improve the access efficiency of the storage engine, this application embodiment provides, for example... Figure 3 The storage engine 300 shown includes a processing module 310, a buffer pool 320, and a storage device 330. The storage device 330 includes a first storage device 331 and a second storage device 332.
[0030] Among them, the processing module 310 and Figure 2 Similar to the processing module 210, the buffer pool 320 is... Figure 2 Similar to the buffer pool 230, the second storage device 332 is... Figure 2 The storage device 220 is similar, so it will not be described in detail for the sake of simplicity.
[0031] Figure 3 The storage engine 300 shown is Figure 2 The difference between the storage engines 200 shown is that, Figure 3 The first storage device 331 in the storage engine 300 has a higher data access speed than the second storage device 332.
[0032] For example, the first storage device 331 can be implemented as any type of non-volatile memory, which can also be called persistent memory, such as a flash drive. The first storage device 331 can be understood as an extension of the buffer pool 320, and therefore can also be called a buffer pool extension (BPE) layer. Optionally, the first storage device 331 can store data evicted from the buffer pool.
[0033] The processing module 310 can interact with the first storage device 331 through a file interface to access data.
[0034] Therefore, when the data to be accessed does not exist in the buffer pool 320, the data can be accessed in the first storage device 331 to improve the data access speed.
[0035] In this embodiment of the application, data access includes data reading, data writing, data modification, and data deletion.
[0036] It should be understood that the following description is for ease of understanding and explanation only, using the storage engine as the execution subject to explain in detail the methods provided in the embodiments of this application. Of course, this application does not limit the execution subject; for example, the execution subject can also be a processing module in the storage engine, or it can also be a data management system deployed with the storage engine, and so on.
[0037] Figure 4 This is a flowchart illustrating a data processing method 400 provided in an embodiment of this application. The method 400 includes, for example: Figure 4 Some or all of the processes in S410 to S450 shown are described below with reference to each step.
[0038] In the S410, the storage engine retrieves an access request for the target data. This access request can be sent by other devices, such as... Figure 1The data request terminal 110 can send an access request to read the target data, and then retrieve, move, or manipulate the target data, such as modifying or deleting it. After receiving the access request for the target data, the storage engine can respond to the request and output the target data.
[0039] The target data can be a data page or data within a data page.
[0040] It should be noted that in this application, the data requester can perform any access operation on the target data, such as searching, writing, modifying, deleting, moving, etc.
[0041] After the storage engine receives an access request for target data, it can directly read the target data from the buffer pool. If the target data exists in the buffer pool, the storage engine can complete the data reading process; if the target data does not exist in the buffer pool, it executes step S420. Alternatively, after receiving the access request for target data, the storage engine can first determine whether the target data exists in the buffer pool. For example, it can determine whether the target data exists in the buffer pool based on the index list stored in the buffer pool. If the target data exists in the buffer pool, it reads the target data from the buffer pool; if the target data does not exist in the buffer pool, it executes step S420.
[0042] In S420 described above, the storage engine can migrate the target data in the storage device to the buffer pool, so that the storage engine can read the target data from the buffer pool.
[0043] For example, S420 may include S421 and S422.
[0044] In S421, when the target data exists in the first storage device, the storage engine can migrate the target data from the first storage device to the buffer pool. In S422, when the target data does not exist in the first storage device, the storage engine can migrate the target data from the second storage device to the buffer pool. The second storage device stores the first data, which may be all the data required by the storage engine. Alternatively, the storage device may store part or all of the first data.
[0045] It should be understood that since the data access speed of the first storage device (i.e., the data exchange speed of the interactive interface that provides data reading and writing) is higher than that of the second storage device, migrating the target data in the first storage device to the buffer pool has higher access efficiency than migrating the target data in the second storage device to the buffer pool.
[0046] Optionally, the first storage device may include at least two sub-storage devices, which have different data access speeds. When the target data exists in the first storage device, the storage engine migrates the target data in the first storage device to a buffer pool. This can be achieved by the storage engine sequentially determining whether data exists in the sub-storage devices according to their data access speeds from fastest to slowest, until the target data is determined to exist in the first sub-storage device, at which point the target data in the first sub-storage device is migrated to the buffer pool. The first sub-storage device may be the one with the fastest access speed among the at least two sub-storage devices storing the target data.
[0047] Optionally, the data pages stored in the first storage device (such as each data page in a data file) are of the same size. Optionally, the data pages stored in the first storage device (such as each data page in a data file) are organized in a tiled manner, that is, there is no structural relationship between the data pages, such as the relationship between parent and child nodes in a tree structure.
[0048] In S430, the storage engine can output the target data read, such as to other data modules in the database, and further output it to the data request end.
[0049] In some embodiments, the second storage device may store data from the first data whose access frequency is greater than or equal to a frequency threshold. It should be understood that the higher the access frequency of the data stored in the second storage device, the more often the second storage device will replace the first storage device in data access, in order to improve data access efficiency.
[0050] Since direct data access in the buffer pool does not require migrating data from the storage device to the buffer pool, it offers higher data access efficiency. Therefore, the access frequency of data in the buffer pool should be higher than that of the first storage device. For example, the storage engine can migrate second data from the buffer pool to the first storage device; this second data is data evicted from the buffer pool. This application does not limit the data eviction algorithm for the buffer pool; that is, the second data can be data evicted from the buffer pool based on any eviction algorithm. Generally, the buffer pool evicts data with lower access frequency based on the data's access frequency.
[0051] The following is combined Figure 5 The process of data access implemented by the storage engine in the embodiments of this application will be described exemplarily.
[0052] See Figure 5S1, the data access interface in the storage engine can send an access request to the buffer pool, or in other words, the data access interface calls a function to request to read the target data in the buffer pool; if the target data exists in the buffer pool, execute S2, the buffer pool can return the target data to the data access interface, or in other words, the storage engine reads the target data from the buffer pool.
[0053] If the target data is not found in the buffer pool, execute S3. The storage engine can migrate the target data in the first storage device to the buffer pool, and then execute S2. If the target data is still not found in the first storage device, execute S4. The storage engine can migrate the target data in the second storage device to the buffer pool, and then execute S2.
[0054] See Figure 5 In S5, the storage engine can migrate evicted data from the buffer pool to the first storage device.
[0055] See Figure 5 In S6, the storage engine can flush the first dirty data page in the buffer pool to the second storage device to synchronize the data in the buffer pool with that data page in the second storage device. The first dirty data page refers to a data page cached in the buffer pool whose content differs from that data page stored in the second storage device, or a data page that has not yet been stored in the second storage device.
[0056] See Figure 5 In S7, the storage engine can flush the second dirty data page in the buffer pool to the first storage device to synchronize the data in the buffer pool with the data page in the first storage device. Here, "second dirty data" refers to data pages cached in the buffer pool whose content differs from that of the data page stored in the first storage device.
[0057] The first dirty data page and the second dirty data page mentioned above can be the same dirty data page, that is, the content of a data page in the buffer pool is different from the corresponding data page in the first storage device and the second storage device; or, the first dirty data page and the second dirty data page mentioned above can be different dirty data pages.
[0058] For example, after the storage engine evicts data from the buffer pool and migrates it to the first storage device, in response to a modification request, it migrates the data page containing that data from the first storage device to the buffer pool. The storage engine then modifies the data in the buffer pool, and the data page containing that data becomes a dirty data page. In this case, the storage engine can flush the data page from the buffer pool to both the first and second storage devices.
[0059] See Figure 5In S8, the first storage device can determine the data to be evicted based on any data eviction algorithm. Generally, the first storage device evicts data based on its access frequency to maintain the access frequency of the data in the first storage device. It should be noted that the data evicted by the first storage device is still stored in the second storage device.
[0060] When the storage engine receives a write request for the target data, the storage engine can write the target data to the buffer pool, and the buffer pool can flush the target data to the second storage device. In some embodiments, the storage engine can also flush the written target data to the first storage device.
[0061] In some embodiments, each data page stored in the first storage device corresponds to a data page control body, and all data pages in the first storage device correspond to an array of data page control bodies. Each data page control body includes the status and attribute information of the corresponding data page. The status of the data page includes usage status, idle status, corrupted status, etc.; the attribute information includes the checksum of the data page, the file identifier (ID) of the data file to which the data page belongs, the offset of the data page in the data file, and the relative position of the data page in the first storage device, etc.
[0062] Optionally, the correspondence between data pages and data page control bodies can be stored in a hash table. For example, the hash table may include the ID of each data page stored in the first storage device, and the data page control body corresponding to that data page ID.
[0063] In some embodiments, the access request may carry the ID of the data page, and the storage engine can read the target data based on the ID of the data page.
[0064] In some embodiments, when migrating the second data from the buffer pool to the first storage device, the storage engine can determine the occupancy rate of the data storage space in the first storage device. When the occupancy rate of the data storage space is greater than or equal to the occupancy rate threshold, the engine can determine the data pages that need to be evicted through data eviction, and then replace the data in the data pages with the second data.
[0065] For example, when the occupancy rate of the data storage space in the first storage device is greater than or equal to the occupancy rate threshold, the data storage space in the first storage device is insufficient, and the data in the first data page is deleted. The access identifier of the first data page is a first identifier, which indicates that the first data page has not been accessed within a preset time period.
[0066] For example, the data page control body includes an access identifier for the corresponding data page. When the access identifier is a first identifier (e.g., false), the data page is allowed to be deleted; when the access identifier is a second identifier (e.g., true), the data page is not allowed to be deleted. Optionally, after the storage engine responds to an access request and accesses data in a data page, it can set the access identifier of the data page to the second identifier, indicating that the data page was accessed within a preset time period.
[0067] The preset time period can be the time period between the data in the first data page stored in the first storage device that can be deleted and the data in the data page stored in the first storage device that was last deleted.
[0068] Optionally, a global pointer can be used to point to a data page control body in the data page control body array. When migrating the second data to the first storage device, if it is determined that the occupancy rate of the data storage space in the first storage device is greater than or equal to the occupancy rate threshold, it can be determined whether the access identifier of the data page in the data page control body pointed to by the pointer is the first identifier. If the access identifier in the data page control body pointed to by the pointer is the first identifier, the data in the data page (such as the first data page) corresponding to the data page control body is deleted, and the second data is stored in the first data page; if the access identifier in the data page control body pointed to by the pointer is the second identifier, the data in the data page control body is not deleted, and the access identifier in the data page control body is set to the first identifier.
[0069] During the above process, the storage engine traverses the access identifier of each data page stored in the first storage device until the access identifier of the data page is the first identifier, at which point the data in that data page is deleted.
[0070] In some embodiments, to improve the reliability of data access by the storage engine, the storage engine may perform data verification when writing or reading data from the first storage device.
[0071] For example, when the storage engine stores second data in the first storage device, it can generate a first checksum for the second data. This checksum might be generated based on the content of the data page to which the second data belongs. The engine then compares the first checksum with the second checksum of the second data with the second checksum of the second data to verify the second data. The second checksum can be a checksum generated when the second storage device stores the second data, and this second checksum can be stored in the header of the data page containing the second data. If the second data passes verification (e.g., the first checksum and the second checksum match), the second data is stored in the first storage device. If the second data fails verification (e.g., the first checksum and the second checksum do not match), it indicates that the second data is corrupted. In this case, the second data can be deleted from the buffer pool and / or the second storage device, or an attempt can be made to repair the second data.
[0072] Optionally, the first check value can be stored in the data page control body of the data page to which the second data belongs.
[0073] For example, when migrating target data from the first storage device to the buffer pool, the storage engine can generate a third checksum for the target data. This third checksum might be generated based on the content of the data page to which the target data belongs. The engine then compares the third checksum, the first checksum, and the second checksum of the target data to verify it. The first checksum is generated when the target data is stored in the first storage device, and the second checksum is generated when the target data is stored in the second storage device. If the target data verification passes, and the first, second, and third checksums are all consistent, the target data from the first storage device is migrated to the buffer pool. If the target data verification fails, and at least two of the first, second, and third checksums are inconsistent, it indicates that the target data is corrupted. In this case, the target data can be deleted from the first storage device, or an attempt can be made to repair it. After deleting or repairing the target data, the first storage device can synchronize the data page to which the target data belongs with the buffer pool and the second storage device.
[0074] In some embodiments, to improve the reliability of the storage engine, the storage engine can control access traffic to limit the upper limit of input / output operations per second (IOPS) of the first storage device. For example, the storage engine can determine the request traffic within the access time period of the access request, determine traffic control parameters based on the request traffic and a traffic threshold, and then perform traffic control based on the traffic control parameters.
[0075] The traffic control parameters may include the total allowed traffic and / or the traffic control ratio. The traffic control ratio can be the ratio between the total allowed traffic and the request traffic within the access period.
[0076] Optionally, the access time period can be of any length, such as 1 second, 1 microsecond, 0.5 seconds, etc., and this application does not limit it.
[0077] For example, when the request traffic during the access period is less than the first traffic threshold, the storage engine determines that the total traffic allowed to be accessed is equal to the request traffic during the access period, or in other words, the storage engine determines that the traffic control ratio is 100%.
[0078] For example, if the request traffic during the access period is greater than or equal to a first traffic threshold and less than a second traffic threshold, the total traffic of the access is determined to be equal to the first traffic threshold. In this case, the traffic control ratio is between 1% and 100%. The second traffic threshold is greater than the first traffic threshold.
[0079] For example, when the request traffic during the access period is greater than or equal to the second traffic threshold, the storage engine determines that the total allowed access traffic is the product of the request traffic and a preset ratio, or the storage engine determines the traffic control ratio to be a preset ratio. Optionally, the preset ratio could be, for example, 1%.
[0080] It should be noted that the terms "first" and "second" in this article are used to distinguish different user terminals and data, and do not represent a chronological order, nor do they limit "first" and "second" to different types.
[0081] Figure 6 This is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of this application. Figure 6 The illustrated electronic device 500 includes a processor 510, which can call and run computer programs from memory to implement the methods in the embodiments of this application.
[0082] Optionally, such as Figure 6 As shown, the electronic device 500 may further include a memory 530. The processor 510 can retrieve and run computer programs from the memory 530 to implement the methods described in the embodiments of this application.
[0083] The memory 530 can be a separate device independent of the processor 510, or it can be integrated into the processor 510.
[0084] Optionally, such as Figure 6 As shown, the electronic device 500 may also include a transceiver 520, which the processor 510 can control to interact with other devices. Specifically, it can send information or data to other devices or receive information or data sent by other devices.
[0085] Optionally, the electronic device 500 can implement the corresponding process of the storage engine or components (such as processing modules) in the storage engine or the device with the storage engine deployed in the various methods of the embodiments of this application. For the sake of brevity, it will not be described in detail here.
[0086] It should be understood that the processor in the embodiments of this application may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor described above can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0087] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0088] It should be understood that the above-described memory is exemplary and not a limiting description. For example, the memory in the embodiments of this application may also be static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DR RAM), etc. That is to say, the memory in the embodiments of this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0089] This application also provides a computer-readable storage medium for storing computer programs.
[0090] Optionally, the computer-readable storage medium can be applied to the electronic device in the embodiments of this application, and the computer program causes the computer to execute the corresponding processes in the various methods of the embodiments of this application. For the sake of brevity, it will not be described in detail here.
[0091] This application also provides a computer program product, including computer program instructions.
[0092] Optionally, the computer program product can be applied to the electronic device in the embodiments of this application, and the computer program instructions cause the computer to execute the corresponding processes in the various methods of the embodiments of this application. For the sake of brevity, they will not be described in detail here.
[0093] This application also provides a computer program.
[0094] Optionally, the computer program can be applied to the electronic device in the embodiments of this application. When the computer program is run on a computer, it causes the computer to execute the corresponding processes in the various methods of the embodiments of this application. For the sake of brevity, it will not be described in detail here.
[0095] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0096] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0097] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A data processing method, characterized in that, Applied to a storage engine, the storage engine including a buffer pool and storage devices, the storage devices including a first storage device and a second storage device, the data access speed of the first storage device being higher than the data access speed of the second storage device, the second storage device storing first data, the data stored in the first storage device including data in the first data whose access frequency is greater than or equal to a frequency threshold, the method includes: An access request to retrieve the target data; When the target data is not present in the buffer pool, the target data in the storage device is migrated to the buffer pool. Output the target data in the buffer pool; The step of migrating the target data from the storage device to the buffer pool includes: If the target data exists in the first storage device, the target data in the first storage device is migrated to the buffer pool; If the target data is not present in the first storage device, the target data in the second storage device is migrated to the buffer pool.
2. The method according to claim 1, characterized in that, The first storage device includes at least two sub-storage devices, and the at least two sub-storage devices have different data access speeds; The step of migrating the target data in the first storage device to the buffer pool includes: According to the order of data access speed from fastest to slowest of the at least two sub-storage devices, it is determined whether the target data exists in the sub-storage device in turn, until it is determined that the target data exists in the first sub-storage device, then the target data in the first sub-storage device is migrated to the buffer pool.
3. The method according to claim 1, characterized in that, The method further includes: The second data in the buffer pool is migrated to the first storage device, and the second data is the data that was evicted from the buffer pool.
4. The method according to claim 3, characterized in that, The step of migrating the second data in the buffer pool to the first storage device includes: If the occupancy rate of the data storage space in the first storage device is greater than or equal to the occupancy rate threshold, then the data in the first data page is deleted. The access identifier of the first data page is the first identifier, which indicates that the first data page has not been accessed within a preset time period. The second data is stored within the first data page.
5. The method according to claim 4, characterized in that, Deleting data within the first data page includes: The access identifier of each data page is traversed until the access identifier of the data page is the first identifier. Then, the data in the data page is deleted. The first identifier is used to indicate that the data page has not been accessed within a preset time period.
6. The method according to claim 4, characterized in that, Storing the second data in the first storage device includes: Generate the first verification value of the second data; The second data is verified by comparing the first verification value and the second verification value of the second data. The second verification value is the verification value generated when the second storage device stores the second data. When the second data passes verification, the second data is stored in the first storage device.
7. The method according to claim 1 or 2, characterized in that, Migrating the target data from the first storage device to the buffer pool includes: Generate a third verification value for the target data; The target data is verified by comparing the third verification value, the first verification value, and the second verification value of the target data. The first verification value is the verification value generated when the first storage device stores the target data, and the second verification value is the verification value generated when the second storage device stores the target data. When the target data passes verification, the target data in the first storage device is migrated to the buffer pool.
8. The method according to claim 1 or 2, characterized in that, After accessing the target data in the first storage device, the method further includes: In the first storage device, the access identifier of the data page to which the target data belongs is set as a second identifier, which is used to indicate that the data page to which the target data belongs is accessed within a preset time period.
9. The method according to claim 1 or 2, characterized in that, Prior to the access request to obtain the target data, the following are included: Determine the request traffic within the access time period to which the access request belongs; Based on the requested traffic and traffic threshold, determine the traffic control parameters; Flow control is performed based on the stated flow control parameters.
10. A storage engine, characterized in that, The storage engine includes a buffer pool and a storage device, comprising a first storage device and a second storage device. The first storage device has a higher data access speed than the second storage device. The second storage device stores first data. The data stored in the first storage device includes data from the first data whose access frequency is greater than or equal to a frequency threshold. The processing module in the storage engine is used for: An access request to retrieve the target data; When the target data is not present in the buffer pool, the target data in the storage device is migrated to the buffer pool. The step of migrating the target data from the storage device to the buffer pool includes: If the target data exists in the first storage device, the target data in the first storage device is migrated to the buffer pool; If the target data is not present in the first storage device, the target data in the second storage device is migrated to the buffer pool.
11. The storage engine according to claim 10, characterized in that, The data stored in the first storage device also includes the data evicted from the buffer pool.
12. An electronic device, characterized in that, include: At least one processor and memory; The memory stores computer-executed instructions; The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Buffer pool extension for database server
CN102782683A
Method and device for second-level cache of database and database storage system
CN103279562A
Storage space configuration method and device
CN104424119A
