Cache scalable processing method, device and equipment of application and medium

By initializing multiple cache components of the target application and utilizing the startup package and cloud storage media, the problem of insufficient terminal storage space is solved, enabling the release of more storage space without affecting the normal use of the application, supporting the installation of more applications and the storage of more data.

CN115048149BActive Publication Date: 2026-04-24杨正 +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
杨正
Filing Date
2022-05-23
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Terminal storage space is limited. After installing large applications, it is impossible to install more applications or store more data. Existing data cleaning methods cannot effectively free up enough storage space and affect the normal use of applications.

Method used

By initializing multiple cache components of the target application, utilizing the startup package and cloud storage media, data other than the startup package in the terminal's local storage media is cleared, and data is retrieved from the cloud storage media and local storage media when needed to support application operation.

Benefits of technology

Without affecting the normal use of applications, thoroughly clean up data to free up more storage space, support the installation of more applications and storage of more data, and reduce the user's purchase cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115048149B_ABST
    Figure CN115048149B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a cache scalable processing method, device and equipment of an application and a medium, the method comprising: starting a target application based on a start-up package of the target application, and initializing a plurality of cache components corresponding to the target application; the plurality of cache components respectively correspond to respective storage media, and the storage media store data supporting the running of the target application; in response to a storage space release event performed on a terminal, the data in the local storage medium of the terminal is cleared by the corresponding cache component; wherein all the data remaining in the local storage medium after being cleared is at least the data in the start-up package, so as to at least ensure the start-up of the target application; in response to a read request of the target application, the data corresponding to the read request is obtained from the cloud storage medium and / or the local storage medium by the corresponding cache component, so as to support the running of the target application; wherein the cloud storage medium stores original data supporting the running of the target application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication processing technology, and in particular to a method, apparatus, device and medium for application-specific cached scalable processing. Background Technology

[0002] With the widespread use of various applications, users typically download and use various applications on their devices, such as installing many apps on their mobile phones.

[0003] However, terminal storage is limited. Installing an application requires downloading its entire data, and some applications have large amounts of data, occupying significant storage space and preventing the terminal from installing more applications. Furthermore, as applications are used, data accumulates, causing the data volume to increase gradually and ultimately reducing the terminal's storage capacity.

[0004] In practice, users often clean up data on their devices to allow them to install more applications or store more data. However, current data cleanup techniques have limitations; they don't free up significant storage space, and cleaning up too much data can interfere with the normal operation of applications. Furthermore, cleaning up even more data often requires uninstalling applications, which users typically prefer.

[0005] Therefore, how to free up a large amount of space on the terminal while retaining numerous applications without affecting the user's normal use of applications is a pain point currently facing terminal technology. Summary of the Invention

[0006] In view of the above problems, embodiments of this application are proposed in order to overcome the above problems or at least partially solve the above problems.

[0007] To address the aforementioned problems, a first aspect of this application provides a scalable caching method for applications, the method comprising:

[0008] The target application is launched based on the startup package of the target application, and multiple cache components corresponding to the target application are initialized; each of the multiple cache components corresponds to its own storage medium, and the storage medium stores data that supports the operation of the target application;

[0009] In response to a storage space release event on the terminal, the data located in the local storage medium of the terminal is cleared through the corresponding caching component; wherein, after clearing, the total data remaining in the local storage medium is at least the data in the startup package, so as to at least ensure the startup of the target application;

[0010] In response to a read request from the target application, the corresponding data for the read request is retrieved from the cloud storage medium and / or the local storage medium through a corresponding caching component to support the operation of the target application; wherein the cloud storage medium stores the original data that supports the operation of the target application.

[0011] Optionally, in response to a storage space release event on the terminal, the data located in the local storage medium of the terminal is cleared through a corresponding caching component, including:

[0012] When the storage space release event is a partial clearing event, the data to be cleared in the local storage medium is cleared, and the data to be cleared is data determined based on the read frequency and / or the most recent read time;

[0013] When the storage space release event is an extreme cleanup event, all data in the local storage medium except for the startup package is cleared.

[0014] Optionally, multiple cache components have their own response priorities, and if the storage space release event is a partial clear event, the method further includes:

[0015] If the local storage medium includes memory, the data to be cleared from the memory is written to the corresponding local storage medium with a lower response priority than the memory;

[0016] For the remaining local storage media other than the memory, the data with target characteristics that have been cleared from the remaining local storage media are written into the incremental data area; wherein, the target characteristics indicate that the data block is data written by the target application.

[0017] Optionally, initializing multiple cache components corresponding to the target application includes:

[0018] Obtain the performance configuration parameters of the terminal; the performance configuration parameters include the version identifier of the terminal's operating system and / or the current performance configuration parameters of the memory on the terminal;

[0019] Based on the performance configuration parameters, the plurality of cache components are initialized, wherein the number of the plurality of cache components is adapted to the performance configuration parameters.

[0020] Optionally, based on the performance configuration parameters, the plurality of cache components are initialized, including:

[0021] When the performance configuration parameters determine that the terminal's memory and / or the operating system meet the target conditions, initialize the cache components corresponding to the multiple external storage devices and the terminal's memory respectively.

[0022] When the performance configuration parameters determine that the terminal's memory and / or the operating system do not meet the target conditions, the cache components corresponding to each of the multiple external storage devices are initialized.

[0023] Optionally, the method further includes:

[0024] Obtain the operating system parameters of the terminal, wherein the operating system parameters are used to indicate the version of the operating system on the terminal;

[0025] Based on the operating system parameters, an interface layer corresponding to the target application is created. The interface layer includes a file system model, a sandbox model, or a file interface model.

[0026] The interface layer is used to receive I / O requests from the target application and storage space release events.

[0027] Optionally, the plurality of cache components have their own response priorities, wherein a cache component with a higher response priority corresponds to a storage medium with a faster response speed, and the method further includes at least one of the following:

[0028] In response to the write request from the target application, the data to be written is written to the corresponding storage medium in descending order of the response priority of the multiple cache components;

[0029] In response to the read request from the target application, the data corresponding to the read request is retrieved from the corresponding storage medium through the cache components in descending order of their response priorities.

[0030] Data read from the storage medium corresponding to the cache component with lower response priority will be written to the storage medium corresponding to the cache component with higher response priority.

[0031] Optionally, the data to be written is sequentially written to the corresponding storage medium according to the response priority of the plurality of cache components from high to low, including:

[0032] According to the order of response priority from high to low, the data to be written is written to the storage medium corresponding to the cache component with the highest response priority through the cache component with the highest response priority;

[0033] The data to be written is read from the storage medium corresponding to the cache component with the highest response priority, and then written to the corresponding storage medium through the cache component with the lowest response priority.

[0034] Optionally, each storage medium stores data supporting the operation of the target application at the data block granularity, wherein the data block is obtained by dividing the original data of the target application into blocks; the method further includes:

[0035] In response to the read request from the target application, the data blocks required by the read request are read from the corresponding storage medium in descending order of the response priority of each of the plurality of cache components;

[0036] The read data blocks are encapsulated and returned to the target application.

[0037] Optionally, each storage medium stores data supporting the operation of the target application at the data block granularity, wherein the data block is obtained by dividing the original data of the target application into blocks, and the method further includes:

[0038] Based on the data read from multiple historical read requests of the target application, determine multiple pre-read data blocks to be read next;

[0039] For a target data block that is not present in the storage medium corresponding to the cache component with the highest response priority among multiple pre-read data blocks, the target data block is read from the corresponding storage medium in descending order of response priority through the remaining cache components.

[0040] The read target data block is written to the storage medium corresponding to the cache component with the highest response priority, so that when the next read request hits the multiple pre-read data blocks, the multiple pre-read data blocks are read from the storage medium corresponding to the cache component with the highest response priority.

[0041] Optionally, in response to a read request from the target application, the data blocks required by the read request are sequentially read from the corresponding storage medium according to the respective response priorities of the plurality of cache components in descending order, including:

[0042] In response to a read request from the target application, a block identifier for each data block required by the read request is determined based on a data correspondence; the data correspondence is used to characterize the correspondence between the original data and the data blocks in the storage medium.

[0043] According to the response priority of each of the plurality of cache components from high to low, the data blocks with the block identifier are read sequentially from the corresponding storage medium.

[0044] Optionally, before launching the target application based on its launcher package, the method further includes:

[0045] The original data of the target application is divided into blocks to obtain all data blocks, and then the original data blocks are further divided to obtain multiple original fragment files;

[0046] The multiple original fragment files and the startup package are uploaded to the cloud storage medium for the target application to download and use.

[0047] Optionally, the method further includes:

[0048] Create multiple interfaces between the corresponding caching components and the cloud storage medium; these interfaces, ranked from highest to lowest response priority, include: Content Delivery Network (CDN) interface, peer-to-peer (P2P) interface, and origin server interface;

[0049] When reading data from the cloud storage medium, the corresponding data is obtained from the cloud storage medium sequentially through the various interfaces in descending order of their response priority.

[0050] A second aspect of this application provides a cache-scalable processing apparatus for an application, the apparatus comprising:

[0051] An initialization module is used to start the target application based on the target application's startup package and initialize multiple cache components corresponding to the target application; each of the multiple cache components corresponds to its own storage medium, and the storage medium stores data that supports the operation of the target application;

[0052] The cleanup module is used to respond to a storage space release event on the terminal by clearing the data located in the local storage medium of the terminal through the corresponding caching component; wherein, after clearing, the total data remaining in the local storage medium is at least the data in the startup package, so as to at least ensure the startup of the target application;

[0053] A response module is used to respond to a read request from the target application and, through a corresponding caching component, obtain the data corresponding to the read request from the cloud storage medium and / or the local storage medium to support the operation of the target application; wherein, the cloud storage medium stores the original data that supports the operation of the target application.

[0054] This application also discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executed, implements a cache-scalable processing method for the application as described in the first aspect.

[0055] This application also discloses a computer-readable storage medium storing a computer program that causes a processor to execute a cache-scalable processing method for an application as described in the first aspect of this application.

[0056] This application also discloses a computer program product, including a computer program / instruction that, when executed by a processor, implements the cache-scalable processing method of the application described in the first aspect.

[0057] The scalable caching processing method of the application embodiment of this application can start the target application based on the target application's startup package and initialize multiple cache components. Since each cache component corresponds to its own storage medium, when the terminal's storage space needs to be released, the corresponding cache component can clear the data in the local storage medium on the terminal. During the clearing process, the total data remaining in the terminal's local storage medium is at least the data in the startup package. Thus, even when only the data in the startup package remains on the terminal, the normal startup of the target application can be guaranteed. Subsequently, during the target application's runtime, the corresponding cache component can retrieve the data corresponding to the read request from the original data in the cloud storage medium and / or the retained data in the local storage medium, thereby supporting the operation of the target application.

[0058] The scalable caching processing method of the application described in this application has the following advantages:

[0059] On the one hand, when clearing data from the local storage medium, only the data in the startup package remains on the terminal. Since the data in the startup package is very small, it occupies very little space on the local storage medium. For example, the startup package of some target applications is only tens of kilobytes, thus freeing up more storage space. This allows the terminal to install more applications and store more data, such as multimedia data.

[0060] On the other hand, the startup package is used to start the target application, which ensures that the target application starts normally on the terminal. When responding to the target application's read request in the future, the required data can be read from the original data in the cloud storage medium and / or the data retained in the local storage medium. Therefore, cleaning up the data does not affect the normal use of the target application.

[0061] In summary, the scalable caching method of this application can free up more space on the terminal for installing more applications and storing more multimedia data while retaining numerous applications without affecting user experience, thus solving the pain points faced by terminal technology. Attached Figure Description

[0062] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0063] Figure 1 This is a diagram of the hardware and software environment in which a cache scalable processing method is implemented in one embodiment of this application.

[0064] Figure 2a The diagram illustrates the hardware and software environment when the interface layer is a file system model.

[0065] Figure 2b The diagram illustrates the hardware and software environment when the interface layer is a sandbox model / file interface model.

[0066] Figure 3 This is a flowchart of the steps of a cache scalability processing method applied in an embodiment of this application;

[0067] Figure 4 This is a flowchart illustrating the data pre-reading steps in the implementation of this application;

[0068] Figure 5 This is a flowchart of the steps involved in creating the original fragment file in the implementation of this application;

[0069] Figure 6 This is a schematic diagram of an exemplary data block description table in an implementation of this application;

[0070] Figure 7 This is a structural block diagram of an application running device based on multi-level caching in the embodiments of this application. Detailed Implementation

[0071] To make the above-mentioned objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0072] The embodiments of the present invention can be applied to various operating systems of terminals, including PCs and mobile terminals. The operating systems include PC operating systems such as Windows, Linux, Unix, and virtual machine emulation systems, as well as mobile terminal operating systems such as Android and iOS.

[0073] In this embodiment of the invention, the target application can refer to an application with a large software installation package and data package, such as a 3D game or a PS application; the target application can be a PC application or a mobile terminal application (APP); the method and system of this embodiment of the invention will be described below using a mobile terminal as an example.

[0074] Currently, when installing applications such as 3D games and Photoshop, these applications typically occupy a significant amount of storage space on the device, preventing the installation of more applications. Furthermore, as these applications are used, data accumulates, increasing in volume and further reducing the available storage space. Generally, when users attempt to install new applications or store large amounts of multimedia data (such as images and videos), the existing applications' storage space prevents the new applications or the multimedia data from finding sufficient room, leading to installation or storage failures.

[0075] In related technologies, users typically clean up data on their devices to have enough space to install new applications or store new data. However, data cleanup is limited and cannot free up significant storage space. For example, when cleaning up WeChat on a phone, only some unimportant data (such as chat data) can be removed. Chat data generally occupies less space than the original data that supports WeChat's operation, but this original data cannot be cleaned, as doing so would render WeChat unusable. Therefore, users often forgo installing new applications or uninstall some existing ones, both of which degrade the user experience. Some users, in order to install more applications, often upgrade their devices, such as purchasing new devices with larger storage capacity, like new phones, or adding memory cards. However, this inevitably increases the user's purchasing costs.

[0076] In view of this, in order to solve the above-mentioned technical problems, this application proposes a technical solution to clean up data more thoroughly on the terminal without affecting the normal use of the application. To achieve this solution, the inventors first make the original data of the target application into a startup package and multiple original fragment files. The startup package is used to start the target application, while the original fragment files store the data required for the target application to run. The original fragment files can initially be saved in a cloud storage medium for the target application to download and use.

[0077] Based on this, this application can obtain the startup package of the target application, launch the target application through the startup package, and initialize multiple cache components corresponding to the target application. Each cache component corresponds to a storage medium. When it is necessary to clean up the terminal's data, the cache components can be used to clean up to at least the data in the target application's startup package remaining on the terminal. For the subsequent operation of the target application, the data required by the target application can be read from the original data in the cloud storage medium and / or the data retained in the local storage medium to support the operation of the target application. In this way, the normal operation of the target application can be guaranteed while cleaning up data more thoroughly and freeing up more space. Sufficient storage space is provided for installing new applications and storing new data. Users do not need to uninstall installed applications or purchase new terminals or new storage cards, thereby optimizing the user experience and reducing the user's purchase cost.

[0078] Furthermore, this application provides the following four improvements based on the above-mentioned technical concept:

[0079] Improvement 1: The number of initial cache components can be adapted to the terminal's operating system and storage device performance configuration parameters. This allows the number of cache components to match the terminal's performance configuration, increasing or decreasing the number as the terminal's performance changes, thus achieving scalability and flexibility to adapt to various terminals.

[0080] Improvement 2: In order to improve the I / O response speed of the target application and enhance its stability, a scheme is proposed to store the original data of the target application in data blocks. That is, the target application data is stored in the original fragment files at the data block granularity.

[0081] In related technologies, the data of each logical file of the target application is saved into three physical files (original data file, incremental data file, and metadata file (containing the attribute information of the logical file)). This yields the original image package of the target application, migrating its original data across these three physical files. This eliminates the need for parsing the runtime environment on which the target application depends and for modular decomposition, significantly reducing labor and time costs. However, with each logical file corresponding to three physical files, the number of files in the original image package increases exponentially. When the target application needs to read or write data, a large number of file handles are generated, easily reaching the system's handle limit and potentially causing the target application to crash.

[0082] Therefore, this application divides the raw data of the target application into blocks, and then distributes all the resulting data blocks into multiple raw fragment files, thus storing the raw data at the granularity of data blocks. In this way, the raw data in multiple logical files of the target application is redistributed to multiple raw fragment files. This allows for reading and writing data directly from the corresponding raw fragment files, avoiding the generation of a large number of file handles and improving the stability of I / O response.

[0083] Improvement 3: Multiple caching components can have their own response priorities, and can respond to the target application's I / O requests according to their respective response priorities, thereby reducing the component hierarchy depth of data access and improving the target application's I / O response speed.

[0084] In this improvement 3, when the target application issues a read request, data can be read from the storage medium with the fastest response speed first and returned to the target application. If data cannot be read from the storage medium with the fastest response speed, data can be read from the storage medium with the second fastest response speed and returned to the application. Thus, when reading data, data is read from the corresponding storage medium in descending order of response speed, thereby improving the I / O response speed of the target application.

[0085] Improvement 4: To further improve the I / O response speed of the target application, the cache component corresponding to the fastest response storage medium has been improved. This is mainly reflected in the following: based on the historical data reading trajectory of the target application, the data that the target application will read next is predicted, and the predicted data is written to the fastest response storage medium from other storage media in advance, thereby helping to further improve the I / O response speed of the target application.

[0086] To fully illustrate the scalable cache processing method of the target application of this application, the embodiments of this application will be described separately from the hardware and software environment applied in this application (Section 1.1), scalable processing of multi-level cache (Sections 2.1 to 3.1), the specific process of I / O response (Section 4.1), and I / O response based on the original fragmented file (Section 5.1).

[0087] 1.1 The hardware and software environment used in this application.

[0088] Reference Figure 1 The diagram illustrates the hardware and software environment in which the cache scalable processing method of the target application of this application is applied. Specifically, in... Figure 1 The hardware and software environment shown includes a multi-level caching system. Figure 1 The dashed box in the middle shows the multi-level caching system, the interface layer, the application manager, and the cache stack manager.

[0089] The multi-level caching system includes a native interface conversion component, a file block manager, a first cache component, a second cache component, a third cache component, a fourth cache component, and a fragmented file I / O splitter. The fragmented file I / O splitter communicates with both the third and fourth cache components. Of course, the number of cache components can vary depending on the terminal. Figure 1 The example given only illustrates the case of four cache components. It is understood that in other cases, there may be three or more cache components, but the number of cache components must be at least two, namely, a cache component corresponding to the cloud storage medium and a cache component corresponding to an external storage device on the terminal.

[0090] Multiple caching components have their own response priorities. Higher priority caching components correspond to faster storage media. Specifically, the first, second, and third caching components correspond to local storage on the terminal, while the fourth caching component corresponds to cloud storage. The local storage media stores a portion of the target application's data, while the cloud storage media stores all of the target application's original data. For example... Figure 1 As shown, Figure 1 The example shows the first cache component corresponding to the terminal's memory, the second cache component corresponding to the terminal's first external storage, and the third cache component corresponding to the terminal's second external storage.

[0091] The cache stack manager can be understood as the process that starts and maintains the multi-level caching system. The interface layer can be understood as the communication bridge between the target application and the multi-level caching system, used to send data read requests, data write requests, and data modification requests from the target application to the multi-level caching system, which then responds to these requests. The application manager can monitor and maintain both the target application and the multi-level caching system; specifically, it is responsible for managing the processes of the multi-level caching system and the target application and maintaining communication between them.

[0092] Among them, such as Figure 1 As shown, the interface layer communicates with the native interface conversion component. The native interface conversion component is the upper-level component of the file block manager. The file block manager is the upper-level component of the first cache component. The first cache component is the upper-level component of the second cache component. The second cache component is the upper-level component of the fragmented file I / O splitter. The fragmented file I / O splitter is the upper-level component of the third and fourth cache components.

[0093] The following is a detailed introduction to the functions of each component in the multi-level caching system:

[0094] 1.1.1 Native Interface Conversion Component. The native interface conversion component is responsible for receiving file I / O requests redirected by the interface layer. It can be oriented towards different operating systems, accepting the file I / O interface specifications corresponding to different operating systems, and converting various file I / O interface specifications into a unified interface specification for connection to the file block manager.

[0095] 1.1.2, File Block Manager. The file block manager is a higher-level component than multiple caching components. It is used to interface with data requests from the target application and manage data in multiple raw shard files. For example, when the file block manager receives a read request, it can determine the data corresponding to the read request, and then convert the read request into a read request that can be recognized by the caching components based on the corresponding data. The read request is then sent to multiple caching components in descending order of response priority to retrieve the corresponding data.

[0096] 1.1.3, Caching Components. Each caching component corresponds to a storage medium. Each caching component has its own data path to the storage medium. Caching components can manage and maintain the data in the storage medium through their respective data paths, and respond to data processing requests by processing the data in the storage medium through the corresponding data paths, such as reading, writing, and clearing the data in the storage medium. Furthermore, caching components can establish intra-system paths with adjacent upper-level and lower-level components according to their hierarchical relationship.

[0097] 1.1.4, Fragmented File I / O Splitter.

[0098] like Figure 1 As shown, the fragmented file I / O splitter is a lower-level component of the second cache component and an upper-level component of the third and fourth cache components, handling data from both local and cloud storage media on the terminal. In practice, complete data from multiple original fragmented files is stored in the cloud storage media, while data downloaded from the original fragmented files to the terminal can first be stored in the local storage media corresponding to a lower-priority cache component on the terminal. Therefore, the local storage media stores only portions of data from multiple original fragmented files. The fragmented file I / O splitter can also manage the incremental data area, which stores data written by the target application.

[0099] For example, the original fragmented files stored in the second external storage corresponding to the third cache component contain some of the downloaded data, while the cloud storage medium corresponding to the fourth cache component stores the original data of multiple original fragmented files. When the fragmented file I / O splitter receives a read request from the second cache component, it can read the required data from the storage medium corresponding to the third cache component and / or the fourth cache component, integrate the data read from the storage medium, and return it to the second cache component.

[0100] 1.1.5, the fourth caching component.

[0101] The fourth caching component, which can actually be called a data merger, is a lower-level component of the fragmented file I / O splitter. When data cannot be successfully read through the first to third caching components, the data merger can read the data required by the target application from different servers and return the data read from different servers to the fragmented file I / O splitter. In this application, the collection of different servers is referred to as cloud storage medium.

[0102] In this embodiment, after obtaining the startup package, the cache stack manager can be used to initialize the various components of the multi-level caching system, as detailed below:

[0103] 1.2 The specific initialization process of the corresponding components in the multi-level caching system.

[0104] In practice, the startup package and cache stack description file of the target application can be downloaded from the server first. The cache stack description file describes the various components that the target application needs to initialize. After the startup package is downloaded, the target application can be started and initialized based on the cache stack description file. Figure 1 The components in the multi-level caching system shown, for example, complete the initialization tasks of multiple caching components through the startup of the cache stack manager.

[0105] After the multi-level caching system is initialized, the target application can be run. When the target application is running, the interface layer sends the read requests, write requests and subsequent data cleanup requests issued by the target application to the native interface conversion component. After being converted by the native interface conversion component, the data is sent to the file block manager. The file block manager then sends the above requests to the corresponding caching components to execute the above requests.

[0106] For example, when initializing the native interface conversion component of the target application based on the cache stack description file, an interface layer that interfaces with the target application can be created; then, a data path can be established between the interface layer and the native interface conversion component so that the native interface conversion component can receive data processing requests redirected by the interface layer through this data path; and a data path can be established between the native interface conversion component and the file block manager so that the file block manager can receive data processing requests redirected by the native interface conversion component through the corresponding data path.

[0107] 1.3 Initialization of multiple caching components (corresponding to improvement point 1).

[0108] In one embodiment, performance configuration parameters of the terminal can be obtained, and the plurality of cache components can be initialized based on the performance configuration parameters. The performance configuration parameters include the version identifier of the terminal's operating system and / or the current performance configuration parameters of the terminal's memory and external storage, and the number of the plurality of cache components is adapted to the performance configuration parameters.

[0109] In this embodiment, the terminal's performance configuration parameters can be used to indicate the terminal's hardware and software performance status. The operating system version identifier can indicate the version of the terminal's operating system. The operating system can be Android, iOS, Windows, Linux, macOS, etc., as well as the operating systems corresponding to hardware platforms such as PlayStation, Xbox, and Nintendo Switch. Different operating systems can occupy different amounts of storage space and provide different operating environments for the terminal.

[0110] The current performance configuration parameters of the terminal's memory can include: the current remaining capacity of the terminal's memory (some system configurations may use a portion of the memory space as supplementary video memory for the integrated graphics card, or as read / write cache for the SSD), memory frequency, bit width, I / O response latency, and other parameters. These parameters reflect the terminal's memory performance, which in turn affects the terminal's application performance.

[0111] In one alternative example, before installing the target application on the terminal, the terminal's performance configuration parameters can be reported to the server where the target application resides via the application manager. The server pre-stores cache stack description files corresponding to different performance configuration parameters. These different cache stack description files guide the initialization of the appropriate number of cache components on terminals with corresponding performance configuration parameters. When downloading and installing the target application, a cache stack description file adapted to the terminal's performance configuration parameters can be downloaded from the server, thereby initializing the appropriate number of cache components based on the downloaded cache stack description file.

[0112] In another alternative example, a standard cache stack description file is stored on the server. When downloading and installing the target application, different terminals can download this cache stack description file from the server. The description entries corresponding to cache components in this cache stack description file can be set to initialize based on the terminal's performance configuration parameters, specifying the type and number of cache components to be initialized for different performance configuration parameters. Thus, when initializing cache components, the number and type of cache components to be initialized can be determined based on the terminal's performance configuration parameters, thereby initializing the corresponding number of cache components based on the cache stack description file and performance configuration parameters.

[0113] Among these components, the caching components corresponding to the cloud storage media are essential. A greater number of caching components means more caching components corresponding to the terminal's local storage media, and thus a wider variety of local storage media types can be utilized (different types of storage media may have different response speeds). This means that when responding to a read request from the target application, the data can pass through more local storage media responses before requesting data from the cloud storage media. Therefore, the probability of the local storage media successfully responding to the target application's request can be increased. Since the data path between the terminal's local storage media and the target application is a local path on the terminal, the communication path is short, thereby improving the response speed to the target application.

[0114] In practice, the local storage media of a terminal may include the terminal's memory and multiple external storage devices, which may include solid-state drives, hard disk drives, and external USB devices, memory cards, etc.

[0115] Among them, the terminal's performance configuration parameters represent the number of cache components initialized when the terminal's performance is better, which is greater than the number of cache components initialized when the terminal's performance is worse.

[0116] In specific implementation, when initializing multiple cache components based on the performance configuration parameters, it can be determined whether the terminal's memory, external storage, and / or operating system meet the target conditions based on the performance configuration parameters. If the target conditions are met, cache components corresponding to the multiple external storages and the terminal's memory are initialized respectively; if the target conditions are not met, cache components corresponding to the multiple external storages are initialized respectively.

[0117] The target conditions can be any combination of one or more conditions, such as the operating system being the target version, the terminal's CPU instruction set bitness being the target bitness, and the terminal's remaining memory capacity being no less than the target capacity. The more target conditions included, the higher the performance configuration parameters of the terminal need to meet in order to initialize a larger number of cache components.

[0118] When the target conditions are met, the initialized cache components include a cache component corresponding to memory, also known as a memory cache component, while multiple external storage devices on the terminal can each initialize their respective cache components. For example, if the target conditions are that the operating system version is Linux, the current remaining memory capacity is not less than 60%, the CPU instruction set is 64-bit, and both solid-state drives (SSDs) and hard disk drives (HDDs) are present, then meeting these conditions indicates that the terminal has superior performance, and four cache components can be initialized. These include, for example, a memory cache component corresponding to memory, a temporary cache component corresponding to the first external storage device (SSD) on the terminal, a local cache component corresponding to the second external storage device (HDD), and a cloud cache component corresponding to the cloud storage medium.

[0119] In one example, the cache component corresponding to one of the multiple external storage devices can be designated as a temporary cache component that complements the memory cache component. This memory cache component is a higher-level component adjacent to the temporary cache component; the two can be used in conjunction and are indispensable. For example... Figure 1 As shown, the first cache component is the memory cache component, and the second cache component is the temporary cache component. When the data in memory corresponding to the memory cache component is cleared, the cleared data can be written to the temporary cache component. In this way, when responding to the I / O requests of the target application, the data that was originally in memory can be read from the temporary cache component. This ensures that the memory space is not excessively occupied, while also guaranteeing the I / O response speed of the target application.

[0120] Of course, it should be noted that a terminal usually has multiple applications installed, which may be installed at different times. Therefore, as applications are continuously installed on the terminal, the terminal's storage resources are continuously occupied. Consequently, the terminal's performance configuration parameters may be different at different times. Therefore, the number of cache components initialized for applications installed at different times may also be different.

[0121] For example, for applications installed earlier, the storage resource utilization rate on the terminal is relatively low and the remaining memory capacity is relatively high during installation. Therefore, the initial caching components for applications installed earlier can include memory caching components and temporary caching components. For applications installed later, the storage resource utilization rate on the terminal is relatively high and the remaining memory capacity is relatively low. Therefore, the initial caching components for applications installed later may not include memory caching components and temporary caching components.

[0122] In this way, for the same terminal, the number of cache components initialized for applications installed at different times can also be different. This allows the terminal to install as many applications as possible while ensuring the response speed of some applications, thus making full use of the terminal's storage resources.

[0123] When using this implementation method, the number of cache components initialized can be determined based on the terminal's performance configuration parameters when initializing the multi-level caching system of the target application. In this way, the number of cache components initialized can be adapted to the terminal's operating system version and the performance configuration of memory and external storage. This means that the number of cache components initialized will be different for terminals with different operating system versions, and the number of cache components initialized will also be different for terminals with different storage performance configurations. Therefore, the number of cache components can be scalable relative to different types of terminals and can also be different for terminals at different installation times, thereby improving the adaptability between the multi-level caching system and the terminal.

[0124] Furthermore, since the cache components other than the one corresponding to the cloud storage medium (the cloud cache component) correspond to the terminal's local storage medium, the local storage medium used by the multi-level caching system on different terminals can be different when the cache components are initialized based on the terminal's performance configuration parameters. For example, when the target conditions are met, the terminal's memory and multiple external storage devices are used to respond to the target application; when the target conditions are not met, multiple external storage devices on the terminal are used to respond to the target application. In this way, appropriate storage media can be used based on the terminal's performance configuration to fully respond to the target application, achieving full utilization and scheduling of the terminal's storage resources.

[0125] 1.4 Initialization of the interface layer.

[0126] In one embodiment, the interface layer can be understood as a communication bridge between the target application and the multi-level caching system. The interface layer is used to receive I / O requests and storage space release events issued by the target application, that is, to receive read requests, write requests, and data cleanup requests from the target application. The interface layer can be a file system model, a sandbox model, or a file interface model.

[0127] In practice, to ensure that a multi-level caching system is fully compatible with the terminal's operating system and to improve its portability across different terminals, the type of the corresponding interface layer can be determined based on the terminal's operating system parameters. Specifically, the terminal's operating system parameters can be obtained, and an interface layer corresponding to the target application can be created based on these parameters.

[0128] In this embodiment, the operating system parameter is used to indicate the version of the operating system on the terminal. This operating system parameter can be an operating system version identifier. As mentioned above, different operating systems provide different program execution environments for terminals, such as differences in system architecture, hardware configuration, software layering models, and permission management designs. Therefore, different interface layers need to be implemented. Furthermore, different interface layers differ in their invasiveness to the operating system and the difficulty of development. Therefore, in order for a multi-level caching system to support the stable operation of target applications in the runtime environment provided by the operating system through a matching interface layer, matching interface layers can be initialized for terminals with different operating systems.

[0129] Specifically, when the operating system parameter indicates that the operating system is the corresponding console operating system such as PlayStation, Nintendo Switch, or iOS, the initialized interface layer can be a file interface model; when the operating system parameter indicates that the operating system is Windows, Linux, Android, or MacOSX, the initialized interface layer can be a file system model; and when the operating system parameter indicates that the operating system is the Xbox console operating system, the initialized interface layer can be a sandbox model or a file interface model.

[0130] Specifically, refer to Figure 2a and Figure 2b As shown, Figure 2a The diagram illustrates a hardware and software environment where the interface layer is a file system model. Figure 2b The diagram illustrates the hardware and software environment when the interface layer is a sandbox model / file interface model.

[0131] like Figure 2a As shown, the file system model, also known as the file system model, is based on kernel file system management. It avoids hijacking the operating system, forcibly modifies memory content, and does not cause stability issues. It offers advantages such as non-intrusiveness to applications, high stability, and no code learning or adjustment costs. Another advantage of the file system model is its ability to handle read and write requests for memory-mapped files. In the related design of the operating system, the file system model is a kernel-level component that can handle application file read / write and file mapping I / O (initiated by the MMU—memory manager) requests. In contrast, the sandbox model and file interface model are application-level components, and therefore can only handle application file read / write requests. Therefore, the file system model is the most adaptable solution for handling application file I / O requests.

[0132] like Figure 2bAs shown, the Sandbox Model is a mechanism for hijacking file access interfaces based on the File Hooking Layer. This mechanism scans relevant file access interfaces in memory during application process initialization, then modifies the binary entry code of the file access interface, redirects and transforms the original function. Engineers do not need to pay attention to the file data access library and related interfaces that the application depends on, and can achieve the goal of taking over file read and write requests. It has the advantages of low code learning cost and low adjustment cost.

[0133] The file interface model is linked and called by the core components of the application (e.g., 3D graphics engine, file compression / decompression library, video codec library, resource parsing library for various formats, etc.). Although there is a certain cost of code learning and adjustment, this method has the best system portability.

[0134] Among them, such as Figure 1 As shown, a data path is established between the interface layer and the native interface conversion component. Through this data path, the native interface conversion component can receive data processing requests redirected by the interface layer. These data processing requests are sent to the interface layer by the target application running in the operating system. The native interface conversion component is used to convert various file I / O interface specifications into a unified interface specification and connect it to the file block manager.

[0135] A data path is also established between the native interface conversion component and the file block manager. Through this data path, the file block manager can receive data processing requests converted by the native interface conversion component. Thus, through the interface layer, the native interface conversion component, and the file block manager, as well as the data paths between them, a communication architecture is established between the multi-level caching system and the target application, thereby successfully enabling the multi-level caching system to support and respond to the target application.

[0136] 1.5 Initialization of the cache component corresponding to the cloud storage medium.

[0137] like Figure 1 As shown, multiple interfaces are configured between the cloud storage medium and the corresponding fourth cache component. These interfaces can have their own response priorities, and different interfaces can have different response speeds. Furthermore, different interfaces can retrieve data from the original fragment files on the corresponding server. By configuring multiple interfaces, the probability of the terminal successfully downloading the target application's data from the cloud storage medium can be increased, thereby ensuring the stable operation of the target application.

[0138] In practice, multiple interfaces can be created between the caching components and the cloud storage medium. These interfaces, ranked from highest to lowest response priority, include: a Content Delivery Network (CDN) interface, a peer-to-peer (P2P) interface, and an origin server interface. Thus, when reading data from the cloud storage medium, the corresponding data can be retrieved sequentially through these interfaces according to their response priorities. It should be noted that interfaces with higher response priorities receive data faster.

[0139] In this embodiment, the cloud storage medium may include multiple data sources (e.g., servers), including CDN (Content Delivery Network) data sources and P2P data sources. Specifically, the CDN interface corresponds to the CDN data source, and the P2P interface corresponds to the P2P data source; the origin server interface corresponds to the storage medium on the initial site storing the data blocks of the target application.

[0140] The basic principle of CDN is to widely deploy multiple cache servers in various regions, distributing these cache servers to areas or network zones where user access data is relatively concentrated. When a user accesses a website, global load balancing technology is used to direct the user's access request to the nearest working cache server, which then directly responds to the user's request. Correspondingly, CDN interfaces can be loaded by the cache stack manager, registering their interface table with the cache stack manager using xxx_ITF_uuid.

[0141] The P2P data source is a P2P transmission component implemented based on the BitTorrent or MagNet communication protocol, which can save download traffic from CDN data sources. When the number of application download users reaches tens or hundreds of millions, it can save enterprise users (app store service providers) a significant amount of traffic costs and increase user stickiness. The P2P interface is loaded by the cache stack manager and its initialization interface (ITF_Initialize) is called. The specific process is as follows: initializing the internal data structure and registering its own interface table with the cache stack manager through xxx_ITF_uuid.

[0142] When retrieving data from cloud storage media sequentially via various interfaces in descending order of response priority, the CDN interface has a higher response priority than the P2P interface, and the P2P interface has a higher response priority than the origin server interface. Therefore, data can be retrieved first from the original shard file of the CDN data source via the CDN interface, i.e., from the nearest cache server. If successfully retrieved, the data is directly returned to the fourth cache component. If unsuccessful, a data retrieval request is encapsulated for the unretrieved data, and the corresponding data is retrieved from the original shard file of the P2P data source via the P2P interface. If successfully retrieved, the data is returned to the fourth cache component. If still unsuccessful, another data retrieval request is encapsulated for the unsuccessful data, and the remaining data is retrieved from the original shard file of the origin server (the server initially storing the original shard files) via the origin server interface. If successfully retrieved, the remaining data is returned to the fourth cache component. If the remaining data is not successfully retrieved, the fourth cache component can return a data read failure message, allowing the target application to re-initiate the read request.

[0143] In addition, to save traffic costs, the response priority of the P2P interface can be adjusted to be higher than that of the CDN interface. As a result, the process of handling read requests from the target application according to the response priority will be adjusted to: first try to obtain data from the original fragment file of the P2P data source, then obtain data from the original fragment file of the CDN data source, and finally obtain data from the original fragment file of the origin data source. Although the adjustment of the response priority will reduce the speed of the fourth caching component in processing read requests, the method of prioritizing the acquisition of data from the P2P data source will save a lot of traffic costs.

[0144] When this implementation method is adopted, since data can be obtained from multiple data sources through different interfaces, fault tolerance (network anomalies) can be maximized, increasing the probability that the terminal can successfully download the data required by the target application from the cloud storage medium, thereby improving the stability of the I / O response to the target application.

[0145] 1.6 Monitoring and maintenance of target applications and multi-level caching systems.

[0146] In this embodiment, the target application can be run in response to the event that the cache stack manager has completed the initialization of the multi-level caching system; the process of the target application and the cache stack manager can be monitored; and the process of the target application and the cache stack manager can be terminated when the process of the target application or the cache stack manager encounters an abnormality.

[0147] In practice, the application manager can monitor the process of the target application and the cache stack manager. Specifically, the application manager can establish a listening channel with the target application based on the PID information (Process Identifier) ​​and establish a listening channel with the cache stack manager based on the PID information of the cache stack manager, so as to monitor the status of the cache stack manager and the target application.

[0148] If either the target application or the cache stack manager encounters an exception or crashes, both will be terminated. When terminating the target application and the cache stack manager, the configuration of the target application and the state of the data managed by the cache component corresponding to the local storage medium can be restored, thereby ensuring the overall consistency of the configuration of the target application and the state of the data managed by the cache component corresponding to the local storage medium.

[0149] In practice, when a user exits the target application normally, the application manager can notify the cache stack manager to exit normally. After waiting for a period of time (checking 30 seconds in a loop), if the cache stack manager still has not exited, it can be forcibly terminated through the operating system API (Application Programming Interface).

[0150] 2.1 Detailed explanation of the target application's scalable caching processing method

[0151] Reference Figure 3 As shown, a flowchart illustrating the steps of the cache scalability processing method for the target application of this application is presented, as follows: Figure 3 As shown, the specific steps may include:

[0152] Step S301: Start the target application based on the target application's startup package and initialize multiple cache components corresponding to the target application.

[0153] Each of the multiple caching components corresponds to its own storage medium, which stores data that supports the execution of the target application. Specifically, the storage medium includes at least cloud storage and the terminal's local storage. The cloud storage includes the raw data that supports the execution of the target application, that is, all the raw data of the target application. The local storage includes some or all of the data of the target application, generally including data downloaded from the cloud storage, and the downloaded data is usually a partial data.

[0154] In this embodiment, when the target application is not installed, the startup package of the target application can be downloaded from the server. Specifically, when a user needs to install the target application on the terminal, they can download the startup package from the corresponding server through the application manager. The startup package contains very little data, including the most basic files for launching the target application. When the terminal runs the target application using the startup package, the package checks whether the target application has already been registered, configured, and installed on the current system. If it has not yet been registered, configured, and installed, the package completes the basic application registration, installation, and configuration for the target application, as well as the interaction between the target application and the terminal's operating system during the installation process. Then, it launches the target application and initializes multiple cache components corresponding to the target application. Otherwise, it directly launches the target application and initializes the multiple cache components corresponding to the target application.

[0155] Therefore, when the startup package is downloaded, the target application can be started using the startup package. When the target application starts, multiple cache components of the target application can be initialized. The initialization process can be referred to in Section 1.3 above. Specifically, the cache stack description file of the target application can be obtained. In one embodiment, the cache stack description file can include multiple cache stack description files, and different cache stack description files are for terminals with different performance configurations. Thus, when downloading the startup package of the target application, the performance configuration parameters of the terminal can be sent to the server to obtain the cache stack description file adapted to the terminal itself, and then multiple cache components can be initialized according to the cache stack description file.

[0156] It is understandable that during the initialization of multiple cache components, a data path can be established between each cache component and its corresponding storage medium to establish a communication connection between the cache component and the storage medium.

[0157] The cache stack description file is used to indicate which components in the multi-level cache system need to be initialized. For example, the "name" field in the cache stack description file indicates the name of the current component, and the "type" field indicates the type of the current component. The cache stack manager needs to perform a validity check: its value can be "I / O_filter", "by-path_filter", or "cluster_I / O_filter", which respectively represent "I / O filter", "bypass filter", and "aggregate I / O filter".

[0158] In this context, "I / O Filter" indicates that the component is essential for data I / O; "Bypass Filter" indicates that the component is not essential for data I / O. The "id" field represents the UUID of the current component, which the cache stack manager needs to validate: the UUIDs of top-level and secondary filter components must be globally unique. The "path" field represents the relative path of the current component; the "components" field exists only for components in the "Aggregate I / O Filter" category, representing the descriptions of the current component's dependent (secondary) components. Its structure is a composite array including the dependent I / O components contained in the aggregate I / O filter. For I / O filters at the same level: they are built from bottom to top and destroyed from top to bottom; for I / O filters at different levels: they are built from the inside out and destroyed from the outside in.

[0159] Step S302: In response to a storage space release event on the terminal, the data located in the local storage medium of the terminal is cleared through the corresponding cache component.

[0160] The process involves clearing data from the local storage medium, ensuring that at least the data in the startup package remains intact, thus guaranteeing the startup of the target application. Specifically, the clearing includes proportional clearing and extreme clearing. In the case of extreme clearing, the data remaining in the local storage medium after clearing is equal to the data in the startup package, ensuring at least the startup of the target application.

[0161] In this embodiment, in order to avoid the target application occupying too much storage space on the local storage medium of the terminal, so that the terminal can install more applications and provide a faster response speed, this application regularly clears the data in the local storage medium to free up more storage space for the terminal to store data of other applications and / or other multimedia data.

[0162] The storage space release event can be triggered on the terminal. In one example, a storage space release event can be triggered when the remaining storage capacity of a local storage medium is detected to be lower than its target capacity. In another example, the storage space release event can also be triggered based on a user's data cleanup operation. For instance, a user enters the application manager and triggers data cleanup for a target application through the interface provided by the application manager, thus triggering the storage space release event. The user can specify the local storage medium to be cleaned and the extent of data cleanup. Subsequently, the caching component corresponding to the local storage medium to be cleaned can clear the data in the local storage medium.

[0163] In practice, some or all of the data on the local storage medium can be erased, for example, such as Figure 1 The local storage medium has three components, corresponding to the first to the third cache components. When data needs to be cleared, the data in all three cache components can be cleared, or only the data in one or two of the three cache components can be cleared.

[0164] When clearing data stored on local storage media, for a given local storage medium, all data or a portion of the data can be cleared. Generally, the limit of clearing is that the amount of data remaining on all local storage media is the same as the data in the boot package. In other words, the data clearing in this application includes proportional data clearing and extreme clearing. In proportional clearing, the proportion can be specified by the user, while extreme clearing minimizes the amount of data remaining on all local storage media; this minimum amount of data is the data in the boot package.

[0165] The startup package only includes components for the application to register with the operating system and configure information, startup program components, and components related to the multi-level caching system. It does not include data of the executable components of the application itself or data of resource packages. Therefore, it occupies very little space on local storage media.

[0166] For example, such as Figure 1 As shown, under this extreme cleanup, all remaining data in the local storage media corresponding to the first to third cache components consists only of the data in the startup package. In this case, the local storage media corresponding to the first and second cache components may not contain the target application's data, while the second external storage corresponding to the third cache component contains only the startup package. Alternatively, the second external storage may not contain the startup package, while the first external storage may contain it.

[0167] Because the startup package occupies very little storage space, it can achieve maximum cleanup of the target application's data on the terminal. Furthermore, since the startup package is used to launch the target application, its presence will not affect the launch and use of the target application.

[0168] Step S303: In response to the read request of the target application, retrieve the data corresponding to the read request from the retained data of the cloud storage medium and / or local storage medium through the corresponding caching component to support the operation of the target application.

[0169] The cloud storage medium contains all the raw data that supports the operation of the target application.

[0170] In this embodiment, after cleaning up the data in the local storage medium based on the storage space release event, if a read request from the target application is received, the data corresponding to the read request can be obtained from the local storage medium and / or the cloud storage medium to support the normal operation of the target application.

[0171] After data cleanup, if the data stored on the local storage medium includes not only the startup package but also other data required by the target application, then if the data corresponding to the read request exists on the local storage medium, the required data can be read from the local storage medium and returned to the target application. If the data corresponding to the read request does not exist on the local storage medium, the required data can be read from the cloud storage medium and returned to the target application. If the data corresponding to some read requests exists on the local storage medium, the existing data can be read first, and then a new read request can be constructed for the remaining non-existent data. This new request can be sent to the corresponding cache component on the cloud storage medium to obtain the remaining data corresponding to the read request. Finally, the data obtained from the local storage medium and the data obtained from the cloud storage medium are concatenated to form the complete data response corresponding to the read request and returned to the target application.

[0172] If, after data cleanup, the only data remaining on the local storage medium is the startup package, then when a read request is received from the target application, the required data can be directly read from the cloud storage medium and returned to the target application.

[0173] In either case, the cloud storage medium always stores all the original data required by the target application. As long as the target application can be launched via the startup package on the terminal side, multiple caching components can ensure that the read requests of the target application are successfully executed to support the operation of the target application.

[0174] It should be noted that the above data cleaning may refer to the deletion of data.

[0175] The technical solution adopted in this application has two advantages. First, when clearing data from the local storage medium, only the data in the startup package remains on the terminal. Since the startup package has a very small data size, it occupies very little space on the local storage medium. For example, the startup package of some target applications is only tens of kilobytes, thus freeing up more storage space. This allows the terminal to install more applications and store more data, such as multimedia data. Second, the startup package is used to launch the target application, ensuring the normal startup of the target application on the terminal. Furthermore, when responding to read requests from the target application, the required data can be read from the cloud storage medium and / or the local storage medium. Therefore, clearing the data does not affect the normal use of the target application.

[0176] In summary, the scalable caching method of this application can free up more space on the terminal for installing more applications and storing more multimedia data while retaining numerous applications without affecting user experience, thus solving the pain points faced by terminal technology.

[0177] The following section details how this application performs data cleaning.

[0178] 3.1 The data cleaning process.

[0179] In this embodiment, in order to avoid the target application occupying too much storage space on the terminal's storage medium, so that the terminal can install more applications and provide a faster response speed, this application uses multiple cache components located on the terminal to periodically clear data from the local storage medium, so as to free up more storage space on the terminal for storing data of other applications.

[0180] Data cleanup involves two scenarios: partial cleanup and complete cleanup. Partial cleanup removes infrequently accessed data from the local storage medium, while complete cleanup removes all data from the local storage medium except for the startup package. The two cleanup scenarios are explained below:

[0181] 3.1.1, Partial clearing.

[0182] In specific implementation, when the storage space release event is a partial clearing event, the data to be cleared in the local storage medium is cleared, and the data to be cleared is determined based on the read frequency and / or the most recent read time.

[0183] In practice, data in the local storage medium that is read less frequently than the target frequency and / or whose most recent read time is earlier than the preset read time can be cleared, or data that is read less frequently than the target frequency and / or whose most recent read time is earlier than the preset read time and meets the target ratio can be cleared.

[0184] The target percentage can be a user-specified percentage reflecting the proportion of data to be cleared relative to the original data volume. For example, a target percentage of 40% means that 40% of the data needs to be cleared. Users can also specify the local storage media to be cleared. For instance, specifying the memory corresponding to the first cache component as the target for data clearing will clear data from that memory according to the target percentage. In practice, all local storage media can be cleared. This allows specifying a target percentage for each local storage media. Different local storage media can correspond to different target percentages, or they can correspond to the same target percentage, thus achieving the clearing of data from the target application on each local storage media.

[0185] In one example, data can be cleared without adhering to the target ratio. In this case, data with a read frequency lower than the target frequency and / or a most recent read time earlier than the preset read time can be cleared. For example, all data with a read frequency lower than the target frequency can be cleared, or all data with a most recent read time earlier than the preset read time can be cleared, or all data with a read frequency lower than the target frequency and a most recent read time earlier than the preset read time can be cleared.

[0186] In one example, the data in each local storage medium can be sorted by frequency and most recent read time. Specifically, corresponding weights can be set for read frequency and read time. Then, based on the read frequency, read time, and their respective weights, a sorting score is obtained for each data point. The data is then sorted according to the sorting score, with the top-ranked data being the data that users read most frequently. In this way, a target proportion of data can be cleared from back to front according to the sorting. This achieves the goal of clearing a target proportion of data based on read frequency and read time.

[0187] Here, read frequency can be understood as the number of reads. Taking data cleanup in memory as an example, when determining the data to be cleared in memory, a doubly linked list can be maintained in the memory cache component. The head of the doubly linked list stores the data identifiers of the "most recently accessed" data, and the tail stores the data identifiers of the "least recently accessed" data. When a read request hits a certain data, the corresponding data identifier is taken from its current position in the doubly linked list and placed at the head of the list. Thus, the closer the data identifier is to the head of the list, the more recently the data has been accessed. When memory cleanup is needed, the data corresponding to multiple data identifiers at the tail of the list can be identified as the data to be cleared (traversing the data blocks from the tail to the head of the list and counting them, while simultaneously calculating the proportion with the total number of data blocks in the list). The proportion of the data to be cleared to the total data in the list is the target proportion. For example, if the target proportion is 40%, then the 40% of data that is not frequently accessed will be cleared.

[0188] Of course, as mentioned above, you can also record the number of times each piece of data is read and the time of each read, and set weights for the number of reads and the reading time respectively. For example, set the weight of the number of reads to 0.8 and the weight of the reading time to 0.2. In this way, the focus will be on eliminating data based on the number of reads.

[0189] In one embodiment, when the local storage medium includes memory, that is, when it includes a memory cache component corresponding to memory and a temporary cache component corresponding to the first external storage, during the data cleanup process, the data in memory and other local storage media can be processed differently to ensure the I / O response of the target application.

[0190] In practice, data cleared from memory can be written to the corresponding local storage medium with a lower response priority than memory; and for the other local storage media besides memory, the data with the target characteristics that has been cleared from the other local storage media can be written to the incremental data area.

[0191] Among them, the target feature representation data is the data written by the target application, and the incremental data area can be located in the local storage medium with the lowest response priority.

[0192] In this embodiment, the memory corresponds to a memory cache component, which has the highest response priority. The lower-level component of the memory cache component is a temporary cache component, which corresponds to the first external storage on the terminal (a local storage medium with a response priority lower than memory), such as a solid-state drive. When data belonging to the target application in memory is cleared, the data evicted from memory can be written to the first external storage. In this case, when a read request from the target application arrives, if the data corresponding to the read request exists in the first external storage, the data can be read from the first external storage.

[0193] Of course, in the above scenarios, the first external storage can be either a local storage medium that is not subject to data cleanup or a local storage medium that is subject to data cleanup. If it is not subject to data cleanup, the data evicted from memory to the first external storage can remain uncleaned, thus ensuring the response speed of the next data read request from the target application. If it is subject to data cleanup, the data with the target characteristics evicted from memory to the first external storage will be written to the incremental data area, thus ensuring that the user's various configurations and archived data for the target application will not be lost.

[0194] When cleaning up data on local storage media other than memory, if the data to be cleaned up was written by the target application, then that data can be written to the incremental data area, for example... Figure 1 As shown, the incremental data area can be located in the second external storage. This incremental data area is a data area that will not be cleared. In other words, the data written by the user will not be deleted, which can ensure that the data written by the user will not be lost due to clearing. For example, it can ensure that the user's graphics, peripherals, game-related configurations or save data will not be lost.

[0195] When this implementation method is adopted, data belonging to the target application in one or more local storage media can be cleaned in a targeted manner. Data can be cleaned according to a target proportion or dynamically according to the reading frequency and / or the most recent reading time. In this way, data cleaning can be carried out according to the actual needs of the user, achieving the purpose of dynamic data cleaning, thereby freeing up more storage space for the terminal.

[0196] 3.1.2, the case of complete removal.

[0197] When the storage space release event is an extreme cleanup event, all data in the local storage medium except for the startup package is cleared.

[0198] Among them, the extreme cleanup event can be understood as extreme data cleanup, that is, after cleanup, all the data left on the local storage medium is only the boot package. At this time, for a local storage medium, the data of the target application stored therein is either completely cleaned up or all the data except the boot package is cleared.

[0199] Specifically, since the startup package needs to be persistently stored locally on the terminal, the local storage medium where the startup package resides is generally the storage medium corresponding to a cache component with a lower response priority. Therefore, for the local storage medium with the lowest response priority, all data except the startup package can be cleared. For the other local storage media with lower response priorities, all data of the target application in the local storage medium can be cleared. For example, such as... Figure 1 As shown, it can clear all data of the target application in memory and the first external storage, while only the startup package is kept in the second external storage, and all other data is cleared.

[0200] In this implementation, on the one hand, the space of the local storage medium can be periodically cleaned up, removing data with infrequent access and / or earlier access times from the local storage medium, so that the local storage medium can store data with frequent access and / or more recent access times. On the other hand, by periodically cleaning up the data in the local storage medium, the occupancy rate of the local storage medium can be reduced. When periodically cleaning up memory, memory usage can be reduced, thereby ensuring the memory's responsiveness to other applications and improving the stability of the terminal's operating system. Furthermore, when periodically cleaning up the first and second external storage, a certain proportion of frequently used data can be retained in the first and second external storage, reducing the storage usage of the first and second external storage to the user-specified proportion. In this way, if the user wants to download and run a new application, the freed-up space can be used to store the corresponding data for the new application, thus ensuring the operation of both the new application and the target application.

[0201] Of course, when a new application initializes the multi-level caching system of this application, the user can also specify the clearing of data belonging to the new application in the local storage medium, thereby freeing up storage space for other applications and dynamically meeting the stable operation of each application.

[0202] 4.1 I / O request response process based on multi-level caching system (corresponding to improvement point 3).

[0203] In this embodiment, multiple caching components have their own response priorities, with higher priority caching components corresponding to faster storage media. These caching components can respond to the target application's I / O requests according to their respective priorities, sequentially reading or writing the data corresponding to the I / O requests to their respective storage media. Thus, the caching components can respond to both write and read requests from the target application.

[0204] 4.1.1 Response to write requests.

[0205] It can respond to write requests from the target application and write the data to be written to the corresponding storage medium in descending order of the response priority of multiple cache components.

[0206] In practice, for each write request, the data corresponding to the write request can be written to the corresponding storage medium level by level. In one optional example, an incremental data area can be set in any storage medium corresponding to any of the other cache components except the one with the highest response priority. After the data to be written is written to the storage medium corresponding to the cache component with the highest response priority, the data to be written can be read from the cache component corresponding to the incremental data area and written to the incremental data area.

[0207] For example, such as Figure 1 As shown, the incremental data area can be set in the first external storage. The first cache component has the highest response priority and can write the data to be written to its corresponding memory. With the incremental data area set in the first external storage, the second cache component reads the data to be written from memory and then writes it to the incremental data area. The incremental data area can mirror the directory of the original fragment file. During writing, the data to be written is written to the corresponding incremental fragment file.

[0208] In another alternative example, the data to be written can be written to the storage medium corresponding to the cache component with the highest response priority, in descending order of response priority; and the data to be written can be read from the storage medium corresponding to the cache component with the highest response priority, and the data to be written can be written to the corresponding storage medium through the cache component with the lowest response priority.

[0209] When writing data to be written to the storage medium corresponding to the cache component with the highest response priority, the next-level cache component of the cache component with the highest response priority reads the data to be written from the storage medium corresponding to the cache component with the highest response priority and writes the data to be written to its own storage medium. The next-level cache component then reads the data to be written from the storage medium corresponding to the next-level cache component and writes it to its own storage medium, and so on, to achieve hierarchical writing of data. In this way, each storage medium can include the data corresponding to the write request of the target application.

[0210] Of course, after writing the data corresponding to the write request to the storage medium, the data flag bit of the data can be updated. The data flag bit can include "0" and "1"; where "0" means clean and "1" means "dirty", indicating that the data has been written.

[0211] In this case, when data needs to be read, the data flag bit of the data to be read can be used to determine whether the data is data to be written. If so, the data is read from the corresponding local storage medium. Specifically, if the data to be written is written to the incremental data area, the data can be read directly from the incremental data area; otherwise, the original data is read from the local storage medium.

[0212] When using this implementation method, when writing data, the data block can be written to the storage medium with the highest response priority, and then the data to be written can be extracted from the storage medium with the highest response priority and written to other storage media or incremental data area. Since the efficiency of writing to the storage medium with the highest response priority is significantly higher than the efficiency of writing to other storage media, the user's write request can be responded to quickly, thereby optimizing the user experience.

[0213] 4.1.2, Response to read requests.

[0214] Specifically, when multiple caching components have their own response priorities, they can respond to the read requests of the target application and retrieve the data corresponding to the read request from the corresponding storage medium in descending order of the response priorities of the multiple caching components.

[0215] In this embodiment, the data corresponding to the read request can be retrieved from the corresponding storage medium through each cache component in descending order of response priority. In specific implementation, the required data can be retrieved from multiple storage media in descending order of response priority.

[0216] When all the required data is read from one or more storage media, the system can return the data to the target application; when not all the required data is read from one or more storage media, the system can return a data read failure message to the target application.

[0217] Accordingly, when attempting to read the required data from multiple storage media sequentially according to response priority from high to low, Figure 1 The following is an example of the hardware and software environment shown. The first cache component corresponds to the terminal's main memory, the second cache component corresponds to the terminal's primary external storage, the third cache component corresponds to the terminal's secondary external storage, and the fourth cache component corresponds to cloud storage media. The specific process can be followed as follows:

[0218] First, retrieve the data from memory;

[0219] If not all data is successfully retrieved from memory, the data that was not retrieved from memory is retrieved from the first external storage.

[0220] If the required data is not successfully retrieved from the first external storage, then the data that was not successfully retrieved from the first external storage is retrieved from the second external storage.

[0221] If the required data is not successfully retrieved from the second external storage, the data that was not successfully retrieved from the second external storage will be retrieved from the cloud storage medium.

[0222] Therefore, it can be seen that this application adopts a multi-level caching component architecture, which can reduce the data access process when reading data, thereby improving the I / O response speed of the target application.

[0223] In one example, data read from the storage medium corresponding to a cache component with a low response priority can also be written to the storage medium corresponding to a cache component with a high response priority.

[0224] When using the above-described implementation method of reading data according to response priority, the data read from the storage medium corresponding to the cache component with low response priority will not exist in the storage medium corresponding to the cache component with high response priority. For example, the data read from the second external storage does not exist in the first external storage and memory.

[0225] Therefore, data read from a low-priority storage medium can be written to the storage medium corresponding to a high-priority cache component. This can be done by writing to the storage media corresponding to all high-priority cache components, or to the storage media corresponding to any one of the high-priority cache components. For example, data read from the second secondary storage can be written to the first secondary storage and memory, or to either the first secondary storage or memory.

[0226] In one embodiment, as described in Section 3.1.1 above, considering that the data in the first external storage corresponding to the temporary cache component (the cache component corresponding to the first external storage) of this application is data that has been evicted from memory, this application may write the data obtained from the second external storage or the cloud storage medium into memory when data is obtained from the second external storage or the cloud storage medium; and write the data obtained from the cloud storage medium into the second external storage when data is obtained from the cloud storage medium.

[0227] In this embodiment of the application, data obtained from the second external storage or cloud storage medium can be written into memory; or, when data is obtained only from the cloud storage medium, the data obtained from the cloud storage medium can be written into memory and the second external storage.

[0228] In this implementation, data retrieved from a low-priority storage medium can be moved to a high-priority storage medium. This allows data to be progressively moved to faster-responding storage media, increasing the probability of shortening the data access process as the number of data accesses increases, thereby improving the I / O response speed during the target application's runtime. Furthermore, on one hand, it ensures that the first external storage only retains data evicted from memory. As the target application runs longer, more and more data is evicted from memory, significantly increasing the probability of successfully reading data from both the first external storage and memory. On the other hand, since data retrieved from cloud storage can be written to the second external storage, it ensures that subsequent reads can be directly retrieved from the second external storage, reducing the access process for subsequent data reads and improving I / O response speed.

[0229] 5.1 Store the target application's raw data at the data block granularity (corresponding to improvement point 2)

[0230] 5.1.1, Creation of the original fragment files.

[0231] As described in improvement point 2 above, while improving the I / O response speed of the target application, the process of creating the original fragmented files has also been improved to enhance the stability of the target application's I / O response. This is mainly reflected in the fact that each storage medium stores data supporting the operation of the target application at the data block granularity. A data block is obtained by dividing all the original data of the target application into blocks.

[0232] In practice, all data blocks obtained after the original data of the target application is divided into blocks can be acquired, and all data blocks can be divided into multiple original fragment files. The multiple original fragment files and the startup package can then be uploaded to the cloud storage medium for the target application to download and use.

[0233] Each original fragment file includes a portion of the original data from the target application. In this way, the original data from multiple logical files of the target application is redistributed to the original fragment files. This allows for reading and writing data from the corresponding original fragment files, improving I / O response stability. Accordingly, in this scenario, if the highest priority storage medium is memory, the downloaded data blocks are stored in memory, while the first and second external storage on the terminal stores the downloaded data blocks based on the original fragment file directory structure. The files formed after the downloaded data blocks are stored in the local storage medium according to the corresponding directory structure are called cached fragment files. The directory structure of the cached fragment files in the first and second external storage is consistent with the directory structure of the original fragment files stored in the cloud storage medium.

[0234] The terminal that creates the original fragmented files can be any terminal, such as the terminal of the target application's developer. When creating the original fragmented files, the data content of each logical file in the target application can be obtained. Based on the data content of each logical file, the amount of data is determined, and the number of data blocks to be divided into is determined accordingly. Then, based on the determined number of data blocks, the data content of each logical file is divided into multiple data blocks. These multiple data blocks are then further fragmented, with the specific fragmentation strategy specified by the creator, resulting in multiple original fragmented files. Finally, the startup package and these multiple original fragmented files are packaged together and uploaded to cloud storage media for storage. In this way, all the original data of the target application is retained in the cloud storage media.

[0235] In this embodiment, the target application data stored in the local storage medium was initially downloaded from the cloud storage medium. It should be noted that read requests are generally made for multiple data blocks, while the local storage medium stores only a portion of the target application's data blocks. Therefore, when it is necessary to read all data blocks from one or more storage media, it is necessary to read at the data block granularity, then encapsulate the read data blocks before returning them to the target application.

[0236] Specifically, the detailed process of creating the original fragment files can be found in section 5.1.5 below.

[0237] 5.1.2 Data I / O Response and Data Cleanup Based on Original Fragment Files

[0238] 5.1.2.1, Data writing based on the original fragment file.

[0239] In the write request response process described in 4.1.1 above, at least one second data block corresponding to the data to be written can be sequentially written to multiple storage media in order of response priority from high to low.

[0240] When a write request arrives, it is generally necessary to update the original data, that is, to rewrite the original data. In this way, at least one data block can be written sequentially to multiple storage media in order of response priority from high to low.

[0241] Specifically, the logical file and write location corresponding to the data to be written can be determined. Based on the logical file and write location corresponding to the data to be written, at least one data block is determined to be divided into the data to be written. The data block is then written in each storage medium.

[0242] In one example, the data flag of the written data block can be updated to "1", where "1" indicates "dirty". In this way, the data flag of the data blocks stored in each storage medium is "1". When cleaning up the data later, the data blocks with the data flag "1" can be moved to the incremental data area.

[0243] In another example, when writing data, it's possible to first write the data to the storage medium with the highest response priority, and then to the incremental data area. This means that when writing a data block, the second data block can be written only to the storage medium with the highest response priority and the incremental data area, with the data flag bit of the data block being updated synchronously. Thus, when reading a data block, if the data block in memory has been cleaned up, it can be read directly from the incremental data area without having to read data blocks from other storage media. This improves the efficiency of reading dirty data blocks.

[0244] 5.1.2.2, Data reading based on the original fragmented file.

[0245] In the response process for the read request described in 4.1.2 above, the data blocks required for the read request can be read from the corresponding storage medium in descending order of the response priority of each of the multiple cache components, and all the read data blocks can be encapsulated and returned to the target application.

[0246] Because the raw data of the target application is divided into blocks and stored in raw fragment files, a read request typically requests data comprising multiple data blocks. Therefore, it is necessary to read all the required data blocks from multiple storage media. Accordingly, all data blocks can be attempted to be read sequentially from multiple storage media in descending order of response priority. Thus, for a given storage medium, in response to a read request, it may retrieve all the required data blocks, or only a portion of the required data blocks.

[0247] The specific process is as follows:

[0248] First, the required data block is retrieved from the corresponding storage medium through the caching component with the highest response priority; for example, the data block is read from memory through the memory caching component.

[0249] If not all data blocks are successfully retrieved, the remaining data blocks that were not retrieved are retrieved from the corresponding storage medium through the next-level cache component; for example, the remaining data blocks are read from the first external storage through the temporary cache component.

[0250] If not all remaining data blocks are successfully retrieved, meaning some data blocks are still missing, then the next level of cache component retrieves these data blocks from the corresponding storage medium. For example, the third cache component reads these data blocks from the second external storage.

[0251] If there are still unread data blocks during the process of retrieving this part of the data blocks, then for these unread data blocks, the next level of caching component will retrieve them from the corresponding storage medium. For example, the fourth caching component will read these data blocks from the cloud storage medium until all data blocks are read and the reading ends, or the entire storage medium is traversed and the reading ends.

[0252] It should be noted that if all data blocks are read, these data blocks can be encapsulated and returned to the target application through the cache component with the highest response priority. For example... Figure 1 As shown, in the case of four caching components, the data blocks read by the third and fourth caching components can be packaged by the fragmented file I / O splitter and uploaded to the temporary caching component. The temporary caching component then uploads the packaged data and the data blocks it has obtained to the memory caching component. After that, the memory caching component encapsulates the packaged data, the data blocks uploaded by the temporary caching component, and the data blocks it has obtained together and returns them to the target application.

[0253] After the above process, the data block corresponding to the read request is obtained. It can be seen that this application adopts a multi-level caching component architecture. When reading data, since the data block is read first from the storage medium with the fastest response speed, it can read data from the storage medium with the fastest response speed as much as possible, thereby reducing the data access process and improving the I / O response speed of the target application.

[0254] In one specific embodiment, since the original shard file stores data blocks, and the data blocks are obtained by dividing the original data of the target application into blocks, in practice, the target application generally indicates the data to be read through the target application's logical file identifier, data location, and data length. Thus, the read request issued by the target application carries the target application's logical file identifier and the range of data to be read. The read request needs to be redirected to convert the read request into a request that can read data blocks in the original / cache shard file of the storage medium (the original shard file exists in the cloud storage medium, and the cache shard file is stored in the local storage medium). This is so that the converted read request can be recognized by the caching component to determine which original shard file or which data block in the cache shard file needs to be read, thereby successfully reading the stored data block from the storage medium.

[0255] Specifically, a correspondence can be established between the raw data of the target application and the data blocks in the storage medium. This correspondence can be understood as a data correspondence. Then, based on this data correspondence, the data block corresponding to the read request can be determined.

[0256] In practice, when reading the data blocks required by the read request from the corresponding storage medium in sequence, the block identifier of each data block after the data to be read corresponding to the read request is determined based on the data correspondence in response to the read request of the target application; and the data blocks with block identifiers are read from the corresponding storage medium in sequence according to the response priority of the multiple cache components from high to low.

[0257] Specifically, each data block in all original fragment files can be assigned a globally unique identifier, such as a block identifier, to uniquely identify a data block. This way, the transformed read request can carry the block identifier to explicitly indicate which data block in which original fragment file needs to be read.

[0258] The data mapping relationship can be downloaded along with the startup package. This relationship records a one-to-one mapping between the raw data in the target application's logical files and the data blocks in the original shard files. The raw data in the logical files is assigned an identifier within the logical file based on the number of data blocks. For example, if the raw data in the logical file needs to be divided into 10 data blocks, then each of the 10 data blocks will be assigned an identifier in the logical file, such as 1, 2, 3. The data blocks in the original shard files have globally unique block identifiers; that is, the block identifiers of data blocks in different original shard files are all different.

[0259] For example, if the target application has 10 logical files, and the data content of these 10 logical files is determined to be divided into 1000 data blocks, then each of the 1000 data blocks will be assigned a unique block identifier. For instance, one data block might have the block identifier "55", referred to as data block 55. This data block 55 corresponds to a data block with the identifier 3 in logical file 4, referred to as data block f4b3 (file_4 / block_3). Thus, data block 55 and data block f4b3 in logical file 4 form a mapping relationship, which is the data correspondence relationship.

[0260] After determining the block identifier of the data to be read in the original fragment file, the read request can be converted into a read request containing the block identifier. Then, the read request is sent to multiple cache components in sequence. Based on the read request, the data blocks are read from the corresponding storage media in descending order of the response priority of each cache component.

[0261] 5.1.3, Data pre-reading based on the original fragmented files (corresponding to improvement point 4).

[0262] Since the original data of the target application is divided into blocks and stored in the original fragment files, the data of the target application is stored in the local storage medium at the data block level. In one embodiment, in order to improve the response speed to read requests from the target application, the data that the target application will read next can be predicted and stored in advance in the storage medium corresponding to the cache component with the highest response priority. When the next read request hits the pre-read data, the data can be read from the storage medium corresponding to the cache component with the highest response priority, thereby improving the response speed.

[0263] Reference Figure 4 As shown, a flowchart of the data pre-reading steps in an embodiment of this application is illustrated. Figure 4 As shown, it includes the following steps:

[0264] Step S401: Based on the data read from multiple historical read requests of the target application, determine the multiple pre-read data blocks to be read next.

[0265] In this embodiment, the data read by each I / O thread of the target application can be monitored and recorded, thereby forming a data reading trajectory for each I / O thread. This trajectory reflects the data reading pattern of each I / O thread, such as whether it reads data forward or oscillates back and forth. This allows the determination of the data reading pattern. Therefore, based on the reading trajectory of each I / O thread, the multiple pre-read data blocks to be read by that I / O thread next can be determined.

[0266] Specifically, the data read by each I / O thread j each time can be recorded. Each time, the data read consists of multiple data blocks. Thus, the block identifier and the number of data blocks read by each I / O thread each time can be determined, thereby forming the data block reading trajectory of I / O thread j.

[0267] By analyzing the data block read trajectory, the data reading pattern of each I / O thread can be determined. For example, if the data block read trajectory shows that the I / O thread always oscillates back and forth within a small range of data blocks—for instance, reading data blocks 3 to 5 on the first read, data blocks 4 to 6 on the second, and data blocks 5 to 7 on the third—it indicates that the data reading is oscillating. Therefore, it can be predicted that the next read will involve three data blocks, specifically data blocks 6 to 8.

[0268] For example, if the first read operation reads data blocks 3 to 5, the second reads data blocks 6 to 8, and the third reads data blocks 9 to 12, this indicates that data reading always proceeds forward. Therefore, based on the principle of predicting the largest data range in the historical reading trajectory, we can predict that the next read will involve four data blocks, specifically data blocks 13 to 16.

[0269] Of course, the above is just an example. In reality, the data reading trajectories of different I / O threads are different and the situation is complex. However, the user's operation has certain regularity. That is to say, although the data reading trajectories of different I / O threads are different, the data reading of each I / O thread still has certain regularity. Based on this regularity, the number of data blocks and the corresponding block identifiers to be read by each I / O thread next can be predicted, thereby determining the multiple pre-read data blocks to be read next.

[0270] Step S402: For target data blocks that are not present in the storage medium corresponding to the cache component with the highest response priority among multiple pre-read data blocks, read the target data blocks from the corresponding storage medium in descending order of response priority through the remaining cache components.

[0271] Step S403: Write the read target data block to the storage medium corresponding to the cache component with the highest response priority, so that when the next read request hits multiple pre-read data blocks, multiple pre-read data blocks can be read from the storage medium corresponding to the cache component with the highest response priority.

[0272] In this embodiment, after determining the multiple pre-read data blocks to be pre-read, it can be determined whether there are multiple pre-read data blocks in the storage medium corresponding to the cache component with the highest response priority. If it is determined that all multiple pre-read data blocks exist in the storage medium, no operation can be performed, and the next read request can be waited for. If multiple pre-read data blocks are hit, the multiple pre-read data blocks can be read from the storage medium.

[0273] If not all of the multiple prefetch data blocks exist in the storage medium, then for the target data blocks that do not exist in the storage medium, the remaining cache components will sequentially read the target data blocks from the corresponding storage medium in descending order of response priority. Then, the read target data blocks will be stored in the storage medium corresponding to the cache component with the highest response priority. Thus, when the next read request arrives, if multiple prefetch data blocks are hit, the multiple prefetch data blocks can be read from the storage medium.

[0274] In one embodiment, such as Figure 1 As shown, it includes four caching components. The first caching component is a memory caching component, and its corresponding storage medium is the terminal's memory. The second caching component is a temporary caching component, and its corresponding storage medium is the terminal's primary external storage. Using this example, we will explain how pre-fetching works:

[0275] The memory caching component can determine whether the data blocks to be read are in memory based on the number of data blocks to be read next by I / O thread j (j is an integer greater than or equal to 1) and the corresponding data block identifier. If they are not in memory, it can identify the target data blocks that do not exist in memory among the multiple pre-read data blocks, encapsulate the pre-read request for these target data blocks that do not exist in memory, and send the pre-read request to the temporary caching component.

[0276] Then, the temporary cache component first instructs the third cache component to read the target data block from the second external storage through the fragmented file I / O splitter. If the target data block does not exist in the second external storage, it then instructs the fragmented file I / O splitter to read the target data block from the original fragmented file of the cloud storage medium through the fourth cache component.

[0277] After the target data block is read, the temporary cache component can send the data back to the memory cache component. The memory cache component then writes the read target data block into memory. The data blocks in memory are stored discretely.

[0278] In this way, when I / O thread j issues the next read request, if the prefetch data block is hit, the prefetch data block can be read directly from memory. This shortens the data access process and improves I / O response speed. If the prefetch data block is not hit, it can be read according to the response priority order of multiple cache components.

[0279] In this implementation, on the one hand, because the data that the target application will read next is predicted in advance and placed into the fastest-responding storage medium, the next read can directly retrieve data from the fastest-responding storage medium, thus improving the response speed to the target application. On the other hand, because the data read trajectories of multiple I / O threads can be monitored simultaneously, and corresponding data blocks can be pre-read and placed into memory for multiple I / O threads at the same time, the response speed of data access during multi-I / O thread runtime is improved.

[0280] 5.1.4 Data cleaning based on the original fragmented files.

[0281] Since each storage medium stores the data supporting the target application's operation at the data block granularity, and the data block is obtained by dividing all the original data of the target application into blocks, the data in the local storage medium can be cleared at the data block granularity.

[0282] Specifically, when the storage space release event is a partial clearing event, the data blocks to be cleared in the local storage medium are cleared. The data blocks to be cleared are determined based on the read frequency and / or the most recent read time.

[0283] When the storage space release event is an extreme cleanup event, all data blocks in the local storage medium except for the startup package are cleared.

[0284] In practice, data blocks in the local storage medium that are read less frequently than the target frequency and / or whose most recent read time is earlier than the preset read time can be cleared, or data blocks that are read less frequently than the target frequency and / or whose most recent read time is earlier than the preset read time and meet the target proportion can be cleared. The process of clearing data blocks in the local storage medium can be referred to the contents of Sections 3.1.1 and 3.1.2 above.

[0285] In the case of clearing data according to a target ratio, taking the clearing of data blocks in memory as an example, when determining the data blocks to be cleared in memory, a doubly linked list can be maintained in the memory cache component. The head of the doubly linked list stores the block identifiers of the "most recently accessed" data blocks, and the tail stores the block identifiers of the "least recently accessed" data blocks. When a read request hits a data block, the corresponding block identifier is retrieved from its current position in the doubly linked list and placed at the head of the list. Thus, the closer the block identifier is to the head of the list, the more recently the data block has been accessed. When memory cleanup is needed, the data blocks corresponding to multiple block identifiers at the tail of the list can be identified as the data blocks to be cleared, and the proportion of the data blocks to be cleared relative to the total data in the list is the target ratio. For example, if the target ratio is 40%, then the 40% of data that is not frequently accessed will be cleared.

[0286] This implementation method allows for more detailed data erasure, resulting in a more thorough erasure process. It can precisely achieve the erasure ratio desired by the user, and the freed-up storage space better meets the user's needs.

[0287] 5.1.5, Detailed process of creating the original fragment files.

[0288] Reference Figure 5 As shown, a flowchart illustrating the steps involved in creating the original fragment file is presented. Figure 5 As shown, the specific steps may include:

[0289] Step S501: Based on the data content in the target application's logical file, determine the number of data blocks to be divided, and establish a data correspondence based on the number of data blocks to be divided.

[0290] Step S502: In response to the file creation request initiated for the target application, multiple empty raw fragment files are created based on the data mapping relationship; wherein, each raw fragment file corresponds to multiple data blocks in multiple logical files described in the data mapping relationship; the number of data blocks allocated in each raw fragment file is specified by the creator of the raw image package.

[0291] Step S503: Read the data content of each logical file of the target application, and write the read data content into the corresponding original fragment files based on the data correspondence.

[0292] After writing is complete, the resulting raw fragment files, cache stack description files, and startup packages can be packaged together and uploaded to the server.

[0293] Among them, with Figure 1 The following is an example of how to create the original fragmented file in this application, using the hardware and software environment shown:

[0294] First, the file block manager pre-creates the data mapping relationship. During this process, the file block manager can read and display the data content and attributes of each logical file of the target application. Then, it determines the data blocks that each data content needs to be divided into and the number of data blocks allocated to each original fragment file. Afterward, the file block manager generates the data mapping relationship based on the divided data blocks and the number of data blocks allocated to each original fragment file.

[0295] When initializing the file block manager and multiple cache components, a data path is established between the file block manager and the third cache component. When it is necessary to create raw fragment files, the raw data in the target application's logical file is written to an empty raw fragment file on the local second external storage. Therefore, a data path can be established between the file block manager and the third cache component (the cache component corresponding to the second external storage). Through this data path, the file block manager can divide the raw data read from the target application's logical file into blocks and write it to an empty raw fragment file on the second external storage.

[0296] Specifically, during the writing process, since the file block manager has pre-created the data mapping relationship, when the data content of the target application is read, the identifier of the logical file to which the data content belongs can be determined. Then, the original fragment file to which the data content needs to be written and the globally unique block identifier assigned to the data block are determined through the data mapping relationship. Thus, the read data content is written into the corresponding original fragment file through the data path.

[0297] After all logical files / directories have been enumerated and written, the configuration file for the target application (such as the cache stack description file) is created and stored in the same directory as the original shard file. Together, they are packaged into an original image package. Then, the original image package and the startup package are packaged and uploaded to the OSS-object storage or large-scale distributed file system of the origin server. Finally, they are preheated to cache servers in different regions through the CDN system. This achieves the storage of the target application's original data in multiple data sources.

[0298] In one embodiment, an implementation method for data correspondence is provided, in which data correspondence can be established through relation table entries, and the specific process is as follows:

[0299] First, create the nodex table and write the attribute information of each logical file into the corresponding field of the nodex table; the attribute information includes the file identifier of the logical file.

[0300] Next, based on the data content of each logical file, the number of data blocks required for each logical file is determined, and a blocks table is created based on the number of data blocks. The blocks table is allocated multiple unique identifiers (the block identifiers mentioned above), and each unique identifier uniquely represents a data block. The number of entries in the blocks table is the same as the total number of data blocks in the target application, and one entry corresponds to one data block. The logical file identifier and the block identifier can be written into the corresponding field of a table entry in the blocks table.

[0301] Next, the file identifier of the logical file and the identifier of the data in the logical file are written into the corresponding block identifier entry in the blocks table; and the blocks table and nodex table after writing are integrated into a data block description table, which is the data mapping table.

[0302] In this embodiment, the file block manager can create a nodex table entry for the attribute information of each logical file / directory, and then write the attribute information of each logical file / directory into the corresponding field of the nodex table entry, thereby obtaining a nodex table composed of multiple nodex table entries. The attribute information of the logical file / directory includes the logical file identifier and information such as the logical file type, size, creation, modification, and access time.

[0303] Reference Figure 6 The diagram shows a schematic of the data block description table of this application, including the nodex table and the blocks table. The blocks table is... Figure 6 The table consisting of the three columns on the left, the nodex table is as follows: Figure 6 The table consists of the nine columns on the right. (Example) Figure 6 As shown, each entry in the nodex table contains the relevant attribute information for each logical file; nodeid represents a globally unique logical file identifier, used to index the corresponding attributes (file attribute information, data block distribution information) of the logical file in the blocks table and the nodex table; parentid refers to the nodeid of the parent logical file; and the other fields are regular attributes.

[0304] In the `blocks` table, `dblkid` refers to the block identifier (unique identifier) ​​of the data block in the original fragment file, while `blockid` refers to the identifier within the logical file (starting from address 0 of the logical file); `c / a / mtime` refers to the creation / access / modification time, which can actually be represented by a timestamp. Figure 6 The timestamp is not specifically shown in the text and is indicated by *; valid / allocsize refers to the validity of the logic file and the size of the allocated capacity (in bytes, which can be used to determine the number of data blocks).

[0305] In this way, when a read request carries a logical file identifier and a data block identifier, the corresponding data block in the original fragment file can be found according to the blocks table.

[0306] Of course, in some embodiments, the file block manager also provides instructions on how to create, delete, open, close, read, and write logical files.

[0307] The creation process for logical files is as follows: insert an entry into the nodex table and set the nodeid of the entry to the nodeid of the logical file. Other attributes are set according to information such as file type, size, creation / modification / access time, and owner user (group) (file descriptors are generally created when the file is opened and destroyed when the file is closed).

[0308] The process for deleting a logical file is as follows: Set the nodeid & blockid of all entries in the blocks table that are equal to the nodeid of the logical file to 0xffffffff, while leaving the dblkid unchanged; then search for the entry in the nodex table that corresponds to the nodeid of the logical file and delete it.

[0309] The logical file opening process is as follows: A file descriptor for the logical file is created in memory. Then, the nodex table is searched for the nodeid corresponding to the logical file. If it is not found, the file descriptor is destroyed and failure is returned. If it is found, the relevant attributes are read into the file descriptor, a virtual file handle corresponding to the file descriptor is created, the virtual file handle points to the file descriptor, and then the virtual file handle is returned to the application.

[0310] The closing process for a logical file is as follows: write the attribute information of the logical file to the nodex table entry corresponding to the nodeid of the logical file, destroy the file descriptor in memory, and delete the virtual file handle.

[0311] The data write process for logical files is as follows: First, allocate writable data block entries in the blocks table that match the number of data blocks in this write request. Then, search for entries with nodeid and blockid of 0xffffffff (indicating free). Once enough entries are found, update the nodeid of the relevant entries to the nodeid of the corresponding logical file and the blockid to the blockid of the corresponding data block in the logical file. Finally, convert the write request into a dblkid write request and send it to the memory cache component to complete the write request.

[0312] The data reading process for logical files is as follows: First, look up the relevant table entry in the blocks table that corresponds to the nodeid of the logical file. Then, determine the dblkid based on the blockid of the read request. Finally, convert the read request into a dblkid-based read request and send it to the memory caching component to complete the read request.

[0313] Section 6.1 provides an exemplary description of the scalable caching processing method used in this application.

[0314] Below, with Figure 1 The hardware and software environment shown provides a simple illustrative description of the caching scalable processing method for the application of this application.

[0315] First, the product manufacturer of the target application, or other terminal manufacturers with the necessary capabilities, should create the startup package and the original image package according to the process described in 5.1.4 above, and upload the cache stack description file separately (which may not be included in the original image package). This cache stack description file can be tailored to terminals with different performance configurations.

[0316] When a terminal wants to download and install a target application, it uploads the target application's identifier and the terminal's performance parameters to the server. Then, it can receive the startup package and corresponding cache stack description file sent by the server, and can download the original image package.

[0317] Next, the terminal launches the target application based on the startup package, and then initializes it based on the cache stack description file. Figure 1 The multi-level caching system shown here uses multiple caching components as an example. Figure 1 The four examples shown are examples.

[0318] Afterwards, the end user begins using the target application. Since the target application's raw data is stored as multiple raw fragment files on cloud storage, once the target application starts, it can obtain the necessary data from the partially downloaded data on the terminal or from the original image package on the cloud storage medium to support application operation. Because the startup package contains very little data, the target application can be launched quickly, and the data required for its operation can be obtained from the original image package or the locally downloaded data, allowing the target application to be launched and used quickly, thus optimizing the user experience.

[0319] As the target application is used, its data accumulates across various storage media. Therefore, the data stored on the terminal's local storage media (memory, first secondary storage, and second secondary storage) can be cleaned up. Specifically, one or more of memory, first secondary storage, and second secondary storage can be cleaned up. During cleanup, a specific percentage can be specified for each storage medium. This percentage can be any percentage, automatically generated by the application manager based on the current operating system and hardware platform performance configuration, or it can be specified by the user.

[0320] When a complete wipe is required, all data except for the startup package is erased from main memory, primary secondary storage, and secondary secondary storage. This frees up significant storage space, enabling the installation of other applications and the storage of additional data on the terminal.

[0321] In summary, the technical solution of this application has the following advantages:

[0322] (1) It can help the terminal run and install more applications.

[0323] Because the terminal's multiple caching components can periodically clear data belonging to the target application from the corresponding storage medium, more storage space is freed up for storing data from other applications and other multimedia data. This allows the terminal to run and install more applications and store more data.

[0324] (2) Improved the I / O response speed of the target application.

[0325] On the one hand, when the target application issues a read request, it can prioritize reading data from the storage medium with the fastest response speed, such as memory, and return the data to the target application. If the data cannot be read from memory, it can read data from the storage medium with the second fastest response speed, such as the first external storage, and return the data to the target application. Thus, when reading data, the data is read from the corresponding storage medium in descending order of response speed, thereby improving the I / O response speed of the target application.

[0326] On the other hand, based on the historical data reading trajectory of the target application, the data blocks and the number of data blocks that the target application will read next are predicted. The predicted data blocks are then written into memory in advance from storage media other than memory so that the data blocks can be read directly from memory on the next read, thereby helping to further improve the I / O response speed of the target application.

[0327] (3) Improved the I / O response stability of the target application.

[0328] By dividing and storing the target application's raw data into blocks at the data block level, multiple raw fragment files are obtained. Each raw fragment file contains a portion of the target application's raw data. In this way, the raw data in multiple logical files of the target application is redistributed across multiple raw fragment files. This allows for reading and writing data directly from the corresponding raw fragment file, thereby improving the stability of I / O response.

[0329] Based on the same inventive concept, this application also provides a data processing apparatus, referring to... Figure 7 The diagram shows a structural block diagram of a data processing device, which may include the following modules:

[0330] An initialization module 701 is used to start the target application based on the target application's startup package and initialize multiple cache components corresponding to the target application; each of the multiple cache components corresponds to its own storage medium, and the storage medium stores data that supports the operation of the target application;

[0331] The cleanup module 702 is used to respond to a storage space release event on the terminal by clearing the data located in the local storage medium of the terminal through the corresponding cache component; wherein, after clearing, the total data remaining in the local storage medium is at least the data in the startup package, so as to at least ensure the startup of the target application;

[0332] The response module 703 is used to respond to the read request of the target application and obtain the data corresponding to the read request from the cloud storage medium and / or the local storage medium through the corresponding caching component to support the operation of the target application; wherein the cloud storage medium stores the original data that supports the operation of the target application.

[0333] Optionally, the cleaning module 702 includes:

[0334] The first cleaning unit is used to clean up the data to be cleaned in the local storage medium when the storage space release event is a partial cleanup event, wherein the data to be cleaned is data determined based on the read frequency and / or the most recent read time;

[0335] The second cleanup unit is used to clear all data in the local storage medium except for the startup package when the storage space release event is an extreme cleanup event.

[0336] Optionally, the device further includes:

[0337] The first write module is used to write data cleared from the memory to a local storage medium with a corresponding response priority lower than that of the memory, when the local storage medium includes memory.

[0338] The second write module is used to write data with target characteristics that have been cleared from the remaining local storage media (excluding the memory) into an incremental data area; wherein the target characteristics indicate that the data block is data written by the target application.

[0339] Optionally, the initialization module 701 includes:

[0340] The parameter acquisition unit is used to acquire the performance configuration parameters of the terminal; the performance configuration parameters include the version identifier of the operating system of the terminal and / or the current performance configuration parameters of the memory on the terminal;

[0341] An initialization unit is used to initialize the plurality of cache components based on the performance configuration parameters, wherein the number of the plurality of cache components is adapted to the performance configuration parameters.

[0342] Optionally, the initialization unit includes:

[0343] The first initial subunit is used to initialize cache components corresponding to the multiple external storage devices and the memory of the terminal respectively when the performance configuration parameters determine that the memory of the terminal and / or the operating system meet the target conditions.

[0344] The second initial subunit is used to initialize the cache components corresponding to each of the plurality of external storage devices when it is determined, based on the performance configuration parameters, that the terminal's memory and / or the operating system do not meet the target conditions.

[0345] Optionally, the device further includes:

[0346] The system parameter acquisition module is used to acquire the operating system parameters of the terminal, wherein the operating system parameters are used to indicate the version of the operating system on the terminal;

[0347] An interface layer initialization module is used to create an interface layer corresponding to the target application based on the operating system parameters. The interface layer includes a file system model, a sandbox model, or a file interface model.

[0348] The interface layer is used to receive I / O requests from the target application and storage space release events.

[0349] Optionally, the plurality of cache components have their own response priorities, wherein a cache component with a higher response priority corresponds to a storage medium with a faster response speed, and the device further includes at least one of the following:

[0350] The first sequential write module is used to respond to the write request of the target application and write the data to be written to the corresponding storage medium in descending order of the response priority of the multiple cache components.

[0351] The sequential read module is used to respond to the read request of the target application and, in order of the response priority of the multiple cache components from high to low, sequentially retrieve the data corresponding to the read request from the corresponding storage medium through the cache components.

[0352] The second sequential write module is used to write data read from the storage medium corresponding to the cache component with lower response priority to the storage medium corresponding to the cache component with higher response priority.

[0353] Optionally, the first-order write module includes:

[0354] The first write unit is used to write the data to be written to the storage medium corresponding to the cache component with the highest response priority, according to the response priority from high to low.

[0355] The second writing unit is used to read the data to be written from the storage medium corresponding to the cache component with the highest response priority, and write the data to be written to the corresponding storage medium through the cache component with the lowest response priority.

[0356] Optionally, each storage medium stores data supporting the operation of the target application at the data block granularity, wherein the data block is obtained by dividing the original data of the target application into blocks; the apparatus further includes:

[0357] The data block reading module is used to respond to the read request of the target application and read the data blocks required by the read request from the corresponding storage medium in descending order of the response priority of the plurality of cache components.

[0358] The data block encapsulation module is used to encapsulate all the read data blocks and return them to the target application.

[0359] Optionally, each storage medium stores data supporting the operation of the target application at the data block granularity, wherein the data block is obtained by dividing the original data of the target application into blocks, and the apparatus further includes:

[0360] The pre-read data block determination module is used to determine the multiple pre-read data blocks to be read next based on the data read by multiple historical read requests of the target application.

[0361] The prefetch data block acquisition module is used to read the target data block that does not exist in the storage medium corresponding to the cache component with the highest response priority from the corresponding storage medium through the remaining cache components in order of response priority from high to low.

[0362] The prefetch data block writing module is used to write the read target data block to the storage medium corresponding to the cache component with the highest response priority, so that when the next read request hits the multiple prefetch data blocks, the multiple prefetch data blocks can be read from the storage medium corresponding to the cache component with the highest response priority.

[0363] Optionally, the data block reading module includes:

[0364] A block identifier determination unit is used to determine the block identifier of each data block required by the read request based on the data correspondence relationship in response to the read request of the target application; the data correspondence relationship is used to characterize the correspondence between the original data and the data blocks in the storage medium;

[0365] The data block reading unit is used to read the data blocks with the block identifier sequentially from the corresponding storage medium according to the response priority of the plurality of cache components from high to low.

[0366] Optionally, the device further includes:

[0367] The data partitioning module is used to divide all the data blocks obtained after the original data of the target application is divided into blocks, and to obtain multiple original fragment files.

[0368] The data upload module is used to upload the multiple original fragment files and the startup package to the cloud storage medium for the target application to download and use.

[0369] Optionally, the device further includes:

[0370] The interface creation module is used to create various interfaces between the corresponding cache components and the cloud storage medium; the various interfaces are arranged in order of response priority from high to low, including: Content Delivery Network (CDN) interface, peer-to-peer (P2P) interface, and origin server interface;

[0371] The data download module is used to retrieve the corresponding data from the cloud storage medium in descending order of the response priority of the various interfaces when reading data from the cloud storage medium.

[0372] It should be noted that the device embodiments are similar to the method embodiments, so the description is relatively simple. For relevant details, please refer to the method embodiments.

[0373] This application also discloses an electronic device, including a memory 1101, a processor 1102, and a computer program stored on the memory 1101 and executable on the processor 1102. When executed by the processor 1102, the cache-scalable processing method, apparatus, device, and medium of the application described above are implemented.

[0374] This application also discloses a computer-readable storage medium storing a computer program that causes a processor to execute a cache-scalable processing method, apparatus, device, and medium for the application described in this application.

[0375] This application also discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements a cache-scalable processing method, apparatus, device, and medium for the application.

[0376] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0377] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0378] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0379] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0380] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0381] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.

[0382] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0383] The above provides a detailed description of the scalable caching processing method, apparatus, device, medium, and product for an application provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A scalable caching method for an application, characterized in that, The method includes: The target application is launched based on the startup package of the target application, and multiple cache components corresponding to the target application are initialized; each of the multiple cache components corresponds to its own storage medium, and the storage medium stores data that supports the operation of the target application; In response to a storage space release event on the terminal, the data located in the local storage medium of the terminal is cleared through the corresponding caching component; wherein, after clearing, the total data remaining in the local storage medium is at least the data in the startup package, so as to at least ensure the startup of the target application; In response to a read request from the target application, the corresponding data for the read request is retrieved from the cloud storage medium and / or the local storage medium through a corresponding caching component to support the operation of the target application; wherein the cloud storage medium stores the original data that supports the operation of the target application. Wherein, the plurality of cache components have their own response priorities, and when the storage space release event is a partial clearing event, the method further includes: If the local storage medium includes memory, the data to be cleared from the memory is written to the corresponding local storage medium with a lower response priority than the memory; For the remaining local storage media other than the memory, the data with target characteristics that have been cleared from the remaining local storage media are written into the incremental data area; wherein, the target characteristic data block is the data written by the target application.

2. The method according to claim 1, characterized in that, In response to a storage space release event on the terminal, the data located in the local storage medium of the terminal is cleared through the corresponding caching component, including: When the storage space release event is a partial clearing event, the data to be cleared in the local storage medium is cleared, and the data to be cleared is data determined based on the read frequency and / or the most recent read time; When the storage space release event is an extreme cleanup event, all data in the local storage medium except for the startup package is cleared.

3. The method according to claim 1, characterized in that, Initialize multiple cache components corresponding to the target application, including: Obtain the performance configuration parameters of the terminal; the performance configuration parameters include the version identifier of the terminal's operating system and / or the current performance configuration parameters of the memory on the terminal; Based on the performance configuration parameters, the plurality of cache components are initialized, wherein the number of the plurality of cache components is adapted to the performance configuration parameters.

4. The method according to claim 3, characterized in that, Based on the performance configuration parameters, initialize the plurality of cache components, including: When the performance configuration parameters determine that the terminal's memory and / or the operating system meet the target conditions, initialize the cache components corresponding to the multiple external storage devices and the terminal's memory respectively. When the performance configuration parameters determine that the terminal's memory and / or the operating system do not meet the target conditions, the cache components corresponding to each of the multiple external storage devices are initialized.

5. The method according to claim 1, characterized in that, The method further includes: Obtain the operating system parameters of the terminal, wherein the operating system parameters are used to indicate the version of the operating system on the terminal; Based on the operating system parameters, an interface layer corresponding to the target application is created. The interface layer includes a file system model, a sandbox model, or a file interface model. The interface layer is used to receive I / O requests from the target application and storage space release events.

6. The method according to claim 1, characterized in that, The plurality of caching components have their own response priorities, wherein a caching component with a higher response priority corresponds to a storage medium with a faster response speed, and the method further includes at least one of the following: In response to the write request from the target application, the data to be written is written to the corresponding storage medium in descending order of the response priority of the multiple cache components; In response to the read request from the target application, the data corresponding to the read request is retrieved from the corresponding storage medium through the cache components in descending order of their response priorities. Data read from the storage medium corresponding to the cache component with lower response priority will be written to the storage medium corresponding to the cache component with higher response priority.

7. The method according to claim 6, characterized in that, According to the response priority of the multiple cache components from high to low, the data to be written is sequentially written to the corresponding storage medium, including: According to the order of response priority from high to low, the data to be written is written to the storage medium corresponding to the cache component with the highest response priority through the cache component with the highest response priority; The data to be written is read from the storage medium corresponding to the cache component with the highest response priority, and then written to the corresponding storage medium through the cache component with the lowest response priority.

8. The method according to any one of claims 1-7, characterized in that, Each storage medium stores data supporting the operation of the target application at the data block granularity, where the data block is obtained by dividing the original data of the target application into blocks; The method further includes: In response to the read request from the target application, the data blocks required by the read request are read from the corresponding storage medium in descending order of the response priority of each of the plurality of cache components; The read data blocks are encapsulated and returned to the target application.

9. The method according to any one of claims 1-7, characterized in that, Each storage medium stores data supporting the operation of the target application at the data block granularity, wherein the data block is obtained by dividing the original data of the target application into blocks, and the method further includes: Based on the data read from multiple historical read requests of the target application, determine multiple pre-read data blocks to be read next; For a target data block that is not present in the storage medium corresponding to the cache component with the highest response priority among multiple pre-read data blocks, the target data block is read from the corresponding storage medium in descending order of response priority through the remaining cache components. The read target data block is written to the storage medium corresponding to the cache component with the highest response priority, so that when the next read request hits the multiple pre-read data blocks, the multiple pre-read data blocks are read from the storage medium corresponding to the cache component with the highest response priority.

10. The method according to claim 8, characterized in that, In response to a read request from the target application, the data blocks required by the read request are sequentially read from the corresponding storage media according to the response priority of each of the plurality of caching components in descending order, including: In response to a read request from the target application, a block identifier for each data block required by the read request is determined based on a data correspondence; the data correspondence is used to characterize the correspondence between the original data and the data blocks in the storage medium. According to the response priority of each of the plurality of cache components from high to low, the data blocks with the block identifier are read sequentially from the corresponding storage medium.

11. The method according to claim 8, characterized in that, Before launching the target application based on its startup package, the method further includes: The original data of the target application is divided into blocks to obtain all data blocks, and then the original data blocks are further divided to obtain multiple original fragment files; The multiple original fragment files and the startup package are uploaded to the cloud storage medium for the target application to download and use.

12. The method according to any one of claims 1-7 or 10-11, characterized in that, The method further includes: Create multiple interfaces between the corresponding caching components and the cloud storage medium; these interfaces, ranked from highest to lowest response priority, include: Content Delivery Network (CDN) interface, peer-to-peer (P2P) interface, and origin server interface; When reading data from the cloud storage medium, the corresponding data is obtained from the cloud storage medium sequentially through the various interfaces in descending order of their response priority.

13. A cache-scalable processing device for an application, characterized in that, The device includes: An initialization module is used to start the target application based on the target application's startup package and initialize multiple cache components corresponding to the target application; each of the multiple cache components corresponds to its own storage medium, and the storage medium stores data that supports the operation of the target application; The cleanup module is used to respond to a storage space release event on the terminal by clearing the data located in the local storage medium of the terminal through the corresponding caching component; wherein, after clearing, the total data remaining in the local storage medium is at least the data in the startup package, so as to at least ensure the startup of the target application; A response module is used to respond to a read request from the target application and, through a corresponding caching component, obtain the data corresponding to the read request from the cloud storage medium and / or the local storage medium to support the operation of the target application; wherein, the cloud storage medium stores the original data that supports the operation of the target application; The plurality of cache components have their own response priorities, and in the case that the storage space release event is a partial clear event, the apparatus further includes: The first write module is used to write data cleared from the memory to a local storage medium with a corresponding response priority lower than that of the memory, when the local storage medium includes memory. The second write module is used to write data with target characteristics that have been cleared from the other local storage media (excluding the memory) into the incremental data area; wherein the target characteristic data block is data written by the target application.

14. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executed, implements the cache-scalable processing method of the application as described in any one of claims 1-12.

15. A computer-readable storage medium, characterized in that, The stored computer program causes the processor to execute the cache-scalable processing method of the application as described in any one of claims 1-12.

Citation Information

Patent Citations

  • Software operation system and software operation method

    CN101452402A

  • Application cache cleaning method and device, equipment and storage medium

    CN113392041A