Data management method and device
By evaluating the scores of multiple storage spaces from multiple dimensions (read and write performance, available remaining space and access frequency) in the federated file system and performing weighted calculations, the problem that the data reading and writing requirements in the existing technology cannot be met in different scenarios is solved, and more reasonable storage space use and data management are achieved.
Patent Information
- Application Number
- CN202311623009.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-30
- Publication Date
- 2025-05-30
AI Technical Summary
When prior art writes data to multiple storage spaces in a joint file system, it fails to evaluate from multiple dimensions, resulting in the inability to meet the data reading and writing requirements of different scenarios.
By receiving the write instructions of the target data, scores of multiple evaluation dimensions such as read and write performance of multiple storage spaces, available remaining space and access frequency, and weighted calculations are performed to obtain the comprehensive score, and finally write the target data to the storage space with the highest comprehensive score.
It realizes the evaluation of multiple storage spaces from multiple dimensions, meets the data reading and writing needs of different scenarios, and uses storage space more rationally, making it easier to manage data.
Smart Images

Figure CN120066382A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data management, and particularly relates to a data management method and apparatus. Background Art
[0002] Currently, when writing data to multiple storage spaces (for example, multiple hard disks) using a union file system, the data storage allocation is often based on the remaining space size of each storage space to allocate the storage location, without considering the different performance gaps brought by different file systems and the nature of each hard disk itself.
[0003] Therefore, when writing target data, the target data needs to be written to the storage space in a high-performance read / write manner (such as random read / write and sequential read / write). However, the existing solutions can only evaluate multiple storage spaces from the dimension of the available remaining space of the storage space, ignoring the evaluation of other dimensions. Therefore, how to evaluate multiple storage spaces from multiple dimensions to meet the data read / write needs of different scenarios has become an urgent problem to be solved. Summary of the Invention
[0004] In view of this, embodiments of the present application provide a data management method and apparatus for evaluating multiple storage spaces from multiple dimensions to meet the data read / write needs of different scenarios, more reasonably using the storage space, and facilitating data management.
[0005] In a first aspect, embodiments of the present application provide a data management method, including:
[0006] Receiving a write instruction for target data; the write instruction is used to store the target data in a corresponding target storage space;
[0007] For each of the multiple storage spaces, obtaining scores corresponding to multiple evaluation dimensions of the storage space;
[0008] Performing weighted calculation on the scores corresponding to the multiple evaluation dimensions of the multiple storage spaces to obtain comprehensive scores corresponding to the multiple storage spaces respectively;
[0009] Taking the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, and writing the target data into the target storage space.
[0010] As an optional implementation manner of embodiments of the present application, the performing weighted calculation on the scores corresponding to the multiple evaluation dimensions of the multiple storage spaces to obtain comprehensive scores corresponding to the multiple storage spaces respectively; includes:
[0011] Obtain the preset weight coefficients of multiple evaluation dimensions corresponding to the storage space; the multiple evaluation dimensions include: read-write performance, available remaining space, and access frequency;
[0012] Multiply the scores of the read-write performance, the scores of the available remaining space, and the scores of the access frequency by the corresponding preset weight coefficients respectively to obtain the first weighted score, the second weighted score, and the third weighted score corresponding to the read-write performance, the available remaining space, and the access frequency respectively;
[0013] Add the first weighted score, the second weighted score, and the third weighted score to obtain the comprehensive scores corresponding to the multiple storage spaces.
[0014] As an optional implementation manner of the embodiment of the present application, before obtaining the priority order of the multiple storage spaces, the method further includes:
[0015] Obtain the priority order of the multiple storage spaces;
[0016] Obtain the target storage space from the multiple storage spaces according to the priority order of the multiple storage spaces.
[0017] As an optional implementation manner of the embodiment of the present application, before obtaining the priority order of the multiple storage spaces, the method further includes:
[0018] Periodically obtain the running statuses corresponding to the multiple storage spaces;
[0019] Update the priority order of the multiple storage spaces based on the running statuses corresponding to the multiple storage spaces.
[0020] As an optional implementation manner of the embodiment of the present application, for each of the multiple storage spaces, obtaining the scores corresponding to the multiple evaluation dimensions of the storage space includes:
[0021] For each of the multiple storage spaces, use a preset test method to evaluate the multiple evaluation dimensions corresponding to the storage space to obtain the scores of the multiple evaluation dimensions corresponding to the storage space.
[0022] As an optional implementation manner of the embodiment of the present application, obtaining the preset weight coefficients of the multiple evaluation dimensions corresponding to the storage space includes:
[0023] Receive a weight coefficient change instruction;
[0024] Respond to the change instruction and change the preset weight coefficients corresponding to the multiple evaluation dimensions.
[0025] In a second aspect, an embodiment of the present application provides a data management device, including:
[0026] A receiving unit, configured to receive a write instruction for target data; the write instruction is used to store the target data into a corresponding target storage space;
[0027] An obtaining unit, configured to obtain scores corresponding to multiple evaluation dimensions of each storage space among multiple storage spaces; the multiple evaluation dimensions at least include at least two or more of read / write performance, available remaining space, and access frequency;
[0028] A calculating unit, configured to perform weighted calculation on the scores corresponding to the multiple evaluation dimensions of the multiple storage spaces to obtain comprehensive scores corresponding to the multiple storage spaces respectively;
[0029] A writing unit, configured to use the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, and write the target data into the target storage space.
[0030] As an optional implementation manner of the embodiment of the present application, the calculating unit is specifically configured to obtain preset weight coefficients of multiple evaluation dimensions corresponding to the storage space; the multiple evaluation dimensions include: read / write performance, available remaining space, and access frequency; multiply the scores of the read / write performance, the available remaining space, and the access frequency by the corresponding preset weight coefficients respectively to obtain first weighted scores, second weighted scores, and third weighted scores corresponding to the read / write performance, the available remaining space, and the access frequency respectively; add the first weighted score, the second weighted score, and the third weighted score to obtain the comprehensive scores corresponding to the multiple storage spaces.
[0031] As an optional implementation manner of the embodiment of the present application, the obtaining unit is further configured to obtain the priority order of the multiple storage spaces; according to the priority order of the multiple storage spaces, obtain the target storage space from the multiple storage spaces.
[0032] As an optional implementation manner of the embodiment of the present application, the data management device further includes an updating unit, specifically configured to periodically obtain the running statuses corresponding to the multiple storage spaces; based on the running statuses corresponding to the multiple storage spaces, update the priority order of the multiple storage spaces.
[0033] As an optional implementation manner of the embodiment of the present application, the obtaining unit is specifically configured to evaluate multiple evaluation dimensions corresponding to the storage space for each storage space among the multiple storage spaces by using a preset test method, and obtain scores of the multiple evaluation dimensions corresponding to the storage space.
[0034] As an optional implementation manner of an embodiment of the present application, the receiving unit is specifically configured to receive a weight coefficient change instruction; in response to the change instruction, change the preset weight coefficients corresponding to the multiple evaluation dimensions respectively.
[0035] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor, where the memory is used to store a computer program; the processor is configured to, when executing the computer program, enable the electronic device to implement the data management method described in any one of the above embodiments.
[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a computing device, the computing device is enabled to implement the data management method described in any one of the above embodiments.
[0037] In a fifth aspect, an embodiment of the present application provides a vehicle, including: the data management device described in the second aspect or the electronic device described in the third aspect.
[0038] The data management method provided by the embodiment of the present application is specifically as follows: receiving a write instruction for target data; the write instruction is used to store the target data into a corresponding target storage space; for each storage space in a plurality of storage spaces, obtaining scores respectively corresponding to multiple evaluation dimensions of the storage space; performing weighted calculation on the scores respectively corresponding to the multiple evaluation dimensions of the multiple storage spaces to obtain comprehensive scores respectively corresponding to the multiple storage spaces; taking the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, and writing the target data into the target storage space. By obtaining the scores of the multiple evaluation dimensions corresponding to the storage space, and then obtaining the comprehensive scores respectively corresponding to the multiple storage spaces, and taking the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, compared with the prior art that selects the target storage space from a single dimension of available remaining space, the embodiment of the present application can evaluate the storage space from multiple dimensions to meet the data reading and writing needs of different scenarios, use the storage space more reasonably, and facilitate data management. Description of the Drawings
[0039] The drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present application and used together with the specification to explain the principles of the present application.
[0040] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the attached drawings required in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other attached drawings can also be obtained based on these attached drawings.
[0041] Figure 1 One of the step flowcharts of the data management method provided by the embodiment of the present application;
[0042] Figure 2 Another step flowchart of the data management method provided by the embodiment of the present application;
[0043] Figure 3 A schematic diagram of the system framework of the data management method provided by the embodiment of the present application;
[0044] Figure 4 A schematic diagram of the structure of the data management device provided by the embodiment of the present application;
[0045] Figure 5 A schematic diagram of the hardware structure of the electronic device provided by the embodiment of the present application. Detailed implementation manners
[0046] In order to be able to more clearly understand the above-mentioned objects, features, and advantages of the present disclosure, the following will further describe the solutions of the present disclosure. It should be noted that, without conflict, the embodiments of the present disclosure and the features in the embodiments can be combined with each other.
[0047] Many specific details are set forth in the following description in order to fully understand the present disclosure, but the present disclosure can also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only a part of the embodiments of the present disclosure, rather than all of the embodiments.
[0048] In the embodiments of the present application, words such as "exemplary" or "for example" are used to represent examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Exactly speaking, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner. In addition, in the description of the embodiments of the present application, unless otherwise specified, the meaning of "a plurality" refers to two or more.
[0049] It should be noted that in this article, the term "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or elements inherent to such a process, method, article, or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, or device including the said element.
[0050] In the prior art, when current data needs to be written into a storage space in a high-performance read / write manner (such as random read / write and sequential read / write), the existing solutions can only evaluate from the dimension of the available remaining space in the storage space, ignoring the evaluation of other performances. Therefore, how to evaluate multiple storage spaces from multiple dimensions to meet the data read / write needs of different scenarios has become an urgent problem to be solved.
[0051] To solve the above problems, embodiments of the present application provide a data management method, and the specific embodiments are as follows:
[0052] Embodiments of the present application provide a data management method, referring to Figure 1 As shown, the data management method includes the following steps S101 - S104:
[0053] S101. Receive a write instruction for the target data.
[0054] Wherein, the write instruction is used to store the target data into the corresponding target storage space.
[0055] In the embodiments of the present application, the usage scenario of this data management method can specifically be: when using a Union File System to write data into multiple storage spaces, wherein, the Union File System can be Merger FS (a kind of Union File System), which merges multiple hard disks or multiple folders into a MergerFS pool, so that such a system will have a unified file entry for convenient management. In the embodiments of the present application, the storage space can be multiple hard disks, and the present application makes no limitation thereto.
[0056] In some embodiments, the user can access the data on all hard disks in the Union File System through a unified mount point, that is, the file entry; at the same time, more storage devices can also be merged according to the actual situation, that is, more hard disks can be extended in the Union File System to meet the storage requirements.
[0057] In some embodiments, it is also possible to customize and implement one's own file system in user space based on the Filesystem in Userspace (FUSE). Then, the data can be managed through a union file system.
[0058] S102. For each of the multiple storage spaces, obtain the scores corresponding to the multiple evaluation dimensions of the storage space.
[0059] Currently, when the union file system receives a new data write request, it only allocates a storage space corresponding to the new data according to a pre-set allocation policy, usually based on the remaining available space of each storage space corresponding to the union file system, without considering other evaluation dimensions except the available remaining space. In the embodiments of the present application, the read / write performance and access frequency are also added to the allocation policy as evaluation dimensions. By evaluating the multiple storage spaces from multiple dimensions and obtaining the scores corresponding to the multiple evaluation dimensions, the performance of each dimension of the storage space can be measured from the scoring situation of each dimension, so as to obtain the storage space that best matches the currently written data.
[0060] Specifically, the multiple evaluation dimensions include: read / write performance, available remaining space, and access frequency. The read / write performance is the IOPS (Input / Output Operations Per Second) corresponding to the storage space: the number of read / write operations per second, with the unit of times (count); throughput: the amount of read / write data per second, with the unit of MB / s; latency: the time elapsed from the sending time of the IO operation to the receipt of the confirmation, with the unit of seconds. The available remaining space refers to the ratio of the available space to the total capacity of the multiple storage spaces. The access frequency refers to the historical access times of the multiple storage spaces within a fixed time. It should be noted that the multiple dimensions of the storage space are not limited to the three dimensions of read / write performance, available remaining space, and access frequency mentioned in the present application, and may also include other different dimensions, which are set according to the actual situation, and the present application does not make any limitations in this regard.
[0061] S103. Perform a weighted calculation on the scores corresponding to the multiple evaluation dimensions of the multiple storage spaces to obtain the comprehensive scores corresponding to the multiple storage spaces.
[0062] In some embodiments, after obtaining the scores of each of the three dimensions of read / write performance, available remaining space, and access frequency of the multiple storage spaces respectively, it is necessary to perform weighted calculation according to the preset weight coefficients corresponding to the multiple dimensions to obtain the comprehensive score corresponding to each storage space. By setting the preset weight coefficients corresponding to each dimension in this application, the corresponding weight coefficients can be set for multiple dimensions according to different usage scenarios of the storage space to meet the different requirements of different scenarios for the storage space. Exemplarily, in some high-performance computing tasks or scenarios where running a large database requires the storage space to have a high read / write speed, the preset weight coefficient corresponding to the dimension of read / write performance can be increased accordingly. So that when determining the target storage space based on the weighted comprehensive score subsequently, the storage space with high read / write performance can be preferentially used as the target storage space for use.
[0063] Exemplarily, there are 3 hard disks corresponding to the storage space in the current joint file system, namely hard disk 1, hard disk 2, and hard disk 3. At least two or more scores corresponding to the three dimensions of read / write performance, available remaining space, and access frequency corresponding to hard disk 1 are obtained respectively, and the same applies to hard disk 2 and hard disk 3. After obtaining the scores corresponding to each of the three dimensions of each hard disk, the comprehensive scores corresponding to the multiple storage spaces are obtained through the preset strategy for subsequent comparison.
[0064] S104. Use the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, and write the target data into the target storage space.
[0065] In some embodiments, after obtaining the comprehensive scores corresponding to the multiple storage spaces, compare the comprehensive scores corresponding to the multiple storage spaces, and select the storage space with the highest comprehensive score. The target storage space with the highest comprehensive score indicates that the storage space is the most matched with the current target data in terms of at least two or more of the three dimensions of read / write performance, available remaining space, and access frequency. Then write the target data into the target storage space.
[0066] Exemplarily, for hard disk 1, hard disk 2, and hard disk 3 corresponding to the storage space in the previous joint file system, the corresponding comprehensive scores are 60, 80, and 50 respectively. Obviously, the comprehensive score of hard disk 2 is the highest, so hard disk 2 is used as the target storage space, and the target data is written into the target storage space, that is, hard disk 2.
[0067] The data management method provided by the embodiments of this application is specifically as follows: receiving a write instruction for target data; the write instruction is used to store the target data in a corresponding target storage space; for each of multiple storage spaces, obtaining scores corresponding to multiple evaluation dimensions of the storage space; performing weighted calculation on the scores corresponding to the multiple evaluation dimensions of the multiple storage spaces to obtain comprehensive scores corresponding to the multiple storage spaces respectively; using the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, and writing the target data into the target storage space. By obtaining the scores of multiple evaluation dimensions corresponding to the storage space, and then obtaining the comprehensive scores corresponding to the multiple storage spaces respectively, and using the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, compared with the prior art that selects the target storage space from a single dimension of available remaining space, the embodiments of this application can evaluate the storage space from multiple dimensions to meet the data reading and writing needs of different scenarios, use the storage space more reasonably, and facilitate data management.
[0068] As an extension and refinement of the above embodiments, the embodiments of this application provide a data management method. Referring to Figure 2 as shown, this data management method includes the following steps S201 - S205:
[0069] S201. Receive a write instruction for target data.
[0070] Among them, the write instruction is used to store the target data in a corresponding target storage space.
[0071] S202. For each of multiple storage spaces, obtain scores corresponding to multiple evaluation dimensions of the storage space.
[0072] In some embodiments, the implementation method of obtaining scores corresponding to multiple evaluation dimensions of each storage space among multiple storage spaces can refer to the following steps:
[0073] For each of the multiple storage spaces, use a preset test method to evaluate multiple evaluation dimensions corresponding to the storage space, and obtain scores corresponding to the multiple evaluation dimensions of the storage space.
[0074] Specifically, first evaluate each dimension of each storage space to obtain index parameters, and then according to the index parameters of each dimension, obtain the scores corresponding to each dimension through the preset test method.
[0075] In the embodiments of the present application, the method for obtaining the index parameters of the read-write performance may be to use the Fio tool to test the read-write performance of the storage space. The read-write performance may include the capabilities of random write, sequential write, sequential mixed read-write, and random mixed read-write. Specifically, Fio is an open-source IOPS test tool under Linux, mainly used for stress testing and performance verification of hard disks or disks. It can generate many threads or processes to execute user-specific types of I / O operations. By writing a job file or directly using commands to execute the test actions, it is equivalent to a multi-threaded io generation tool for generating various IO modes to test the performance of hard disk devices (mostly used for testing the performance of bare disks). In the embodiments of the present application, developers can use the Fio tool to test the index parameters of read-write performance such as the read-write speed and I / O latency of the storage space, for example, IOPS (number of read / write operations per second), throughput, and latency.
[0076] In the embodiments of the present application, the method for obtaining the index parameters of the available remaining space may be as follows: Check the hard disk occupancy through the df command in linux (a free-to-use and freely distributable Unix-like operating system that is a multi-user, multi-tasking operating system supporting multi-threading and multi-CPUs). Through the df command, the file system can be viewed in units of disk partitions, and information such as how much space on the hard disk has been occupied and how much space remains can be obtained. The output results may include: Filesystem: represents which partition the file system is, so the device name is listed. 1K-blocks: indicates that the unit of the following numbers is 1KB. The unit size can be changed using -h or -m, or -B can be used to set it. Used: the size of the space that has been used. Available: the size of the remaining space. Use%: the disk usage rate. If the usage rate is above 90%, attention needs to be paid to avoid system problems caused by insufficient disk capacity, especially for situations where the file content increases rapidly (such as / home, / var / spool / mail, etc.). Mounted on: the directory where the disk is mounted, that is, which directory the disk is mounted under. Therefore, in the embodiments of the present application, by adding the mount points of each file system under the union file system behind the data write path, that is, each of the storage spaces, the proportion of the remaining available space of each storage space in the total space can be viewed respectively, that is, the index parameters of the available remaining space.
[0077] In the embodiments of the present application, the index parameter for obtaining the access frequency may be to track the number of read and write operations of each storage space through the iotop tool, so as to obtain the access frequency within a fixed time period; the iotop tool is an open-source and free tool similar to the top command for monitoring disk I / O usage, and iotop can monitor the I / O information of processes. It is written in the Python language. Compared with the iostat tool, iostat is a system-level IO monitoring, while iotop is a process-level IO monitoring and can also be used to display real-time disk activities. Most of the IO statistical tools under Linux, such as iostat and nmon, can only count the read and write situations per device. iotop monitors the I / O usage information output by the Linux kernel and displays the current I / O usage of processes or threads in a system. It shows the read and write I / O bandwidth of each process / thread. It also shows the percentage of time spent by threads / processes waiting for swapping in and waiting for I / O. Therefore, in the embodiments of the present application, the access frequency of the storage space within a period of time can be obtained through the iotop tool to obtain the parameter index of the access frequency.
[0078] After obtaining the index parameters corresponding to the multiple evaluation dimensions, it is also necessary to perform calculation processing on the index parameters to uniformly quantify the index parameters of different dimensions to obtain the corresponding scores. In the embodiments of the present application, corresponding preset test methods will be set for different evaluation dimensions to obtain the corresponding scores. The preset test method may be a pre-written test script. Through the test script, combined with the index parameters corresponding to the multiple evaluation dimensions, the scores of the multiple evaluation dimensions corresponding to the storage space can be obtained. Then, according to the scores of the multiple evaluation dimensions corresponding to the storage space, combined with the weight coefficients corresponding to the multiple evaluation dimensions, calculations are performed to obtain the comprehensive scores corresponding to each storage space.
[0079] S203. Obtain the preset weight coefficients of the multiple evaluation dimensions corresponding to the storage space.
[0080] Among them, the multiple evaluation dimensions include: read and write performance, available remaining space, and access frequency.
[0081] In some embodiments, when it is necessary to evaluate the storage space from three dimensions of read and write performance, available remaining space, and access frequency, the preset weight coefficients of the multiple evaluation dimensions can be set according to the requirements of the current actual situation.
[0082] Specifically, Task A's requirements for written data highly depend on the read-write speed of the storage space. For example, for some high-performance computing tasks or running large databases, etc., the weight coefficient of the read-write performance dimension can be appropriately increased, and then the storage spaces with high read-write performance can be preferentially used.
[0083] Task B focuses on the allocation and utilization of the storage space. For example, when the storage requirements continuously increase or the storage resources are limited, etc., the weight coefficient of the available remaining space dimension can be increased, and then the storage spaces with more remaining space can be preferentially used.
[0084] Task C has strict requirements for the access frequency. For example, when certain application apps are running an online service that requires quick response, the weight coefficient of the access frequency can be increased, and then the data that is frequently accessed is preferentially stored on the storage space with better performance.
[0085] S204. Multiply the scores of the read-write performance, the available remaining space, and the access frequency by the corresponding preset weight coefficients respectively to obtain the first weighted score, the second weighted score, and the third weighted score corresponding to the read-write performance, the available remaining space, and the access frequency respectively.
[0086] In some embodiments, the score (PerformanceScore) corresponding to the read-write performance in the multiple evaluation dimensions can be represented by P, (a*P) is the first weighted score, the score (Storage Score) of the available remaining space can be represented by S, (b*S) is the second score, the score (Access Frequency Score) of the access frequency can be represented by A, (c*A) is the third score. Specifically, after obtaining the first, second, and third weighted scores corresponding to the three dimensions of any storage space respectively, add the first, second, and third weighted scores, and then the comprehensive score of this storage space can be obtained. The comprehensive scores corresponding to multiple storage spaces can be obtained with reference to the following calculation formula:
[0087] Score = (a*P) + (b*S) + (c*A)
[0088] Among them, a, b, and c are respectively the weight coefficients corresponding to the read-write performance, the available remaining space, and the access frequency.
[0089] In the embodiments of the present application, the weight coefficients corresponding to the read-write performance, the available remaining space, and the access frequency are updated according to the actual situation or the usage scenario. Therefore, the data management method provided by the embodiments of the present application further includes the following Step 1 and Step 2:
[0090] Step 1. Receive a weight coefficient change instruction.
[0091] In some embodiments, when the user needs to change the weight coefficients corresponding to the multiple evaluation dimensions according to the actual situation or the requirements of the usage scenario, a weight change instruction can be issued to change the weight coefficients corresponding to the multiple evaluation dimensions; for example, when the expected read / write performance is the first weight, the proportion of weight coefficient a is set to be the highest, when the expected available remaining space is the first weight, the proportion of weight coefficient b is set to be the highest, and when the expected access frequency is the first weight, the proportion of weight coefficient c is set to be the highest; specifically, the weight coefficients corresponding to the current read / write performance, available remaining space, and access frequency are: a is 30%, b is 40%, and c is 30%. As the actual requirements change, if the data written at this time has a relatively high requirement for the read / write performance of the storage space, the weight coefficients can be appropriately adjusted. The weight coefficients corresponding to the read / write performance, available remaining space, and access frequency can be adjusted to: a is 50%, b is 25%, and c is 25%.
[0092] Step 2: In response to the change instruction, change the preset weight coefficients corresponding to the multiple evaluation dimensions respectively.
[0093] In some embodiments, the weight change instruction carries the target value of the weight coefficient that the user needs to change. Therefore, after receiving the weight coefficient change instruction, the weight coefficient can be directly changed.
[0094] S205: Add the first weighted score, the second weighted score, and the third weighted score to obtain the comprehensive scores corresponding to the multiple storage spaces.
[0095] In some embodiments, adding the first weighted score, the second weighted score, and the third weighted score to obtain the comprehensive scores corresponding to the multiple storage spaces can refer to the formula provided in the above step S204 to add the first weighted score, the second weighted score, and the third weighted score to obtain the comprehensive scores corresponding to the storage spaces, which will not be elaborated here.
[0096] S206: Use the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, and write the target data into the target storage space.
[0097] As an extension and refinement of the above embodiments, the embodiments of the present application provide a data management method, which further includes the following steps A and B:
[0098] Step A: Obtain the priority order of the multiple storage spaces.
[0099] In some embodiments, a priority order may also be set for the multiple storage spaces. Exemplarily, for the current joint file system with hard disk A, hard disk B, and hard disk C, the priority order may be: hard disk A > hard disk B > hard disk C. Therefore, when determining the target storage space, even if the comprehensive score of hard disk B is greater than that of hard disk A, since the priority of hard disk A is higher than that of hard disk B, the target storage space is still hard disk A.
[0100] In the embodiments of the present application, the method for obtaining the priority order of the storage spaces is as follows in steps a and b:
[0101] Step a: Periodically obtain the running states corresponding to the multiple storage spaces.
[0102] Step b: Based on the running states corresponding to the multiple storage spaces, update the priority order of the multiple storage spaces.
[0103] In the embodiments of the present application, corresponding policy methods may be set to periodically monitor the running states of the individual storage spaces in the joint file system. When a certain storage space among the multiple storage spaces fails or becomes inaccessible, the priority order is adjusted in a timely manner. The priority order of the storage space that has failed or become inaccessible is set at the end of the priority order, or directly deleted from the priority order to ensure the normal operation of the entire current joint file system.
[0104] Step B: According to the priority order of the multiple storage spaces, obtain the target storage space from the multiple storage spaces.
[0105] In some embodiments, after obtaining the priority order of the individual storage spaces, the storage spaces are evaluated from the priority order to obtain the final target storage space.
[0106] In the embodiments of the present application, by periodically obtaining the priority order of the multiple storage spaces and obtaining the target storage space, it is possible to adjust the priority order in real time and dynamically according to the running conditions of the current storage spaces, avoiding putting damaged or malfunctioning storage spaces into use and causing unnecessary problems; at the same time, it is also possible to meet the requirements of different situations according to the weight coefficients of different evaluation dimensions, weigh and optimize multiple factors related to hard disks, and meet various different environmental and application requirements.
[0107] Combined with the above embodiments, referring to Figure 3 As shown, it is a schematic diagram of the system architecture of a data management method provided by the embodiments of the present application, which includes a receiving module 31, a performance evaluation module 32, and a data distribution module 33;
[0108] Specifically, the receiving module 31 is configured to receive a write instruction for target data.
[0109] The performance evaluation module 32 is configured to obtain scores corresponding to multiple evaluation dimensions of each storage space among multiple storage spaces; the multiple evaluation dimensions at least include at least two or more of read / write performance, available remaining space, and access frequency; and perform weighted calculation on the scores corresponding to the multiple evaluation dimensions of the multiple storage spaces to obtain comprehensive scores corresponding to the multiple storage spaces respectively.
[0110] The data distribution module 33 is configured to use the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, and write the target data into the target storage space.
[0111] Based on the same inventive concept, as an implementation of the above method, an embodiment of the present application further provides a data management device. This embodiment corresponds to the foregoing method embodiment. For the convenience of reading, details of the foregoing method embodiment will not be repeated one by one in this embodiment. However, it should be clear that the data management device in this embodiment can correspondingly implement all the contents of the foregoing method embodiment.
[0112] An embodiment of the present application provides a data management device. Figure 4 As shown in the structural schematic diagram of the data management device, Figure 4 as shown, the data management device 400 includes:
[0113] A receiving unit 401 is configured to receive a write instruction for target data; the write instruction is used to store the target data into a corresponding target storage space.
[0114] An obtaining unit 402 is configured to obtain scores corresponding to multiple evaluation dimensions of each storage space among multiple storage spaces; the multiple evaluation dimensions at least include at least two or more of read / write performance, available remaining space, and access frequency.
[0115] A calculating unit 403 is configured to perform weighted calculation on the scores corresponding to the multiple evaluation dimensions of the multiple storage spaces to obtain comprehensive scores corresponding to the multiple storage spaces respectively.
[0116] A writing unit 404 is configured to use the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, and write the target data into the target storage space.
[0117] As an optional implementation manner of an embodiment of the present application, the calculation unit 403 is specifically configured to obtain preset weight coefficients of multiple evaluation dimensions corresponding to the storage space; the multiple evaluation dimensions include: read-write performance, available remaining space, and access frequency; multiply the score of the read-write performance, the score of the available remaining space, and the score of the access frequency by the corresponding preset weight coefficients respectively to obtain first weighted scores, second weighted scores, and third weighted scores corresponding to the read-write performance, the available remaining space, and the access frequency respectively; add the first weighted score, the second weighted score, and the third weighted score to obtain a comprehensive score corresponding to the multiple storage spaces.
[0118] As an optional implementation manner of an embodiment of the present application, the obtaining unit 402 is further configured to obtain the priority order of the multiple storage spaces; and obtain the target storage space from the multiple storage spaces according to the priority order of the multiple storage spaces.
[0119] As an optional implementation manner of an embodiment of the present application, the data management device further includes an update unit, which is specifically configured to periodically obtain the running states corresponding to the multiple storage spaces; and update the priority order of the multiple storage spaces based on the running states corresponding to the multiple storage spaces.
[0120] As an optional implementation manner of an embodiment of the present application, the obtaining unit 402 is specifically configured to, for each of the multiple storage spaces, evaluate multiple evaluation dimensions corresponding to the storage space by using a preset test method to obtain scores of the multiple evaluation dimensions corresponding to the storage space.
[0121] As an optional implementation manner of an embodiment of the present application, the receiving unit 401 is specifically configured to receive a weight coefficient change instruction; and in response to the change instruction, change the preset weight coefficients corresponding to the multiple evaluation dimensions respectively.
[0122] Based on the same inventive concept, an embodiment of the present disclosure further provides an electronic device. Figure 5 The following is a schematic structural diagram of the electronic device provided by the embodiment of the present disclosure. As Figure 5 shown, the electronic device provided in this embodiment includes: a memory 501 and a processor 502. The memory 501 is used to store a computer program; the processor 502 is configured to execute the audio data processing method provided in the above embodiment when executing the computer program.
[0123] Based on the same inventive concept, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the computing device is enabled to implement the data management method provided in the above embodiment.
[0124] Based on the same inventive concept, an embodiment of the present application further provides a vehicle, which includes the data management device provided in the above embodiment or the electronic device provided in the above embodiment.
[0125] Those skilled in the art should understand that the embodiments of the present application may be provided as a method, a system, or a computer program product. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media that contain computer-usable program code.
[0126] The processor may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0127] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of, for example, read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0128] Computer-readable media include both permanent and non-permanent, removable and non-removable storage media. The storage media can implement information storage by any method or technology, and the information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information accessible by a computing device. As defined herein, computer-readable media do not include transitory media such as modulated data signals and carrier waves.
[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A data management method, characterized in that, it includes: Receiving a write instruction for target data; The write instruction is used to store the target data into a corresponding target storage space; For each of multiple storage spaces, obtaining scores corresponding to multiple evaluation dimensions of the storage space; Performing weighted calculation on the scores corresponding to multiple evaluation dimensions of the multiple storage spaces to obtain comprehensive scores corresponding to the multiple storage spaces respectively; Taking the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, and writing the target data into the target storage space.
2. The data management method according to claim 1, characterized in that, The performing weighted calculation on the scores corresponding to multiple evaluation dimensions of the multiple storage spaces to obtain comprehensive scores corresponding to the multiple storage spaces respectively; includes: Obtaining preset weight coefficients of multiple evaluation dimensions corresponding to the storage space; the multiple evaluation dimensions include: read-write performance, available remaining space, access frequency; Multiplying the score of the read-write performance, the score of the available remaining space, and the score of the access frequency by the corresponding preset weight coefficients respectively to obtain a first weighted score, a second weighted score, and a third weighted score corresponding to the read-write performance, the available remaining space, and the access frequency respectively; Adding the first weighted score, the second weighted score, and the third weighted score to obtain the comprehensive scores corresponding to the multiple storage spaces.
3. The data management method according to claim 1, characterized in that, Before taking the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, the method further includes: Obtaining the priority order of the multiple storage spaces; Obtaining the target storage space from the multiple storage spaces according to the priority order of the multiple storage spaces.
4. The data management method according to claim 3, characterized in that, Before obtaining the priority order of the multiple storage spaces, the method further includes: Periodically obtaining the running states corresponding to the multiple storage spaces; Updating the priority order of the multiple storage spaces based on the running states corresponding to the multiple storage spaces.
5. The data management method according to claim 1, characterized in that, The obtaining scores corresponding to multiple evaluation dimensions of the storage space for each of multiple storage spaces, includes: For each of the multiple storage spaces, using a preset test method to evaluate multiple evaluation dimensions corresponding to the storage space to obtain scores of the multiple evaluation dimensions corresponding to the storage space.
6. The data management method according to claim 2, characterized in that, The obtaining preset weight coefficients of multiple evaluation dimensions corresponding to the storage space, includes: Receiving a weight coefficient change instruction; Responding to the change instruction, changing the preset weight coefficients corresponding to the multiple evaluation dimensions respectively.
7. A data management device, characterized in that, it includes: A receiving unit, configured to receive a write instruction for target data; The write instruction is used to store the target data into the corresponding target storage space; An acquisition unit, configured to acquire scores corresponding to multiple evaluation dimensions of each storage space among multiple storage spaces; The multiple evaluation dimensions at least include at least two or more of read-write performance, available remaining space, and access frequency; A calculation unit, configured to perform weighted calculation on the scores corresponding to the multiple evaluation dimensions of the multiple storage spaces to obtain comprehensive scores corresponding to the multiple storage spaces respectively; A write unit, configured to use the storage space with the highest comprehensive score among the multiple storage spaces as the target storage space, and write the target data into the target storage space.
8. An electronic device, characterized in that it includes: A memory and a processor, the memory is used to store a computer program; the processor is used to cause the electronic device to implement the data management method according to any one of claims 1-7 when executing the computer program.
9. A computer-readable storage medium, characterized in that A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a computing device, the computing device is caused to implement the data management method according to any one of claims 1-7.
10. A vehicle, characterized in that it includes: The data management device according to claim 7 or the electronic device according to claim 8.