File access method, device, computer equipment and program product

By constructing a portrait data pool and local cache in multi-modal model training, the problem of access pressure on the file storage system caused by frequent acquisition of small files by multiple devices is solved, and efficient file access and training efficiency are achieved.

CN118069589BActive Publication Date: 2024-08-27JINAN INSPUR DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410459427.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-17
Publication Date
2024-08-27
Estimated Expiration
2044-04-17

AI Technical Summary

Technical Problem

During multi-modal model training, multiple training devices frequently obtain small files from the file storage system, resulting in high access pressure on the file storage system, prone to data blocking, and reduced training efficiency.

Method used

By building a portrait data pool in the file storage system, it is determined whether the file meets the prefetch conditions based on the file path information and the portrait data pool. If it is met, the file is copied from the file storage system to the local cache, and file access processing is performed based on the local cache. , Reduce the access pressure on the file storage system.

Benefits of technology

It improves the file access rate without the user being aware of it, improves the cache hit rate, reduces the access pressure on the file storage system, avoids data blocking, and ensures the accuracy of prefetch operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118069589B
    Figure CN118069589B
Patent Text Reader

Abstract

The present invention relates to the field of computer technology, and discloses a file access method, device, computer equipment and program product. The method comprises: obtaining a file access request, and determining whether the first file meets the file pre-fetching condition according to the first path information of the first file to be accessed in the file access request in the file storage system and the portrait data pool; if the file pre-fetching condition is met, determining the corresponding pre-fetching file of the first file in the file storage system; copying the pre-fetching file from the file storage system to the local cache; performing file access processing according to the first path information and the files in the local cache; wherein the portrait data pool includes the portrait data of each file set of the first file type in the file storage system. The present invention reduces the access pressure of the file storage system and improves the file access efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a file access method, device, computer equipment and program product. Background Art

[0002] With the continuous development of artificial intelligence technology, multimodal model training has been widely used in many fields. At present, the data used for multimodal model training is usually small files of tens to hundreds of KB, and in each training round of the model, the training device usually obtains the small files used in the current training round from the remote file storage system. However, when there are multiple training devices, the multiple training devices repeatedly obtain small files from the file storage system, which easily causes access pressure on the file storage system, data blocking, and reduced training efficiency. Summary of the invention

[0003] In view of this, the present invention provides a file access method, device, computer equipment and program product, which have solved the problems of high access pressure of file storage system, easy data blocking, reduced training efficiency and so on.

[0004] In a first aspect, the present invention provides a file access method, the method comprising:

[0005] Obtaining a file access request; the file access request includes first path information of a first file to be accessed in the file storage system;

[0006] Determine whether the first file meets the file pre-fetching condition according to the first path information and the portrait data pool; the portrait data pool includes the portrait data of each file set of the first file type in the file storage system;

[0007] If the file pre-fetching condition is met, determining a pre-fetching file corresponding to the first file in the file storage system;

[0008] Copy the pre-fetched files from the file storage system to the local cache;

[0009] File access processing is performed according to the first path information and the files in the local cache.

[0010] The file access method provided in this embodiment realizes file prefetching without the user's involvement in any operation after obtaining the file access request. File access processing based on the prefetched files in the local cache can not only improve the cache hit rate, thereby improving the file access rate; it can also greatly reduce the access pressure of the file storage system and avoid data blocking caused by multiple computer devices simultaneously obtaining files from the file storage system. Furthermore, since the portrait data pool includes the portrait data of each file set of the first file type in the file storage system, it is not only possible to accurately describe the characteristics of the file set in the file storage system based on the portrait data pool, but also possible to accurately determine whether the prefetching conditions are met based on the portrait data pool, thereby ensuring the accuracy of the prefetching operation.

[0011] In an optional embodiment, the method further includes:

[0012] Obtaining a file saving request; the file saving request includes a target file set to be saved in a file storage system;

[0013] If it is determined that the file type of the target file set is the first file type, generating image data of the target file set according to the file saving request;

[0014] Save the image data to the image data pool.

[0015] In the file access method provided in this embodiment, by saving the generated portrait data to the portrait data pool, not only can the characteristics of the file set in the file storage system be accurately described based on the portrait data pool, but also whether the pre-fetching conditions are met can be accurately determined based on the portrait data pool, thereby ensuring the accuracy of the pre-fetching operation.

[0016] In an optional implementation, after obtaining the file saving request, the method further includes:

[0017] Parsing the target file set to obtain a first number of second files included in the target file set;

[0018] determining a first storage capacity required to store each second file and a maximum storage capacity among the first storage capacities;

[0019] determining an average storage capacity of the second file based on the first number and the first storage capacity;

[0020] The file type of the target file set is determined according to the first quantity, the maximum storage capacity, and the average storage capacity.

[0021] In the file access method provided in this embodiment, by determining the maximum storage capacity and the average storage capacity, and determining the file type of the target file set based on the first quantity, the maximum storage capacity, and the average storage capacity, it is possible to avoid misjudgment of the file type when a second file is too large and other second files are relatively small.

[0022] In an optional implementation, generating the image data of the target file set according to the file saving request includes:

[0023] Acquire second path information of the target file set in the file storage system from the file saving request;

[0024] Generate image data of the target file set according to the second path information.

[0025] In the file access method provided in this embodiment, by generating portrait data including the second path information, it is possible to accurately determine whether the first file meets the pre-fetching condition based on the portrait data in the subsequent process, thereby ensuring the accuracy of the pre-fetching operation.

[0026] In an optional implementation, the portrait data includes second path information of the file set in the file storage system; determining whether the first file meets the file pre-fetching condition according to the first path information and the portrait data pool includes:

[0027] determining whether the first file is in read-only mode;

[0028] If yes, matching the first path information with each second path information in the portrait data pool is performed;

[0029] If there is target second path information that matches successfully, it is determined that the first file meets the file pre-fetching condition.

[0030] In the file access method provided in this embodiment, the first path information is matched with the second path information of each file set of the first file type in the file storage system included in the portrait data pool to determine whether the first file meets the pre-fetching condition, thereby ensuring the accuracy of the determination result and further ensuring the accuracy of the pre-fetching operation.

[0031] In an optional implementation, matching the first path information with each second path information in the portrait data pool includes:

[0032] Determine whether the path information table corresponding to the second file type includes the first path information;

[0033] If not, matching the first path information with each second path information in the portrait data pool;

[0034] The method also includes:

[0035] If it is determined that the file pre-fetching condition is not met, the first path information is saved in the path information table.

[0036] In the file access method provided in this embodiment, by saving the first path information that does not meet the file pre-fetching condition into the path information table corresponding to the second file type, it is possible to avoid multiple pre-fetching condition judgments for the same first file that is not of the first file type based on the path information table.

[0037] In an optional implementation, the second path information and the first path information include a multi-level directory; matching the first path information with each second path information in the portrait data pool includes:

[0038] Determine the target directory to be matched in the first path information;

[0039] Compare the target directory with each second path information in the portrait data pool;

[0040] If the comparison fails, the directories except the last level directory in the target directory are determined as the current target directories to be matched, and the comparison process is performed until the comparison succeeds or all the comparisons fail.

[0041] In the file access method provided in this embodiment, by performing a level-by-level comparison process on the path information, the accuracy of the comparison result is greatly guaranteed, thereby ensuring the accuracy of determining the file pre-fetching condition.

[0042] In an optional implementation, determining a pre-fetched file corresponding to the first file in the file storage system includes:

[0043] Determine the current available storage capacity of the local cache;

[0044] Determine a second storage capacity required to store a candidate file set; the candidate file set is a file set corresponding to the target second path information;

[0045] A pre-fetched file corresponding to the first file in the file storage system is determined according to the available storage capacity and the second storage capacity.

[0046] In an optional implementation, determining, according to the available storage capacity and the second storage capacity, a pre-fetched file corresponding to the first file in the file storage system includes:

[0047] Determine a target file set in the file storage system according to the available storage capacity and the second storage capacity;

[0048] The pre-fetch files are determined based on the available storage capacity and the size of each file in the target file set.

[0049] In the file access method provided by the present embodiment, when it is determined that the first file satisfies the file pre-fetching condition, the current available storage capacity of the local cache and the second storage capacity required to store the candidate file set are determined, and the target folder is determined based on the available storage capacity and the second storage capacity, and the pre-fetched file is obtained in the target folder. On the basis of ensuring the storage performance of the local cache, the accurate determination of the pre-fetched file is achieved, thereby ensuring the accuracy of the pre-fetching processing.

[0050] In an optional implementation, performing file access processing according to the first path information and the file in the local cache includes:

[0051] If it is determined that the first file is in read-only mode, determining whether the first file is stored in the local cache according to the first path information;

[0052] If yes, generating a file access response based on the first file in the local cache;

[0053] If not, the first file is obtained from the file storage system according to the first path information, and a file access response is generated according to the obtained first file.

[0054] In the file access method provided in this embodiment, when a file access request is obtained, the file access is first performed based on the file in the local cache, and data interaction is performed with the file storage system only when the first file is not stored in the local cache. This can not only improve the cache hit rate, thereby improving the file access rate; it can also greatly reduce the access pressure of the file storage system, avoiding data blocking and other problems caused by multiple computer devices sending file acquisition requests to the file storage system at the same time.

[0055] In an optional implementation, determining whether the first file is stored in the local cache according to the first path information includes:

[0056] redirecting the first path information according to the redirection rule corresponding to the first path information to obtain third path information;

[0057] Determine whether the local cache contains the third path information;

[0058] If so, determining that the first file is stored in the local cache;

[0059] If not, it is determined that the first file does not exist in the local cache.

[0060] In the file access method provided in this embodiment, since the second storage path of the pre-fetched file in the file storage system is often different from the third storage path in the local cache, accurate access to the file in the local cache is achieved by redirecting the first path information.

[0061] In an optional implementation, obtaining a file access request includes:

[0062] Get the file access request sent by the model training thread;

[0063] Accordingly, file access processing is performed, including:

[0064] According to the obtained first file, a file access response is sent to the model training thread; the first file is used by the model training thread to perform model training processing.

[0065] In the file access method provided in this embodiment, file access processing is performed based on the pre-fetched files in the local cache, which can not only improve the cache hit rate, increase the file access rate, and thus improve the model training efficiency; but also greatly reduce the access pressure of the file storage system, and avoid data blocking and other problems caused by multiple model training threads simultaneously obtaining files from the file storage system.

[0066] In an optional implementation, determining a pre-fetched file corresponding to the first file in the file storage system includes:

[0067] Starting a pre-fetch thread, and determining a pre-fetch file corresponding to the first path information in the file storage system through the pre-fetch thread;

[0068] Copying the pre-fetched file from the file storage system to the local cache includes: copying the pre-fetched file from the file storage system to the local cache through the pre-fetch thread;

[0069] Performing file access processing according to the first path information and the files in the local cache includes: starting an access thread, and performing file access processing according to the first path information and the files in the local cache through the access thread.

[0070] In the file access method provided in this embodiment, pre-fetch processing is performed through a pre-fetch thread, and file access processing is performed through an access thread. The two are executed in parallel and have complementary interference, which further improves the file access efficiency.

[0071] In an optional embodiment, the method further includes:

[0072] Determine whether the local cache meets the file cleanup conditions;

[0073] If so, the local cache is cleaned up according to the preset cleanup rules.

[0074] In the file access method provided in this embodiment, by performing file cleaning processing on the local cache, the storage space of the cache can be released in time, thereby ensuring the smooth progress of the pre-fetching processing.

[0075] In a second aspect, the present invention provides a file access device, the device comprising:

[0076] A first acquisition module, used to acquire a file access request; the file access request includes first path information of a first file to be accessed in the file storage system;

[0077] A first determination module, used to determine whether the first file meets the file pre-fetching condition according to the first path information and the portrait data pool; the portrait data pool includes the portrait data of each file set of the first file type in the file storage system;

[0078] A second determining module, configured to determine a pre-fetched file corresponding to the first file in the file storage system if the file pre-fetching condition is met;

[0079] A copy module, used for copying the pre-fetched file from the file storage system to a local cache;

[0080] An access module is used to perform file access processing according to the first path information and the files in the local cache.

[0081] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the file access method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0082] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the file access method of the first aspect or any corresponding embodiment thereof.

[0083] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the file access method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0084] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0085] Figure 1 is a flowchart of a file access method according to an embodiment of the present invention;

[0086] Figure 2 is a schematic diagram of an application scenario of a file access method according to an embodiment of the present invention;

[0087] Figure 3 is a flowchart of another file access method according to an embodiment of the present invention;

[0088] Figure 4 is a flowchart of another file access method according to an embodiment of the present invention;

[0089] Figure 5 is a flowchart of another file access method according to an embodiment of the present invention;

[0090] Figure 6 is a flowchart of another file access method according to an embodiment of the present invention;

[0091] Figure 7 is a flowchart of another file access method according to an embodiment of the present invention;

[0092] Figure 8 is a structural block diagram of a file access device according to an embodiment of the present invention;

[0093] Fig. 9 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0094] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0095] With the rapid development of AIGC (Artificial Intelligence Generative Content), the size of data sets has also exploded, especially in multimodal large model training scenarios, where the number of images used has reached over 100 million. In multimodal training scenarios, the training data used in each training round is usually small files ranging from tens of KB to hundreds of KB, that is, in the data preprocessing stage, data is read from a remote file storage system in multiple threads or processes concurrently according to the batch size. However, the repeated reading of massive small files will occupy a large amount of storage network bandwidth, resulting in excessive I / O (Input / Output) requests for the remote file storage system, long-term I / O blocking, and thus causing the GPU (graphics processing unit) to stop, resulting in serious waste of computing resources and affecting training efficiency. In order to solve this technical problem, one solution adopted in the relevant technology is the data preheating function, that is, before the application is run, a copy of the original data is manually copied to the local storage space of the computing node. In this method, users are required to manually participate in data movement. In the case of a huge data set, it takes a lot of time to move data to the local computing node. And when the user needs to change the data set, it is necessary to repeatedly pull and delete the data, which is time-consuming and labor-intensive, and it is impossible to achieve intelligent management and movement of data. Furthermore, users need a certain amount of warm-up operation learning cost, which greatly increases the user's development time. Another solution adopted in the related technology is the data prefetching strategy, that is, during the operation of the application, the data is automatically moved locally. The current prefetching strategy is mainly based on the file granularity, and the prefetching strategy is designed based on the I / O mode of large files, such as sequential, reverse, jump, hotspot reading and other modes. Although this type of prefetching strategy realizes the intelligent movement of data, it cannot adapt to the model training scenario of massive small files, resulting in a low prefetching hit rate and increased system consumption. Based on this, the present invention provides a file access method. When a file access request is obtained, the first file to be accessed in the file storage system is determined according to the first path information of the portrait data pool and the first file to be accessed in the file access request, whether the first file meets the file pre-fetching condition; and when the file pre-fetching condition is met, the corresponding pre-fetched file of the first file in the file storage system is determined, and the pre-fetched file is copied from the file storage system to the local cache; and the file access processing is performed according to the first path information and the file in the local cache. Therefore, after obtaining the file access request, since the user does not need to participate in any operation, the file pre-fetching is realized without the user's awareness.Based on the pre-fetched files in the local cache, file access processing can not only improve the cache hit rate, thereby improving the file access rate; it can also greatly reduce the access pressure of the file storage system, avoiding data blocking and other problems caused by multiple computer devices simultaneously obtaining files from the file storage system. Furthermore, since the portrait data pool includes the portrait data of each file set of the first file type in the file storage system, it is not only possible to accurately describe the characteristics of the file set in the file storage system based on the portrait data pool, but also possible to accurately determine whether the pre-fetching conditions are met based on the portrait data pool, thereby ensuring the accuracy of the pre-fetching operation.

[0096] According to an embodiment of the present invention, a file access method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0097] In this embodiment, a file access method is provided, which can be used for the above-mentioned computer devices, such as mobile phones, tablet computers, desktop computers, portable notebooks, servers, etc. Figure 1 is a flowchart of a file access method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0098] Step S101, obtaining a file access request; the file access request includes first path information of a first file to be accessed in a file storage system.

[0099] In some embodiments, Figure 2 As shown, at least one computer device ( Figure 2Only one is shown in the figure) can be connected to a remote file storage system through a network for communication. Among them, the file storage system can be a distributed file storage system, that is, the file storage system can include N storage nodes for storing files, and N is an integer greater than 1. The N storage nodes can be set in the same place (for example, each storage node is set in city 1), or they can be set in different places (for example, storage node 1 is set in city 1, storage node 2 is set in city 2, etc.). A target client corresponding to the file storage system is mounted in the computer device (the target client can also be called a kernel client), and the file access method in the present invention can be executed through the target client. Specifically, when the target thread in the computer device needs to access the first file in the file storage system, the target client mounted in the computer device obtains a file access request sent by the target thread. Among them, the first file can be one or more. The target thread can be a model training thread for model training, or it can be a business thread of an application installed in the computing device, etc. The file access request can include the first path information of the first file in the file storage system, the file name of the first file, etc. The first file can be one or more of text, image, audio, video, etc.

[0100] Step S102, determining whether the first file meets the file pre-fetching condition based on the first path information and the portrait data pool; the portrait data pool includes the portrait data of each file set of the first file type in the file storage system.

[0101] Considering that in actual applications, there may be multiple computer devices accessing the file storage system at the same time. In order to reduce the access pressure on the file storage system caused by multiple computer devices accessing the file storage system at the same time and avoid problems such as data blocking, the present invention pre-constructs a portrait data pool. The portrait data pool may include portrait data of each file set of the first file type in the file storage system. When the target client in the computer device obtains a file access request, it can determine whether the first file meets the file pre-fetching condition based on the first path information of the first file to be accessed in the file storage system and the portrait data pool, so as to perform subsequent file pre-fetching when the file pre-fetching condition is met, thereby performing file access processing based on the pre-fetched file, and reducing the access pressure of the file storage system. Among them, the first file type can be set according to the actual application as needed, and this is not specifically limited in the present invention. In some embodiments, the file access method in the present invention can be applied to the model training scenario, and accordingly, the first file type can be a small file type, and the small file can be a file with a size between tens of KB and hundreds of KB.

[0102] Step S103: If the file pre-fetching condition is met, determine the pre-fetching file corresponding to the first file in the file storage system.

[0103] Specifically, when it is determined based on the portrait data pool that the first file meets the file pre-fetching condition, the file type characterizing the first file is the first file type, and the pre-fetched file corresponding to the first file is determined in the file set of each first file type stored in the file storage system. In other words, the file types of the pre-fetched file and the first file are both the first file type, and the file formats of the pre-fetched file and the first file can be the same, for example, both are images, or both are videos, etc.

[0104] Step S104, copying the pre-fetched file from the file storage system to the local cache.

[0105] Specifically, the cache address of the local cache may be pre-configured in the configuration file, and accordingly, the target client may copy the pre-fetched file from the file storage system to the local cache corresponding to the configured cache address.

[0106] Step S105: performing file access processing according to the first path information and the files in the local cache.

[0107] It should be noted that step S105 can be performed simultaneously with the pre-fetching process described in steps S102 to S104. Taking the model training scenario as an example, generally, the file types of the training samples used in different training rounds are the same. Therefore, by performing file pre-fetching, the hit rate of files in the local cache can be improved in the subsequent training process, thereby improving the file access rate and the model training rate, and can greatly reduce the access pressure of the file storage system.

[0108] It can be understood that the file access method in the present invention is not limited to application in model training scenarios, but can be applied to any file access scenario.

[0109] The file access method provided in this embodiment, when obtaining a file access request, determines whether the first file meets the file pre-fetching condition according to the first path information of the first file to be accessed in the image data pool and the file access request in the file storage system; and when the file pre-fetching condition is met, determines the pre-fetched file corresponding to the first file in the file storage system, and copies the pre-fetched file from the file storage system to the local cache; and, performs file access processing according to the first path information and the files in the local cache. Thus, after obtaining the file access request, since the user does not need to participate in any operation, file pre-fetching is achieved without the user's awareness. And performing file access processing based on the pre-fetched files in the local cache can not only improve the cache hit rate, and thus improve the file access rate; but also can greatly reduce the access pressure of the file storage system, and avoid problems such as data blocking caused by multiple computer devices simultaneously obtaining files from the file storage system. Furthermore, since the portrait data pool includes the portrait data of each file set of the first file type in the file storage system, it is not only possible to accurately describe the characteristics of the file set in the file storage system based on the portrait data pool, but also possible to accurately determine whether the pre-fetching conditions are met based on the portrait data pool, thereby ensuring the accuracy of the pre-fetching operation.

[0110] In this embodiment, a file access method is provided, which can be used for the above-mentioned computer devices, such as mobile phones, tablet computers, desktop computers, portable notebooks, servers, etc. Figure 3 is a flowchart of a file access method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:

[0111] Step S301, obtaining a file access request; the file access request includes first path information of a first file to be accessed in a file storage system.

[0112] Step S302, determining whether the first file meets the file pre-fetching condition based on the first path information and the portrait data pool; the portrait data pool includes the portrait data of each file set of the first file type in the file storage system.

[0113] Step S303: If the file pre-fetching condition is met, determine the pre-fetching file corresponding to the first file in the file storage system.

[0114] Step S304: copy the pre-fetched file from the file storage system to the local cache.

[0115] Step S305: perform file access processing according to the first path information and the files in the local cache.

[0116] The specific implementation process of the above steps S301 to S305 can be found in the relevant description in this article, and the repeated parts will not be repeated here.

[0117] Step S306, obtaining a file saving request; the file saving request includes a target file set to be saved in the file storage system.

[0118] Specifically, when the user operates the computer device to copy or download the target file set to the file storage system, the target client in the computing device obtains a file saving request generated by the user's copy operation or download operation. The target file set may include multiple second files, or the target file set may include multiple folders, each of which includes at least one file. The target file set may be in the form of a folder, or in the form of a compressed package.

[0119] As an example, the target file set is a folder including 600 images, that is, the target file set includes 600 second files.

[0120] As another example, the target file set is a folder including 500 subfolders, each of which includes an image, that is, the target file set includes 500 second files.

[0121] Step S307: If it is determined that the file type of the target file set is the first file type, then generating image data of the target file set according to the file saving request.

[0122] Specifically, before step S307, the process may further include: determining the file type of the target file set. In some implementations, determining the file type of the target file set may include: determining the quantity attribute and the capacity attribute of the target file set; and determining the file type of the target file set according to the quantity attribute and the capacity attribute.

[0123] In some embodiments, the above-mentioned determination of the quantity attribute and capacity attribute of the target file set may include: parsing the target file set to obtain the first quantity of second files included in the target file set; determining the first storage capacity required to store each second file and the maximum storage capacity in the first storage capacity; and determining the average storage capacity of the second files based on the first quantity and the first storage capacity. Specifically, parsing the target file set to obtain the first quantity of second files included in the target file set. And obtaining the attribute information of each second file in the target folder, and determining the file size in the attribute information as the first storage capacity required to store the corresponding second file. Sorting the first storage capacities to obtain the maximum storage capacity. And adding the first storage capacities to obtain the sum, and dividing the sum by the first quantity to obtain the average storage capacity of the second files.

[0124] Correspondingly, the above-mentioned determination of the file type of the target file set according to the quantity attribute and the capacity attribute may include: determining the file type of the target file set according to the first quantity, the maximum storage capacity, and the average storage capacity. Specifically, determining whether the first quantity is greater than the quantity threshold; determining whether the maximum storage capacity is less than the first storage capacity threshold; determining whether the average storage capacity is less than the second storage capacity threshold; if the determination results are all yes, then determining that the file type of the target file set is the first type. Among them, each threshold can be set according to needs in actual applications, and this is not specifically limited in the present invention.

[0125] Therefore, by determining the maximum storage capacity and the average storage capacity and determining whether they are less than the corresponding thresholds respectively, it is possible to avoid misjudgment of the file type when a second file is too large while other second files are small.

[0126] Furthermore, generating the portrait data of the target file set according to the file saving request in step S307 may include: obtaining the second path information of the target file set in the file storage system from the file saving request; generating the portrait data of the target file set according to the second path information. That is, the portrait data includes the second path information. In some embodiments, the portrait data may also include the name of the target file set, etc. The specific content of the portrait data may be set as required in actual applications.

[0127] By generating the portrait data including the second path information, it is possible to accurately determine whether the first file meets the pre-fetching condition based on the portrait data in the subsequent process, thereby ensuring the accuracy of the pre-fetching operation.

[0128] Step S308, saving the portrait data to the portrait data pool.

[0129] It should be pointed out that Figure 3 For illustration only and not limitation, steps S306 to S308 are not limited to being executed after step S305, and may be executed at any time before step S305, for example, before step S301, or simultaneously with step S301, etc.

[0130] The file access method provided in this embodiment, by saving the generated portrait data to the portrait data pool, can not only accurately describe the characteristics of the file set in the file storage system based on the portrait data pool, but also can accurately determine whether the pre-fetching conditions are met based on the portrait data pool, thereby ensuring the accuracy of the pre-fetching operation.

[0131] In this embodiment, a file access method is provided, which can be used for the above-mentioned computer devices, such as mobile phones, tablet computers, desktop computers, portable notebooks, servers, etc. Figure 4 is a flowchart of a file access method according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:

[0132] Step S401, obtaining a file access request; the file access request includes first path information of a first file to be accessed in a file storage system.

[0133] The implementation method of step S401 is the same as the implementation method of step S101 in the previous text. Please refer to the relevant description in the previous text, and the repeated parts will not be repeated here.

[0134] Step S402, determining whether the first file meets the file pre-fetching condition based on the first path information and the portrait data pool; the portrait data pool includes the portrait data of each file set of the first file type in the file storage system.

[0135] In some implementations, step S402 may include the following steps S4021 to S4023:

[0136] Step S4021, determining whether the first file is in read-only mode.

[0137] Specifically, a mode identifier of the first file is obtained, and whether the first file is in read-only mode is determined according to the mode identifier.

[0138] Step S4022: If yes, the first path information is matched with each second path information in the portrait data pool.

[0139] Considering that in actual applications, the file type of the first file may not be the first file type. In order to avoid multiple pre-fetching condition judgments for the same first file that is not the first file type, in some embodiments of the present invention, a path information table corresponding to the second file type can be established, and when the first path information is not included in the path information table, the first path information is matched with each second path information in the portrait data pool. That is, step S4022 may include: if yes, determining whether the path information table corresponding to the second file type includes the first path information; if not, matching the first path information with each second path information in the portrait data pool. Among them, the second file type is a file type other than the first file type.

[0140] Correspondingly, the method further includes: if it is determined that the first file does not satisfy the file pre-fetching condition, saving the first path information in the file access request into a path information table corresponding to the second file type.

[0141] Furthermore, the second path information and the first path information may include a multi-level directory. Accordingly, the matching process of the first path information with each second path information in the portrait data pool may include the following steps a1 to a3:

[0142] Step a1, determining the target directory to be matched currently in the first path information.

[0143] In some embodiments, the multi-level directory of the first path information can be determined as the current target directory to be matched. That is, for each first path information, when the matching process is performed for the first time, the first path information can be determined as the current target directory to be matched. It can be understood that since the first path information is the path information of the first file in the file storage system, its last level directory is the first name of the first file, the second-to-last level directory is the second name of the file set 1 where the first file is located, and the third-to-last level directory is the third name of the file set 2 where the file set 1 is located, and so on. As an example, the file name of the first file is dox1, and the first path information is F:\folder 1\subfolder 2\dox1, which means that the first file dox1 is located in subfolder 2 under folder 1 of disk F, then it is determined that the current target directory to be matched is F:\folder 1\subfolder 2\dox1.

[0144] In some embodiments, it is considered that the second path information contained in the portrait data pool is the path information of the file set in the file storage system, that is, the last level directory of the second path information is the name of the file set. In order to improve the matching rate, in step a1, the target except the last level target in the multi-level directory of the first path information can be determined as the current target directory to be matched. For example, the file name of the first file is dox1, the first path information is F:\folder 1\subfolder 2\dox1, and the last level directory is dox1. Therefore, F:\folder 1\subfolder 2 can be determined as the current target directory to be matched.

[0145] Step a2, comparing the target directory with each second path information in the portrait data pool;

[0146] Specifically, the multi-level directory of each second path information in the portrait data pool is compared with the target directory to determine whether there is second path information identical to the target directory. If so, the comparison is determined to be successful; if not, the comparison is determined to be a failure.

[0147] Step a3: If the comparison fails, the directory except the last directory in the target directory is determined as the current target directory to be matched, and the process returns to step a2 until the comparison succeeds or all comparisons fail.

[0148] As an example, the current target directory to be matched is "F:\Folder 1\Subfolder 2\dox1". If the comparison fails, the directory "F:\Folder 1\Subfolder 2" in the target directory except the last-level directory "dox1" is determined as the current target directory to be matched, and the target directory is compared with each second path information in the portrait data pool; if the comparison is successful, step S4023 is executed; if the comparison fails, the directory "F:\Folder 1" in the target directory except the last-level directory "Subfolder 2" is determined as the current target directory to be matched, and the target directory is compared with each second path information in the portrait data pool; and so on, until the comparison is successful, and step S4023 is executed; if all comparisons fail, it is determined that the first file does not meet the file pre-fetching condition, and the process ends.

[0149] Therefore, by comparing the path information step by step, the accuracy of the comparison result is greatly guaranteed, thereby ensuring the accuracy of the file pre-fetching condition determination.

[0150] Step S4023: If there is successfully matched target second path information, it is determined that the first file meets the file pre-fetching condition, and step S403 is executed.

[0151] Step S403: determine the pre-fetched file corresponding to the first file in the file storage system.

[0152] Step S404: copy the pre-fetched file from the file storage system to the local cache.

[0153] Step S405: perform file access processing according to the first path information and the files in the local cache.

[0154] For the implementation of steps S403 to S405, please refer to the relevant description in this article, and the repeated parts will not be repeated here.

[0155] In the file access method provided in this embodiment, the first path information is matched with the second path information of each file set of the first file type in the file storage system included in the portrait data pool to determine whether the first file meets the pre-fetching condition, thereby ensuring the accuracy of the determination result and further ensuring the accuracy of the pre-fetching operation.

[0156] In this embodiment, a file access method is provided, which can be used for the above-mentioned computer devices, such as mobile phones, tablet computers, desktop computers, portable notebooks, servers, etc. Figure 5 is a flowchart of a file access method according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:

[0157] Step S501, obtaining a file access request; the file access request includes first path information of a first file to be accessed in a file storage system.

[0158] Step S502, determining whether the first file meets the file pre-fetching condition based on the first path information and the portrait data pool; the portrait data pool includes the portrait data of each file set of the first file type in the file storage system.

[0159] Step S503: If the file pre-fetching condition is met, determine the pre-fetching file corresponding to the first file in the file storage system.

[0160] In some implementations, step S503 may include the following steps S5031 to S5033:

[0161] Step S5031: If the file pre-fetching condition is met, the current available storage capacity of the local cache is determined.

[0162] In some embodiments, determining the current available storage capacity of the local cache may include: obtaining the maximum storage capacity of the local cache, and the storage capacity currently used by the local cache; subtracting the maximum storage capacity of the local cache from the storage capacity currently used by the local cache to obtain a subtraction result; determining the subtraction result as the current available storage capacity of the local cache; or, multiplying the subtraction result by a preset ratio, and determining the multiplication result as the current available storage capacity of the local cache.

[0163] Step S5032, determining the second storage capacity required to store the candidate file set; the candidate file set is the file set corresponding to the target second path information.

[0164] Specifically, the attribute information of the candidate file set corresponding to the successfully matched second path information is obtained, the size of the candidate file set is obtained from the attribute information, and the size of the candidate file set is determined as the second storage capacity required to store the candidate file set.

[0165] Step S5033: Determine a pre-fetched file corresponding to the first file in the file storage system according to the available storage capacity and the second storage capacity.

[0166] In some implementations, step S5033 may include the following steps b1 and b2:

[0167] Step b1, determining a target file set in the file storage system according to the available storage capacity and the second storage capacity.

[0168] Specifically, determine whether the second storage capacity is less than the available storage capacity; if the second storage capacity is not less than the available storage capacity, determine the candidate file set as the target file set; if the second storage capacity is less than the available storage capacity, determine whether the second storage capacity is greater than a third storage capacity threshold; if the second storage capacity is greater than the third storage capacity threshold, determine the candidate file set as the target folder; if the second storage capacity is not greater than the third storage capacity threshold, determine the candidate file set and any file set at the same level as the candidate file set as the target file set.

[0169] More specifically, when the second storage capacity is not less than the available storage capacity, it indicates that the available storage capacity of the local cache can no longer store all the files in the candidate folder, so the candidate file set is determined as the target file set. When the second storage capacity is less than the available storage capacity, considering that the second storage capacity may be small and the available storage capacity may be large, after the local cache stores the files in the candidate folder, the remaining storage capacity may still be relatively abundant. Based on this, in order to improve the subsequent file access efficiency, when the second storage capacity is less than the available storage capacity, it is determined whether the second storage capacity is greater than the third storage capacity threshold. If the second storage capacity is greater than the third storage capacity threshold, it indicates that after the local cache stores the files in the candidate folder, the remaining storage space is insufficient to store other files, so the candidate file set is determined as the target folder. If the second storage capacity is not greater than the third storage capacity threshold, it indicates that after the local cache stores the files in the candidate folder, the remaining storage space can also store other files, so a file set can be randomly selected from the file sets at the same level as the candidate file set, and the candidate file set and the randomly selected file set are determined as the target file set. As an example, folder 1 includes subfolder 1, subfolder 2, subfolder 3 and subfolder 4, the candidate folder is subfolder 2, and the randomly selected folder is subfolder 4, then subfolder 2 and subfolder 4 are determined as target folders.

[0170] Step b2, determining the pre-fetched files according to the available storage capacity and the size of each file in the target file set.

[0171] Specifically, at least one pre-fetched file is determined according to the size of each file in the target folder, so that the total size of each pre-fetched file is not greater than the available storage capacity.

[0172] Furthermore, since the storage capacity of the local cache is fixed, in order to release the storage space of the local cache in a timely manner, thereby ensuring the effective implementation of the pre-fetching process. In some embodiments, the method further includes: determining whether the local cache meets the file cleaning condition; if so, performing file cleaning processing on the local cache according to the preset cleaning rules.

[0173] In some implementations, a file cleanup cycle can be preset. Accordingly, if it is determined that the current time reaches the file cleanup time corresponding to the file request cycle, the local cache is cleaned up according to the preset cleanup rules. Alternatively, if it is determined that the available storage capacity of the local cache reaches the preset capacity threshold, the local cache is cleaned up according to the preset cleanup rules. The cleanup rule can be a first-in-first-out rule, that is, the files first saved in the local cache will be cleaned up first.

[0174] Step S504: copy the pre-fetched file from the file storage system to the local cache.

[0175] Step S505: perform file access processing according to the first path information and the files in the local cache.

[0176] For the specific implementation of step S504 and step S505, please refer to the relevant description in this article, and the repeated parts will not be repeated here.

[0177] The file access method in this embodiment, when determining that the first file satisfies the file pre-fetching condition, determines the current available storage capacity of the local cache, the second storage capacity required to store the candidate file set, and determines the target folder based on the available storage capacity and the second storage capacity, and obtains the pre-fetched file in the target folder. On the basis of ensuring the storage performance of the local cache, the accurate determination of the pre-fetched file is achieved, thereby ensuring the accuracy of the pre-fetching processing.

[0178] In this embodiment, a file access method is provided, which can be used for the above-mentioned computer devices, such as mobile phones, tablet computers, desktop computers, portable notebooks, servers, etc. Figure 6 is a flowchart of a file access method according to an embodiment of the present invention. Figure 6 As shown, the process includes the following steps:

[0179] Step S601, obtaining a file access request; the file access request includes first path information of a first file to be accessed in a file storage system.

[0180] Step S602, determining whether the first file meets the file pre-fetching condition based on the first path information and the portrait data pool; the portrait data pool includes the portrait data of each file set of the first file type in the file storage system.

[0181] Step S603: If the file pre-fetching condition is met, determine the pre-fetching file corresponding to the first file in the file storage system.

[0182] Step S604: copy the pre-fetched file from the file storage system to the local cache.

[0183] For the specific implementation of steps S601 to S604, please refer to the relevant description in this document, and the repeated parts will not be repeated here.

[0184] Step S605: perform file access processing according to the first path information and the files in the local cache.

[0185] In some implementations, step S605 may include the following steps S6051 to S6053:

[0186] Step S6051, if it is determined that the first file is in read-only mode, determine whether the first file is stored in the local cache according to the first path information; if yes, execute step S6052, otherwise execute step S6053.

[0187] Specifically, a mode identifier of the first file is obtained, and if it is determined according to the mode identifier that the first file is in read-only mode, whether the first file is stored in the local cache is determined according to the first path information.

[0188] Taking into account that the second storage path of the pre-fetched file in the file storage system is often different from the third storage path in the local cache, based on this, in order to achieve accurate access to the file, in some embodiments, determining whether the first file is stored in the local cache according to the first path information may include: redirecting the first path information according to the redirection rule corresponding to the first path information to obtain the third path information; determining whether the local cache contains the third path information; if so, determining that the first file is stored in the local cache; if not, determining that the first file is not stored in the local cache.

[0189] The redirection rule can be set as needed in actual applications, and is not specifically limited in the present invention. As an example, the folder 1 in the first path information is redirected to the folder 11, that is, the folder 1 in the file storage system is redirected to the folder 11 in the local cache, etc.

[0190] Step S6052: Generate a file access response according to the first file in the local cache.

[0191] Step S6053: Obtain a first file from the file storage system according to the first path information, and generate a file access response according to the obtained first file.

[0192] Specifically, when the target client in the computer device determines that the first file is not stored in the local cache of the computer device, it sends a file acquisition request to the file storage system according to the first path information of the first file; the file storage system queries the first file according to the first path information in the file acquisition request, and sends the first file to the target client; the target client generates a file access response according to the received first file.

[0193] The file access method in this embodiment, when it is determined that the file pre-fetching condition is met, copies the determined pre-fetched file from the file storage system to the local cache, and when a file access request is obtained, firstly performs file access based on the file in the local cache, and only performs data interaction with the file storage system when the first file is not stored in the local cache. Thus, firstly performing file access processing based on the pre-fetched file in the local cache can not only improve the cache hit rate, and thus improve the file access rate; but also can greatly reduce the access pressure of the file storage system, and avoid problems such as data blocking caused by multiple computer devices sending file acquisition requests to the file storage system at the same time.

[0194] In this embodiment, a file access method is provided, which can be used for the above-mentioned computer devices, such as mobile phones, tablet computers, desktop computers, portable notebooks, servers, etc. Figure 7 is a flowchart of a file access method according to an embodiment of the present invention. Figure 7 As shown, the process includes the following steps:

[0195] Step S701, obtaining a file access request sent by a model training thread; the file access request includes first path information of a first file to be accessed in a file storage system.

[0196] In some embodiments, a target client corresponding to the file storage system is mounted in the computer device, and a model training thread for model training is also running in the computer device. When the model training thread needs to obtain a file in the file storage system and use it as a training sample, a file access request is sent to the target client. The target client receives the file access request sent by the model training thread.

[0197] Step S702, determining whether the first file meets the file pre-fetching condition based on the first path information and the portrait data pool; the portrait data pool includes the portrait data of each file set of the first file type in the file storage system.

[0198] Step S703: if the file pre-fetching condition is met, a pre-fetching thread is started, and a pre-fetching file corresponding to the first path information in the file storage system is determined through the pre-fetching thread.

[0199] Step S704: copy the pre-fetched file from the file storage system to the local cache through the pre-fetch thread.

[0200] Step S705, start the access thread, perform file access processing according to the first path information and the files in the local cache through the access thread, and send a file access response to the model training thread according to the obtained first file; the first file is used for the model training thread to perform model training processing.

[0201] In the file access method provided in this embodiment, when a file access request sent by a model training thread is obtained, it is determined whether the first file meets the file pre-fetching condition according to the first path information of the first file to be accessed in the portrait data pool and the file access request in the file storage system; and when the file pre-fetching condition is met, the pre-fetching thread determines the pre-fetching file corresponding to the first file in the file storage system, and copies the pre-fetching file from the file storage system to the local cache; and, the access thread performs file access processing according to the first path information and the files in the local cache. Therefore, after obtaining the file access request, since the user does not need to participate in any operation, file pre-fetching is achieved without the user's awareness. File access processing based on the pre-fetched files in the local cache can not only improve the cache hit rate, improve the file access rate, and thus improve the model training efficiency; but also can greatly reduce the access pressure of the file storage system, and avoid data blocking and other problems caused by multiple model training threads simultaneously obtaining files from the file storage system. Furthermore, since the portrait data pool includes the portrait data of each file set of the first file type in the file storage system, it is not only possible to accurately describe the characteristics of the file set in the file storage system based on the portrait data pool, but also possible to accurately determine whether the pre-fetching condition is met based on the portrait data pool, thereby ensuring the accuracy of the pre-fetching operation. Furthermore, the pre-fetching process is performed by the pre-fetching thread, and the file access process is performed by the access thread, and the two are executed in parallel and complement each other, further improving the file access efficiency.

[0202] In this embodiment, a file access device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0203] This embodiment provides a file access device, such as Figure 8 As shown, including:

[0204] A first acquisition module 801 is used to acquire a file access request; the file access request includes first path information of a first file to be accessed in a file storage system;

[0205] A first determination module 802 is used to determine whether the first file meets the file pre-fetching condition according to the first path information and the portrait data pool; the portrait data pool includes the portrait data of each file set of the first file type in the file storage system;

[0206] A second determination module 803 is used to determine a pre-fetched file corresponding to the first file in the file storage system if the file pre-fetching condition is met;

[0207] A copy module 804, used to copy the pre-fetched file from the file storage system to the local cache;

[0208] The access module 805 is used to perform file access processing according to the first path information and the files in the local cache.

[0209] In some optional embodiments, the device further comprises:

[0210] A second acquisition module is used to acquire a file saving request; the file saving request includes a target file set to be saved in the file storage system;

[0211] A generating module, for generating image data of the target file set according to a file saving request if it is determined that the file type of the target file set is the first file type;

[0212] The first saving module is used to save the portrait data to the portrait data pool.

[0213] In some optional embodiments, the device further comprises:

[0214] A parsing module, used for parsing the target file set to obtain a first number of second files included in the target file set;

[0215] The third determination module is used to determine the first storage capacity required to store each second file and the maximum storage capacity in the first storage capacity; determine the average storage capacity of the second files based on the first quantity and the first storage capacity; determine the file type of the target file set based on the first quantity, the maximum storage capacity and the average storage capacity.

[0216] In some optional implementations, the third determining module is specifically configured to:

[0217] determining whether the first quantity is greater than a quantity threshold;

[0218] determining whether the maximum storage capacity is less than a first storage capacity threshold;

[0219] determining whether the average storage capacity is less than a second storage capacity threshold;

[0220] If the determination results are all yes, then the file type of the target file set is determined to be the first type.

[0221] In some optional implementations, the generation module includes:

[0222] A first acquisition unit, configured to acquire second path information of a target file set in a file storage system from a file saving request;

[0223] A generating unit is used to generate image data of a target file set according to the second path information.

[0224] In some optional implementations, the portrait data includes second path information of the file set in the file storage system; the first determination module 802 includes:

[0225] A first determining unit, configured to determine whether the first file is in a read-only mode;

[0226] A matching unit, configured to match the first path information with each second path information in the portrait data pool if the determination result of the determination unit is yes;

[0227] The second determination unit is configured to determine that the first file satisfies the file pre-fetching condition if there is target second path information that matches successfully.

[0228] In some optional implementations, the matching unit is specifically used to:

[0229] Determine whether the path information table corresponding to the second file type includes the first path information;

[0230] If not, matching the first path information with each second path information in the portrait data pool;

[0231] The device also includes:

[0232] The second saving module is used to save the first path information into the path information table if it is determined that the file pre-fetching condition is not met.

[0233] In some optional implementations, the second path information and the first path information include a multi-level directory; accordingly, the matching unit is specifically configured to:

[0234] Determine the target directory to be matched in the first path information;

[0235] Compare the target directory with each second path information in the portrait data pool;

[0236] If the comparison fails, the directories except the last level directory in the target directory are determined as the current target directories to be matched, and the comparison process is performed until the comparison succeeds or all the comparisons fail.

[0237] In some optional implementations, the matching unit is further specifically configured to:

[0238] Determine the multi-level directory of the first path information as the current target directory to be matched;

[0239] Alternatively, the targets except the last level target in the multi-level directory of the first path information are determined as the current target directory to be matched.

[0240] In some optional implementations, the second determining module 803 includes:

[0241] A third determining unit, configured to determine a current available storage capacity of the local cache;

[0242] A fourth determining unit is used to determine a second storage capacity required to store a candidate file set; the candidate file set is a file set corresponding to the target second path information;

[0243] The fifth determining unit is used to determine the pre-fetched file corresponding to the first file in the file storage system according to the available storage capacity and the second storage capacity.

[0244] In some optional implementations, the fifth determining unit is specifically configured to:

[0245] Determine a target file set in the file storage system according to the available storage capacity and the second storage capacity;

[0246] The pre-fetch files are determined based on the available storage capacity and the size of each file in the target file set.

[0247] In some optional implementations, the fifth determining unit is further specifically configured to:

[0248] determining whether the second storage capacity is less than the available storage capacity;

[0249] If the second storage capacity is not less than the available storage capacity, determining the candidate file set as the target file set;

[0250] If the second storage capacity is less than the available storage capacity, determining whether the second storage capacity is greater than a third storage capacity threshold;

[0251] If the second storage capacity is greater than the third storage capacity threshold, determining the candidate file set as the target folder;

[0252] If the second storage capacity is not greater than the third storage capacity threshold, the candidate file set and any file set at the same level as the candidate file set are determined as the target file set.

[0253] In some optional implementations, the access module 805 includes:

[0254] a sixth determining unit, configured to determine whether the first file is stored in the local cache according to the first path information if it is determined that the first file is in the read-only mode;

[0255] a generating unit, configured to generate a file access response according to the first file in the local cache if the determination result of the sixth determining unit is yes;

[0256] The second acquisition unit is configured to acquire the first file from the file storage system according to the first path information if the determination result of the sixth determination unit is no, and generate a file access response according to the acquired first file.

[0257] In some optional implementations, the sixth determining unit is specifically configured to:

[0258] redirecting the first path information according to the redirection rule corresponding to the first path information to obtain third path information;

[0259] Determine whether the local cache contains the third path information;

[0260] If so, determining that the first file is stored in the local cache;

[0261] If not, it is determined that the first file does not exist in the local cache.

[0262] In some optional implementations, the first acquisition module 801 is specifically used to:

[0263] Get the file access request sent by the model training thread;

[0264] Accordingly, the access module 805 is specifically used for:

[0265] According to the obtained first file, a file access response is sent to the model training thread; the first file is used by the model training thread to perform model training processing.

[0266] In some optional implementations, the second determining module 803 is specifically configured to:

[0267] Starting a pre-fetch thread, and determining a pre-fetch file corresponding to the first path information in the file storage system through the pre-fetch thread;

[0268] The copy module 804 is specifically used to: copy the pre-fetched file from the file storage system to the local cache through the pre-fetch thread;

[0269] The access module 805 is specifically used to start an access thread, and perform file access processing according to the first path information and the files in the local cache through the access thread.

[0270] In some optional embodiments, the device further comprises:

[0271] The cleaning module is used to determine whether the local cache meets the file cleaning conditions; if so, the local cache is cleaned according to the preset cleaning rules.

[0272] The file access device in this embodiment, when obtaining a file access request, determines whether the first file meets the file pre-fetching condition according to the first path information of the first file to be accessed in the file storage system in the portrait data pool and the file access request; and when the file pre-fetching condition is met, determines the pre-fetched file corresponding to the first file in the file storage system, and copies the pre-fetched file from the file storage system to the local cache; and, performs file access processing according to the first path information and the file in the local cache. Thus, after obtaining the file access request, since the user does not need to participate in any operation, the file pre-fetching is realized without the user's feeling. And the file access processing based on the pre-fetched file in the local cache can not only improve the cache hit rate, and then improve the file access rate; but also can greatly reduce the access pressure of the file storage system, and avoid data blocking and other problems caused by multiple computer devices simultaneously obtaining files from the file storage system. Furthermore, since the portrait data pool includes the portrait data of each file set of the first file type in the file storage system, it can not only accurately describe the characteristics of the file set in the file storage system based on the portrait data pool, but also accurately determine whether the pre-fetching condition is met based on the portrait data pool, thereby ensuring the accuracy of the pre-fetching operation.

[0273] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0274] The file access device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0275] The embodiment of the present invention also provides a computer device having the above Figure 8 The file access device shown.

[0276] See also Fig. 9 , Fig. 9 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig. 9As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig. 9 A processor 10 is taken as an example.

[0277] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0278] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0279] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0280] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0281] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Fig. 9 The example of connecting through bus is taken in the following.

[0282] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device may be a touch screen.

[0283] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0284] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0285] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A file access method, characterized in that: The method comprises: Obtaining a file access request; the file access request includes first path information of a first file to be accessed in a file storage system; Determining whether the first file meets a file pre-fetching condition according to the first path information and the portrait data pool; the portrait data pool includes portrait data of each file set of the first file type in the file storage system; If the file pre-fetching condition is met, determining a pre-fetching file corresponding to the first file in the file storage system; Copying the pre-fetched file from the file storage system to a local cache; Performing file access processing according to the first path information and the files in the local cache; Wherein, the method further comprises: Obtaining a file saving request, wherein the file saving request includes a target file set to be saved in the file storage system; Parsing the target file set to obtain a first number of second files included in the target file set; determining a first storage capacity required to store each of the second files, and a maximum storage capacity among the first storage capacities; determining an average storage capacity of the second file according to the first number and the first storage capacity; If the first quantity is greater than a quantity threshold, and the maximum storage capacity is less than a first storage capacity threshold, and the average storage capacity is less than a second storage capacity threshold, it is determined that the file type of the target file set is the first file type, and image data of the target file set is generated according to the file saving request; The portrait data is saved in the portrait data pool.

2. The method according to claim 1, characterized in that The step of generating the image data of the target file set according to the file saving request includes: Acquire second path information of the target file set in the file storage system from the file saving request; Generate image data of the target file set according to the second path information.

3. The method according to claim 1, characterized in that: The portrait data includes second path information of the file set in the file storage system; and determining whether the first file meets the file pre-fetching condition according to the first path information and the portrait data pool includes: determining whether the first file is in read-only mode; If yes, matching the first path information with each second path information in the portrait data pool; If there is target second path information that matches successfully, it is determined that the first file meets the file pre-fetching condition.

4. The method according to claim 3, characterized in that The matching process of the first path information with each second path information in the portrait data pool includes: Determine whether the path information table corresponding to the second file type includes the first path information; If not, matching the first path information with each second path information in the portrait data pool; The method further comprises: If it is determined that the file pre-fetching condition is not met, the first path information is saved in the path information table.

5. The method according to claim 3, characterized in that: The second path information and the first path information include a multi-level directory; the matching process of the first path information with each second path information in the portrait data pool includes: Determine the target directory to be matched currently in the first path information; Compare the target directory with each second path information in the portrait data pool; If the comparison fails, the directories in the target directory except the last level directory are determined as the current target directories to be matched, and the comparison process is performed until the comparison succeeds or all comparisons fail.

6. The method according to claim 5, characterized in that The determining the current target directory to be matched in the first path information includes: Determine the multi-level directory of the first path information as the current target directory to be matched; Alternatively, the targets except the last level target in the multi-level directory of the first path information are determined as the current target directory to be matched.

7. The method according to claim 3, characterized in that The determining the pre-fetched file corresponding to the first file in the file storage system includes: Determining the current available storage capacity of the local cache; Determine a second storage capacity required to store a candidate file set; the candidate file set is a file set corresponding to the target second path information; A pre-fetched file corresponding to the first file in the file storage system is determined according to the available storage capacity and the second storage capacity.

8. The method according to claim 7, characterized in that The determining, according to the available storage capacity and the second storage capacity, a pre-fetched file corresponding to the first file in the file storage system comprises: Determining a target file set in the file storage system according to the available storage capacity and the second storage capacity; The pre-fetched files are determined according to the available storage capacity and the size of each file in the target file set.

9. The method according to claim 8, characterized in that The step of determining a target file set in the file storage system according to the available storage capacity and the second storage capacity includes: determining whether the second storage capacity is less than the available storage capacity; If the second storage capacity is not less than the available storage capacity, determining the candidate file set as the target file set; If the second storage capacity is less than the available storage capacity, determining whether the second storage capacity is greater than a third storage capacity threshold; If the second storage capacity is greater than the third storage capacity threshold, determining the candidate file set as a target folder; If the second storage capacity is not greater than the third storage capacity threshold, the candidate file set and any file set at the same level as the candidate file set are determined as the target file set.

10. The method according to claim 1, characterized in that The performing file access processing according to the first path information and the files in the local cache includes: If it is determined that the first file is in read-only mode, determining whether the first file is stored in the local cache according to the first path information; If yes, generating a file access response according to the first file in the local cache; If not, the first file is obtained from the file storage system according to the first path information, and a file access response is generated according to the obtained first file.

11. The method according to claim 10, characterized in that The determining, according to the first path information, whether the first file is stored in the local cache includes: redirecting the first path information according to the redirection rule corresponding to the first path information to obtain third path information; Determining whether the local cache contains the third path information; If yes, determining that the first file is stored in the local cache; If not, it is determined that the first file does not exist in the local cache.

12. The method according to claim 1, characterized in that The obtaining of the file access request comprises: Get the file access request sent by the model training thread; The file access processing includes: According to the first file obtained, a file access response is sent to the model training thread; the first file is used by the model training thread to perform model training processing.

13. The method according to claim 1, characterized in that The determining the pre-fetched file corresponding to the first file in the file storage system includes: Starting a prefetch thread, and determining, through the prefetch thread, a prefetch file corresponding to the first path information in the file storage system; The copying of the pre-fetched file from the file storage system to the local cache comprises: copying the pre-fetched file from the file storage system to the local cache through the pre-fetch thread; The performing file access processing according to the first path information and the files in the local cache includes: starting an access thread, and performing file access processing according to the first path information and the files in the local cache through the access thread.

14. The method according to claim 1, characterized in that The method further comprises: Determining whether the local cache meets the file cleaning condition; If so, the local cache is cleaned up according to the preset cleaning rules.

15. A file access device, characterized in that: The device comprises: A first acquisition module, used to acquire a file access request; the file access request includes first path information of a first file to be accessed in the file storage system; A first determination module, used to determine whether the first file meets the file pre-fetching condition according to the first path information and the portrait data pool; the portrait data pool includes the portrait data of each file set of the first file type in the file storage system; A second determining module, configured to determine a pre-fetched file corresponding to the first file in the file storage system if the file pre-fetching condition is met; A copy module, used for copying the pre-fetched file from the file storage system to a local cache; An access module, used for performing file access processing according to the first path information and the files in the local cache; Wherein, the device further comprises: A second acquisition module is used to acquire a file saving request, wherein the file saving request includes a target file set to be saved in the file storage system; A parsing module, used for parsing the target file set to obtain a first number of second files included in the target file set; A third determination module is used to determine a first storage capacity required to store each of the second files and a maximum storage capacity among the first storage capacities; determine an average storage capacity of the second files according to the first quantity and the first storage capacity; the first quantity is greater than a quantity threshold, the maximum storage capacity is less than a first storage capacity threshold, and the average storage capacity is less than a second storage capacity threshold; a generating module, configured to generate image data of the target file set according to the file saving request if the third determining module determines that the file type of the target file set is the first file type; The first saving module is used to save the portrait data to the portrait data pool.

16. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the file access method according to any one of claims 1 to 14 by executing the computer instructions.

17. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to cause a computer to execute the file access method according to any one of claims 1 to 14.