Method and device for optimizing file access speed of cloud application
By using the mount point subdirectories of the fuse or sdcardfs file system as the merge layer of the OverlayFS file system in the containerized solution, the kernel state and user state switching is reduced, which solves the problem of slow access to cloud application files and improves performance.
Patent Information
- Application Number
- CN202510829238.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-20
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2045-06-20
AI Technical Summary
When cloud applications access files in containerized solutions, frequent switching between kernel and user modes leads to poor performance, especially when there are many directory levels, which affects file access speed.
In the containerization scheme, the mount point subdirectories of the fuse file system or sdcardfs file system are used as the merge layer of the OverlayFS file system, and the lower layer and upper layer are mounted to the merge layer, reducing the number of processing directory levels of the fuse file system or sdcardfs file system, and using the OverlayFS file system to handle subsequent directory access.
Reduces the number of switching times or overhead between the kernel state and the user state, and improves the performance of cloud applications accessing files.
Smart Images

Figure CN120336270A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud applications, and particularly to a method and device for optimizing the file access speed of cloud applications. Background Art
[0002] Cloud applications (such as cloud games, cloud phones, etc.) are a new type of online application mode. By running, rendering, and processing applications on a remote cloud server and transmitting the application screens to user devices, users can enjoy high-quality application experiences on various devices without the need for high-performance hardware support.
[0003] With the development of the cloud application field, mainstream companies use containerization solutions to run the Android system and run applications in containers on cloud servers. In this solution, application data can be stored on a storage server, and multiple containers can share the same application data by mounting the NFS network file system and using the OverlayFS file system, and save their respective modifications to the application data. Or the application data can be pre-placed in the host, and the OverlayFS file system is used to achieve sharing of the same application data by multiple containers and save their respective modifications to the application data, so as to save the storage space of the cloud server and speed up the startup and running speed of cloud applications. The commonly used file systems in the Android system include fuse and sdcardfs. The fuse file system supports data isolation between containers, while the sdcardfs file system does not support data isolation between containers. Therefore, the containerization solution generally uses the fuse file system and the OverlayFS file system together. When a cloud application in a container accesses a file, the VFS file system of the kernel routes the file operation request to the path under the mount point of the fuse file system according to the application's permissions, and then forwards the file operation request to the kernel module of the fuse file system. The kernel module passes these requests to the user-space daemon process through the character device / dev / fuse. The user-space daemon process continuously monitors the / dev / fuse device, reads the file operation requests passed by the kernel module through the / dev / fuse device, converts the path in the requests into the underlying actual storage path, performs file operations on the underlying actual storage path, and returns the results to the kernel through the / dev / fuse device, and finally returns to the cloud application. In this process, the user-space daemon process needs to layer by layer process the permission verification and path conversion of each directory after the mount point, and the processing of each directory layer will trigger the switching between the kernel space and the user space. Especially when the directory level of the file is relatively large, the whole process requires frequent switching between the kernel space and the user space, resulting in poor file access performance.
[0004] Therefore, how to provide a solution to optimize the file access speed of cloud applications to improve the performance of accessing files in cloud applications has become a technical problem to be solved urgently.
[0005] The solution in the background art is the technical concept of the applicant and does not constitute an identification of the prior art. Summary of the Invention
[0006] In view of the technical problems existing in the prior art, embodiments of the present application provide a method and device for optimizing the file access speed of cloud applications.
[0007] In a first aspect, embodiments of the present application provide a method for optimizing the file access speed of cloud applications, which is applied to a cloud server and includes: S10. When the fuse file system is adopted in the containerization solution, use the first directory in the host or the second directory in the container of the host as the lower layer of the OverlayFS file system, use the third directory in the container as the upper layer of the OverlayFS file system, use the fourth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer. Among them, the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mounted directory of the external storage directory of the cloud application in the container in the storage server, the fourth directory is the mounted point sub-directory of the fuse file system, and the bottommost directory of the fourth directory is the cloud application package name directory or a directory after the cloud application package name directory; or S11. When the sdcardfs file system is adopted in the containerization solution, use the first directory in the host or the second directory in the container of the host as the lower layer of the OverlayFS file system, use the fifth directory in the container as the upper layer of the OverlayFS file system, use the sixth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer. Among them, the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mounted directory of the external storage directory of the cloud application in the container in the storage server, the sixth directory is the directory where the cloud application package name is located or a directory after the directory where the cloud application package name is located under the real storage directory of the user media files in the Android system. When the cloud application is installed in the container, the container identifier, the cloud application package name, and the user identifier UID of the cloud application are stored. The sdcardfs file system does not contain the verification logic for the file system to which the real storage directory of the user media files in the Android system belongs and the file system corresponding to the path of the file accessed by the cloud application under the real storage directory.
[0008] Second aspect, embodiments of the present application further provide a device for optimizing the file access speed of cloud applications, which is applied to a cloud server and includes: A first mounting unit, configured to, when the containerization solution adopts the fuse file system, use the first directory in the host or the second directory in the container of the host as the lower layer of the OverlayFS file system, use the third directory in the container as the upper layer of the OverlayFS file system, use the fourth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer. Among them, the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mounted directory of the external storage directory of the cloud application in the container in the storage server, the fourth directory is the subdirectory of the mounting point of the fuse file system, and the bottommost directory of the fourth directory is the cloud application package name directory or a directory after the cloud application package name directory; or A second mounting unit, configured to, when the containerization solution adopts the sdcardfs file system, use the first directory in the host or the second directory in the container of the host as the lower layer of the OverlayFS file system, use the fifth directory in the container as the upper layer of the OverlayFS file system, use the sixth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer. Among them, the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mounted directory of the external storage directory of the cloud application in the container in the storage server, the sixth directory is the directory where the cloud application package name is located or a directory after the directory where the cloud application package name is located under the actual storage directory of the user media files in the Android system. When the cloud application is installed in the container, the container identifier, the cloud application package name, and the user identifier UID of the cloud application are stored. The sdcardfs file system does not include the verification logic for the file system to which the actual storage directory of the user media files in the Android system belongs and the corresponding path of the file accessed by the cloud application in the file system under the actual storage directory.
[0009] In summary, the method and apparatus for optimizing the file access speed of cloud applications provided by the embodiments of the present application include two solutions: Solution 1 uses the FUSE file system, mounts the subdirectory of the mount point of the FUSE file system as the OverlayFS file system, and the bottommost directory of the subdirectory of the mount point of the FUSE file system is the cloud application package name directory or a directory after the cloud application package name directory. In this way, when the cloud application accesses a file, starting from the corresponding position of the subdirectory of the mount point of the FUSE file system in the file path, the FUSE file system is no longer used, but the OverlayFS file system is used. That is to say, compared with the existing solution using the FUSE file system, Solution 1 reduces the number of directory levels processed by the FUSE file system. Therefore, the number of switches between the kernel mode and the user mode can be reduced, and thus the performance of the cloud application accessing the file can be improved; Solution 2 uses the sdcardfs file system, and the sdcardfs file system is implemented in the kernel mode. Compared with the FUSE file system, it can reduce the overhead of switching between the user mode and the kernel mode. Therefore, compared with the existing solution using the FUSE file system, Solution 2 can also improve the performance of the cloud application accessing the file. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 FIG. is a schematic flowchart of an embodiment of a method for optimizing the file access speed of a cloud application provided by an embodiment of the present application; Figure 2 FIG. is a schematic structural diagram of an embodiment of an apparatus for optimizing the file access speed of a cloud application provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0011] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. It should be understood that the accompanying drawings in the present application are only for the purpose of illustration and description, and are not used to limit the protection scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in the present application illustrate the operations implemented according to some embodiments of the present application. It should be understood that the operations in the flowchart may not be implemented in sequence, and steps without logical context may be reversed or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart or remove one or more operations from the flowchart under the guidance of the content of the present application.
[0012] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all embodiments. The components of the embodiments of the present application generally described and illustrated in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but merely represents selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative efforts fall within the scope of protection of the present application.
[0013] It should be noted that the term "including" will be used in the embodiments of the present application to indicate the presence of the features stated hereinafter, but does not exclude the addition of other features.
[0014] Referring to Figure 1 As shown, the embodiments of the present application provide a schematic flowchart of a method for optimizing the file access speed of cloud applications. The method is applied to a cloud server and includes: S10. When the fuse file system is adopted in the containerization solution, the first directory in the host or the second directory in the container of the host is used as the lower layer of the OverlayFS file system, the third directory in the container is used as the upper layer of the OverlayFS file system, the fourth directory is used as the merge layer of the OverlayFS file system, and the lower layer and the upper layer are mounted on the merge layer. Among them, the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mounted directory of the external storage directory of the cloud application in the storage server in the container, the fourth directory is the mounted sub-directory of the fuse file system, and the bottommost directory of the fourth directory is the cloud application package name directory or a directory after the cloud application package name directory; or S11. When the sdcardfs file system is adopted in the containerization solution, the first directory in the host or the second directory in the container of the host is used as the lower layer of the OverlayFS file system, the fifth directory in the container is used as the upper layer of the OverlayFS file system, the sixth directory is used as the merge layer of the OverlayFS file system, and the lower layer and the upper layer are mounted on the merge layer. Among them, the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mounted directory of the external storage directory of the cloud application in the storage server in the container, the sixth directory is the directory where the cloud application package name is located or a directory after the directory where the cloud application package name is located under the real storage directory of the user media files in the Android system. When the cloud application is installed in the container, the identifier of the container, the package name of the cloud application, and the user identifier UID of the cloud application are stored.
[0015] In this embodiment, it should be noted that in step S10, when the containerization solution adopts the FUSE file system, the fourth directory is used as the merge layer of the OverlayFS file system. The fourth directory is the mount point sub-directory of the FUSE file system, and the bottommost directory of the fourth directory is the cloud application package name directory or a directory after the cloud application package name directory. Then, when the cloud application accesses the files in the external storage directory, the FUSE file system is still used before the corresponding position of the fourth directory in the path obtained by the access path conversion. Starting from the corresponding position of the fourth directory, the FUSE file system is no longer used, but the OverlayFS file system is used. For example, assume that the current user is the main user, and the soft link / sdcard that provides a unified external storage access interface points to the user's storage root directory / storage / emulated. The directories / mnt / runtime / default / emulated, / mnt / runtime / read / emulated, and / mnt / runtime / write / emulated are the mount points of the FUSE file system. The system will mount the corresponding FUSE file system mount points to / storage / emulated through bind mounts according to the permissions of the cloud application: the directory / mnt / runtime / default / emulated is the default mount point and is used when the cloud application has no read and write permissions; while / mnt / runtime / read / emulated and / mnt / runtime / write / emulated are used when the cloud application has read and write permissions respectively.Suppose a cloud application with write permission wants to access the file / sdcard / Android / data / com.xxx.xxx / files / resourse / a.txt. The fourth directory is / mnt / runtime / write / emulated / 0 / Android / data / com.xxx.xxx, where com.xxx.xxx is the cloud application package name directory. Then the VFS file system will resolve the symbolic link / sdcard, determine that / sdcard points to the directory / storage / emulated, redirect the directory / storage / emulated to the mount point / mnt / runtime / write / emulated according to the cloud application's permissions, convert the path / sdcard / Android / data / com.xxx.xxx / files / resourse / a.txt to the path / mnt / runtime / write / emulated / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt, and hand the file operation request (the file operation request carries the relative path / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt of the path / mnt / runtime / write / emulated / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt relative to the mount point / mnt / runtime / write / emulated) to the kernel module of the fuse file system. Then the kernel module encapsulates the file operation request as a message and passes it to the user-space daemon process through the character device / dev / fuse. The user-space daemon process sequentially performs permission verification (to determine whether the cloud application has the right to access the corresponding directory) and path conversion (such as converting the directory / mnt / runtime / write / emulated / 0 / Android to / data / media / 0 / Android) on the 0 directory, Android directory, and data directory in / mnt / runtime / write / emulated. For the subsequent directories (i.e., the com.xxx.xxx directory, files directory, and resourse directory), the OverlayFS file system is used instead of the fuse file system, and finally the file in the lower layer / upper layer is accessed, while the writing of the file is processed in the upper layer. The third directory is the specified directory and can be an empty directory.
[0016] In step S11, for example, assume that the current user is the primary user. The soft link / sdcard that provides a unified external storage access interface points to the user's storage root directory / storage / emulated. The directories / mnt / runtime / default / emulated, / mnt / runtime / read / emulated, and / mnt / runtime / write / emulated are the mount points of the sdcardfs file system. The system will mount the corresponding mount points to / storage / emulated through bind mounts according to the permissions of the cloud application: The directory / mnt / runtime / default / emulated is the default mount point and is used when the cloud application has no read and write permissions; while / mnt / runtime / read / emulated and / mnt / runtime / write / emulated are used when the cloud application has read and write permissions respectively.When the cloud application in the previous example accesses the file / sdcard / Android / data / com.xxx.xxx / files / resourse / a.txt, the VFS file system will parse the symbolic link / sdcard, determine that the directory pointed to by / sdcard is / storage / emulated, redirect the directory / storage / emulated to the mount point / mnt / runtime / write / emulated according to the cloud application's permissions, convert the path / sdcard / Android / data / com.xxx.xxx / files / resourse / a.txt to the path / mnt / runtime / write / emulated / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt, and hand over the file operation request (the file operation request carries the relative path / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt of the path / mnt / runtime / write / emulated / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt relative to the mount point / mnt / runtime / write / emulated) to the sdcardfs file system. The sdcardfs file system (when the user-space daemon is initialized, it will mount / data / media / to / mnt / runtime / default / emulated, and mount / mnt / runtime / default / emulated to / mnt / runtime / read / emulated and / mnt / runtime / write / emulated) determines the target path / data / media / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt according to / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt, and accesses the file corresponding to the target path, finally accessing the file in the lower layer / upper layer, while the writing of the file is processed in the upper layer. / data / media / 0 is the actual storage directory of user media files in the Android system, and the sixth directory can be / data / media / 0 / Android / data / com.xxx.xxx. The fifth directory is the specified directory, which can be an empty directory, and the third directory can be the same as or different from the fifth directory.Since the sdcardfs file system does not support data isolation between containers, in this embodiment, the container identifier, the package name of the cloud application, and the user identifier UID of the cloud application will be stored when the cloud application is installed in the container. In this way, even if the same cloud application is installed in different containers of the host, the data of each cloud application can be isolated by the container identifier. In addition, it should be noted that when the containerization solution uses the sdcardfs file system, if the actual storage directory of the user media files in the Android system and the corresponding path of the file accessed by the cloud application under this actual storage directory belong to different file systems, the sdcardfs file system will report an error. In the S11 solution, the actual storage directory of the user media files in the Android system (which can refer to the / data / media / 0 directory in the previous example) belongs to the f2fs file system, and the corresponding path of the file accessed by the cloud application under this actual storage directory (which can refer to the / data / media / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt path in the previous example) belongs to the OverlayFS file system. Since the two are different, in order to avoid the sdcardfs file system from reporting an error, it is necessary to modify the logic of the sdcardfs file system and remove the above verification logic so that it supports the OverlayFS file system. That is to say, the sdcardfs file system in step S11 is a modified sdcardfs file system, and its logic does not have the verification logic for the file system to which the actual storage directory of the user media files in the Android system belongs and the file system to which the corresponding path of the file accessed by the cloud application under this actual storage directory belongs.
[0017] For the first directory, a cloud application can be installed in the host. Then, the files in the external storage directory (sdcard directory) of the data directory of the cloud application in the storage server can be downloaded to the host, and the download directory is the first directory. Alternatively, the external storage directory (sdcard directory) of the data directory of the cloud application in the storage server can be mounted to the host, and the first directory can be obtained by copying the files in the mounted directory to a new directory. It should be noted that this embodiment is directed to the files in the external storage directory (sdcard directory) of the data directory of the cloud application. For the app directory (i.e., the APK installation directory) in the data directory of the cloud application, the source data directory can be mounted to a container (for example, the app directory in the data directory of the cloud application in the storage server can be mounted to the container, or after installing the cloud application in the host, the files in the app directory of the data directory of the cloud application in the storage server can be downloaded to the host and the download directory can be mounted to the container, etc.). Or the app directory in the data directory of the cloud application in the storage server can be mounted to the container, with the mounted directory as the lower layer, other specified directories as the upper layer, and the app directory that the cloud application in the container accesses by default as the merge layer, and the lower layer and the upper layer are mounted to the merge layer. Or after installing the cloud application in the host, the files in the app directory of the data directory of the cloud application in the storage server can be downloaded to the host, with the download directory as the lower layer, other specified directories as the upper layer, and the app directory that the cloud application in the container accesses by default as the merge layer, and the lower layer and the upper layer are mounted to the merge layer. For the data directory (i.e., the internal data directory) in the data directory of the cloud application, the data directory in the data directory of the cloud application in the storage server can be mounted to the container, with the mounted directory as the lower layer, other specified directories as the upper layer, and the data directory that the cloud application in the container accesses by default as the merge layer, and the lower layer and the upper layer are mounted to the merge layer. Or after installing the cloud application in the host, the files in the data directory of the data directory of the cloud application in the storage server can be downloaded to the host, with the download directory as the lower layer, other specified directories as the upper layer, and the data directory that the cloud application in the container accesses by default as the merge layer, and the lower layer and the upper layer are mounted to the merge layer.
[0018] The method for optimizing the file access speed of cloud applications provided by the embodiments of the present application includes two solutions: Solution 1 uses the FUSE file system, mounts the subdirectory of the mount point of the FUSE file system as the OverlayFS file system, and the bottommost directory of the subdirectory of the mount point of the FUSE file system is the cloud application package name directory or a directory after the cloud application package name directory. In this way, when the cloud application accesses a file, starting from the corresponding position of the subdirectory of the mount point of the FUSE file system in the file path, the OverlayFS file system is used instead of the FUSE file system. That is to say, compared with the existing solution using the FUSE file system, Solution 1 reduces the number of directory levels processed by the FUSE file system, so it can reduce the number of switches between the kernel mode and the user mode, and thus improve the performance of the cloud application accessing files; Solution 2 uses the sdcardfs file system, and the sdcardfs file system is implemented in the kernel mode. Compared with the FUSE file system, it can reduce the overhead of switching between the user mode and the kernel mode. Therefore, compared with the existing solution using the FUSE file system, Solution 2 can also improve the performance of the cloud application accessing files.
[0019] Based on the foregoing method embodiments, the owner of the file in the first directory or the external storage directory is the specified user identifier.
[0020] In this embodiment, it should be noted that in order to enable the cloud application to successfully access files, the owner of the file in the first directory or the external storage directory of the cloud application can be set to the specified user identifier (this user identifier is the UID of the specified cloud application and can be set as needed). In addition, the file permission of the file in the first directory or the external storage directory of the cloud application can be set to 0777.
[0021] Based on the foregoing method embodiments, before step S11, the following may further be included: Remove the verification logic of the file system to which the real storage directory of the user media file in the Android system in the sdcardfs file system belongs and the corresponding path of the file access path of the cloud application under the real storage directory.
[0022] Based on the foregoing method embodiments, the identifier of the container may include the process number of the initialization process of the container.
[0023] Based on the foregoing method embodiments, when installing a cloud application in a container, the process ID of the initialization process of the container can be obtained through the package_details_appid_store function in the kernel layer. The process ID of the initialization process is used as the identifier of the container. The identifier of the container and the package name of the cloud application are used as the key, and the user identifier UID of the cloud application is used as the value. The key and the value are stored in a linked list.
[0024] In this embodiment, it should be noted that the processing logic of the package_details_appid_store function can be modified to enable the package_details_appid_store function to obtain the process ID of the initialization process of the container. The process ID of the initialization process is used as the identifier of the container. The identifier of the container and the package name of the cloud application are used as the key, and the user identifier UID of the cloud application is used as the value. The key and the value are stored in the linked list hashtable_entry. Among them, obtaining the process ID of the initialization process of the container includes: obtaining the namespace pid_ns of the current process in the macro current, obtaining the namespace level ns_level according to the namespace pid_ns. If it is determined that the namespace level ns_level is greater than 0, indicating that the current process is in the container environment, the process ID of the initialization process of the container is obtained through the child_reaper member of the namespace pid_ns.
[0025] Refer to Figure 2 As shown, it is a schematic structural diagram of a device for optimizing the file access speed of a cloud application provided by an embodiment of the present application. The device is applied to a cloud server and includes: A first mounting unit 20, which is used to, when the containerization solution adopts the fuse file system, use the first directory in the host host or the second directory in the container of the host host as the lower layer of the OverlayFS file system, use the third directory in the container as the upper layer of the OverlayFS file system, use the fourth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer. Among them, the data in the first directory is the same as the data in the external storage directory of the cloud application. The second directory is the mounting directory in the container of the external storage directory of the cloud application in the storage server. The fourth directory is the mounting point subdirectory of the fuse file system, and the bottommost directory of the fourth directory is the cloud application package name directory or a directory after the cloud application package name directory; or The second mounting unit is used to, when the sdcardfs file system is adopted in the containerization solution, use the first directory in the host or the second directory in the container of the host as the lower layer of the OverlayFS file system, use the fifth directory in the container as the upper layer of the OverlayFS file system, use the sixth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer. Among them, the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mounting directory in the container of the external storage directory of the cloud application in the storage server, the sixth directory is the directory where the cloud application package name is located or the directory after the directory where the cloud application package name is located under the real storage directory of the user media files in the Android system. When the cloud application is installed in the container, the container identifier, the package name of the cloud application, and the user identifier UID of the cloud application are stored. The sdcardfs file system does not contain the verification logic for the file system to which the real storage directory of the user media files in the Android system belongs and the file system corresponding to the path of the file accessed by the cloud application under the real storage directory.
[0026] The device for optimizing the file access speed of the cloud application provided by the embodiment of the present application includes two solutions: Solution 1 uses the fuse file system, mounts the subdirectory of the mounting point of the fuse file system as the OverlayFS file system, and the bottommost directory of the subdirectory of the mounting point of the fuse file system is the cloud application package name directory or the directory after the cloud application package name directory. In this way, when the cloud application accesses a file, starting from the corresponding position of the subdirectory of the mounting point of the fuse file system in the file path, the fuse file system is no longer used, but the OverlayFS file system is used. That is to say, compared with the existing solution using the fuse file system, Solution 1 reduces the number of directory levels processed by the fuse file system. Therefore, the number of switches between the kernel mode and the user mode can be reduced, and thus the performance of the cloud application accessing files can be improved; Solution 2 uses the sdcardfs file system, and the sdcardfs file system is implemented in the kernel mode. Compared with the fuse file system, it can reduce the overhead of switching between the user mode and the kernel mode. Therefore, compared with the existing solution using the fuse file system, Solution 2 can also improve the performance of the cloud application accessing files.
[0027] Based on the foregoing device embodiment, the owner of the file in the first directory or the external storage directory is the specified user identifier.
[0028] Based on the foregoing device embodiment, the second mounting unit can also be used for: Remove the verification logic for the file system corresponding to the path of the file accessed by the cloud application in the file system to which the real storage directory of the user media file in the Android system belongs in the sdcardfs file system under the real storage directory.
[0029] Based on the foregoing device embodiments, the identifier of the container may include the process number of the initialization process of the container.
[0030] Based on the foregoing device embodiments, when a cloud application is installed in a container, the process number of the initialization process of the container can be obtained through the package_details_appid_store function in the kernel layer. The process number of the initialization process is used as the identifier of the container. The identifier of the container and the package name of the cloud application are used as the key, and the user identifier UID of the cloud application is used as the value. The key and the value are stored in a linked list.
[0031] The device for optimizing the file access speed of the cloud application provided by the embodiments of the present application has the same implementation process as the method for optimizing the file access speed of the cloud application provided by the embodiments of the present application, and the effects that can be achieved are also the same as those of the method for optimizing the file access speed of the cloud application provided by the embodiments of the present application, and will not be described in detail here.
[0032] The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for optimizing the file access speed of cloud applications, applied to a cloud server, characterized in that, Including: S10. When using the fuse file system in the containerization solution, use the first directory in the host or the second directory in the container of the host as the lower layer of the OverlayFS file system, use the third directory in the container as the upper layer of the OverlayFS file system, use the fourth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer. Among them, the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mounted directory in the container of the external storage directory of the cloud application in the storage server, the fourth directory is the mounted point sub-directory of the fuse file system, and the bottommost directory of the fourth directory is the cloud application package name directory or a directory after the cloud application package name directory; or S11. When using the sdcardfs file system in the containerization solution, use the first directory in the host or the second directory in the container of the host as the lower layer of the OverlayFS file system, use the fifth directory in the container as the upper layer of the OverlayFS file system, use the sixth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer. Among them, the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mounted directory in the container of the external storage directory of the cloud application in the storage server, the sixth directory is the directory where the cloud application package name is located or a directory after the directory where the cloud application package name is located under the real storage directory of the user media files in the Android system. When the cloud application is installed in the container, the container identifier, the cloud application package name, and the user identifier UID of the cloud application are stored. The sdcardfs file system does not include the verification logic for the file system to which the real storage directory of the user media files in the Android system belongs and the file system corresponding to the path of the file accessed by the cloud application under the real storage directory.
2. The method according to claim 1, wherein The owner of the file in the first directory or the external storage directory is the specified user identifier.
3. The method according to claim 1, characterized in that, Before step S11, it also includes: Remove the verification logic for the file system to which the real storage directory of the user media files in the Android system belongs and the file system corresponding to the path of the file accessed by the cloud application under the real storage directory in the sdcardfs file system.
4. The method according to claim 1, wherein The container identifier includes the process number of the initialization process of the container.
5. The method according to claim 4, wherein When the cloud application is installed in the container, obtain the process number of the initialization process of the container through the package_details_appid_store function in the kernel layer, use the process number of the initialization process as the container identifier, use the container identifier and the cloud application package name as the key, use the user identifier UID of the cloud application as the value, and store the key and the value in the linked list.
6. A device for optimizing the file access speed of cloud applications, applied to a cloud server, characterized in that Including: The first mounting unit is used to, when the containerization solution adopts the FUSE file system, use the first directory in the host or the second directory in the container of the host as the lower layer of the OverlayFS file system, use the third directory in the container as the upper layer of the OverlayFS file system, use the fourth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer. Among them, the data in the first directory is the same as the data in the external storage directory of the cloud application. The second directory is the mounted directory of the external storage directory of the cloud application in the storage server in the container. The fourth directory is the mounted point sub-directory of the FUSE file system, and the bottommost directory of the fourth directory is the cloud application package name directory or a directory after the cloud application package name directory; or The second mounting unit is used to, when the containerization solution adopts the sdcardfs file system, use the first directory in the host or the second directory in the container of the host as the lower layer of the OverlayFS file system, use the fifth directory in the container as the upper layer of the OverlayFS file system, use the sixth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer. Among them, the data in the first directory is the same as the data in the external storage directory of the cloud application. The second directory is the mounted directory of the external storage directory of the cloud application in the storage server in the container. The sixth directory is the directory where the cloud application package name is located or a directory after the directory where the cloud application package name is located under the real storage directory of the user media files in the Android system. When the cloud application is installed in the container, the container's identifier, the cloud application's package name, and the cloud application's user identifier UID are stored. The sdcardfs file system does not contain the verification logic for the file system to which the real storage directory of the user media files in the Android system belongs and the file system corresponding to the path of the file accessed by the cloud application under this real storage directory.
7. The device according to claim 6, characterized in that, The owner of the file in the first directory or the external storage directory is the specified user identifier.
8. The device according to claim 6, characterized in that, The second mounting unit is further used for: Removing the verification logic for the file system to which the real storage directory of the user media files in the Android system belongs and the file system corresponding to the path of the file accessed by the cloud application under this real storage directory in the sdcardfs file system.
9. The device according to claim 6, characterized in that, The identifier of the container includes the process number of the initialization process of the container.
10. The device according to claim 9, characterized in that, When the cloud application is installed in the container, obtain the process number of the initialization process of the container through the package_details_appid_store function in the kernel layer, use the process number of the initialization process as the identifier of the container, use the identifier of the container and the package name of the cloud application as the key, use the user identifier UID of the cloud application as the value, and store the key and the value in the linked list.
Citation Information
Patent Citations
Shared file operation method and device for Linux compatible Android system
CN113986858A
Container storage space management method and device
CN116257326A
Cloud storage access method and device, electronic equipment and storage medium
CN116303255A
Front-end module manager, management method and system based on user mode file system
CN116594978A
File processing method and device and storage medium
CN118312958A
Cited By
File access method and device
CN120743383A