Data storage method and device and computing equipment
By migrating cold data to cloud storage in the cloud database system and storing metadata locally, combined with access strategies for hot, cold, and warm data, the problem of high storage costs in the database system is solved and a balance between performance and cost is achieved.
Patent Information
- Application Number
- CN202310266217.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-16
- Publication Date
- 2024-09-27
AI Technical Summary
When existing database systems ensure high availability and reliability, storage costs are too high and computing resources are wasted. In particular, standby nodes are idle in most cases, and storage costs cannot be effectively saved.
By migrating cold data to cloud storage services in the cloud database system, and storing the metadata of cached cold data locally, using local storage to cache hot data and warm data, the access frequency and data volume of the data table are used to determine hot and cold data. , warm data, and implement corresponding storage strategies to reduce the use of high-performance storage.
Without affecting access performance, storage costs and overheads are reduced, computing resources are saved, the use of high-performance storage is reduced, and storage efficiency is improved.
Smart Images

Figure CN118708561A
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing, and more specifically, to a data storage method, apparatus, and computing device. Background Art
[0002] During the use of the database, a large amount of data is written and updated every day. However, usually only the data that is close in time, such as within a month or even a week, is frequently updated and accessed. This part of frequently accessed data is called hot data, and the data that is not frequently accessed is called cold data (such as historical orders of e-commerce, historical transaction records of banking systems, time series data, etc.). In the production environment, high-performance storage is usually used to meet the writing performance requirements, so the cost is relatively high. It is also stored in the high-performance storage medium of the production environment, resulting in excessively high storage costs.
[0003] In addition, in order to ensure high availability and high reliability, most database systems generally adopt a one-master-multiple-backup deployment mode (the master and backup nodes are generally isomorphic), with multiple consistent backups of data in multiple computing nodes to ensure that after the master node fails, the backup node can take over and restore the business, so the storage cost will be further increased. At the same time, one-master-multiple-backup will cause the backup node to be idle in most cases, resulting in a large waste of computing resources.
[0004] Therefore, how to save storage costs and overhead without affecting performance has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The present application provides a data storage method, apparatus, and computing device, which can save data storage costs without affecting performance.
[0006] In a first aspect, a method for data storage is provided, wherein a cloud database system comprises a database master node and one or more database slave nodes, a cloud computing platform deploys the cloud database system on cloud computing resources managed by the cloud computing platform, and the cloud computing platform deploys a cloud storage service on the cloud computing resources, the method comprising: a first node receives multiple access requests for accessing a database, the first node being a database master node or a database slave node of the cloud database system; in a process in which the first node processes the multiple access requests, hot data is cached in a local storage of the first node; in a process in which the first node processes the multiple access requests, cold data is migrated to the cloud storage service, and metadata of the cold data is cached in a local storage of the first node; wherein the hot data and the cold data are different data tables of the database, or the hot data and the cold data are different table partitions of the data table; wherein the hot data and the cold data are determined according to one or both of the number of times the table partition of the data table is accessed and the amount of data, or the hot data and the cold data are determined according to one or both of the number of times the data table is accessed and the amount of data.
[0007] In the above technical solution, hot data and cold data are determined according to one or both of the number of times the table partition of the data table is accessed and the amount of data, and the cold data is migrated to the cloud storage service, and the metadata of the cold data is cached in the local storage of the first node, and the metadata is used to access the cold data in the cloud storage service. In this way, the cost of data storage is saved by migrating the cold data to the cloud storage service, and the metadata of the cold data is cached in the local storage of the first node, so that even if the cold data is migrated to the cloud storage service, the first node can access the cold data in the cloud storage service through the metadata of the cold data cached in the local storage, without affecting the subsequent access performance.
[0008] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: in the process of the first node processing the multiple access requests, migrating the warm data to the cloud storage service, and caching the metadata of the warm data in the local storage of the first node; wherein the hot data, the warm data and the cold data are different data tables of the database, or the hot data, the warm data and the cold data are different table partitions of the data table; wherein the hot data, the warm data and the cold data are determined according to one or both of the number of times the table partition of the data table is accessed and the amount of data, or the hot data, the warm data and the cold data are determined according to one or both of the number of times the data table is accessed and the amount of data.
[0009] In combination with the first aspect, in certain implementations of the first aspect, the first node is a database master node of the cloud database system, and the method further includes: during the process of the first node processing the multiple access requests, migrating the warm data to the cloud storage service, and caching the warm data in the local storage of the first node, and one or more database slave nodes included in the cloud database system locally store metadata of the warm data.
[0010] In combination with the first aspect, in some implementations of the first aspect, the method further includes: the first node maintains a first table, and the first table is used to record storage conditions of the hot data, the cold data, and the warm data.
[0011] In combination with the first aspect, in certain implementations of the first aspect, the multiple access requests include a write request, and the write request includes data to be written. The method also includes: the first node performs a write operation on the cold data stored in the cloud storage service according to the write request, and caches the data to be written in the form of incremental data in the local storage of the first node.
[0012] In combination with the first aspect, in certain implementations of the first aspect, the multiple access requests include a write request, and the write request includes data to be written. The method also includes: the first node performs a write operation on the warm data stored in the cloud storage service according to the write request, and caches the data to be written in the form of incremental data in the local storage of the first node.
[0013] In combination with the first aspect, in certain implementations of the first aspect, the method also includes: the first node merges the incremental data in the local storage of the first node and the cold data or the warm data stored in the cloud storage service, and migrates the merged data to the cloud storage service.
[0014] In combination with the first aspect, in certain implementations of the first aspect, the first table is further used to record the existence of the incremental data.
[0015] In a second aspect, a data storage device is provided. The cloud database system includes a database master node and one or more database slave nodes. The cloud computing platform deploys the cloud database system on the cloud computing resources it manages. The cloud computing platform deploys cloud storage services on the cloud computing resources. The device is applied to a first node, which is a database master node or a database slave node of the cloud database system. The device includes: a receiving module, a caching module, and a migration module, wherein the receiving module is used to receive multiple access requests for accessing the database, and the first node is a database master node or a database slave node of the cloud database system; the caching module is used to In the process of processing the multiple access requests, the hot data is cached in the local storage of the first node; the migration module is used to migrate the cold data to the cloud storage service during the process of processing the multiple access requests, and cache the metadata of the cold data in the local storage of the first node; wherein the hot data and the cold data are different data tables of the database, or the hot data and the cold data are different table partitions of the data table; wherein the hot data and the cold data are determined according to one or both of the number of times the table partition of the data table is accessed and the amount of data, or the hot data and the cold data are determined according to one or both of the number of times the data table is accessed and the amount of data.
[0016] In combination with the second aspect, in certain implementations of the second aspect, the migration module is further used to migrate the warm data to the cloud storage service during processing the multiple access requests, and cache the metadata of the warm data in the local storage of the first node; wherein the hot data, the warm data and the cold data are different data tables of the database, or the hot data, the warm data and the cold data are different table partitions of the data table; wherein the hot data, the warm data and the cold data are determined according to one or both of the number of times the table partition of the data table is accessed and the amount of data, or the hot data, the warm data and the cold data are determined according to one or both of the number of times the data table is accessed and the amount of data.
[0017] In combination with the second aspect, in certain implementations of the second aspect, the first node is the database master node of the cloud database system, and the migration module is also used to migrate the warm data to the cloud storage service during the process of processing the multiple access requests, and cache the warm data in the local storage of the first node, and one or more database slave nodes included in the cloud database system locally store metadata of the warm data.
[0018] In combination with the second aspect, in some implementations of the second aspect, the device further includes: a maintenance module, used to maintain a first table, where the first table is used to record storage conditions of the hot data, the cold data, and the warm data.
[0019] In combination with the second aspect, in certain implementations of the second aspect, the multiple access requests include a write request, which includes data to be written. The cache module is also used to cache the data to be written in the form of incremental data in the local storage of the first node based on the write operation performed on the cold data stored in the cloud storage service.
[0020] In combination with the second aspect, in certain implementations of the second aspect, the multiple access requests include a write request, which includes data to be written. The cache module is also used to cache the data to be written in the form of incremental data in the local storage of the first node based on the write operation performed on the warm data stored in the cloud storage service.
[0021] In combination with the second aspect, in certain implementations of the second aspect, the device also includes: a merging module, used to merge the incremental data in the local storage of the first node and the cold data or the warm data stored in the cloud storage service; the migration module, also used to migrate the merged data to the cloud storage service.
[0022] In combination with the second aspect, in certain implementations of the second aspect, the first table is further used to record the existence of the incremental data.
[0023] In a third aspect, a computing device is provided, comprising a processor and a memory, and optionally, an input / output interface, wherein the processor is used to control the input / output interface to send and receive information, the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so as to execute the method in the first aspect or any possible implementation of the first aspect.
[0024] Optionally, the processor may be a general-purpose processor, which may be implemented by hardware or software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory, which may be integrated in the processor or located outside the processor and exist independently.
[0025] In a fourth aspect, a computing device cluster is provided, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method in the first aspect or any possible implementation of the first aspect.
[0026] In a fifth aspect, a chip is provided, which obtains instructions and executes the instructions to implement the method in the above-mentioned first aspect and any implementation manner of the first aspect.
[0027] Optionally, as an implementation method, the chip includes a processor and a data interface, and the processor reads instructions stored in the memory through the data interface to execute the method in the above-mentioned first aspect and any implementation method of the first aspect, or executes the method in the second aspect or any possible implementation method of the second aspect.
[0028] Optionally, as an implementation method, the chip may also include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the method in the first aspect and any one of the implementation methods of the first aspect, or execute the method in the second aspect or any one of the possible implementation methods of the second aspect.
[0029] In a sixth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device, the computing device executes the method in the first aspect and any one of the implementations of the first aspect.
[0030] In a seventh aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device cluster, the computing device cluster executes the method in the first aspect and any one of the implementations of the first aspect.
[0031] In an eighth aspect, a computer-readable storage medium is provided, characterized in that it includes computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the method in the above-mentioned first aspect and any one of the implementations of the first aspect.
[0032] By way of example, these computer-readable storages include, but are not limited to, one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), Flash memory, electrically EPROM (EEPROM), and hard drive.
[0033] Optionally, as an implementation manner, the above-mentioned storage medium may specifically be a non-volatile storage medium.
[0034] In a ninth aspect, a computer-readable storage medium is provided, characterized in that it includes computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method in the above-mentioned first aspect and any one of the implementations of the first aspect.
[0035] By way of example, these computer-readable storages include, but are not limited to, one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), Flash memory, electrically EPROM (EEPROM), and hard drive.
[0036] Optionally, as an implementation manner, the above-mentioned storage medium may specifically be a non-volatile storage medium. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a schematic block diagram of a cloud scenario applicable to an embodiment of the present application.
[0038] Figure 2 It is a schematic flowchart of a data storage method provided in an embodiment of the present application.
[0039] Figure 3 This is a schematic diagram of dividing cold data, warm data, and hot data in a database provided by an embodiment of the present application.
[0040] Figure 4 It is a schematic block diagram of a storage situation before data migration in a database system provided in an embodiment of the present application.
[0041] Figure 5 It is a schematic block diagram of data storage after data migration according to a migration strategy provided in an embodiment of the present application.
[0042] Figure 6 This is another schematic block diagram of data storage after data migration according to a migration strategy provided in an embodiment of the present application.
[0043] Figure 7 It is a schematic diagram of a read-write conflict processing logic provided in an embodiment of the present application.
[0044] Figure 8 It is a schematic block diagram of a data storage device 800 provided in an embodiment of the present application.
[0045] Fig. 9 It is a schematic diagram of the architecture of a computing device 1500 provided in an embodiment of the present application.
[0046] Fig.10 It is a schematic diagram of the architecture of a computing device cluster provided in an embodiment of the present application.
[0047] Fig.11It is a schematic diagram of the connection between computing devices 1500A and 1500B via a network provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0049] The present application will present various aspects, embodiments or features around a system including multiple devices, components, modules, etc. It should be understood and appreciated that each system may include additional devices, components, modules, etc., and / or may not include all devices, components, modules, etc. discussed in conjunction with the figures. In addition, combinations of these schemes may also be used.
[0050] In addition, in the embodiments of the present application, words such as "exemplary" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present concepts in a concrete way.
[0051] In the embodiments of the present application, "corresponding (corresponding, relevant)" and "corresponding (corresponding)" can sometimes be used interchangeably. It should be pointed out that when the distinction between them is not emphasized, the meanings they intend to express are consistent.
[0052] The business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. A person of ordinary skill in the art can appreciate that, with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0053] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0054] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: including the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0055] During the use of the database, a large amount of data is written and updated every day. However, usually only the data that is close in time, such as within a month or even a week, is frequently updated and accessed. This part of frequently accessed data is called hot data, and the data that is not frequently accessed is called cold data (such as historical orders of e-commerce, historical transaction records of banking systems, time series data, etc.). In the production environment, high-performance storage is usually used to meet the writing performance requirements, so the cost is relatively high. It is also stored in the high-performance storage medium of the production environment, resulting in excessively high storage costs.
[0056] In addition, in order to ensure high availability and high reliability, most database systems generally adopt a one-master-multiple-backup deployment mode (the master and backup nodes are generally isomorphic), with multiple consistent backups of data in multiple computing nodes to ensure that after the master node fails, the backup node can take over and restore the business, so the storage cost will be further increased. At the same time, one-master-multiple-backup will cause the backup node to be idle in most cases, resulting in a large waste of computing resources.
[0057] Therefore, in order to achieve high availability and high reliability, current database systems, both online and offline, have increased operating costs to a certain extent.
[0058] In view of this, an embodiment of the present application provides a method for data storage, which can save storage costs and expenses without affecting performance.
[0059] In a possible implementation, the data storage method provided in the embodiment of the present application can be applied to a cloud service scenario, and the data storage method is executed by a cloud management platform in the cloud service scenario. As an example, a cloud database system includes a database master node and one or more database slave nodes, and a cloud computing platform deploys the cloud database system on the cloud computing resources it manages, and the cloud computing platform deploys cloud storage services on the cloud computing resources.
[0060] For the convenience of description, the following Figure 1 , describe the cloud service scenarios in detail.
[0061] Figure 1 is a schematic block diagram of a cloud scenario applicable to an embodiment of the present application. Figure 1 As shown, the cloud scenario may include: a cloud management platform 110 , the Internet 120 , and a client 130 .
[0062] like Figure 1 As shown, the cloud management platform 110 is used to manage the infrastructure that provides multiple cloud services. The infrastructure includes multiple cloud data centers, each of which includes multiple servers, each of which includes cloud service resources to provide corresponding cloud services for tenants.
[0063] The cloud management platform 110 may be located in a cloud data center, which may provide an access interface (such as an interface or an application program interface (API)). The tenant may operate the client 130 to remotely access the access interface to register a cloud account and password on the cloud management platform 110, and log in to the cloud management platform 110. After the cloud management platform 110 successfully authenticates the cloud account and password, the tenant may further pay to select and purchase a virtual machine of specific specifications (processor, memory, disk) on the cloud management platform 110. After the paid purchase is successful, the cloud management platform 110 provides the remote login account and password of the purchased virtual machine, and the client 130 may remotely log in to the virtual machine, install and run the tenant's application in the virtual machine. Therefore, the tenant may create, manage, log in and operate a virtual machine in the cloud data center through the cloud management platform 110. Among them, the virtual machine may also be called a cloud server (elastic compute service, ECS) or an elastic instance (different cloud service providers have different names).
[0064] It should be understood that tenants of cloud services can be individuals, enterprises, schools, hospitals, administrative agencies, etc.
[0065] The functions of the cloud management platform 110 include, but are not limited to, user console, computing management service, network management service, storage management service, authentication service, and image management service. The user console provides an interface or API to interact with tenants, the computing management service is used to manage servers running virtual machines and containers and bare metal servers, the network management service is used to manage network services (such as gateways, firewalls, etc.), the storage management service is used to manage storage services (such as data bucket services), the authentication service is used to manage tenant accounts and passwords, and the image management service is used to manage virtual machine images. Tenants can use the client 130 to log in to the cloud management platform 110 through the Internet 120 to manage the rented cloud services.
[0066] Figure 2 is a schematic flow chart of a data storage method provided by an embodiment of the present application. Figure 2 As shown, the method may include steps 210-230, and steps 210-230 are described in detail below.
[0067] Step 210: The first node receives a plurality of access requests for accessing a database.
[0068] As an example, the first node may be a database master node or a database slave node of a cloud database system, which is not limited in the embodiments of the present application. The first node receives multiple access requests for accessing a database.
[0069] Step 220: When the first node processes multiple access requests, hot data is cached in the local storage of the first node.
[0070] As an example, the hot data may be different data tables of the above database, or may also be table partitions of different data tables in the above database, which is not specifically limited in the embodiments of the present application.
[0071] As an example, the hot data may be determined according to one or both of the number of times a table partition of a data table is accessed and the amount of data, or the hot data may be determined according to one or both of the number of times a data table is accessed and the amount of data, which is not specifically limited in the present embodiment. Figure 3 The example in describes in detail how to determine hot data based on the number of times a data table or a table partition of a data table is accessed and the amount of data, which will not be described in detail here.
[0072] For example, in an embodiment of the present application, a TieredMeta component can be added to the database system, and the TieredMeta component is used to count the number of accesses to data in the database and / or the amount of data accesses within a statistical period.
[0073] It should be understood that the above-mentioned TieredMeta component can be deployed in any node or process that can obtain the execution status of the database and the transaction execution status, or it can also be deployed independently as a proxy to achieve periodic table-level access statistics and transaction execution statistics, etc. The embodiments of the present application do not make specific limitations on this.
[0074] In an embodiment of the present application, for hot data, since hot data is frequently accessed online data, it has high requirements for storage performance and high requirements for data access. Therefore, the first node can cache the hot data in the local storage of the first node to ensure access requirements.
[0075] As an example, the local storage of the first node may include but is not limited to: a solid state drive (SSD), a high-performance cloud disk, a power-saving memory, and a non-volatile memory express (NVME), which is not specifically limited in this embodiment.
[0076] Step 230: When the first node processes multiple access requests, the cold data is migrated to the cloud storage service, and metadata of the cold data is cached in the local storage of the first node.
[0077] As an example, the cold data may be different data tables of the above database, or may be table partitions of different data tables in the above database, which is not specifically limited in the embodiments of the present application.
[0078] As an example, the cold data may be determined based on one or both of the number of times a table partition of a data table is accessed and the amount of data, or may be determined based on one or both of the number of times a data table is accessed and the amount of data, which is not specifically limited in the present embodiment. Figure 3 The example in describes in detail how to determine cold data based on the number of times a data table or a table partition of a data table is accessed and the amount of data. This is not described in detail here.
[0079] In the embodiment of the present application, for cold data, since cold data refers to offline data that is not frequently accessed, such as backup and archive data, it has low requirements for storage performance and data access. Therefore, the first node can migrate the cold data to the cloud storage service, and cache the metadata of the cold data in the local storage of the first node, which can save storage costs. Moreover, even if the cold data is migrated to the cloud storage service, the first node can access the cold data in the cloud storage service through the metadata of the cold data cached in the local storage, without affecting the subsequent access performance.
[0080] In a possible implementation, the metadata of the cold data stored in the local storage cache of the first node may include, but is not limited to, address and size of the cold data stored in the cloud storage service.
[0081] In the above technical solution, hot data and cold data are determined according to one or both of the number of times the table partition of the data table is accessed and the amount of data, and the cold data is migrated to the cloud storage service, and the metadata of the cold data is cached in the local storage of the first node, and the metadata is used to access the cold data in the cloud storage service. In this way, since the cost of local storage of the database node is high, the cost of data storage is saved by migrating the cold data to the cloud storage service, and the metadata of the cold data is cached in the local storage of the first node, so that even if the cold data is migrated to the cloud storage service, the first node can access the cold data in the cloud storage service through the metadata of the cold data cached in the local storage, without affecting the subsequent access performance.
[0082] Optionally, in some embodiments, the method further includes: during the process of the first node processing the multiple access requests, migrating the warm data to the cloud storage service, and caching metadata of the warm data in the local storage of the first node.
[0083] As an example, the hot data, the warm data, and the cold data are different data tables of the database, or the hot data, the warm data, and the cold data are different table partitions of the data table.
[0084] As an example, the hot data, the warm data, and the cold data are determined according to one or both of the number of times a table partition of a data table is accessed and the amount of data, or the hot data, the warm data, and the cold data are determined according to one or both of the number of times the data table is accessed and the amount of data, and the embodiments of the present application do not specifically limit this.
[0085] In the embodiment of the present application, for warm data, since the probability of warm data being accessed is still lower than that of hot data, the warm data can also be migrated to the cloud storage service, and the metadata of the warm data can be cached in the local storage of the first node, which can save storage costs. Moreover, even if the warm data is migrated to the cloud storage service, the first node can access the warm data in the cloud storage service through the metadata of the warm data cached in the local storage, which does not affect the subsequent access performance.
[0086] Optionally, in some embodiments, if the first node is the database master node of the cloud database system, the cloud database system also includes one or more database slave nodes. In the embodiment of the present application, in the process of the first node processing the multiple access requests, the warm data can be migrated to the cloud storage service, and the warm data can be cached in the local storage of the first node, and the metadata of the warm data can be stored locally in one or more database slave nodes included in the cloud database system, or, one or more database slave nodes can store the warm data locally in part of the slave nodes, and the metadata of the warm data can be stored locally in another part of the slave nodes. In this way, since the access volume of warm data is still relatively large compared to cold data, on the one hand, caching the warm data in the local storage of the database master node can ensure the write performance of the database master node, and on the other hand, since the cost of local storage of the database node is high, the storage cost can be further reduced by reducing the number of copies of warm data in the slave nodes of the database.
[0087] As an example, a method provided by an embodiment of the present application is listed below for determining cold data, warm data, or hot data according to one or both of the number of times a data table or a table partition of a data table is accessed and the amount of data.
[0088] For example, Figure 3 As shown, (warm_min, warm_max) is the interval of the number of accesses and / or the amount of data accesses to warm data, wherein warm_min is the minimum number of accesses and / or the amount of data accesses to warm data, and warm_max is the maximum number of accesses and / or the amount of data accesses to warm data.
[0089] Cold data: If the number of accesses and / or the amount of accesses to data in a database during a period is lower than warm_min, the data in the database can be defined as cold data.
[0090] Warm data: If the access count and / or access volume of a data in a database during a period is higher than warm_min but lower than warm_max, the data in the database can be defined as warm data.
[0091] Hot data: If the number of accesses and / or the amount of accesses to a piece of data in a database during a period is higher than warm_max, the data in the database can be defined as hot data.
[0092] Figure 4 It is a schematic block diagram of a storage situation before data migration in a database system provided in an embodiment of the present application.
[0093] It should be understood that the embodiment of the present application does not specifically limit the number of nodes of the database system, and may include only a master node, or may include a master node and at least one standby node. Figure 4 The example below takes 1 master node and 3 backup nodes as an example.
[0094] like Figure 4 As shown, the database system includes a master node (node 1) and three standby nodes (also called slave nodes, namely node 2, node 3, and node 4). Table 1, Table 2, Table 3, and Table 4 are data tables stored in the database. Before data migration, Table 1, Table 2, Table 3, and Table 4 are stored in the local storage of the master node (node 1), and the data is synchronized to the three standby nodes (node 2, node 3, and node 4) through asynchronous remote replication or other means. That is, Table 1, Table 2, Table 3, and Table 4 are stored in the local storage of nodes 1 to 4, respectively.
[0095] Since the local storage cost of nodes 1 to 4 is relatively high, it is possible to determine which data in Tables 1 to 4 are cold data, warm data, and hot data based on the number of times Tables 1, 2, 3, and 4 are accessed during the statistical period and / or the amount of data accessed, and migrate the data to a storage device with lower storage cost (for example, a cloud storage service) for storage according to the corresponding migration strategy, thereby saving the cost and overhead of data storage.
[0096] As an example, the embodiment of the present application is based on the time window. Figure 4 The table-level data access times and / or access amounts of Table 1 to Table 4 stored in the database system are counted. In a possible implementation, Figure 3 For example, if the number of accesses and / or the amount of accesses to Table1 is higher than warm_max, then Table1 is hot data. If the number of accesses and / or the amount of accesses to Table2 to Table3 is higher than warm_min but lower than warm_max, then Table2 to Table3 are warm data. If the number of accesses and / or the amount of accesses to Table4 is lower than warm_min, then Table4 is cold data.
[0097] Combine the following Figure 5-Figure 6 , taking Table 1 as hot data, Table 2 to Table 3 as warm data, and Table 4 as cold data as an example, the data storage after data migration according to the migration strategy provided in the embodiment of the present application is described in detail. It should be understood that Figure 5-Figure 6The examples are only intended to help those skilled in the art understand the embodiments of the present application, and are not intended to limit the embodiments of the present application to Figure 5-Figure 6 The specific numerical values or specific scenarios shown in the examples. Figure 5-Figure 6 The examples given below are obviously susceptible to various equivalent modifications or changes, and such modifications and changes also fall within the scope of the embodiments of the present application.
[0098] Figure 5 It is a schematic block diagram of data storage after data migration according to a migration strategy provided in an embodiment of the present application.
[0099] Taking examples as an example, a possible migration strategy corresponding to cold data, warm data, and hot data is described in detail below.
[0100] 1. Migration strategy for hot data (Strategy 1)
[0101] The migration strategy for hot data is not to migrate the hot data, and the hot data is still persisted in the local storage (first storage), that is, the hot data is not migrated to the second storage (corresponding to the cloud storage service mentioned above, also called cold storage) for storage.
[0102] As an example, see Figure 5 Since Table 1 is hot data, the data entities of Table 1 are stored in the local storage (in the first storage) of nodes 1 to 4, while the data entities of Table 1 are not stored in the second storage (cold storage).
[0103] 2. Migration strategy for cold data (Strategy 2)
[0104] For cold data, the cold data can be migrated to the second storage (cold storage) for storage, and only the metadata corresponding to the cold data is retained in the local storage, and the metadata points to the cold data stored in the cold storage. The metadata can also be called the pointing information of the cold data stored in the cold storage, and the pointing information can include, but is not limited to: the size, address and other pointing information of the cold data stored in the cold storage. This ensures that when a business is connected to the node, normal read access capabilities can still be provided, or when other nodes fail, the node can participate in the election normally to ensure that the corresponding business is taken over.
[0105] As an example, see Figure 5Since Table4 is cold data, Table4 is migrated to the second storage (cold storage) for storage, and only the metadata of Table4 is stored in the local storage (first storage) of nodes 1 to 4. This allows any node from node 1 to node 4 to read and access the stored Table4 from the second storage (cold storage) based on the metadata of Table4 stored locally.
[0106] 3. Migration strategy for warm data (strategy 3)
[0107] For warm data, all warm data can be migrated to the second memory (cold storage) for storage in the same way as cold data. Since the access frequency or access volume of warm data is relatively large, the data entity storing warm data in the master node 1 and the data stored in the local storage (in the first memory) of the three standby nodes (node 2, node 3, and node 4) can be determined according to the following different implementation methods.
[0108] In a possible implementation, according to the hot data processing method, the local storage (in the first memory) of the three standby nodes (node 2, node 3, and node 4) can store the data entity of the warm data.
[0109] In another possible implementation, according to the cold data processing method, the metadata of the warm data can be stored in the local storage (in the first memory) of the three standby nodes (node 2, node 3, and node 4), and the metadata points to the warm data stored in the cold storage.
[0110] In another possible implementation, the hotter the warm data, the more copies of the data the standby node retains. As the hotness of the warm data decreases, the number of copies is gradually reduced according to certain rules, thereby achieving the purpose of reducing costs.
[0111] As an example, see Figure 5, since Table2~Table3 are warm data, Table2~Table3 are migrated to the second storage (cold storage) for storage, and the data entities of Table2~Table3 are stored in the local storage (first storage) of node 1. According to the above implementation method, the number of copies of Table2~Table3 in the standby node is reduced from the original three to one, that is, only one standby node (for example, node 2) stores the data entities of Table2~Table3 in the local storage, and the metadata of Table2~Table3 is stored in the local storage of the remaining standby nodes (for example, node 3 and node 4), and the metadata points to Table2~Table3 stored in the second storage (cold storage), so that any node in the remaining standby nodes can read and access the stored Table2~Table3 from the second storage (cold storage) according to the metadata of Table2~Table3 stored locally. For example, the local storage (first storage) stored in node 3 stores the data entities of Table2~Table3, and the local storage (first storage) of nodes 2 to 4 stores the metadata of Table2~Table3.
[0112] It should be noted that the number of replicas of Table2 and Table3 on the standby node may be the same or different, and this embodiment of the present application does not specifically limit this.
[0113] Figure 6 This is another schematic block diagram of data storage after data migration according to a migration strategy provided in an embodiment of the present application.
[0114] For example, in the embodiment of the present application, for any of cold data, warm data or hot data, the data entity can be regularly migrated to the second storage (cold storage) for storage, and the metadata of the data is stored in the local storage (first storage) of nodes 1 to 4. In this way, the storage cost can be minimized.
[0115] See also Figure 6 , all Table1 to Table4 are migrated from the local storage (first storage) of nodes 1 to 4 to the second storage (cold storage) for storage. The local storage (first storage) of nodes 1 to 4 stores the metadata of Table1 to Table4, and the metadata of Table1 to Table4 points to the data entities of Table1 to Table4 stored in the cold storage.
[0116] Optionally, in some embodiments, the resource load of each node in the cluster may be collected periodically so that when data is migrated, the nodes with lighter loads are preferentially migrated, thereby achieving load balancing. As an example, the resource load of the node may include, but is not limited to: the node's memory load, central processing unit (CPU) load, network load, etc.
[0117] Optionally, in some embodiments, data entities may be preferentially retained on nodes with lighter loads to achieve load balancing.
[0118] In the embodiment of the present application, after the data is migrated according to the above migration strategy, the current storage distribution of each data can also be recorded. Figure 5 For example, the table map shown in Table 1 shows the distribution of Table 1 to Table 4 on all nodes in the cluster, that is, how many and which nodes hold the data of Table 1 to Table 4.
[0119] Refer to Table 1, db_name indicates the database name, Table_name indicates the table name, node_count indicates the number of nodes holding the data, node_x indicates the node identifier holding the data, and deltatbl indicates incremental data. If node_count is 0, it means that the data is stored in cold storage and can be accessed by any node; otherwise, if node_count is not 0, node_count indicates the number of nodes holding the data stored after this record. For example, Table1 stores data entities locally (first storage device) in nodes 2, 3, and 4, so the value of node_count corresponding to Table1 is 3. Table2 to Table3 store data entities only locally (first storage device) in node 3, so the value of node_count corresponding to Table2 to Table3 is 1, and the node holding the data is node 3. Table4 is only stored in cold storage, and no data entities are stored locally (first storage device) in nodes 1 to 4, so the value of node_count corresponding to Table4 is 0.
[0120] Table 1 table map
[0121] db_name Table_name node_count db1 Table 1 3 Node 2 Node 3 Node 4 db1 Table 2 1 Node 3 deltatbl db1 Table 3 1 Node 3 deltatbl db1 Table 4 0 deltatbl
[0122] It should be understood that after the data is migrated to cold storage, most cold storage only supports append writes. In order to continue to provide write services, when write operations such as insert, update, and delete occur on cold data (table or partition), they can be recorded locally in the form of incremental data. The deltatbl in Table 1 indicates that Table2 to Table4 have incremental data.
[0123] It should be noted that the deltatbl in the above table stores the table name of the incremental data, or the log file, or the file path, or related information of other types of files, and the embodiment of the present application does not make specific limitations on this.
[0124] In the embodiment of the present application, the newly written data generated after the migration is organized in the form of incremental data, and its organizational form may include but is not limited to: sub-tables, logs, other open source persistent structures and other formats. Its main purpose is to solve the problem that after the data is migrated to cold storage, the modification and write operation cannot be supported, so by recording incremental data, continuous writing capability is provided.
[0125] Optionally, when accessing data stored in cold storage, it may involve querying the data stored in cold storage and local incremental data at the same time. Therefore, when generating a query plan, if it is found that there is corresponding incremental data in the table in TableMap, the generated query plan needs to scan the incremental data together and merge it with the data stored in cold storage. And there may be duplicate data between the incremental data and the data in cold storage, but the incremental data must be the latest data, so the query result only needs to retain the records in the incremental data. In addition, if only the most recently generated or modified data is accessed, there will be no performance loss because it is saved in the local incremental data, because the performance loss is mainly generated when accessing historical data to ensure that the full amount of historical data is read.
[0126] Optionally, in some embodiments, after running for a long enough time, local incremental data may accumulate a lot. In order to prevent a large amount of incremental data from occupying the local storage resources of the node, for example, Figure 6 In the process, since hot data is saved in cold storage, there are a lot of write accesses to hot data, which will generate a lot of incremental data in the local storage of the node. In view of this situation, the embodiment of the present application can also merge the incremental data with the corresponding data on the cold storage regularly or when the system is idle, so as to achieve the purpose of reducing the incremental data in the local storage.
[0127] The embodiments of the present application do not specifically limit the above-mentioned merging method. In one example, the data corresponding to the incremental data can be read from the cold storage, and the data can be merged with the incremental data before being stored in the cold storage. In another example, the incremental data can be directly stored in the cold storage, and the incremental data and the data corresponding to the incremental data can be merged in the cold storage.
[0128] It should be understood that the above-mentioned merging operation can be automatically performed when the system is idle, or can be performed manually when there is no business, and this application does not limit this.
[0129] In the embodiment of the present application, since only the master node is writable, after the master node transaction is submitted, the data needs to be synchronized to the standby machine through asynchronous remote replication or other means. Asynchronous remote replication will cause the consistency between nodes to be unable to be guaranteed in real time. Therefore, the purpose here is to record the currently submitted transaction, or the transaction information submitted that has started to be copied but not copied to all nodes, as a basis for judging visibility, to ensure the isolation level of the transaction. Therefore, the embodiment of the present application also adds a distributed global active transaction record, which saves transactions that are currently unsubmitted or have been submitted but have not yet been copied to all copies through the consensus protocol. When the node receiving the read request conflicts with the transaction in the global active transaction record, the request is forwarded to the master node for execution. Thus, it can be ensured that the read / write transaction isolation level of each node is not affected.
[0130] As an example, the above TieredMeta component can also be responsible for recording transaction information that is currently uncommitted or committed but has not yet reached consistency among all nodes. For example, Writing_Tables in Table 2 records an example that has been written or is being written, but has not yet been copied to all replicas recorded in TableMap and completed the playback of the table or partition. Because only the primary node can perform write operations, the backup node can only specify read-related operations. Therefore, writing_tables only needs to be collected on the primary node.
[0131] Table 2 writing_tables
[0132] txn1 tbl 1 running txn2 tbl 2 committing txn3 tbl 3 replication
[0133] Take transaction 1 (txn1) in Table 2 as an example. When transaction 1 (txn1) writes table 1, the corresponding record is inserted into the writing tables, and the initial state is running. When transaction txn1 is committed, it enters the replication state. When all nodes holding the table have completed replication and playback is successful, it is set to the committed state and the record is deleted.
[0134] Optionally, in some embodiments, the embodiments of the present application may also implement the read-write conflict processing logic through the above-mentioned writing_tables, thereby ensuring the isolation level of each transaction when multiple transactions are executed concurrently.
[0135] For example, Figure 7 The figure shows a logic for handling read-write conflicts. txn B is a write transaction executed on the master node, and the running marked under txn B is the running status of txn B. txn A, txn C, and txn D are three concurrently executed read transactions. Among them, txn A is a read transaction started later than txn B, txn C is a read transaction started earlier than txn B, and txn D is a read transaction started after txn B is committed and remote replication begins. The conflict handling logic of concurrent read transactions in the corresponding interval of each transaction line is marked on the dotted interval on each transaction line, that is, within the transaction status interval of txn B, the handling method of read transactions started at different times is: whether to read on any standby node or go to the master node for reading.
[0136] Combination of the above Figures 1 to 7 , describes in detail the method provided by the embodiment of the present application, and will be combined with Figure 8-Figure 11 , describes in detail the embodiment of the device of the present application. It should be understood that the description of the method embodiment corresponds to the description of the device embodiment, so the parts not described in detail can refer to the previous method embodiment.
[0137] Figure 8It is a schematic block diagram of a data storage device 800 provided in an embodiment of the present application. The device 800 can be implemented by software, hardware, or a combination of the two. The device 800 provided in an embodiment of the present application can implement the method flow shown in the embodiment of the present application, and the device 800 can be applied to a first node, which is a database master node or a database slave node of the cloud database system. The cloud computing platform deploys the cloud database system in the cloud computing resources it manages. The cloud database system includes a database master node and one or more database slave nodes, and the cloud computing platform deploys a cloud storage service on the cloud computing resources. The device 800 includes: a receiving module 810, a caching module 820, and a migration module 830, wherein the receiving module 810 is used to receive multiple access requests for accessing a database, and the first node is a database master node or a database slave node of the cloud database system; the caching module 820 is used to cache hot data in the local storage of the first node during processing of the multiple access requests; the migration module 830 is used to migrate cold data to the cloud storage service during processing of the multiple access requests, and cache metadata of the cold data in the local storage of the first node; wherein the hot data and the cold data are different data tables of the database, or the hot data and the cold data are different table partitions of the data table; wherein the hot data and the cold data are determined according to one or both of the number of times the table partition of the data table is accessed and the amount of data, or the hot data and the cold data are determined according to one or both of the number of times the data table is accessed and the amount of data.
[0138] Optionally, the migration module 830 is also used to migrate the warm data to the cloud storage service during processing the multiple access requests, and cache the metadata of the warm data in the local storage of the first node; wherein the hot data, the warm data and the cold data are different data tables of the database, or the hot data, the warm data and the cold data are different table partitions of the data table; wherein the hot data, the warm data and the cold data are determined according to one or both of the number of times the table partition of the data table is accessed and the amount of data, or the hot data, the warm data and the cold data are determined according to one or both of the number of times the data table is accessed and the amount of data.
[0139] Optionally, the first node is the database master node of the cloud database system, and the migration module 830 is also used to migrate the warm data to the cloud storage service during the process of processing the multiple access requests, and cache the warm data in the local storage of the first node, and the metadata of the warm data is stored locally in one or more database slave nodes included in the cloud database system.
[0140] Optionally, the device 800 further includes: a maintenance module, used for maintaining a first table, where the first table is used for recording storage conditions of the hot data, the cold data, and the warm data.
[0141] Optionally, the multiple access requests include a write request, which includes data to be written. The cache module is also used to perform a write operation on the cold data stored in the cloud storage service according to the write request, and cache the data to be written in the form of incremental data in the local storage of the first node.
[0142] Optionally, the multiple access requests include a write request, which includes data to be written. The cache module 820 is also used to perform a write operation on the warm data stored in the cloud storage service according to the write request, and cache the data to be written in the form of incremental data in the local storage of the first node.
[0143] Optionally, the device 800 also includes: a merging module, used to merge the incremental data in the local storage of the first node and the cold data or the warm data stored in the cloud storage service; the migration module is also used to migrate the merged data to the cloud storage service.
[0144] Optionally, the first table is also used to record the existence of the incremental data.
[0145] The device 800 here can be embodied in the form of a functional module. The term "module" here can be implemented in the form of software and / or hardware, and is not specifically limited to this.
[0146] For example, a "module" may be a software program, a hardware circuit, or a combination of the two that implements the above functions. Exemplarily, the implementation of the receiving module 810 is described below by taking the receiving module 810 as an example. Similarly, the implementation of other modules, such as the cache module 820 and the migration module 830, may refer to the implementation of the receiving module 810.
[0147] The receiving module 810 is taken as an example of a software functional unit, and the receiving module 810 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the receiving module 810 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with similar geographical locations. Among them, usually a region may include multiple AZs.
[0148] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0149] The receiving module 810 is taken as an example of a hardware functional unit, and the receiving module 810 may include at least one computing device, such as a server, etc. Alternatively, the receiving module 810 may also be a device implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), etc. The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0150] The multiple computing devices included in the receiving module 810 can be distributed in the same region or in different regions. The multiple computing devices included in the receiving module 810 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the receiving module 810 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0151] Therefore, the modules of each example described in the embodiments of the present application can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0152] It should be noted that: when the device provided in the above embodiment executes the above method, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. For example, the receiving module 810 can be used to execute any step in the above method, the cache module 820 can be used to execute any step in the above method, and the migration module 830 can be used to execute any step in the above method. The steps that the receiving module 810, the cache module 820, and the migration module 830 are responsible for implementing can be specified as needed, and the full functions of the above device are realized by respectively implementing different steps in the above method through the receiving module 810, the cache module 820, and the migration module 830.
[0153] In addition, the device and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation processes are detailed in the method embodiments above, which will not be repeated here.
[0154] The method provided in the embodiment of the present application can be performed by a computing device, which can also be referred to as a computer system. It includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes hardware such as a processing unit, a memory and a memory control unit, and then the function and structure of the hardware are described in detail. The operating system is any one or more computer operating systems that implement business processing through a process, for example, a Linux operating system, a Unix operating system, an Android operating system, an iOS operating system, or a windows operating system. The application layer includes applications such as a browser, an address book, a word processing software, and an instant messaging software. In addition, optionally, the computer system is a handheld device such as a smart phone, or a terminal device such as a personal computer, and the present application is not particularly limited, as long as the method provided by the embodiment of the present application can be used. The execution subject of the method provided in the embodiment of the present application can be a computing device, or a functional module in a computing device that can call a program and execute a program.
[0155] Combine the following Fig. 9 , a computing device provided in an embodiment of the present application is described in detail.
[0156] Fig. 9 1 is a schematic diagram of the architecture of a computing device 1500 provided in an embodiment of the present application. The computing device 1500 may be a server or a computer or other device with computing capabilities. Fig. 9 The computing device 1500 shown includes at least one processor 1510 and a memory 1520 .
[0157] It should be understood that the present application does not limit the number of processors and memories in the computing device 1500 .
[0158] The processor 1510 executes the instructions in the memory 1520, so that the computing device 1500 implements the method provided by the present application. Alternatively, the processor 1510 executes the instructions in the memory 1520, so that the computing device 1500 implements the functional modules provided by the present application, thereby implementing the method provided by the present application.
[0159] Optionally, the computing device 1500 further includes a communication interface 1530. The communication interface 1530 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1500 and other devices or a communication network.
[0160] Optionally, the computing device 1500 further includes a system bus 1540, wherein the processor 1510, the memory 1520, and the communication interface 1530 are respectively connected to the system bus 1540. The processor 1510 can access the memory 1520 through the system bus 1540. For example, the processor 1510 can read and write data or execute code in the memory 1520 through the system bus 1540. The system bus 1540 is a peripheral component interconnect express (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus 1540 is divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0161] In a possible implementation, the function of the processor 1510 is mainly to interpret the instructions (or codes) of the computer program and process the data in the computer software. The instructions of the computer program and the data in the computer software can be stored in the memory 1520 or the cache 1516.
[0162] Optionally, the processor 1510 may be an integrated circuit chip with signal processing capabilities. As an example and not a limitation, the processor 1510 is 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 device, a discrete gate or transistor logic device, a discrete hardware component. Among them, the general-purpose processor is a microprocessor, etc. For example, the processor 1510 is a central processing unit (CPU).
[0163] Optionally, each processor 1510 includes at least one processing unit 1512 and a memory control unit 1514 .
[0164] Optionally, the processing unit 1512 is also called a core or kernel, which is the most important component of the processor. The processing unit 1512 is manufactured from single crystal silicon using a certain production process, and all calculations, command reception, command storage, and data processing of the processor are performed by the core. The processing units run program instructions independently and use the ability of parallel computing to speed up the running speed of the program. Various processing units have a fixed logical structure. For example, the processing unit includes logical units such as a first-level cache, a second-level cache, an execution unit, an instruction-level unit, and a bus interface.
[0165] In one implementation example, the memory control unit 1514 is used to control data interaction between the memory 1520 and the processing unit 1512. Specifically, the memory control unit 1514 receives a memory access request from the processing unit 1512, and controls access to the memory based on the memory access request. As an example and not a limitation, the memory control unit is a device such as a memory management unit (MMU).
[0166] In one implementation example, each memory control unit 1514 addresses the memory 1520 through the system bus. And an arbiter ( Fig. 9 ), which is responsible for handling and coordinating competing accesses of multiple processing units 1512.
[0167] In an implementation example, the processing unit 1512 and the memory control unit 1514 are connected to each other through connection lines inside the chip, such as address lines, so as to achieve communication between the processing unit 1512 and the memory control unit 1514.
[0168] Optionally, each processor 1510 also includes a cache 1516, wherein the cache is a buffer for data exchange (called cache). When the processing unit 1512 wants to read data, it will first search for the required data from the cache. If it is found, it will be executed directly. If it is not found, it will be searched from the memory. Since the running speed of the cache is much faster than the memory, the role of the cache is to help the processing unit 1512 run faster.
[0169] The memory 1520 can provide a running space for the processes in the computing device 1500. For example, the computer program (specifically, the program code) used to generate the process is stored in the memory 1520. After the computer program is executed by the processor to generate the process, the processor allocates a corresponding storage space for the process in the memory 1520. Furthermore, the above storage space further includes a text segment, an initialized data segment, a bit initialized data segment, a stack segment, a heap segment, etc. The memory 1520 stores the data generated during the running of the process in the storage space corresponding to the above process, such as intermediate data, process data, etc.
[0170] Optionally, the storage is also called memory, and its function is to temporarily store the operation data in the processor 1510 and the data exchanged with the external storage such as the hard disk. As long as the computer is running, the processor 1510 will transfer the data to be calculated to the memory for calculation, and when the calculation is completed, the processing unit 1512 will transmit the result.
[0171] As an example and not limitation, memory 1520 is a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory is a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory is a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct rambus RAM (DRRAM). It should be noted that the memory 1520 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0172] The structure of the computing device 1500 listed above is only an example, and the present application is not limited thereto. The computing device 1500 of the embodiment of the present application includes various hardware in the computer system in the prior art. For example, the computing device 1500 also includes other memories besides the memory 1520, such as disk storage, etc. Those skilled in the art should understand that the computing device 1500 may also include other devices necessary for normal operation. At the same time, according to specific needs, those skilled in the art should understand that the above-mentioned computing device 1500 may also include hardware devices for implementing other additional functions. In addition, those skilled in the art should understand that the above-mentioned computing device 1500 may also include only the devices necessary to implement the embodiment of the present application, and does not necessarily include Fig. 9 All devices shown in .
[0173] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device may be a server. In some embodiments, the computing device may also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0174] like Fig.10 As shown, the computing device cluster includes at least one computing device 1500. The memory 1520 in one or more computing devices 1500 in the computing device cluster may store the same instructions for executing the above method.
[0175] In some possible implementations, the memory 1520 in one or more computing devices 1500 in the computing device cluster may also store some instructions for executing the above method. In other words, the combination of one or more computing devices 1500 may jointly execute the instructions of the above method.
[0176] It should be noted that the memory 1520 in different computing devices 1500 in the computing device cluster may store different instructions, which are respectively used to execute part of the functions of the above-mentioned apparatus. That is, the instructions stored in the memory 1520 in different computing devices 1500 may implement the functions of one or more modules in the above-mentioned apparatus.
[0177] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.11 A possible implementation is shown. Fig.11 As shown, two computing devices 1500A and 1500B are connected via a network. Specifically, they are connected to the network via a communication interface in each computing device.
[0178] It should be understood that Fig.11 The functionality of the computing device 1500A shown in FIG. 1 may also be implemented by multiple computing devices 1500. Similarly, the functionality of the computing device 1500B may also be implemented by multiple computing devices 1500.
[0179] In this embodiment, a computer program product including instructions is also provided, and the computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on a computing device, the computing device is caused to execute the method provided above, or the computing device is caused to implement the function of the apparatus provided above.
[0180] In this embodiment, a computer program product including instructions is also provided, and the computer program product may be software or a program product including instructions that can be run on a computing device cluster or stored in any available medium. When the computer program product is run by a computing device cluster, the computing device cluster executes the method provided above, or the computing device cluster implements the function of the apparatus provided above.
[0181] In this embodiment, a computer-readable storage medium is also provided. The computer-readable storage medium may be any available medium that can be stored by a computing device or a data storage device such as a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions. When the instructions in the computer-readable storage medium are executed on a computing device, the computing device executes the method provided above.
[0182] In this embodiment, a computer-readable storage medium is also provided, and the computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc. The computer-readable storage medium includes instructions, and when the instructions in the computer-readable storage medium are executed by a computing device cluster, the computing device cluster executes the method provided above.
[0183] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0184] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example 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 performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0185] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0186] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0187] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0188] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0189] If the functions are implemented in the form of 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 the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.
[0190] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for data storage, characterized in that: The cloud database system includes a database master node and one or more database slave nodes. The cloud computing platform deploys the cloud database system on the cloud computing resources managed by the cloud computing platform. The cloud computing platform deploys cloud storage services on the cloud computing resources. The method includes: A first node receives a plurality of access requests for accessing a database, wherein the first node is a database master node or a database slave node of the cloud database system; During the process of the first node processing the multiple access requests, the hot data is cached in the local storage of the first node; In the process of processing the multiple access requests by the first node, the cold data is migrated to the cloud storage service, and metadata of the cold data is cached in the local storage of the first node; The hot data and the cold data are different data tables of the database, or the hot data and the cold data are different table partitions of the data table; The hot data and the cold data are determined according to one or both of the number of times a table partition of a data table is accessed and the amount of data, or the hot data and the cold data are determined according to one or both of the number of times the data table is accessed and the amount of data.
2. The method according to claim 1, characterized in that The method further comprises: In the process of processing the multiple access requests by the first node, the warm data is migrated to the cloud storage service, and metadata of the warm data is cached in the local storage of the first node; The hot data, the warm data and the cold data are different data tables of the database, or the hot data, the warm data and the cold data are different table partitions of the data table; The hot data, the warm data and the cold data are determined according to one or both of the number of times a table partition of a data table is accessed and the amount of data, or the hot data, the warm data and the cold data are determined according to one or both of the number of times the data table is accessed and the amount of data.
3. The method according to claim 1, characterized in that The first node is a database master node of the cloud database system, and the method further includes: During the process of the first node processing the multiple access requests, the warm data is migrated to the cloud storage service, and the warm data is cached in the local storage of the first node. One or more databases included in the cloud database system store metadata of the warm data locally from the node.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: The first node maintains a first table, where the first table is used to record storage conditions of the hot data, the cold data, and the warm data.
5. The method according to any one of claims 1 to 4, characterized in that The multiple access requests include a write request, the write request includes data to be written, and the method further includes: The first node performs a write operation on the cold data stored in the cloud storage service according to the write request, and caches the data to be written in the form of incremental data in the local storage of the first node.
6. The method according to any one of claims 2 to 4, characterized in that The multiple access requests include a write request, the write request includes data to be written, and the method further includes: The first node performs a write operation on the warm data stored in the cloud storage service according to the write request, and caches the data to be written in the form of incremental data in the local storage of the first node.
7. The method according to claim 5 or 6, characterized in that: The method further comprises: The first node merges the incremental data in the local storage of the first node and the cold data or the warm data stored in the cloud storage service, and migrates the merged data to the cloud storage service.
8. The method according to any one of claims 4 to 7, characterized in that The first table is also used to record the existence of the incremental data.
9. A data storage device, characterized in that: The cloud database system includes a database master node and one or more database slave nodes. The cloud computing platform deploys the cloud database system on the cloud computing resources it manages. The cloud computing platform deploys cloud storage services on the cloud computing resources. The device is applied to a first node, which is a database master node or a database slave node of the cloud database system. The device includes: A receiving module, used to receive multiple access requests for accessing a database, wherein the first node is a database master node or a database slave node of the cloud database system; a cache module, configured to cache hot data in a local storage of the first node during processing of the plurality of access requests; a migration module, configured to migrate the cold data to the cloud storage service and cache the metadata of the cold data in the local storage of the first node during processing of the multiple access requests; The hot data and the cold data are different data tables of the database, or the hot data and the cold data are different table partitions of the data table; The hot data and the cold data are determined according to one or both of the number of times a table partition of a data table is accessed and the amount of data, or the hot data and the cold data are determined according to one or both of the number of times the data table is accessed and the amount of data.
10. The device according to claim 9, characterized in that The migration module is further configured to migrate the warm data to the cloud storage service during processing of the multiple access requests, and cache metadata of the warm data in the local storage of the first node; The hot data, the warm data and the cold data are different data tables of the database, or the hot data, the warm data and the cold data are different table partitions of the data table; The hot data, the warm data and the cold data are determined according to one or both of the number of times a table partition of a data table is accessed and the amount of data, or the hot data, the warm data and the cold data are determined according to one or both of the number of times the data table is accessed and the amount of data.
11. The device according to claim 9, characterized in that The first node is a database master node of the cloud database system, The migration module is also used to migrate the warm data to the cloud storage service during the process of processing the multiple access requests, and cache the warm data in the local storage of the first node, and one or more databases included in the cloud database system locally store metadata of the warm data from the node.
12. The device according to any one of claims 9 to 11, characterized in that The device also includes: The maintenance module is used to maintain a first table, where the first table is used to record the storage status of the hot data, the cold data, and the warm data.
13. The device according to any one of claims 9 to 12, characterized in that The multiple access requests include a write request, and the write request includes data to be written. The cache module is further configured to cache the data to be written in the form of incremental data in the local storage of the first node according to the write request for performing a write operation on the cold data stored in the cloud storage service.
14. The device according to any one of claims 10 to 12, characterized in that The multiple access requests include a write request, and the write request includes data to be written. The cache module is further configured to cache the data to be written in the form of incremental data in the local storage of the first node according to the write request for performing a write operation on the warm data stored in the cloud storage service.
15. The device according to claim 13 or 14, characterized in that The device also includes: A merging module, configured to merge the incremental data in the local storage of the first node and the cold data or the warm data stored in the cloud storage service; The migration module is also used to migrate the merged data to the cloud storage service.
16. The device according to claim 12 or 15, characterized in that The first table is also used to record the existence of the incremental data.
17. A computing device, characterized in that The computer comprises a processor and a memory, wherein the processor is configured to execute instructions stored in the memory so that the computing device executes the method according to any one of claims 1 to 8.
18. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 8.
19. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device, the computing device is caused to perform the method according to any one of claims 1 to 8.
20. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster is caused to perform the method according to any one of claims 1 to 8.
21. A computer-readable storage medium, characterized in that: The method comprises computer program instructions, which, when executed by a computing device, causes the computing device to perform the method as claimed in any one of claims 1 to 8.
22. A computer-readable storage medium, characterized in that: The method comprises computer program instructions, and when the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Distributed time sequence database system, electronic equipment and storage medium
CN113641763A
Hybrid cloud
US20180084050A1
Data migration using a migration data placement tool between storage systems based on data access
US20180157655A1
Cited By
Method and system for AI-driven real-time database analysis based on distributed storage
CN120196683A
A method and system for AI-driven real-time analysis database based on distributed storage
CN120196683B
Shopping mall sales data storage method based on cloud platform
CN120371837A
Data storage method, apparatus and computing device
EP4672016A1
Data storage method, apparatus and computing device
WO2024187922A1
