Data storage method and device, storage medium and electronic device
Through the data storage service, selecting appropriate storage media types and addresses based on file data attribute information, the problem of poor read and write performance caused by file data storage in the prior art is solved, and more efficient data storage is achieved.
Patent Information
- Application Number
- CN202111632239.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2041-12-28
AI Technical Summary
The existing file data storage method leads to poor read and write performance and cannot meet the file's read and write needs.
Receive storage requests for target file data through the data storage service, determine the matching storage media type based on the attribute information of the file data, and store the file data to the corresponding storage address. Use a combination of at least two media types, such as MongoDB database, solid-state drive and mechanical hard disk, and dynamically migrate according to the data volume and frequency of use.
It realizes matching storage based on file data attribute information, improves data read and write performance, and solves performance problems caused by improper data storage.
Smart Images

Figure CN114327273B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular, to a data storage method, apparatus, storage medium, and electronic device. Background Art
[0002] With the advent of the big data era, the ability to store file data has been increasingly emphasized. The data storage method based on file services usually uses mechanical hard disks or solid-state drives to store file data. Different storage methods can provide different file read / write capabilities. Therefore, the storage of file data needs to balance storage performance and storage cost.
[0003] Currently, the storage of file data usually divides the space of the storage location to avoid waste of storage space as much as possible. However, this storage method will cause a decline in the read / write performance of file data and cannot meet the read / write requirements of files.
[0004] In view of the above problems, no effective solution has been proposed yet. Summary of the Invention
[0005] Embodiments of the present invention provide a data storage method, apparatus, storage medium, and electronic device to at least solve the technical problem of poor data read / write performance caused by improper data storage.
[0006] According to one aspect of the embodiments of the present invention, a data storage method is provided, including: a data storage service receives a storage request for target file data, where the storage request carries data attribute information of the target file data; determines a first storage medium matching the data attribute information for the target file data, where the data storage service includes at least two medium types, and the at least two medium types include the medium type to which the first storage medium belongs; and stores the target file data in a first storage address in the first storage medium.
[0007] According to another aspect of the embodiments of the present invention, a data storage apparatus is further provided, including: a receiving unit for a data storage service to receive a storage request for target file data, where the storage request carries data attribute information of the target file data; a determining unit for determining a first storage medium matching the data attribute information for the target file data, where the data storage service includes at least two medium types, and the at least two medium types include the medium type to which the first storage medium belongs; and a storage unit for storing the target file data in a first storage address in the first storage medium.
[0008] According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the above data storage method when running.
[0009] According to another aspect of the embodiments of the present invention, there is also provided an electronic device including a memory and a processor. A computer program is stored in the memory, and the processor is configured to execute the above data storage method through the computer program.
[0010] In the embodiments of the present invention, when a data storage service receives a storage request for target file data, according to the data attribute information of the target file data, a first storage medium matching the data attribute information is determined from at least two types of media included in the data storage service, so as to store the target file data at the first storage address of the first storage medium. By requesting the data attribute information of the target file data stored in the data storage service, a first storage medium matching the data attribute information is determined from at least two types of media included, so as to store the target file data at the first storage address in the first storage medium, achieving the purpose of determining a matching media type according to the data attribute information of the file data, and thus storing the file data at the storage address of the storage medium matching the data attribute information, thereby realizing the technical effect of determining a storage media type matching the file data according to the data attribute information, and then performing data matching storage, and further solving the technical problem of poor data read and write performance caused by improper data storage. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:
[0012] Figure 1 is a schematic diagram of an application environment of an optional data storage method according to an embodiment of the present invention;
[0013] Figure 2 is a schematic flowchart of an optional data storage method according to an embodiment of the present invention;
[0014] Figure 3 is a schematic flowchart of an optional data storage method according to an embodiment of the present invention;
[0015] Figure 4 is a schematic structural diagram of an optional data storage device according to an embodiment of the present invention;
[0016] Figure 5It is a schematic structural diagram of an optional electronic device according to an embodiment of the present invention. Detailed implementation manners
[0017] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0018] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order different from those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0019] According to one aspect of the embodiments of the present invention, a data storage method is provided. Optionally, the above data storage method can be but is not limited to being applied to an environment such as Figure 1 shown. The terminal 100 sends a storage request to the data storage service 120 through the network 110 for storing the file data of the terminal 100. After storing the file data, the data storage service 120 feeds back the storage result to the terminal 100 through the network 110. The storage result can be but is not limited to storage information such as a storage address and whether the storage is successful.
[0020] The storage of the file data by the data storage service 120 is not limited to being implemented by sequentially executing S102 to S106. S102, receive a storage request. The data storage service receives a storage request for target file data, and the storage request carries data attribute information of the target file data. S104, determine a first storage medium. A first storage medium matching the data attribute information is determined for the target file data. The data storage service includes at least two medium types, and the at least two medium types include the medium type to which the first storage medium belongs. S106, store to the first storage address. The data storage service stores the target file data to the first storage address in the first storage medium.
[0021] Optionally, in this embodiment, the terminal 100 may be any form of terminal device, including but not limited to at least one of the following: mobile phone (such as Android phone, IOS phone, etc.), laptop computer, tablet computer, handheld computer, MID (Mobile Internet Devices), PAD, desktop computer, smart speaker, smart TV and other smart home devices. The network 110 may include but not limited to: wired network, wireless network, where the wired network includes: local area network, metropolitan area network and wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that implement wireless communication. The data storage service 120 may be a server, which may be a single server, a server cluster composed of multiple servers, or a cloud server. The above is only an example, and this embodiment does not make any limitation thereto.
[0022] As an alternative implementation, as Figure 2 shown, the above data storage method includes:
[0023] S202, the data storage service receives a storage request for target file data, where the storage request carries data attribute information of the target file data;
[0024] S204, determine a first storage medium that matches the data attribute information for the target file data, where the data storage service includes at least two medium types, and the at least two medium types include the medium type to which the first storage medium belongs;
[0025] S206, store the target file data in a first storage address in the first storage medium.
[0026] Optionally, the data storage service is used to provide storage services for various data types, and the data storage service is not limited to including storage media of at least two medium types. Different types of storage media may be located on the same storage device or on different storage devices. When different types of storage media are located in the same storage device, the data storage service is not limited to the storage service for managing data storage in the storage device. When different types of storage media are located in different storage devices, the storage devices included in the data storage service cover at least two medium types of storage media. The number of storage devices included in the data storage service is not limited herein.
[0027] The media types for file data are not limited to including: MongoDB databases, solid state drives (SSDs), and hard disk drives (HDDs). Determine the media type that matches the file data based on the data attribute information of the file data, thereby determining the storage medium for storing the file data from the storage media of the media type that matches the file data, and determining the specific storage address in the determined storage medium.
[0028] Thus, determining the storage medium for storing the file data from the storage media of the media type that matches the file data is not limited to determining the storage medium for storing the file data in the storage media of the media type that matches the file data according to the usage order of the storage media. At the same time, it is not limited to determining the specific storage address for storing the file data according to the current space usage order of the storage media.
[0029] The data attribute information of the file data is not limited to including at least one of the data volume, data format, request time for storage, storage duration for storage, number of uses, and usage frequency of the file data. Determine the storage media type that matches the file data based on the data attribute information of the file data, thereby determining the specific storage location for the file data in the storage media of the corresponding type.
[0030] In the embodiment of the present application, when the data storage service receives a storage request for target file data, according to the data attribute information of the target file data, determine a first storage medium that matches the data attribute information from at least two media types included in the data storage service, and thus store the target file data at the first storage address of the first storage medium. By requesting the data attribute information of the target file data stored in the data storage service, determine a first storage medium that matches the data attribute information from the at least two media types included, and thus store the target file data at the first storage address in the first storage medium, achieving the purpose of determining the matching media type according to the data attribute information of the file data, and thus storing the file data at the storage address of the storage medium that matches the data attribute information, thereby realizing the technical effect of determining the storage media type that matches the file data according to the data attribute information, and thus performing data matching storage, and further solving the technical problem of poor data read and write performance caused by improper data storage.
[0031] As an optional implementation manner, determining a first storage medium that matches the data attribute information for the target file data includes:
[0032] When the data attribute information indicates that the data volume of the target file data is less than the first data threshold, determine that the file database media type matches the data attribute information, and determine the first storage medium in the storage media of the file database media type;
[0033] When the data attribute information indicates that the data volume of the target file data is greater than or equal to the first data threshold and less than the second data threshold, it is determined that the solid-state drive media type matches the data attribute information, and the first storage medium is determined from the storage media of the solid-state drive media type;
[0034] When the data attribute information indicates that the data volume of the target file data is greater than or equal to the second data threshold, it is determined that the mechanical hard disk media type matches the data attribute information, and the first storage medium is determined from the storage media of the mechanical hard disk media type.
[0035] When the data attribute information includes the data volume of the file data, it is not limited to determining the media type that matches the target file data according to the comparison result between the data volume of the file data and the data threshold. The data threshold is not limited to including at least one data threshold, so as to determine the data volume ranges corresponding to the two media types respectively. The number of data thresholds is related to the number of media types in the data storage service. According to the number of media types, the data volume ranges corresponding to each media type are determined, so as to determine each data threshold.
[0036] Taking the data storage service including three media types, namely the file database media type, the solid-state drive media type, and the mechanical hard disk media type as an example, the data thresholds are the corresponding first data threshold and second data threshold, and the value of the second data threshold is greater than the value of the first data threshold. When the data volume of the file data is less than the first data threshold, it is determined that the file database media type matches the file data. The file database media type is not limited to corresponding to the MongoDB database of the data storage service. The storage medium for storing the file data is determined from the storage medium of the file database, as well as the specific storage address on the storage medium, and the file data is stored at the determined storage address. The MongoDB database is not limited to using binary for data storage and has the characteristics of high-performance distributed file storage. The unit storage space of the MongoDB database is suitable for storing file data with a small data volume, such as files not exceeding 256K.
[0037] When the data volume of the file data is greater than or equal to the first data threshold and less than the second data threshold, it is determined that the solid-state drive media type matches the file data. The solid-state drive media type is not limited to the fixed hard disk corresponding to the data storage service. In the storage medium of the solid-state drive, a storage medium for storing the file data and a specific storage address on the storage medium are determined, and the file data is stored at the determined storage address. The read and write performance of the solid-state drive is higher than that of the MongoDB database. Therefore, it is suitable for storing files with a moderate data volume, such as files between 256K and 16M, which can not only ensure that the storage of file data can fully utilize the storage space on the solid-state drive, but also ensure the read and write performance of the file data.
[0038] When the data volume of the file data is greater than or equal to the second data threshold, it is determined that the mechanical hard disk media type matches the file data. The mechanical hard disk media type is not limited to the mechanical hard disk corresponding to the data storage service. In the storage medium of the mechanical hard disk, a storage medium for storing the file data and a specific storage address on the storage medium are determined, and the file data is stored at the determined storage address. The read and write performance of the mechanical hard disk is weaker than that of the solid-state drive, but the storage space is larger. Therefore, the storage cost is smaller than that of the solid-state drive, and it is suitable for storing files with a large data volume, such as 16M files.
[0039] As an alternative implementation, after storing the target file data at the first storage address in the first storage medium, it further includes: when the data usage information in the data attribute information reaches the migration condition, migrating the target file data from the first storage address to the second storage address in the second storage medium, where the media type to which the second storage medium belongs is different from the media type to which the first storage medium belongs.
[0040] After the file data is stored at the first storage address, it is not limited to determining whether the file data reaches the migration condition according to the data usage information in the data attribute information, so as to determine whether to perform a media type migration on the file data, migrating from the storage medium of the media type where the current file data is located to the storage medium of other media types.
[0041] The data usage information is not limited to the data usage information generated when the file data is stored at the first storage address. As an alternative implementation, after storing the target file data at the first storage address in the first storage medium, it further includes: obtaining the data usage information generated by the target file data at the first storage address, where the data usage information includes at least one of the following: the number of times the target file data is used, the usage frequency of the target file data.
[0042] The unlimited number of uses refers to the cumulative number of times the file data is read, written, and called after being stored at the first storage address. The usage frequency refers to the average number of times the file data is read, written, and called per unit time period after being stored at the first storage address, or the target number of times the file data is read, written, and called within the target time period. When the data usage information includes the number of uses and the usage frequency, it is not limited to calculating the target usage information for determining data migration according to parameter weights, so as to determine whether the file data meets the migration conditions.
[0043] As an alternative implementation, after storing the target file data at the first storage address in the first storage medium, it further includes:
[0044] When the first storage medium belongs to the solid-state drive medium type and the usage value indicated by the data usage information is less than the first usage threshold, it is determined that the data usage information meets the migration conditions;
[0045] When the first storage medium belongs to the mechanical hard disk medium type and the usage value indicated by the data usage information is greater than the second usage threshold, it is determined that the data usage information meets the migration conditions, where the second usage threshold is greater than the first usage threshold.
[0046] As an alternative implementation, migrating the target file data from the first storage address to the second storage address in the second storage medium includes:
[0047] When the first storage medium belongs to the solid-state drive medium type, determine the second storage medium in the storage medium of the mechanical hard disk medium type;
[0048] When the first storage medium belongs to the mechanical hard disk medium type, determine the second storage medium in the storage medium of the solid-state drive medium type.
[0049] When the target file data is determined to match the solid-state drive medium type according to the data volume and is thus stored in the storage medium included in the solid-state drive, and the usage value of the target file data is less than the first usage threshold, it is determined that the target file data meets the migration conditions, and thus the target file data is migrated from the first storage address of the solid-state drive to the second storage address of the mechanical hard disk. When the target file data is stored in the storage medium included in the solid-state drive and the usage value is greater than or equal to the first usage threshold, it is determined that the target file data does not meet the migration conditions, and no data migration is performed on the target file data, and the target file data continues to be stored at the first storage address.
[0050] When the target file data is determined to match the mechanical hard disk media type according to the data volume and is thus stored in the storage media included in the mechanical hard disk, and the usage value of the target file data is greater than the second usage threshold, it is determined that the target file data meets the migration condition, and thus the target file data is migrated from the first storage address of the mechanical hard disk to the second storage address of the solid state drive. When the target file data is stored in the storage media included in the mechanical hard disk and the usage value is less than or equal to the second usage threshold, it is determined that the target file data does not reach the migration condition, and no data migration is performed on the target file data, and the target file data continues to be stored at the first storage address.
[0051] Taking the usage information as the usage frequency as an example, it is not limited to determining the low usage frequency based on the first usage threshold and determining the high usage frequency based on the second usage threshold, so as to migrate the file data with low usage frequency in the solid state drive to the mechanical hard disk, and migrate the file data with high usage frequency in the mechanical hard disk to the solid state drive, so as to adjust the storage media type of the file data to make the storage media type meet the read and write performance of the file data.
[0052] In the embodiment of the present application, after storing the file data based on the data attributes, it is determined whether to migrate the file data to the media type matching the usage information of the file data based on the usage information of the file data, so as to adjust the media type where the data is stored, so that the storage address of the file data is adjusted to the media type that better matches the read and write performance of the file. By timely adjusting the storage location of the file data, the media type where the storage address is located meets the read and write performance of the file data, avoiding the problem that the storage media cannot meet the read and write performance of the file data.
[0053] As an alternative implementation, as Figure 3 shown, migrating the target file data from the first storage address to the second storage address located in the second storage media includes:
[0054] S302, copying the target file data to the second storage address;
[0055] S304, binding the file attribute data associated with the first storage address to the second storage address;
[0056] S306, deleting the target file data in the first storage address.
[0057] Specifically, the migration of file data is not limited to including the copying of file data, the binding of attribute data, and the deletion of files at the original storage location. The file attribute data includes the attribute data generated by the file data at the first storage address, and is not limited to including link data such as read-write connections and call links. The file attribute data is not limited to being stored at the first storage address. The file attribute data is bound to the second storage address after the file data is migrated, so as to avoid the loss of file attribute data caused by file migration and ensure the integrity of the attribute data of the file data.
[0058] In the embodiment of the present application, when migrating file data according to file usage information, by binding the file attribute data to the storage address after migration, the integrity of the file attribute data is ensured, and the loss of file attribute data caused by file migration is avoided.
[0059] It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.
[0060] According to another aspect of the embodiment of the present invention, there is also provided a data storage device for implementing the above data storage method. As Figure 4 shown, the device includes:
[0061] A receiving unit 402, configured to receive a storage request for target file data for a data storage service, where the storage request carries data attribute information of the target file data;
[0062] A determining unit 404, configured to determine a first storage medium that matches the data attribute information for the target file data, where the data storage service includes at least two medium types, and the at least two medium types include the medium type to which the first storage medium belongs;
[0063] A storage unit 406, configured to store the target file data in a first storage address in the first storage medium.
[0064] Optionally, the above-mentioned determination unit 404 is further configured to: when the data volume of the target file data indicated by the data attribute information is less than the first data threshold, determine that the file database medium type matches the data attribute information, and determine a first storage medium in the storage medium of the file database medium type; when the data volume of the target file data indicated by the data attribute information is greater than or equal to the first data threshold and less than the second data threshold, determine that the solid-state drive medium type matches the data attribute information, and determine a first storage medium in the storage medium of the solid-state drive medium type; when the data volume of the target file data indicated by the data attribute information is greater than or equal to the second data threshold, determine that the mechanical hard disk medium type matches the data attribute information, and determine a first storage medium in the storage medium of the mechanical hard disk medium type.
[0065] Optionally, the above-mentioned data storage device further includes a migration unit, configured to, after storing the target file data to a first storage address in the first storage medium, when the data usage information in the data attribute information reaches the migration condition, migrate the target file data from the first storage address to a second storage address located in a second storage medium, where the medium type to which the second storage medium belongs is different from the medium type to which the first storage medium belongs.
[0066] Optionally, the above-mentioned data storage device further includes a migration determination unit, configured to, after storing the target file data to a first storage address in the first storage medium, when the first storage medium belongs to the solid-state drive medium type and the usage value indicated by the data usage information is less than the first usage threshold, determine that the data usage information reaches the migration condition; when the first storage medium belongs to the mechanical hard disk medium type and the usage value indicated by the data usage information is greater than the second usage threshold, determine that the data usage information reaches the migration condition, where the second usage threshold is greater than the first usage threshold.
[0067] Optionally, the above-mentioned migration unit is further configured to, when the first storage medium belongs to the solid-state drive medium type, determine a second storage medium in the storage medium of the mechanical hard disk medium type; when the first storage medium belongs to the mechanical hard disk medium type, determine a second storage medium in the storage medium of the solid-state drive medium type.
[0068] Optionally, the above-mentioned migration unit is further configured to copy the target file data to the second storage address; bind the file attribute data associated with the first storage address to the second storage address; and delete the target file data in the first storage address.
[0069] Optionally, after storing the target file data in the first storage address of the first storage medium, the above data storage device is further configured to obtain data usage information generated by the target file data at the first storage address, where the data usage information includes at least one of the following: the number of times the target file data is used, and the usage frequency of the target file data.
[0070] In the embodiments of the present application, when a data storage service receives a storage request for target file data, according to the data attribute information of the target file data, a first storage medium matching the data attribute information is determined for the target file data from at least two medium types included in the data storage service, so as to store the target file data in the first storage address of the first storage medium. By requesting the data attribute information of the target file data stored in the data storage service, a first storage medium matching the data attribute information is determined from at least two medium types included, so as to store the target file data in the first storage address of the first storage medium, achieving the purpose of determining a matching medium type according to the data attribute information of the file data, and thus storing the file data in the storage address of the storage medium matching the data attribute information, thereby realizing the technical effect of determining a storage medium type matching the file data according to the data attribute information, and then performing data matching storage, and further solving the technical problem of poor data read and write performance caused by improper data storage.
[0071] According to another aspect of the embodiments of the present invention, an electronic device for implementing the above data storage method is further provided. The electronic device may be Figure 1 the data storage service shown. As Figure 5 shown, the electronic device includes a memory 502 and a processor 504. A computer program is stored in the memory 502, and the processor 504 is configured to execute the steps in any one of the above method embodiments through the computer program.
[0072] Optionally, in this embodiment, the above electronic device may be at least one network device among multiple network devices in a computer network.
[0073] Optionally, in this embodiment, the above processor may be configured to execute the following steps through a computer program:
[0074] S1, the data storage service receives a storage request for target file data, where the storage request carries data attribute information of the target file data;
[0075] S2, determine a first storage medium matching the data attribute information for the target file data, where at least two medium types are included in the data storage service, and the at least two medium types include the medium type to which the first storage medium belongs;
[0076] S3. Store the target file data in the first storage address in the first storage medium.
[0077] Optionally, those of ordinary skill in the art can understand that Figure 5 The structure shown is only schematic. The electronic device can also be a smart phone (such as an Android phone, an IOS phone, etc.), a tablet computer, a handheld computer, and terminal devices such as Mobile Internet Devices (MID), PAD, etc. Figure 5 It does not limit the structure of the above-mentioned electronic device. For example, the electronic device may further include more or fewer components (such as a network interface, etc.) than those shown in Figure 5 or have a different configuration from that shown in Figure 5 Shown.
[0078] Among them, the memory 502 can be used to store software programs and modules, such as the program instructions / modules corresponding to the data storage method and device in the embodiments of the present invention. The processor 504 executes various functional applications and data processing by running the software programs and modules stored in the memory 502, that is, the above-mentioned data storage method is implemented. The memory 502 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 502 may further include a memory remotely set relative to the processor 504, and these remote memories can be connected to the terminal through a network. Examples of the above-mentioned network include but are not limited to the Internet, an enterprise internal network, a local area network, a mobile communication network, and combinations thereof. Among them, the memory 502 can specifically but not limitedly be used to store the target file data and information such as the data attribute information and storage address of the target file data. As an example, as Figure 5 Shown, the above-mentioned memory 502 may include but are not limited to the receiving unit 402, the determining unit 404, and the storage unit 406 in the above-mentioned data storage device. In addition, it may further include but are not limited to other module units in the above-mentioned data storage device, which will not be elaborated in this example.
[0079] Optionally, the above-mentioned transmission device 506 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one instance, the transmission device 506 includes a Network Interface Controller (NIC), which can be connected to other network devices and routers through a network cable so as to communicate with the Internet or a local area network. In one instance, the transmission device 506 is a Radio Frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0080] In addition, the above electronic device further includes: a display 508 for displaying the above storage address; and a connection bus 510 for connecting each module component in the above electronic device.
[0081] In other embodiments, the above terminal device or server may be a node in a distributed system. Among them, the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes in a form of network communication. Among them, the nodes may form a peer-to-peer (P2P) network, and any form of computing device, such as an electronic device like a server or a terminal, can become a node in the blockchain system by joining the peer-to-peer network.
[0082] According to one aspect of the present application, there is provided a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional implementation manners of the above data storage aspect. Among them, the computer program is configured to execute the steps in any one of the above method embodiments when running.
[0083] Optionally, in this embodiment, the above computer-readable storage medium may be configured to store a computer program for executing the following steps:
[0084] S1, a data storage service receives a storage request for target file data, where the storage request carries data attribute information of the target file data;
[0085] S2, determine a first storage medium that matches the data attribute information for the target file data, where the data storage service includes at least two medium types, and the at least two medium types include the medium type to which the first storage medium belongs;
[0086] S3, store the target file data in a first storage address in the first storage medium.
[0087] Optionally, in this embodiment, those of ordinary skill in the art can understand that all or part of the steps in the above various methods can be completed by a program instructing the relevant hardware of the terminal device. The program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc, etc.
[0088] The serial numbers of the above embodiments of the present invention are only for description and do not represent the superiority or inferiority of the embodiments.
[0089] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage media. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in the storage medium and includes several instructions for causing one or more computer devices (which can be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention.
[0090] In the above embodiments of the present invention, the descriptions of the various embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0091] In the several embodiments provided by the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there can be other division methods. For example, 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 displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the units or modules can be in electrical or other forms.
[0092] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0093] In addition, the functional units in the various embodiments of the present invention can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0094] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A data storage method, characterized in that, Including: The data storage service receives a storage request for target file data, where the storage request carries data attribute information of the target file data, and the data attribute information includes the data volume, data format, request time for storage, storage duration for the request, number of uses, and usage frequency of the file data. Determine a first storage medium that matches the data attribute information for the target file data, where there are at least two medium types included in the data storage service, and the at least two medium types include the medium type to which the first storage medium belongs. Store the target file data at a first storage address in the first storage medium. Obtain the data usage information generated by the target file data at the first storage address, and calculate the target usage information for determining data migration according to parameter weights, where the data usage information includes the number of uses and usage frequency of the target file data. When the target usage information in the data attribute information reaches the migration condition, migrate the target file data from the first storage address to a second storage address in a second storage medium, where the medium type to which the second storage medium belongs is different from the medium type to which the first storage medium belongs. The migrating the target file data from the first storage address to a second storage address in a second storage medium includes: Copy the target file data to the second storage address. Bind the read-write connection and call link associated with the first storage address to the second storage address. Delete the target file data in the first storage address.
2. The method according to claim 1, wherein The determining a first storage medium that matches the data attribute information for the target file data includes: When the data attribute information indicates that the data volume of the target file data is less than a first data threshold, determine that the file database medium type matches the data attribute information, and determine the first storage medium in the storage medium of the file database medium type. When the data attribute information indicates that the data volume of the target file data is greater than or equal to the first data threshold and less than a second data threshold, determine that the solid-state drive medium type matches the data attribute information, and determine the first storage medium in the storage medium of the solid-state drive medium type. When the data attribute information indicates that the data volume of the target file data is greater than or equal to the second data threshold, determine that the mechanical hard drive medium type matches the data attribute information, and determine the first storage medium in the storage medium of the mechanical hard drive medium type.
3. The method according to claim 2, characterized in that, After storing the target file data at the first storage address in the first storage medium, it further includes: When the first storage medium belongs to the solid-state drive medium type and the usage value indicated by the data usage information is less than a first usage threshold, determine that the data usage information reaches the migration condition. When the first storage medium belongs to the type of mechanical hard disk medium and the usage value indicated by the data usage information is greater than a second usage threshold, it is determined that the data usage information meets the migration condition, where the second usage threshold is greater than the first usage threshold.
4. The method according to claim 2, wherein The migrating the target file data from the first storage address to a second storage address located in a second storage medium includes: When the first storage medium belongs to the type of solid state drive medium, determining the second storage medium in the storage medium of the mechanical hard disk medium type; When the first storage medium belongs to the type of mechanical hard disk medium, determining the second storage medium in the storage medium of the solid state drive medium type.
5. A data storage device, characterized in that, Includes: A receiving unit, configured to receive a storage request for target file data for a data storage service, where the storage request carries data attribute information of the target file data, and the data attribute information includes the data volume, data format, request time for storage, storage duration for the request for storage, number of usage times, and usage frequency of the file data; A determining unit, configured to determine a first storage medium that matches the data attribute information for the target file data, where the data storage service includes at least two types of media, and the at least two types of media include the type of medium to which the first storage medium belongs; A storage unit, configured to store the target file data at a first storage address in the first storage medium; The apparatus is further configured to: Obtain data usage information generated by the target file data at the first storage address, and calculate, according to parameter weights, target usage information for determining data migration, where the data usage information includes the number of usage times and the usage frequency of the target file data; When the target usage information in the data attribute information meets the migration condition, migrating the target file data from the first storage address to a second storage address located in a second storage medium, where the type of medium to which the second storage medium belongs is different from the type of medium to which the first storage medium belongs; The migrating the target file data from the first storage address to a second storage address located in a second storage medium includes: Copying the target file data to the second storage address; Binding a read-write connection and a call link associated with the first storage address to the second storage address; Deleting the target file data in the first storage address.
6. A computer-readable storage medium, the computer-readable storage medium including a stored program, wherein, When the program runs, it executes the method described in any one of claims 1 to 4.
7. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is configured to execute the method described in any one of claims 1 to 4 through the computer program.
Citation Information
Patent Citations
Method and system for multi-channel data transmission
CN101520714A
Data caching method and device
CN107273040A