Data storage method and device, electronic equipment and readable storage medium

By dynamically adjusting the data storage space, the problem of low efficiency of cold data query is solved, and efficient data query and business demand support is achieved.

CN120045124APending Publication Date: 2025-05-27GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411927026.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The prior art intercool data query is inefficient and cannot efficiently support and adapt to business needs, especially when the access frequency of cold and hot data changes.

Method used

By responding to data access requests, the data priority in the access time and storage space is obtained, and priority is adjusted according to the access time and endpoint time of the work cycle. According to the data storage time and preset time, determine the target storage space and migrate the data when necessary to dynamically adjust the storage space.

Benefits of technology

It improves the efficiency of data query, can efficiently support and adapt to business needs, especially dynamically adjust storage space when access frequency changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120045124A_ABST
    Figure CN120045124A_ABST
Patent Text Reader

Abstract

The invention provides a data storage method and device, electronic equipment and a readable storage medium, and the method comprises the steps: in response to an access request for data, obtaining an access moment corresponding to the access request and the priority of the data which is stored in a first storage space and corresponds to the access request, adjusting the priority of the data according to a first comparison result of the access moment and the endpoint moment of the current work period to obtain the adjusted priority of the data, and adjusting the priority of the data according to a second comparison result of the storage moment of the data and the preset moment and a third comparison result of the adjusted priority of the data and the preset priority. And determining a target storage space from the first storage space and the second storage space, and if the first storage space of the data is not consistent with the target storage space, migrating the data to the target storage space. The data query efficiency can be improved, and business requirements are efficiently supported and adapted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of data storage, and particularly relates to a data storage method, apparatus, electronic device, and readable storage medium. Background Art

[0002] With the popularization of cloud computing and the Internet of Things, the amount of data is growing at an unprecedented high speed. Enterprises need to process more and more data, and how to manage these data reasonably and efficiently becomes particularly important.

[0003] In related technologies, according to the access frequency of data, the data generated by offline home host devices is divided into cold data and hot data, and the cold data and hot data are stored in corresponding storage spaces respectively for data storage.

[0004] However, when the access frequencies of cold data and hot data change, that is, the access frequency of cold data increases and the access frequency of hot data decreases, there will be a problem of low query efficiency of cold data, and it is impossible to efficiently support and adapt to business requirements. Summary of the Invention

[0005] This application aims to provide a data storage method, apparatus, electronic device, and readable storage medium, at least solving the problem of low query efficiency of cold data in the prior art and the problem of being unable to efficiently support and adapt to business requirements.

[0006] In a first aspect, an embodiment of this application discloses a data storage method, and the method includes:

[0007] In response to an access request for data, obtain the access time corresponding to the access request and the priority of the data stored in the first storage space corresponding to the access request; the storage space further includes a second storage space, and the average access frequency of the data in the first storage space is different from that in the second storage space;

[0008] According to the first comparison result between the access time and the end time of the current working cycle, adjust the priority of the data to obtain the adjusted priority of the data; the priority of the data is used to reflect the expected access frequency of the data; the higher the priority of the data, the higher the expected access frequency of the data;

[0009] According to the second comparison result between the storage time of the data and a preset time, and the third comparison result between the adjusted priority of the data and a preset priority, determine a target storage space from the first storage space and the second storage space;

[0010] If the first storage space of the data is inconsistent with the target storage space, migrate the data to the target storage space.

[0011] In a second aspect, embodiments of the present application disclose a data storage device, the device comprising:

[0012] A first acquisition module, configured to, in response to an access request for data, acquire an access time corresponding to the access request and a priority of the data stored in a first storage space and corresponding to the access request; the storage space further includes a second storage space, and an average access frequency of the data in the first storage space is different from that of the second storage space;

[0013] An adjustment module, configured to adjust the priority of the data according to a first comparison result between the access time and an end time of a current working cycle, so as to obtain an adjusted priority of the data; the priority of the data is used to reflect an expected access frequency of the data; the higher the priority of the data, the higher the expected access frequency of the data;

[0014] A first determination module, configured to determine a target storage space from the first storage space and the second storage space according to a second comparison result between a storage time of the data and a preset time, and a third comparison result between the adjusted priority of the data and a preset priority;

[0015] A migration module, configured to, if the first storage space of the data is inconsistent with the target storage space, migrate the data to the target storage space.

[0016] In a third aspect, embodiments of the present application further disclose an electronic device, comprising a processor and a memory, where the memory stores a program or instruction that can run on the processor, and when the program or instruction is executed by the processor, the steps of the method as described in the first aspect are implemented.

[0017] In a fourth aspect, embodiments of the present application further disclose a readable storage medium, where a program or instruction is stored on the readable storage medium, and when the program or instruction is executed by a processor, the steps of the method as described in the first aspect are implemented.

[0018] In summary, in the embodiments of the present application, in response to an access request for data, the access time corresponding to the access request and the priority of the data stored in the first storage space corresponding to the access request are obtained. The storage space further includes a second storage space. The average access frequency of the data in the first storage space is different from that of the second storage space. According to the first comparison result between the access time and the endpoint time of the current working cycle, the priority of the data is adjusted to obtain the adjusted priority of the data. The priority of the data is used to reflect the expected access frequency of the data. The higher the priority of the data, the higher the expected access frequency of the data. According to the second comparison result between the data storage time and the preset time, and the third comparison result between the adjusted priority of the data and the preset priority, a target storage space is determined from the first storage space and the second storage space. If the first storage space of the data is inconsistent with the target storage space, the data is migrated to the target storage space. In the embodiments of the present application, according to the first comparison result between the access time and the endpoint time of the current working cycle, the priority of the data is adjusted, so that according to the second comparison result between the data storage time and the preset time, and the third comparison result between the adjusted priority of the data and the preset priority, the target storage space is determined. Instead of only storing data in a fixed storage space. Therefore, when the access frequency of the data changes, the storage space of the data can be dynamically adjusted, which can improve the query efficiency of the data and efficiently support and adapt to business requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In the drawings:

[0020] Figure 1 is a flowchart of the steps of a data storage method provided by an embodiment of the present application;

[0021] Figure 2 is a flowchart of the steps of another data storage method provided by an embodiment of the present application;

[0022] Figure 3 is a flowchart of the steps of yet another data storage method provided by an embodiment of the present application;

[0023] Figure 4 is a block diagram of a data storage device provided by an embodiment of the present application;

[0024] Figure 5 is a block diagram of an electronic device according to an embodiment provided by an embodiment of the present application;

[0025] Figure 6 is a block diagram of an electronic device according to another embodiment provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0026] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0027] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than 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 application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually of the same type, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally indicates an "or" relationship between the associated objects before and after.

[0028] Figure 1 is a step flowchart of a data storage method provided by an embodiment of the present application. Refer to Figure 1 , the method may include the following steps:

[0029] Step 101, in response to an access request for data, obtain the access time corresponding to the access request and the priority of the data stored in the first storage space corresponding to the access request; the storage space further includes a second storage space, and the average access frequency of the data in the first storage space is different from that in the second storage space.

[0030] Exemplarily, the average access frequency of the data in the first storage space is different from that in the second storage space. For example, the average access frequency of the data in the first storage space can be less than that in the second storage space. At this time, the first storage space is a cold space for storing cold data, and the second storage space is a hot space for storing hot data. Another example is that the average access frequency of the data in the first storage space can be greater than that in the second storage space. At this time, the first storage space is a hot space for storing hot data, and the second storage space is a cold space for storing cold data. Among them, the access frequencies of cold and hot data are different, and the access frequency of hot data is higher than that of cold data.

[0031] Exemplarily, the cold space and the hot space usually refer to the access frequency of data in memory. This concept is based on the observed phenomenon that not all memory data is accessed equally. Some data is accessed frequently, i.e., hot data, while other data is rarely accessed, i.e., cold data. The purpose of distinguishing the cold space and the hot space is to optimize system performance and the use of storage resources. By keeping hot data in the fast-access hot space, the memory access latency can be reduced and the system response speed can be increased. At the same time, migrating cold data to the colder space with lower cost can reduce the overall storage cost.

[0032] Exemplarily, the priority of data is used to reflect the expected access frequency of the data, and the priority of the data is proportional to the expected access frequency of the data. That is to say, the higher the expected access frequency of the data, the higher the priority of the data. The lower the expected access frequency of the data, the lower the priority of the data.

[0033] Exemplarily, the data can be log information generated by an offline home host. The offline home host is a central control device that can control smart home devices under the same local area network.

[0034] Step 102: Adjust the priority of the data according to the first comparison result between the access time and the endpoint time of the current working cycle, and obtain the adjusted priority of the data; the priority of the data is used to reflect the expected access frequency of the data; the higher the priority of the data, the higher the expected access frequency of the data.

[0035] Exemplarily, compare the access time with the endpoint time of the current working cycle to obtain the first comparison result for adjusting the priority of the data.

[0036] Exemplarily, the endpoint time of the current working cycle includes the start time and the end time. If the access time is greater than the endpoint time of the current working cycle, it means that the access time exceeds the end time of the current working cycle, and the data is not accessed during the current working cycle. If the access time is between the two endpoint times of the current working cycle, it means that the access time is greater than the start time of the current working cycle and less than the end time of the current working cycle, and the data is accessed during the current working cycle.

[0037] Exemplarily, after comparing the access time with the endpoint time of the current working cycle to obtain the first comparison result in the embodiment of the present application, the priority of the data is adjusted according to the first comparison result, so that the target storage space can be determined based on the adjusted priority of the data. Instead of only storing the data in a fixed storage space, therefore, when the access frequency of the data changes, the storage space of the data can be dynamically adjusted, which can improve the query efficiency of the data and efficiently support and adapt to business requirements.

[0038] Step 103: Determine a target storage space from the first storage space and the second storage space according to the second comparison result between the storage time of the data and a preset time, and the third comparison result between the priority of the adjusted data and a preset priority.

[0039] Exemplarily, the preset time can be a custom time used to compare with the storage time of the data to obtain the second comparison result.

[0040] Exemplarily, the preset priority can be a priority defined manually before data migration. The priority of the data can be defined according to the data type to which the data belongs. For example, when the device is initialized, simple priority classification is performed on the data generated by the device. Taking the data type of error type as an example, when a device fails during operation, the data of the error type is more convenient for developers to troubleshoot fault information. Therefore, within a short period of time after the error type data appears, it is more likely to be frequently queried, so the priority is higher.

[0041] Exemplarily, the priority of the adjusted data is compared with the preset priority to obtain the third comparison result. According to the second comparison result and the third comparison result, the target storage space is determined from the first storage space and the second storage space, rather than simply storing the data in a fixed storage space. Therefore, when the access frequency of the data changes, the storage space of the data can be dynamically adjusted, which can improve the query efficiency of the data and efficiently support and adapt to business requirements.

[0042] Step 104: If the first storage space of the data is inconsistent with the target storage space, migrate the data to the target storage space.

[0043] Exemplarily, after determining the target storage space from the first storage space and the second storage space according to the second comparison result between the storage time of the data and a preset time, and the third comparison result between the priority of the adjusted data and a preset priority, if the target storage space is the first storage space, no data migration is performed; if the target storage space is the second storage space, the data is migrated to the second storage space.

[0044] In summary, in the embodiment of the present application, in response to an access request for data, the access time corresponding to the access request and the priority of the data stored in the first storage space corresponding to the access request are obtained. The storage space further includes a second storage space, and the average access frequency of the data in the first storage space is different from that in the second storage space. According to the first comparison result between the access time and the endpoint time of the current working cycle, the priority of the data is adjusted to obtain the adjusted priority of the data. The priority of the data is used to reflect the expected access frequency of the data. The higher the priority of the data, the higher the expected access frequency of the data. According to the second comparison result between the data storage time and the preset time, and the third comparison result between the adjusted priority of the data and the preset priority, a target storage space is determined from the first storage space and the second storage space. If the first storage space of the data is inconsistent with the target storage space, the data is migrated to the target storage space. In the embodiment of the present application, the priority of the data is adjusted according to the first comparison result between the access time and the endpoint time of the current working cycle, so as to determine the target storage space according to the second comparison result between the data storage time and the preset time, and the third comparison result between the adjusted priority of the data and the preset priority. Instead of only storing data in a fixed storage space, therefore, when the access frequency of the data changes, the storage space of the data can be dynamically adjusted, which can improve the query efficiency of the data and efficiently support and adapt to business requirements.

[0045] Figure 2 is a flowchart of the steps of another data storage method provided by the present application. Refer to Figure 2 , the method may include the following steps:

[0046] Step 201, in response to an access request for data, obtain the access time corresponding to the access request and the priority of the data stored in the first storage space corresponding to the access request; the storage space further includes a second storage space, and the average access frequency of the data in the first storage space is different from that in the second storage space.

[0047] This step can specifically refer to the above step 101 and will not be elaborated here.

[0048] Optionally, the first storage space is a cold space for storing cold data, and the second storage space is a hot space for storing hot data, or the first storage space is a hot space for storing hot data, and the second storage space is a cold space for storing cold data. Among them, the access frequencies of cold and hot data are different, and the access frequency of hot data is higher than that of cold data.

[0049] Optionally, before step 201, the method further includes:

[0050] Step A1: Determine the data type to which the data stored in the first storage space and the second storage space belongs; the data type includes any one of the following: abnormal data, instruction data, and running data;

[0051] Step A2: If the data type belongs to a preset data type, set the priority of the data to a priority greater than a first preset value;

[0052] Step A3: If the data type does not belong to the preset data type, set the priority of the data to a priority less than or equal to a second preset value.

[0053] For steps A1 - A3, the preset data type can include any one of abnormal data and instruction data. After determining the data type to which the data stored in the first storage space and the second storage space belongs, if the data type belongs to any one of abnormal data and instruction data, set the priority of the data to a priority greater than a first preset value; if the data type belongs to running data, set the priority of the data to a priority less than or equal to a second preset value.

[0054] Exemplarily, abnormal data is the log information generated when the device encounters an abnormality, usually used for problem analysis. Instruction data is a data type used for training large models, usually presented in the form of question and answer. Abnormal data and instruction data are log information with a relatively high usage frequency, so their priorities are relatively high. Running data is the log information generated during the normal operation of the device. These information are usually not accessed but are necessary log information, so their priorities are relatively low.

[0055] Step 202: Adjust the priority of the data according to the first comparison result between the access time and the end time of the current working cycle to obtain the adjusted priority of the data; the priority of the data is used to reflect the expected access frequency of the data; the higher the priority of the data, the higher the expected access frequency of the data.

[0056] This step can specifically refer to step 102 above and will not be elaborated here.

[0057] Optionally, step 202 can specifically include:

[0058] Sub-step 2021: If the access time is greater than or equal to the end time of the current working cycle, lower the priority of the data, and determine the lowered priority of the data as the adjusted priority of the data;

[0059] Sub-step 2022: If the access time is less than the end time of the current working cycle, increase the priority of the data, and determine the increased priority of the data as the priority of the adjusted data.

[0060] For sub-step 2021 - sub-step 2022, taking the current priority of the data as level 7 as an example, if the access time is greater than or equal to the end time of the current working cycle, reduce the priority of the data, adjust the priority of the data to level 6, and determine level 6 as the priority of the adjusted data; if the access time is less than the end time of the current working cycle, increase the priority of the data, adjust the priority of the data to level 8, and determine level 8 as the priority of the adjusted data.

[0061] Exemplarily, taking the data type as instruction data and the data as turning on the air conditioner, the current priority of turning on the air conditioner is level 7. If the access time of turning on the air conditioner is greater than or equal to the end time of the current working cycle of the device, reduce the priority of turning on the air conditioner, adjust the priority of turning on the air conditioner to level 6; if the access time of turning on the air conditioner is less than the end time of the current working cycle of the device, increase the priority of turning on the air conditioner, adjust the priority of turning on the air conditioner to level 8.

[0062] Optionally, after step 201, the method further includes:

[0063] Step B1: Obtain the access time of the historical data and the priority of the historical data in the last time period, and obtain the sample data composed of the access time of the historical data and the priority of the historical data;

[0064] Step B2: Input the sample data into a machine learning model for training to obtain a priority prediction model; the priority prediction model is used to predict the priority of the adjusted data;

[0065] Step B3: Input the access time into the priority prediction model to obtain the priority corresponding to the data, and determine the priority corresponding to the data as the priority of the adjusted data.

[0066] For steps B1 - B3, first, obtain the access time and priority of historical data in the previous time period to get sample data composed of the access time and priority of historical data. Second, input the sample data into a machine learning model for training to obtain a priority prediction model. Finally, input the access time into the priority prediction model to get the priority corresponding to the data, and determine the priority corresponding to the data as the priority of the adjusted data. After the user has used it for a period of time, classify some data according to the user's usage habits. For example, record the log information that the user is accustomed to using within a certain period of each day for model training and analyze the user's usage habits.

[0067] Step 203: If the storage time of the data is greater than or equal to the preset time and the priority of the adjusted data is higher than the preset priority, determine that the target storage space of the data is the second storage space.

[0068] Exemplarily, the preset time and the preset priority can be customized. If the time when the data is stored in the corresponding storage space is greater than or equal to the preset time, it means that the data is stored relatively late. If the priority of the adjusted data is higher than the preset priority, it means that the priority of the data is relatively high. If the data is stored relatively late and the priority of the data is relatively high, determine the target storage space of the data as the second storage space.

[0069] Step 204: If the storage time of the data is less than the preset time and the priority of the adjusted data is lower than the preset priority, determine that the target storage space of the data is the first storage space.

[0070] Exemplarily, the preset time and the preset priority can be customized. If the time when the data is stored in the corresponding storage space is less than the preset time, it means that the data is stored relatively early. If the priority of the adjusted data is lower than the preset priority, it means that the priority of the data is relatively low. If the data is stored relatively early and the priority of the data is relatively low, determine the target storage space of the data as the first storage space.

[0071] Step 205: If the first storage space of the data is inconsistent with the target storage space, migrate the data to the target storage space.

[0072] This step can specifically refer to step 104 above and will not be elaborated here.

[0073] Exemplarily, taking the data type as instruction data and the data as turning on the air conditioner as an example, if the time when turning on the air conditioner is stored in the first storage space is greater than or equal to the preset time, it means that the time when turning on the air conditioner is stored is relatively late. If the adjusted priority of turning on the air conditioner is higher than the preset priority, it means that the priority of turning on the air conditioner is relatively high. If the time when turning on the air conditioner is stored is relatively late and the priority of turning on the air conditioner is relatively high, then the target storage space for turning on the air conditioner is determined as the second storage space. If the time when turning on the air conditioner is stored in the first storage space is less than the preset time, it means that the time when turning on the air conditioner is stored is relatively early. If the adjusted priority of turning on the air conditioner is lower than the preset priority, it means that the priority of turning on the air conditioner is relatively low. If the time when turning on the air conditioner is stored is relatively early and the priority of turning on the air conditioner is relatively low, then the target storage space for turning on the air conditioner is determined as the first storage space. If the target storage space is the first storage space, no data migration is performed. If the target storage space is the second storage space, then turning on the air conditioner is migrated to the second storage space.

[0074] Optionally, the method further includes:

[0075] Step 206: Monitor the space capacity of the storage space in each time period to obtain the actual space capacity of the storage space;

[0076] Step 207: If the actual space capacity is greater than or equal to the preset space capacity and the average access frequency of the first storage space is less than that of the second storage space, delete the data in the first storage space until the actual space capacity of the storage space is less than the preset space capacity;

[0077] Step 208: If the actual space capacity is greater than or equal to the preset space capacity and the average access frequency of the first storage space is greater than or equal to that of the second storage space, delete the data in the second storage space until the actual space capacity of the storage space is less than the preset space capacity.

[0078] Regarding steps 206 - 208, in each time period, monitor the space capacity of the storage space to obtain the actual space capacity of the storage space. If the actual space capacity is greater than or equal to the preset space capacity and the average access frequency of the first storage space is less than that of the second storage space, delete the data in the first storage space until the actual space capacity of the storage space is less than the preset space capacity. If the actual space capacity is greater than or equal to the preset space capacity and the average access frequency of the first storage space is greater than or equal to that of the second storage space, delete the data in the second storage space until the actual space capacity of the storage space is less than the preset space capacity. In the embodiments of the present application, the first storage space or the second storage space that is generated earliest is cleaned every once in a while. When the space capacity of the storage space is insufficient, the data in the earliest first storage space or second storage space is deleted.

[0079] Exemplarily, in the embodiments of the present application, the central processing unit (CPU) occupancy of the offline home host is monitored through other services. The running status of each service in the server is monitored through the Eureka registry. It is also possible to add monitoring of the CPU and storage space capacity in the registry, so as to monitor the resource occupancy of the offline home host and dynamically adjust and clear early data. The offline home host is a device that contains its own hardware information. Assuming that the memory of the device is only 1 gigabyte (G), and the space capacity of each storage space is 50 megabytes (M), when the 1G memory is about to be full, by clearing some unnecessary data, the unnecessary memory occupancy can be reduced.

[0080] Optionally, the method further includes:

[0081] Step C1: If there are multiple first storage spaces in the storage space, obtain the generation time of the data stored in all the first storage spaces;

[0082] Step C2: Determine the generation time of the first storage space as the latest time among the generation times of the data in each first storage space;

[0083] Step 207 may specifically include:

[0084] Sub-step 2071: Delete the data in the first storage space in the order from earliest to latest according to the generation time of the first storage space.

[0085] Regarding Step C1 - Step C2 and Sub-step 2071, if there are multiple first storage spaces in the storage space, obtain the generation time of the data stored in all the first storage spaces, determine the generation time of the first storage space as the latest time among the generation times of the data in each first storage space, and delete the data in the first storage space in the order from earliest to latest according to the generation time of the first storage space.

[0086] Optionally, the method further includes:

[0087] Step D1: If there are multiple second storage spaces in the storage space, obtain the generation time of the data stored in all the second storage spaces;

[0088] Step D2: Determine the generation time of the second storage space as the latest time among the generation times of the data in each second storage space;

[0089] Step 207 may specifically include:

[0090] Sub-step 2072: Delete the data in the second storage space in the order from the earliest to the latest generation time of the second storage space.

[0091] For step D1 - step D2 and sub-step 2072, if there are multiple second storage spaces in the storage space, obtain the generation times of the data stored in all second storage spaces, and determine the generation time of the second storage space as the latest time among the generation times of the data in each second storage space. Then, delete the data in the second storage space in the order from the earliest to the latest generation time of the second storage space.

[0092] Optionally, the method further includes:

[0093] Step 209: Calculate the actual access frequency of the data within each time period;

[0094] Step 210: If the access frequency of the data is less than the first threshold, determine the first storage space as the target storage space for the data;

[0095] Step 211: If the access frequency of the data is greater than or equal to the first threshold, determine the second storage space as the target storage space for the data.

[0096] For steps 209 - 211, the actual access frequency of the data can be the quantity of the data. Taking the average access frequency of the first storage space being less than that of the second storage space as an example, if the quantity of the data is less than the first threshold, determine the first storage space as the target storage space for the data; if the quantity of the data is greater than or equal to the first threshold, determine the second storage space as the target storage space for the data. Taking the average access frequency of the first storage space being greater than that of the second storage space as an example, if the quantity of the data is less than the first threshold, determine the second storage space as the target storage space for the data; if the quantity of the data is greater than or equal to the first threshold, determine the first storage space as the target storage space for the data.

[0097] Optionally, the method further includes:

[0098] Step 212: If the access frequency of the data in the first storage space is greater than the second threshold, determine the second storage space as the target storage space for the data;

[0099] Step 213: If the access frequency of the data in the second storage space is less than the third threshold, determine the first storage space as the target storage space for the data.

[0100] Regarding steps 212 - 213, taking the example where the average access frequency of the first storage space is less than that of the second storage space, the second threshold is the maximum value of the access frequencies of the data in the first storage space, and the third threshold is the minimum value of the access frequencies of the data in the second storage space. If the access frequency of the data in the first storage space is greater than the maximum value of the access frequencies of the data in the first storage space, then the second storage space is determined as the target storage space for the data. If the access frequency of the data in the second storage space is less than the minimum value of the access frequencies of the data in the second storage space, then the first storage space is determined as the target storage space for the data.

[0101] Exemplarily, taking the example where the average access frequency of the first storage space is greater than that of the second storage space, the second threshold is the maximum value of the access frequencies of the data in the second storage space, and the third threshold is the minimum value of the access frequencies of the data in the first storage space. If the access frequency of the data in the second storage space is greater than the maximum value of the access frequencies of the data in the second storage space, then the first storage space is determined as the target storage space for the data. If the access frequency of the data in the first storage space is less than the minimum value of the access frequencies of the data in the first storage space, then the second storage space is determined as the target storage space for the data.

[0102] In the embodiments of the present application, in response to an access request for data, the access time corresponding to the access request and the priority of the data stored in the first storage space corresponding to the access request are obtained. The storage space further includes a second storage space. The average access frequency of the data in the first storage space is different from that of the second storage space. According to the first comparison result between the access time and the endpoint time of the current working cycle, the priority of the data is adjusted to obtain the adjusted priority of the data. The priority of the data is used to reflect the expected access frequency of the data. The higher the priority of the data, the higher the expected access frequency of the data. According to the second comparison result between the storage time of the data and the preset time, and the third comparison result between the adjusted priority of the data and the preset priority, the target storage space is determined from the first storage space and the second storage space. If the first storage space of the data is inconsistent with the target storage space, then the data is migrated to the target storage space. In the embodiments of the present application, the priority of the data is adjusted according to the first comparison result between the access time and the endpoint time of the current working cycle, so as to determine the target storage space according to the second comparison result between the storage time of the data and the preset time, and the third comparison result between the adjusted priority of the data and the preset priority. Instead of only storing the data in a fixed storage space, therefore, when the access frequency of the data changes, the storage space of the data can be dynamically adjusted, which can improve the query efficiency of the data and efficiently support and adapt to business requirements.

[0103] See Figure 3, which shows a flowchart of steps of another data storage method provided by an embodiment of the present application, specifically including:

[0104] Step S1, set data priorities.

[0105] Step S2, determine the storage space used by the current service running data as the hot storage space.

[0106] Step S3, if there is data in the cold storage space with a priority higher than the preset priority and there is data in the hot storage space with a priority lower than the preset priority, then exchange the data with a priority higher than the preset priority in the cold storage space for the data with a priority lower than the preset priority in the hot storage space.

[0107] Step S4, dynamically adjust the priorities of the data.

[0108] Step S5, when the space capacity of the storage space is greater than or equal to the preset space capacity, clear the data in the cold storage space, and finally, back up the data in the cold storage space.

[0109] In an embodiment of the present application, in response to an access request for data, obtain the access time corresponding to the access request and the priority of the data stored in the first storage space corresponding to the access request. The storage space further includes a second storage space. The average access frequency of the data in the first storage space is different from that in the second storage space. According to the first comparison result between the access time and the end time of the current working cycle, adjust the priority of the data to obtain the adjusted priority of the data. The priority of the data is used to reflect the expected access frequency of the data. The higher the priority of the data, the higher the expected access frequency of the data. According to the second comparison result between the data storage time and the preset time, and the third comparison result between the adjusted priority of the data and the preset priority, determine the target storage space from the first storage space and the second storage space. If the first storage space of the data is inconsistent with the target storage space, then migrate the data to the target storage space. In an embodiment of the present application, according to the first comparison result between the access time and the end time of the current working cycle, adjust the priority of the data, so as to determine the target storage space according to the second comparison result between the data storage time and the preset time, and the third comparison result between the adjusted priority of the data and the preset priority. Instead of only storing data in a fixed storage space, therefore, when the access frequency of the data changes, the storage space of the data can be dynamically adjusted, which can improve the query efficiency of the data and efficiently support and adapt to business requirements.

[0110] See Figure 4 , which shows a data storage device 30 provided by an embodiment of the present application. The data storage device 30 includes:

[0111] The first acquisition module 301 is configured to, in response to an access request for data, acquire the access time corresponding to the access request and the priority of the data stored in the first storage space and corresponding to the access request; the storage space further includes a second storage space, and the average access frequency of the data in the first storage space is different from that in the second storage space;

[0112] The adjustment module 302 is configured to adjust the priority of the data according to a first comparison result between the access time and the end time of the current working cycle, so as to obtain the adjusted priority of the data; the priority of the data is used to reflect the expected access frequency of the data; the higher the priority of the data, the higher the expected access frequency of the data;

[0113] The first determination module 303 is configured to determine a target storage space from the first storage space and the second storage space according to a second comparison result between the storage time of the data and a preset time, and a third comparison result between the adjusted priority of the data and a preset priority;

[0114] The migration module 304 is configured to, if the first storage space of the data is inconsistent with the target storage space, migrate the data to the target storage space.

[0115] Optionally, the device further includes:

[0116] The second determination module is configured to determine the data type to which the data stored in the first storage space and the second storage space belongs; the data type includes any one of exception data, instruction data, and running data;

[0117] The first setting module is configured to, if the data type belongs to a preset data type, set the priority of the data to a priority greater than a first preset value;

[0118] The second setting module is configured to, if the data type does not belong to the preset data type, set the priority of the data to a priority less than or equal to a second preset value.

[0119] Optionally, the adjustment module includes:

[0120] The reduction sub-module is configured to, if the access time is greater than or equal to the end time of the current working cycle, reduce the priority of the data, and determine the reduced priority of the data as the adjusted priority of the data;

[0121] The increase sub-module is configured to, if the access time is less than the end time of the current working cycle, increase the priority of the data, and determine the increased priority of the data as the adjusted priority of the data.

[0122] Optionally, the device further includes:

[0123] A second acquisition module, configured to acquire the access time of historical data and the priority of the historical data in the last time period, and obtain sample data composed of the access time of the historical data and the priority of the historical data;

[0124] A training module, configured to input the sample data into a machine learning model for training to obtain a priority prediction model; the priority prediction model is used to predict the priority of the adjusted data;

[0125] A third determination module, configured to input the access time into the priority prediction model to obtain the priority corresponding to the data, and determine the priority corresponding to the data as the priority of the adjusted data.

[0126] Optionally, the first determination module includes:

[0127] A first determination sub-module, configured to determine that the target storage space of the data is the second storage space if the storage time of the data is greater than or equal to the preset time and the priority of the adjusted data is higher than the preset priority;

[0128] A second determination sub-module, configured to determine that the target storage space of the data is the first storage space if the storage time of the data is less than the preset time and the priority of the adjusted data is lower than the preset priority.

[0129] Optionally, the first storage space is a cold space for storing cold data, the second storage space is a hot space for storing hot data, or the first storage space is a hot space for storing hot data, and the second storage space is a cold space for storing cold data.

[0130] Optionally, the device further includes:

[0131] A monitoring module, configured to monitor the space capacity of the storage space in each time period to obtain the actual space capacity of the storage space;

[0132] A first deletion module, configured to delete the data in the first storage space until the actual space capacity of the storage space is less than the preset space capacity if the actual space capacity is greater than or equal to the preset space capacity and the average access frequency of the first storage space is less than that of the second storage space;

[0133] A second deletion module, configured to delete the data in the second storage space until the actual space capacity of the storage space is less than the preset space capacity if the actual space capacity is greater than or equal to the preset space capacity and the average access frequency of the first storage space is greater than or equal to that of the second storage space.

[0134] Optionally, the device further includes

[0135] A third acquisition module, configured to acquire the generation time of the data stored in all the first storage spaces if there are multiple first storage spaces in the storage space;

[0136] A fourth determination module, configured to determine the generation time of the first storage space as the latest time among the generation times of the data in each first storage space;

[0137] The first deletion module includes:

[0138] A first deletion sub-module, configured to delete the data in the first storage space in ascending order of the generation time of the first storage space.

[0139] Optionally, the device further includes

[0140] A fourth acquisition module, configured to acquire the generation time of the data stored in all the second storage spaces if there are multiple second storage spaces in the storage space;

[0141] A fifth determination module, configured to determine the generation time of the second storage space as the latest time among the generation times of the data in each second storage space;

[0142] The second deletion module includes:

[0143] A second deletion sub-module, configured to delete the data in the second storage space in ascending order of the generation time of the second storage space.

[0144] Optionally, the device further includes:

[0145] A calculation module, configured to calculate the actual access frequency of the data in each time period;

[0146] A sixth determination module, configured to determine the first storage space as the target storage space of the data if the access frequency of the data is less than a first threshold;

[0147] A seventh determination module, configured to determine the second storage space as the target storage space of the data if the access frequency of the data is greater than or equal to the first threshold.

[0148] Optionally, the device further includes:

[0149] An eighth determination module, configured to determine the target storage space of the data in the second storage space if the access frequency of the data in the first storage space is greater than a second threshold;

[0150] A ninth determination module, configured to determine the target storage space of the data in the first storage space if the access frequency of the data in the second storage space is less than a third threshold.

[0151] In an embodiment of the present application, in response to an access request for data, an access time corresponding to the access request and a priority of the data stored in the first storage space corresponding to the access request are obtained. The storage space further includes a second storage space. The average access frequency of the data in the first storage space is different from that in the second storage space. According to a first comparison result between the access time and the end time of the current working cycle, the priority of the data is adjusted to obtain an adjusted priority of the data. The priority of the data is used to reflect the expected access frequency of the data. The higher the priority of the data, the higher the expected access frequency of the data. According to a second comparison result between the storage time of the data and a preset time, and a third comparison result between the adjusted priority of the data and a preset priority, a target storage space is determined from the first storage space and the second storage space. If the first storage space of the data is inconsistent with the target storage space, the data is migrated to the target storage space. In the embodiment of the present application, according to the first comparison result between the access time and the end time of the current working cycle, the priority of the data is adjusted, so that according to the second comparison result between the storage time of the data and the preset time, and the third comparison result between the adjusted priority of the data and the preset priority, the target storage space is determined. Instead of only storing data in a fixed storage space, therefore, when the access frequency of the data changes, the storage space of the data can be dynamically adjusted, which can improve the query efficiency of the data and efficiently support and adapt to service requirements.

[0152] See Figure 5 , the electronic device 400 may include one or more of the following components: a processing component 402, a memory 404, a power component 406, a multimedia component 408, an audio component 410, an input / output (I / O) interface 412, a sensor component 414, and a communication component 416.

[0153] The processing component 402 generally controls the overall operation of the electronic device 400, such as operations associated with display, telephone calls, data communication, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to complete all or part of the steps of the above methods. In addition, the processing component 402 may include one or more modules to facilitate the interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate the interaction between the multimedia component 408 and the processing component 402.

[0154] The memory 404 is used to store various types of data to support the operation of the electronic device 400. Examples of such data include instructions for any application or method operating on the electronic device 400, contact data, phone book data, messages, pictures, multimedia, etc. The memory 404 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disks, or optical disks.

[0155] The power component 406 provides power to various components of the electronic device 400. The power component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 400.

[0156] The multimedia component 408 includes an interface that provides an output interface between the electronic device 400 and the user. In some embodiments, the interface may include a liquid crystal display (LCD) and a touch panel (TP). If the interface includes a touch panel, the interface can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can not only sense the boundaries of touch or swipe actions, but also detect the duration and pressure associated with the touch or swipe operations. In some embodiments, the multimedia component 408 includes a front camera and / or a rear camera. When the electronic device 400 is in an operating mode, such as a shooting mode or a multimedia mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.

[0157] The audio component 410 is used to output and / or input audio signals. For example, the audio component 410 includes a microphone (MIC). When the electronic device 400 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is used to receive external audio signals. The received audio signals can be further stored in the memory 404 or sent via the communication component 416. In some embodiments, the audio component 410 further includes a speaker for outputting audio signals.

[0158] The input / output I / O interface 412 provides an interface between the processing component 402 and a peripheral interface module. The peripheral interface module can be a keyboard, a click wheel, buttons, etc. These buttons can include, but are not limited to: a home button, a volume button, a power-on button, and a lock button.

[0159] The sensor component 414 includes one or more sensors for providing status assessments of various aspects of the electronic device 400. For example, the sensor component 414 can detect the on / off state of the electronic device 400, the relative positioning of components. For example, the components are the display and the keypad of the electronic device 400. The sensor component 414 can also detect a change in the position of the electronic device 400 or a component of the electronic device 400, the presence or absence of user contact with the electronic device 400, the orientation or acceleration / deceleration of the electronic device 400, and the temperature change of the electronic device 400. The sensor component 414 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor component 414 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 414 can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0160] The communication component 416 is used to facilitate communication between the electronic device 400 and other devices in a wired or wireless manner. The electronic device 400 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 416 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0161] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components, and is used to implement a data storage method provided by an embodiment of the present application.

[0162] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is further provided, such as a memory 404 including instructions. The above instructions can be executed by a processor 420 of the electronic device 400 to complete the above method. For example, the non-transitory storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0163] Figure 6 It is a block diagram of an electronic device 500 according to another embodiment of the present invention. For example, the electronic device 500 may be provided as a server. Refer to Figure 6 , the electronic device 500 includes a processing component 522, which further includes one or more processors, and memory resources represented by a memory 532 for storing instructions executable by the processing component 522, such as application programs. The application programs stored in the memory 532 may include one or more modules each corresponding to a set of instructions. In addition, the processing component 522 is configured to execute instructions to perform a data storage method provided by an embodiment of the present application.

[0164] The electronic device 500 may further include a power supply component 526 configured to perform power management of the electronic device 500, a wired or wireless network interface 550 configured to connect the electronic device 500 to a network, and an input / output (I / O) interface 558. The electronic device 500 may operate based on an operating system stored in the memory 532, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSD TM or the like.

[0165] Those skilled in the art will readily think of other embodiments of the present application after considering the specification and practicing the application disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include common general knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present application are pointed out by the following claims.

[0166] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.

Claims

1. A data storage method, characterized in that: The method comprises: In response to a request for access to data, obtaining an access time corresponding to the access request and a priority of data corresponding to the access request stored in a first storage space; the storage space also includes a second storage space, and an average access frequency of data in the first storage space is different from that in the second storage space; According to a first comparison result between the access time and the endpoint time of the current working cycle, the priority of the data is adjusted to obtain an adjusted priority of the data; the priority of the data is used to reflect the expected access frequency of the data; the higher the priority of the data, the higher the expected access frequency of the data; Determine a target storage space from the first storage space and the second storage space according to a second comparison result between the storage time of the data and the preset time, and a third comparison result between the adjusted priority of the data and the preset priority; If the first storage space of the data is inconsistent with the target storage space, the data is migrated to the target storage space.

2. The method according to claim 1, characterized in that: Before obtaining the priority of the data corresponding to the access request stored in the first storage space, the method further includes: Determine the data type of the data stored in the first storage space and the second storage space; the data type includes: any one of abnormal data, instruction data and operation data; If the data type belongs to a preset data type, setting the priority of the data to a priority greater than a first preset value; If the data type does not belong to the preset data type, the priority of the data is set to a priority less than or equal to a second preset value.

3. The method according to claim 1, characterized in that The step of adjusting the priority of the data according to the first comparison result between the access time and the endpoint time of the current working cycle to obtain the adjusted priority of the data includes: If the access time is greater than or equal to the endpoint time of the current working cycle, lowering the priority of the data, and determining the lowered priority of the data as the adjusted priority of the data; If the access time is less than the endpoint time of the current working cycle, the priority of the data is increased, and the increased priority of the data is determined as the priority of the adjusted data.

4. The method according to claim 1, characterized in that: After obtaining, in response to the access request for data, the access time corresponding to the access request and the priority of the data corresponding to the access request stored in the first storage space, the method further includes: Acquire the access time of historical data and the priority of historical data in the previous time period, and obtain sample data consisting of the access time of the historical data and the priority of the historical data; Inputting the sample data into a machine learning model for training to obtain a priority prediction model; the priority prediction model is used to predict the priority of the adjusted data; The access time is input into the priority prediction model to obtain the priority corresponding to the data, and the priority corresponding to the data is determined as the priority of the adjusted data.

5. The method according to claim 1, characterized in that The determining of the target storage space from the first storage space and the second storage space according to the second comparison result between the storage time of the data and the preset time, and the third comparison result between the adjusted priority of the data and the preset priority, comprises: If the storage time of the data is greater than or equal to the preset time, and the priority of the adjusted data is higher than the preset priority, determining that the target storage space of the data is the second storage space; If the storage time of the data is less than the preset time, and the priority of the adjusted data is lower than the preset priority, the target storage space of the data is determined to be the first storage space.

6. The method according to claim 1, characterized in that The first storage space is a cold space for storing cold data, and the second storage space is a hot space for storing hot data, or the first storage space is a hot space for storing hot data, and the second storage space is a cold space for storing cold data.

7. The method according to claim 1, characterized in that The method further comprises: In each time period, the space capacity of the storage space is monitored to obtain the actual space capacity of the storage space; If the actual space capacity is greater than or equal to the preset space capacity, and the average access frequency of the first storage space is less than that of the second storage space, deleting the data in the first storage space until the actual space capacity of the storage space is less than the preset space capacity; If the actual space capacity is greater than or equal to the preset space capacity, and the average access frequency of the first storage space is greater than or equal to the second storage space, data in the second storage space is deleted until the actual space capacity of the storage space is less than the preset space capacity.

8. The method according to claim 7, characterized in that The method further comprises If there are multiple first storage spaces in the storage space, obtaining the generation time of the data stored in all the first storage spaces; Determine the latest generation time of the data in each of the first storage spaces as the generation time of the first storage space; The deleting the data in the first storage space in the storage space includes: The data in the first storage space is deleted in order from earliest to latest according to the generation time of the first storage space.

9. The method according to claim 7, characterized in that: The method further comprises If there are multiple second storage spaces in the storage space, obtaining the generation time of the data stored in all the second storage spaces; Determine the latest generation time of the data in each of the second storage spaces as the generation time of the second storage space; The deleting the data in the second storage space in the storage space includes: The data in the second storage space is deleted in order from earliest to latest according to the generation time of the second storage space.

10. The method according to claim 1, characterized in that The method further comprises: In each time period, calculate the actual access frequency of the data; If the access frequency of the data is less than a first threshold, determining the first storage space as a target storage space for the data; If the access frequency of the data is greater than or equal to the first threshold, the second storage space is determined as the target storage space of the data.

11. The method according to claim 10, characterized in that The method further comprises: If the access frequency of the data in the first storage space is greater than a second threshold, determining the second storage space as a target storage space for the data; If the access frequency of the data in the second storage space is less than a third threshold, the first storage space is determined as a target storage space for the data.

12. A data storage device, characterized in that: The device comprises: a first acquisition module, configured to, in response to a request for accessing data, acquire an access time corresponding to the access request and a priority of data corresponding to the access request stored in a first storage space; the storage space further comprising a second storage space, and an average access frequency of data in the first storage space is different from that in the second storage space; an adjustment module, configured to adjust the priority of the data according to a first comparison result between the access time and the endpoint time of the current working cycle, so as to obtain the priority of the adjusted data; the priority of the data is used to reflect the expected access frequency of the data; the higher the priority of the data, the higher the expected access frequency of the data; A first determining module, configured to determine a target storage space from the first storage space and the second storage space according to a second comparison result between the storage time of the data and the preset time, and a third comparison result between the priority of the adjusted data and the preset priority; A migration module is used to migrate the data to the target storage space if the first storage space of the data is inconsistent with the target storage space.

13. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the method according to any one of claims 1 to 11 are implemented.

14. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.

Citation Information

Patent Citations

  • Data access processing method and device based on big data

    CN104598547A

  • Cold and hot data exchange method and system based on optical storage

    CN110442309A

  • Data processing method, device and system for database

    CN113515497A

  • Data processing method and device, electronic equipment and storage medium

    CN116126813A

  • Storage management method and device, electronic equipment and storage medium

    CN116643704A