A file storage control method, device, computer equipment, and storage medium
By predicting file access and adjusting storage location, the problem of balanced storage media costs and access efficiency in cloud storage is solved, and file access efficiency is improved and storage cost is reduced.
Patent Information
- Application Number
- CN202411841959.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-04
AI Technical Summary
In the face of rapid increase in data volume, how to balance the problem of reducing storage media costs and improving access efficiency.
By predicting the number of accesses to a file during the prediction period, the random forest regression model is used to output the predicted value of the access, and the target storage level is matched according to the predicted value, and the storage location of the file is adjusted to optimize the storage distribution of the file.
It is realized that files with large access prediction values are migrated to storage locations with large read and write speeds in advance, and files with small access prediction values are migrated to storage locations with small read and write speeds in advance, optimize the storage distribution of files, improve the overall access efficiency of files, and reduce the overall requirements of storage media, thereby achieving cost reduction.
Smart Images

Figure CN119759857A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and specifically relates to a file storage control method, device, computer equipment, and storage medium. Background Art
[0002] With the rapid development of cloud computing technology, public and private clouds have gradually become important IT infrastructure for enterprises and individual users. Cloud storage solutions are highly mature and users can store and manage large-scale data in the cloud. However, although the cloud storage model is convenient, with the rapid increase in data volume, on the one hand, the demand for storage media is huge, and on the other hand, user access needs are diverse. Cloud storage solutions face the problem of how to balance reducing storage media costs and improving access efficiency. Summary of the invention
[0003] The purpose of the embodiments of the present application is to propose a file storage control method, device, computer equipment, and storage medium to solve the problem of how to balance the storage medium cost and access efficiency of cloud storage.
[0004] In order to solve the above technical problems, the present application provides a file storage control method, which adopts the following technical solution:
[0005] A file storage control method, comprising:
[0006] Acquire a predicted feature value of an input feature corresponding to the file according to the predicted time period, wherein the input feature includes at least a file feature and a time feature;
[0007] Input the predicted feature value into a preset random forest regression model, and output a predicted value of the number of visits to the file within the predicted period;
[0008] Match the target storage level according to the predicted access volume value, and determine whether the target storage level is consistent with the current storage level of the file. If so, maintain the storage position of the file unchanged; otherwise, adjust the storage position of the file according to the target storage level, wherein different target storage levels correspond to storage media with different read and write speeds.
[0009] Further, before the step of adjusting the storage location of the file according to the target storage level, the method includes:
[0010] Determine all files whose storage locations need to be adjusted, and calculate the file migration size within the forecast period based on the determined files;
[0011] The migration time is estimated according to the file migration size, and the migration time point is determined based on the migration time, so as to start migrating the files whose storage locations need to be adjusted from the migration time point.
[0012] Furthermore, the step of migrating the files that need to adjust the storage location starting from the migration time point includes:
[0013] Determine whether the migration time exceeds the reserved time, and if so, adjust the access volume prediction value corresponding to the file at the storage location as needed to determine the file migration priority;
[0014] The files to be finally migrated are determined according to the migration priority, and the files to be finally migrated are migrated according to the migration priority.
[0015] Furthermore, after the step of migrating the files to be finally migrated according to the migration priority, the method further includes:
[0016] Real-time monitoring of the actual number of accesses to the files after the migration is completed during the forecast period;
[0017] For files migrated to a storage location with high read / write speeds, if the actual access volume is lower than a first preset threshold, the corresponding file is migrated back to the original storage location; or for files migrated to a storage location with low read / write speeds, if the actual access volume is higher than a second preset threshold, the corresponding file is migrated back to the original storage location.
[0018] Furthermore, the step of outputting the predicted value of the number of visits of the file in the predicted period includes:
[0019] Divide the prediction period into a plurality of sub-prediction periods, and output a predicted value of visit volume for each of the sub-prediction periods;
[0020] The step of matching the target storage level according to the predicted access volume value comprises:
[0021] The number of sub-prediction periods whose predicted visit volume values are less than a third preset threshold is determined, and when the number reaches the threshold, the target storage level of each sub-prediction period is matched according to the predicted visit volume values of each sub-prediction period.
[0022] Further, before the step of inputting the predicted feature value into the pre-trained random forest regression model, the method includes:
[0023] Obtaining historical access log information of all files according to a preset time interval, and extracting training feature values of the target variable and the input feature according to the historical access log information;
[0024] Divide all files into a training set and a validation set, and train a random forest regression model according to the training feature values of each file in the training set;
[0025] Input the training feature values of each file in the validation set into the trained random forest regression model to determine whether the error between the model output and the target variable is less than a preset threshold;
[0026] If yes, the trained random forest regression model is used as the preset random forest regression model; otherwise, the model is retrained after adjusting the time feature until the model output error is less than the preset threshold.
[0027] Furthermore, the step of extracting the target variable and the training feature value of the input feature according to the historical access log information includes:
[0028] Clean the historical access log information and remove invalid records;
[0029] Divide the historical access log information into multiple time periods of equal length according to the time span, and summarize the access volume of each file in each time period of equal length as the target variable;
[0030] and extracting a time feature value according to the access time of each file in each time period of equal length as a training feature value of the input feature;
[0031] The target variable and a corresponding set of training feature values of the input features are stored in the form of structured data.
[0032] In order to solve the above technical problems, the embodiment of the present application further provides a file storage control device, which adopts the following technical solution:
[0033] A file storage control device, the device comprising:
[0034] A feature acquisition module, used to acquire a predicted feature value of an input feature corresponding to a file according to a predicted time period, wherein the input feature includes at least a file feature and a time feature;
[0035] A prediction module, used for inputting the predicted feature value into a preset random forest regression model, and outputting a predicted value of the number of visits to the file within the prediction period;
[0036] A storage control module is used to match the target storage level according to the access volume prediction value, and determine whether the target storage level is consistent with the current storage level of the file. If so, the storage position of the file is maintained unchanged; otherwise, the storage position of the file is adjusted according to the target storage level, wherein different target storage levels correspond to storage media with different read and write speeds.
[0037] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0038] A computer device comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of any of the above-mentioned file storage control methods when executing the computer-readable instructions.
[0039] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0040] A computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the file storage control method described in any one of the above.
[0041] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0042] The present application predicts the access volume prediction value of the file in the prediction period, and adjusts the storage location of the file according to the access volume prediction value matching the target storage level. It can realize the migration of files with large access volume prediction values to storage locations with high read and write speeds in advance, and the migration of files with small access volume prediction values to storage locations with low read and write speeds, thereby optimizing the storage distribution of files. This enables different files to meet the different access needs of users and improves the overall access efficiency of files. In addition, some files are stored in storage media with low read and write speeds, which can reduce the overall requirements for storage media, achieve cost reduction, and achieve a relative balance between file access efficiency and storage media cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0044] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0045] Figure 2 A flowchart of an embodiment of the file storage control method of the present application;
[0046] Figure 3 A schematic diagram of the structure of an embodiment of the file storage control device of the present application;
[0047] Figure 4 A schematic diagram of the structure of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION
[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0049] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0050] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0051] like Figure 1 As shown, the system architecture 100 may include a terminal device 101, a network 102 and a server 103. The terminal device 101 may be a laptop 1011, a tablet computer 1012 or a mobile phone 1013. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links or optical fiber cables.
[0052] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, access files in the server 103, etc.
[0053] The terminal device 101 may be any electronic device having a display screen and supporting web browsing. In addition to a notebook computer 1011, a tablet computer 1012 or a mobile phone 1013, the terminal device 101 may also be a laptop computer and a desktop computer. Various communication client applications may be installed on the terminal device 101, such as a web browser application, an instant messaging tool, etc.
[0054] The server 103 may be a server that provides various services, such as a background server that provides support for a web page displayed on the terminal device 101 .
[0055] It should be understood that Figure 1The number of terminal devices 101, networks 102 and servers 103 in the embodiment is only for illustration. Any number of terminal devices 101, networks 102 and servers 103 may be provided according to implementation requirements.
[0056] It should be noted that the file storage control method provided in the embodiment of the present application is generally executed by the server 103, and accordingly, the file storage control device is generally set in the server.
[0057] Continue to refer Figure 2 , shows a flow chart of an embodiment of a file storage control method according to the present application. The file storage control method comprises the following steps S201 to S203:
[0058] S201, obtaining a predicted feature value of an input feature corresponding to a file according to a predicted time period, wherein the input feature includes at least a file feature and a time feature;
[0059] S202, inputting the predicted feature value into a preset random forest regression model, and outputting a predicted value of the number of visits to the file within the predicted period;
[0060] S203, matching the target storage level according to the predicted access volume value, and determining whether the target storage level is consistent with the current storage level of the file; if so, maintaining the storage position of the file unchanged; otherwise, adjusting the storage position of the file according to the target storage level, wherein different target storage levels correspond to storage media with different read and write speeds.
[0061] In this embodiment, the prediction period refers to any time period in the future, such as an hour, a day, a week, etc. in the future, and the present application preferably uses a day. The file features include at least a file identifier and a service identifier, and different files of different service categories can be independently predicted through the file identifier and the service identifier to improve the accuracy of the prediction. The time features include the month, week (such as the day of the week), whether it is a working day, the number of hours (i.e., the number of hours in a day), etc. corresponding to the access time of the file. For the prediction period, the access time refers to the time point of the expected access within the prediction period.
[0062] Based on these specific input features, the predicted value of file access can be predicted. For example, if the prediction period is the next day, the predicted feature values of the corresponding input features in the next day are obtained, and these predicted feature values are used as the input of the preset random forest regression model to obtain the predicted value of the access of each file in the next day.
[0063] The predicted access volume can be used to match the target storage level of each file in the next day. For cloud storage, in order to ensure the access efficiency of files during high-frequency access, files tend to be stored in high-cost high-speed storage media. However, files are not always in a high-frequency access state. For non-high-frequency access periods, if these files still occupy the space of high-speed storage media, it will cause unnecessary waste of storage data. The target storage level can solve this problem. Different target storage levels correspond to storage media with different storage speeds, such as high-speed storage media, medium-speed storage media, and low-speed storage media. For files stored in high-speed storage media, if the access frequency is low in a certain period of time, they can be stored in that period of time. Migrate files to medium-speed storage media or even low-speed storage media within a certain period of time, and migrate files with high access frequency in the same period of time but originally stored in medium-speed storage media or low-speed storage media to high-speed storage media, thereby reducing the delay in file-free access response time and improving user experience. After the peak access period, these files can be migrated back to low-cost low-speed storage media, thereby reducing the configuration of high-speed storage media. The intelligent storage strategy of this application can not only achieve effective cost control in large-scale cloud storage, but also optimize file distribution between different types of storage. It has high flexibility, can improve the overall access performance of the storage system, and reduce storage costs while ensuring file access efficiency.
[0064] In one embodiment, the step of outputting the predicted access value of the file in the prediction period includes: dividing the prediction period into multiple sub-prediction periods, and outputting the predicted access value of each sub-prediction period. This embodiment predicts the file access volume of each sub-prediction period by constructing a feature table of sub-prediction periods for each file, and inputting the feature data in the feature table into the model in a loop. For example, if the prediction period is one day in the future, the prediction period is divided into hours and a feature table is constructed, that is, each hour corresponds to a sub-prediction period. In this way, by inputting the feature data into the model in a loop, the predicted access value of the file in each hour in the future day can be obtained, which can achieve more refined storage control and help improve the overall utilization of high-speed storage media.
[0065] Furthermore, the step of matching the target storage level according to the predicted access volume includes: determining the number of sub-prediction time periods whose predicted access volume is less than a third preset threshold, and when the number reaches the threshold, matching the target storage level of each sub-prediction time period according to the predicted access volume of each sub-prediction time period. This step can determine the sub-prediction time periods with high-frequency access in the future day, such as when high-frequency access is expected in a few hours, and when the number of hours with high-frequency access in a day is too low (lower than the third preset threshold), in order to balance the system processing resources, such files will be excluded from the migration queue to avoid excessive occupation of system processing resources.
[0066] In some embodiments, after step S202 obtains the visit volume prediction value for the prediction period or sub-prediction period, a timestamp is generated based on the prediction period or sub-prediction period, and the visit volume prediction value and the corresponding timestamp are stored in the database to obtain a data set containing future time points and their visit volume prediction values for subsequent calls.
[0067] In this embodiment, the preset random forest regression model is stored in a model file, and the model file needs to be preloaded when executing step S202. By inputting a data frame containing time features, the output result array contains the visit volume prediction value.
[0068] In one embodiment, before the step of adjusting the storage location of the file according to the target storage level, the method includes: determining all files that need to adjust the storage location, calculating the file migration size within the prediction period according to the determined files; estimating the migration time according to the file migration size, determining the migration time point based on the migration time, and starting to migrate the files that need to adjust the storage location from the migration time point. When obtaining the file migration size, first obtain the file size according to the file identifier (such as the file ID), and obtain the minimum transmission rate of the system migration data, and estimate the migration time based on the formatted output file size and transmission rate. In the case of limited migration time, this embodiment can prioritize the migration of files with the largest access volume to ensure more reasonable use of storage resources.
[0069] In some embodiments, during the migration process, the remaining estimated migration time can be adjusted in real time according to the actual migration time of the migrated files. When the remaining estimated migration time is expected to exceed the reserved time, the migration file can be prioritized, and the migration of files with lower priority can be abandoned or delayed as needed.
[0070] In a specific embodiment, the step of migrating the files that need to adjust the storage location from the migration time point includes: judging whether the migration time exceeds the reserved time, and if so, determining the file migration priority according to the access volume prediction value corresponding to the file that needs to adjust the storage location; determining the final migrated file according to the migration priority, and migrating the final migrated file according to the migration priority. This can ensure that the files that need to be migrated can be migrated within the specified time, and the specified time is before the time when high-frequency access is predicted.
[0071] Furthermore, after the step of migrating the final migrated files according to the migration priority, the method further includes: real-time monitoring of the actual access volume of the files after the migration is completed in the predicted period; for files migrated to a storage location with high read / write speed, if the actual access volume is lower than a first preset threshold, the corresponding files are migrated back to the original storage location, or for files migrated to a storage location with low read / write speed, if the actual access volume is higher than a second preset threshold, the corresponding files are migrated back to the original storage location. This embodiment can quickly complete the migration of files with inaccurate predictions, avoiding unreasonable storage distribution of files.
[0072] In one embodiment, before the step of inputting the predicted feature value into the pre-trained random forest regression model, the method includes: obtaining historical access log information of all files according to a preset time interval, extracting the training feature values of the target variable and the input feature according to the historical access log information; dividing all files into a training set and a validation set, and training the random forest regression model according to the training feature values of each file in the training set; inputting the training feature values of each file in the validation set into the trained random forest regression model, and determining whether the error between the model output and the target variable is less than a preset threshold; if so, using the trained random forest regression model as the preset random forest regression model, otherwise adjusting the time feature and retraining the model until the model output error is less than the preset threshold.
[0073] This embodiment is a model training process, and the core task is to use log data to train the machine learning model to predict the file access volume in the future time period. The training process specifically includes steps such as data preparation, model training and parameter adjustment, model evaluation and storage. Through these steps, an efficient prediction model can be generated to provide support for file access volume prediction.
[0074] This embodiment uses a random forest regression model. For the extraction of input features, the historical access log information after the user accesses the file is retrieved to extract the file identifier, business identifier, access time and other information. The corresponding feature data such as month, day of the week, whether it is a working day, hours and the like are extracted according to the access time. The feature data is then divided into a training set and a test set. For example, 80% of the feature data is used for training and 20% of the feature data is used for testing. The training of the random forest regression model begins. The training process can use grid search to match the best parameter combination. The model is retrained using the best parameters until the output error meets the requirements. After the training is completed, the prediction accuracy of the random forest regression model is evaluated based on the test data. For files with low accuracy, the model is retrained by reducing the time features, such as removing the hours, whether it is a working day, etc., to improve the prediction accuracy. Finally, the trained model is saved in the form of a model file for later use.
[0075] In one embodiment, the step of extracting the target variable and the training feature value of the input feature according to the historical access log information includes: cleaning the historical access log information and removing invalid records; dividing the historical access log information into multiple time periods of equal length according to the time span, summarizing the access volume of each file in each time period of equal length as the target variable; and extracting the time feature value according to the access time of each file in each time period of equal length as the training feature value of the input feature; storing the target variable and a corresponding set of training feature values of the input feature in the form of structured data. This embodiment can obtain accurate historical data, ensure the accuracy and consistency of the data, and ensure the prediction accuracy of the model.
[0076] This application predicts the access volume prediction value of the file in the prediction period, and adjusts the storage location of the file according to the access volume prediction value matching the target storage level, so as to achieve the migration of files with large access volume prediction values to storage locations with high read and write speeds in advance, and the migration of files with small access volume prediction values to storage locations with low read and write speeds, thereby optimizing the storage distribution of files. This enables different files to meet different access needs of users and improve the overall access efficiency of files. In addition, some files are stored in storage media with low read and write speeds, which can reduce the overall requirements for storage media, achieve cost reduction, and achieve a relative balance between file access efficiency and storage media cost. In general, this application uses machine learning algorithms to predict the access cycle and frequency of files, and can more intelligently adjust the storage resource configuration.
[0077] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0078] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0079] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a file storage control device, and the device embodiment is similar to Figure 2 The method embodiment shown corresponds to the embodiment shown in FIG. Figure 3 As shown, the file storage control device 3 described in this embodiment includes: a feature acquisition module 301, a prediction module 302 and a storage control module 303, wherein:
[0080] The feature acquisition module 301 is used to obtain the predicted feature value of the input feature corresponding to the file according to the prediction time period, and the input feature includes at least file feature and time feature; the prediction module 302 is used to input the predicted feature value into a preset random forest regression model, and output the predicted value of the access volume of the file in the prediction time period; the storage control module 303 is used to match the target storage level according to the predicted value of the access volume, and determine whether the target storage level is consistent with the current storage level of the file. If so, the storage position of the file is maintained unchanged, otherwise the storage position of the file is adjusted according to the target storage level, wherein different target storage levels correspond to storage media with different read and write speeds.
[0081] In one embodiment, the storage control module 303 is further used, before adjusting the storage location of the file according to the target storage level, to: determine all files whose storage locations need to be adjusted, and calculate the file migration size within the prediction period based on the determined files; estimate the migration time based on the file migration size, and determine the migration time point based on the migration time, so as to migrate the files whose storage locations need to be adjusted starting from the migration time point.
[0082] In one embodiment, when the storage control module 303 migrates files that need to adjust the storage location starting from the migration time point, it is specifically used to: determine whether the migration time exceeds the reserved time, and if so, determine the file migration priority according to the access volume prediction value corresponding to the file whose storage location needs to be adjusted; determine the final migrated file according to the migration priority, and migrate the final migrated file according to the migration priority.
[0083] Furthermore, the storage control module 303 is also used to monitor in real time the actual access volume of the files after the migration is completed in the predicted time period after the files to be finally migrated are migrated according to the migration priority; for files migrated to a storage location with high read and write speeds, if the actual access volume is lower than a first preset threshold, the corresponding files are migrated back to the original storage location, or for files migrated to a storage location with low read and write speeds, if the actual access volume is higher than a second preset threshold, the corresponding files are migrated back to the original storage location.
[0084] In some embodiments, when the prediction module 302 outputs the predicted value of the number of visits of the file in the prediction period, it is specifically used to divide the prediction period into multiple sub-prediction periods and output the predicted value of the number of visits of each sub-prediction period.
[0085] Correspondingly, when the storage control module 303 matches the target storage level according to the access volume prediction value, it is specifically used to determine the number of sub-prediction time periods in which the access volume prediction value is less than a third preset threshold value. When the number reaches the threshold value, the target storage level of each sub-prediction time period is matched according to the access volume prediction value of each sub-prediction time period.
[0086] In one embodiment, the prediction module 302 is also used to perform model training before inputting the predicted feature value into the pre-trained random forest regression model, specifically for: obtaining historical access log information of all files according to a preset time interval, and extracting the training feature values of the target variable and the input feature according to the historical access log information; dividing all files into a training set and a validation set, and training the random forest regression model according to the training feature values of each file in the training set; inputting the training feature values of each file in the validation set into the trained random forest regression model, and determining whether the error between the model output and the target variable is less than a preset threshold; if so, using the trained random forest regression model as the preset random forest regression model, otherwise adjusting the time feature and retraining the model until the model output error is less than the preset threshold.
[0087] In one embodiment, when the prediction module 302 extracts the target variable and the training feature value of the input feature according to the historical access log information, it is specifically used to: clean the historical access log information and eliminate invalid records; divide the historical access log information into multiple time periods of equal length according to the time span, and summarize the access volume of each file in each time period of equal length as the target variable; and extract the time feature value according to the access time of each file in each time period of equal length as the training feature value of the input feature; store the target variable and a corresponding set of training feature values of the input features in the form of structured data.
[0088] It should be noted that the beneficial effects of the file storage control device can be referred to the above method embodiment, which will not be expanded here.
[0089] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0090] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with a memory 41, a processor 42, and a network interface 43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0091] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0092] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk equipped on the computer device 4, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as the program code of the file storage control method, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.
[0093] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run the program code stored in the memory 41 or process data, such as running the program code of the file storage control method.
[0094] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.
[0095] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the file storage control method as described above.
[0096] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0097] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. A file storage control method, characterized in that: include: Acquire a predicted feature value of an input feature corresponding to the file according to the predicted time period, wherein the input feature includes at least a file feature and a time feature; Input the predicted feature value into a preset random forest regression model, and output a predicted value of the number of visits to the file within the predicted period; Match the target storage level according to the predicted access volume value, and determine whether the target storage level is consistent with the current storage level of the file. If so, maintain the storage position of the file unchanged; otherwise, adjust the storage position of the file according to the target storage level, wherein different target storage levels correspond to storage media with different read and write speeds.
2. The file storage control method according to claim 1, characterized in that: Before the step of adjusting the storage location of the file according to the target storage level, the method includes: Determine all files whose storage locations need to be adjusted, and calculate the file migration size within the forecast period based on the determined files; The migration time is estimated according to the file migration size, and the migration time point is determined based on the migration time, so as to start migrating the files whose storage locations need to be adjusted from the migration time point.
3. The file storage control method according to claim 2, characterized in that: The step of migrating the files that need to adjust the storage location starting from the migration time point includes: Determine whether the migration time exceeds the reserved time, and if so, adjust the access volume prediction value corresponding to the file at the storage location as needed to determine the file migration priority; The files to be finally migrated are determined according to the migration priority, and the files to be finally migrated are migrated according to the migration priority.
4. The file storage control method according to claim 3, characterized in that: After the step of migrating the files to be finally migrated according to the migration priority, the method further includes: Real-time monitoring of the actual number of accesses to the files after the migration is completed during the forecast period; For files migrated to a storage location with high read / write speeds, if the actual access volume is lower than a first preset threshold, the corresponding file is migrated back to the original storage location; or for files migrated to a storage location with low read / write speeds, if the actual access volume is higher than a second preset threshold, the corresponding file is migrated back to the original storage location.
5. The file storage control method according to claim 1, characterized in that: The step of outputting the predicted value of the number of visits of the file in the predicted period includes: Divide the prediction period into a plurality of sub-prediction periods, and output a predicted value of visit volume for each of the sub-prediction periods; The step of matching the target storage level according to the predicted access volume value comprises: The number of sub-prediction periods whose predicted visit volume values are less than a third preset threshold is determined, and when the number reaches the threshold, the target storage level of each sub-prediction period is matched according to the predicted visit volume values of each sub-prediction period.
6. The file storage control method according to any one of claims 1 to 5, characterized in that: Prior to the step of inputting the predicted feature value into the pre-trained random forest regression model, the method comprises: Obtaining historical access log information of all files according to a preset time interval, and extracting training feature values of the target variable and the input feature according to the historical access log information; Divide all files into a training set and a validation set, and train a random forest regression model according to the training feature values of each file in the training set; Input the training feature values of each file in the validation set into the trained random forest regression model to determine whether the error between the model output and the target variable is less than a preset threshold; If yes, the trained random forest regression model is used as the preset random forest regression model; otherwise, the model is retrained after adjusting the time feature until the model output error is less than the preset threshold.
7. The file storage control method according to claim 6, characterized in that: The step of extracting the target variable and the training feature value of the input feature according to the historical access log information includes: Clean the historical access log information and remove invalid records; Divide the historical access log information into multiple time periods of equal length according to the time span, and summarize the access volume of each file in each time period of equal length as the target variable; and extracting a time feature value according to the access time of each file in each time period of equal length as a training feature value of the input feature; The target variable and a corresponding set of training feature values of the input features are stored in the form of structured data.
8. A file storage control device, characterized in that: The device comprises: A feature acquisition module, used to acquire a predicted feature value of an input feature corresponding to a file according to a predicted time period, wherein the input feature includes at least a file feature and a time feature; A prediction module, used for inputting the predicted feature value into a preset random forest regression model, and outputting a predicted value of the number of visits to the file within the prediction period; A storage control module is used to match the target storage level according to the access volume prediction value, and determine whether the target storage level is consistent with the current storage level of the file. If so, the storage position of the file is maintained unchanged; otherwise, the storage position of the file is adjusted according to the target storage level, wherein different target storage levels correspond to storage media with different read and write speeds.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the file storage control method according to any one of claims 1 to 7 when executing the computer-readable instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the file storage control method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
File storage method and device and related equipment
CN121578954A