Page cache policy switching method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202610660215.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-13
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2046-05-13
AI Technical Summary
[0005]本公开提供一种页面缓存策略切换方法、装置、电子设备和存储介质,以至少解决相关技术因切换页面缓存策略造成的系统I/O性能短期下降的问题
根据本公开的页面缓存策略切换方法、装置、电子设备和存储介质,针对元数据语义不同的旧策略(即第一页面缓存策略)与新策略(即第二页面缓存策略),通过对旧策略下的文件页“相对冷热关系”(通过热度顺位表示)进行量化处理,可以构造一个与具体策略解耦、但能够保留相对冷热关系的中间表示(即参考热度值),进而将旧策略中文件页的相对冷热关系传递给新策略,得到转换热度值,作为新策略的初始热度值,实现对已经累积的冷热状态的合理传递。该方法既降低了同一cgroup文件页在执行缓存冷切换时的瞬态损失,保障了热点文件页不会在切换瞬间全部退化为统一默认状态,又在传递累积的冷热状态时不生硬拷贝旧策略的私有状态,而是把可迁移内容限定为“相对冷热关系”,通过“量化表示+按照新策略转换”的方式,实现了可执行的语义桥接,使得切换后新策略仍然能够在一定程度上保留热点识别能力,减少了因策略切换造成的短期I/O性能下降。
Smart Images

Figure CN122195944B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of operating systems, and more particularly to a method, apparatus, electronic device, and storage medium for switching page caching strategies. Background Technology
[0002] In Linux systems, memory management is one of the core aspects affecting performance, and the page cache (where a page refers to a memory page, the smallest unit of memory allocated by the operating system, typically 4KB in size) is a key component for improving I / O performance in memory management. Simply put, the page cache is an area in which the kernel temporarily stores disk file data using free physical memory. By storing frequently accessed file data (file-backed pages) in it, it avoids direct disk operations on every read and write operation, thus significantly improving I / O performance. For most Linux applications (such as web servers, databases, and file servers), the efficient utilization of the page cache directly determines the system's response speed and throughput, and the efficiency of the page cache is reflected in the maintenance of the stored pages. To this end, many page caching strategies have been proposed, implementing page retention, eviction / removal, or hot / cold sorting, enabling the storage of frequently accessed pages in the page cache and the removal of less frequently accessed pages from the page cache.
[0003] In systems that support dynamic page caching strategies, file page caching within the same cgroup (control group, a resource isolation mechanism in the Linux kernel) may need to switch between different candidate page caching strategies to adapt to the needs of different stages and further optimize I / O performance.
[0004] However, when switching page caching strategies, the target of the switch is a large number of file pages already residing in the page cache. The old strategy often accumulates hot / cold status information for these file pages, such as linked list order, segment position, frequency bucket, and score sorting. To address this, related technologies typically clear the old status directly during the switch. Especially in eBPF (Extended Berkeley Packet Filter) or similar loadable page caching strategy frameworks, after the old strategy is unloaded, its private BPF Map, linked list nodes, segment queue positions, or counting structures usually become invalid at the end of the program's lifecycle. After the new strategy is reloaded, it can only see the currently residing file pages, but naturally cannot see the hot / cold status information accumulated within the old strategy. This switching method causes the new strategy to lose its hotspot identification ability for a period of time, resulting in a decrease in I / O performance during this period, negating the I / O performance improvement brought about by dynamically loading page caching strategies. Summary of the Invention
[0005] This disclosure provides a method, apparatus, electronic device, and storage medium for switching page caching strategies, to at least solve the problem of short-term system I / O performance degradation caused by switching page caching strategies in related technologies.
[0006] According to a first aspect of the present disclosure, a page caching strategy switching method is provided, comprising: in response to the initiation of a strategy switching session, under a first page caching strategy, extracting page information of a plurality of file pages stored in a page cache, wherein the page information includes a popularity ranking, and the first page caching strategy is the currently executed page caching strategy; quantifying the popularity ranking of the plurality of file pages to obtain reference popularity values of the plurality of file pages; converting the reference popularity values of the plurality of file pages into popularity values under a second page caching strategy to obtain converted popularity values of the plurality of file pages, wherein the second page caching strategy is the target page caching strategy to be executed; and switching to the second page caching strategy by using the converted popularity values of the plurality of file pages as the initial popularity values of the plurality of file pages under the second page caching strategy.
[0007] Optionally, the step of quantifying the popularity ranking of the plurality of file pages to obtain a reference popularity value for the plurality of file pages includes: mapping the popularity ranking of the plurality of file pages proportionally to corresponding values within a preset value range to obtain the reference popularity value for the plurality of file pages.
[0008] Optionally, converting the reference popularity values of the plurality of file pages into popularity values under the second page caching strategy to obtain the converted popularity values of the plurality of file pages includes: for each of the plurality of file pages, if the reference popularity value of the file page is greater than or equal to a popularity threshold, converting the reference popularity value of the file page into a popularity value under the second page caching strategy to obtain the converted popularity value of the file page; if the reference popularity value of the file page is less than the popularity threshold, using the default popularity value under the second page caching strategy as the converted popularity value of the corresponding file page.
[0009] Optionally, the page information further includes verification information; wherein, converting the reference popularity values of the plurality of file pages into popularity values under the second page caching strategy to obtain the converted popularity values of the plurality of file pages includes: performing validity verification on the file page according to the verification information of each file page in the plurality of file pages; converting the reference popularity values of the file pages that pass the validity verification into popularity values under the second page caching strategy to obtain the converted popularity values of the corresponding file pages; and for the file pages that fail the validity verification, using the default popularity value under the second page caching strategy as the converted popularity value of the corresponding file pages.
[0010] Optionally, the verification information for each file page includes at least one of the following: the session identifier of the policy switching session, the information validity period of the file page, and the verification value of the file page. The information validity period of the file page is determined based on the time when the file page's popularity ranking is extracted, and the verification value of the file page is calculated by applying a set algorithm to other information in the page information of the file page, excluding the verification value.
[0011] Optionally, converting the reference popularity values of the plurality of file pages into popularity values under the second page caching strategy to obtain the converted popularity values of the plurality of file pages includes: in response to the initiation of the strategy switching session, setting the popularity conversion flag of the plurality of file pages to an unconverted state; for each of the plurality of file pages, in response to determining that the popularity conversion flag of the file page is in the unconverted state, converting the reference popularity value of the file page into a popularity value under the second page caching strategy to obtain the converted popularity value of the file page, and setting the popularity conversion flag of the file page to a converted state.
[0012] Optionally, after switching to the second page caching strategy, the page caching strategy switching method further includes: executing the second page caching strategy within a set dimension range based on the initial popularity values of the plurality of file pages, and collecting preset performance monitoring indicators during the execution process, wherein the set dimension range is a set value range under a preset dimension; in response to completing the strategy execution within the set dimension range and determining that the preset performance monitoring indicators meet preset pass conditions, executing the second page caching strategy within the full dimension range, wherein the full dimension range is the complete value range that the second page caching strategy can be applied to under the preset dimension; and in response to determining that the preset performance monitoring indicators meet preset fallback conditions, reverting to the first page caching strategy.
[0013] Optionally, the preset dimensions include at least one of the following: time dimension, file page dimension, and file page operation request dimension.
[0014] Optionally, after switching to the second page caching strategy, the page caching strategy switching method further includes: in response to completing the strategy execution within the set dimension range and determining that the preset performance monitoring indicator does not meet the preset pass condition, executing the second page caching strategy again within the set dimension range, or outputting a strategy switching request to request the start of a new strategy switching session.
[0015] According to a second aspect of the present disclosure, a page caching strategy switching apparatus is provided, comprising: an extraction unit configured to, in response to the initiation of a strategy switching session, extract page information of a plurality of file pages stored in a page cache under a first page caching strategy, wherein the page information includes a popularity ranking, and the first page caching strategy is the currently executed page caching strategy; a quantization unit configured to quantize the popularity ranking of the plurality of file pages to obtain reference popularity values of the plurality of file pages; a conversion unit configured to convert the reference popularity values of the plurality of file pages into popularity values under a second page caching strategy to obtain converted popularity values of the plurality of file pages, wherein the second page caching strategy is the target page caching strategy to be executed; and a switching unit configured to switch to the second page caching strategy by using the converted popularity values of the plurality of file pages as the initial popularity values of the plurality of file pages under the second page caching strategy.
[0016] Optionally, the quantization unit is further configured to map the popularity ranking of the plurality of file pages proportionally to corresponding values within a preset value range to obtain reference popularity values for the plurality of file pages.
[0017] Optionally, the conversion unit is further configured to: for each of the plurality of file pages, if the reference popularity value of the file page is greater than or equal to the popularity threshold, convert the reference popularity value of the file page into a popularity value under the second page caching strategy to obtain the converted popularity value of the file page; if the reference popularity value of the file page is less than the popularity threshold, use the default popularity value under the second page caching strategy as the converted popularity value of the corresponding file page.
[0018] Optionally, the page information further includes verification information; the conversion unit is further configured to: perform validity verification on the file page according to the verification information of each file page in the plurality of file pages; convert the reference popularity value of the file page that passes the validity verification in the plurality of file pages into a popularity value under the second page caching strategy to obtain the conversion popularity value of the corresponding file page; and for the file page that fails the validity verification in the plurality of file pages, use the default popularity value under the second page caching strategy as the conversion popularity value of the corresponding file page.
[0019] Optionally, the verification information for each file page includes at least one of the following: the session identifier of the policy switching session, the information validity period of the file page, and the verification value of the file page. The information validity period of the file page is determined based on the time when the file page's popularity ranking is extracted, and the verification value of the file page is calculated by applying a set algorithm to other information in the page information of the file page, excluding the verification value.
[0020] Optionally, the conversion unit is further configured to: in response to the initiation of the policy switching session, set the popularity conversion identifier of the plurality of file pages to an unconverted state; for each of the plurality of file pages, in response to determining that the popularity conversion identifier of the file page is in the unconverted state, convert the reference popularity value of the file page into a popularity value under the second page caching policy to obtain the converted popularity value of the file page, and set the popularity conversion identifier of the file page to a converted state.
[0021] Optionally, the page caching strategy switching device further includes an execution unit configured to: execute the second page caching strategy within a set dimension range based on the initial popularity values of the plurality of file pages, and collect preset performance monitoring indicators during the execution process, wherein the set dimension range is a set value range under a preset dimension; in response to completing the strategy execution within the set dimension range and determining that the preset performance monitoring indicators meet preset pass conditions, execute the second page caching strategy within the full dimension range, wherein the full dimension range is the complete value range that the second page caching strategy can be applied to under the preset dimension; and in response to determining that the preset performance monitoring indicators meet preset fallback conditions, fall back to the first page caching strategy.
[0022] Optionally, the preset dimensions include at least one of the following: time dimension, file page dimension, and file page operation request dimension.
[0023] Optionally, the execution unit is further configured to, in response to completing the strategy execution within the set dimension range and determining that the preset performance monitoring indicator does not meet the preset pass condition, execute the second page caching strategy again within the set dimension range, or output a strategy switching request to request the initiation of a new strategy switching session.
[0024] According to a third aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and at least one memory storing computer-executable instructions, wherein the computer-executable instructions, when executed by the at least one processor, cause the at least one processor to perform a page caching strategy switching method according to an exemplary embodiment of the present disclosure.
[0025] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein instructions in the computer-readable storage medium, when executed by at least one processor, cause at least one processor to perform a page caching strategy switching method according to an exemplary embodiment of the present disclosure.
[0026] According to a fifth aspect of the present disclosure, a computer program product is provided, including computer instructions that, when executed by at least one processor, cause at least one processor to perform a page caching strategy switching method according to an exemplary embodiment of the present disclosure.
[0027] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects: According to the page caching strategy switching method, apparatus, electronic device, and storage medium disclosed herein, for old strategies (i.e., the first page caching strategy) and new strategies (i.e., the second page caching strategy) with different metadata semantics, by quantifying the "relative hot and cold relationship" of file pages under the old strategy (represented by the order of popularity), an intermediate representation (i.e., a reference popularity value) that is decoupled from the specific strategy but can retain the relative hot and cold relationship can be constructed. Then, the relative hot and cold relationship of file pages in the old strategy is transferred to the new strategy to obtain the converted popularity value, which serves as the initial popularity value of the new strategy, thereby realizing the reasonable transfer of the accumulated hot and cold status. This method reduces the transient loss when performing a cold switch of the same cgroup file page, ensuring that hot file pages do not all degenerate to a unified default state at the moment of switching. It also avoids rigidly copying the private state of the old strategy when transferring the accumulated hot and cold states. Instead, it limits the transferable content to "relative hot and cold relationships" and achieves executable semantic bridging through "quantized representation + conversion according to the new strategy". This allows the new strategy to still retain the hot spot identification capability to a certain extent after switching, reducing the short-term I / O performance degradation caused by strategy switching.
[0028] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0029] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0030] Figure 1 This is a flowchart of a page caching strategy switching method according to an exemplary embodiment of the present disclosure.
[0031] Figure 2 This is an architecture diagram of a page caching strategy switching method according to a specific embodiment of the present disclosure.
[0032] Figure 3 This is a flowchart illustrating a page caching strategy switching method according to a specific embodiment of the present disclosure.
[0033] Figure 4This is a schematic diagram illustrating the core differences between related technologies and page caching strategy switching methods according to specific embodiments of this disclosure.
[0034] Figure 5 This is a block diagram of a page caching strategy switching device according to an exemplary embodiment of the present disclosure.
[0035] Figure 6 This is a block diagram of an electronic device according to exemplary embodiments of the present disclosure. Detailed Implementation
[0036] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0037] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following examples do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0038] It should be noted that the phrase "at least one of several items" in this disclosure refers to three parallel cases: "any one of the several items", "a combination of any number of the several items", and "all of the several items". For example, "including at least one of A and B" includes the following three parallel cases: (1) including A; (2) including B; (3) including A and B. Another example is "performing at least one of step one and step two", which means the following three parallel cases: (1) performing step one; (2) performing step two; (3) performing both step one and step two.
[0039] The following are some existing page caching strategy types.
[0040] 1. Recency-based strategies use "recent access" to organize page order, often employing singly linked lists or doubly linked lists. For example, LRU (Least Recently Used) typically organizes pages based on their most recent usage order, while MRU (Most Recently Used) can be used to reduce the long-term cache contamination of recently scanned pages when sequential scanning is highly disruptive.
[0041] 2. The inverse-recency strategy has the opposite internal priority direction to the recency strategy, and can organize page order based on reverse recency.
[0042] 3. Frequency-based strategies use access frequency, frequency buckets, or similar counting results (obtained using an integer counter) to represent page popularity. For example, LFU (Least Frequently Used) typically organizes page popularity based on access frequency.
[0043] 4. The segmented strategy categorizes pages based on multi-segment queues, hot and cold zones, or annual buckets.
[0044] 5. Score-based strategy: sorts pages by comprehensive score and can derive the relative ranking of each page.
[0045] The difference between different strategies lies in how they organize the hot and cold access relationships of pages, and these relationships often cannot be directly converted between strategies. For example, the "most recently accessed" order in LRU cannot be directly used as the actual access frequency in LFU, and the hot and cold stratification in segmented queues cannot be directly applied to another type of page caching organization. Therefore, related technologies often use a cold switch approach when switching page caching strategies, that is, the system directly unloads the old strategy and loads the new strategy, but does not inherit the hot and cold status accumulated by the old strategy. This causes the new strategy to lose its hot spot identification ability for a period of time, resulting in a decrease in I / O performance during this period, thus weakening the I / O performance improvement brought about by dynamically loading page caching strategies.
[0046] To address this issue, several technical solutions exist, but these solutions often focus on "adaptive adjustment within the same strategy framework" or "rough prediction before switching".
[0047] For example, for the former, some adaptive caching methods maintain ghostlists, segment queues, or scaling logic within the same policy framework to adjust space allocation between two sub-policies under that framework. However, the design focus of these methods is on scaling optimization within the framework, rather than cross-policy state migration. Their state always remains within the same caching framework, does not need to bridge the private states between different policy instances, and usually does not involve the discontinuous lifecycle problem of "unloading the old policy and loading the new policy".
[0048] For the latter, some pre-switch prediction or shadow simulation methods estimate whether candidate strategies might benefit before the switch by using shadow caching, low-traffic replay, or offline simulation. However, if the shadow samples deviate from the actual access sequences, these methods may still result in inconsistencies between predictions and reality. Furthermore, even if the prediction is correct, it does not solve the problem of how the new strategy inherits the old state after the switch. Pre-switch prediction alone cannot replace the actual state transition.
[0049] In response, the exemplary embodiments of this disclosure propose a page caching strategy switching method. For old strategies (i.e., the first page caching strategy) and new strategies (i.e., the second page caching strategy) with different metadata semantics, a reference heat value can be constructed by quantifying the "relative hot and cold relationship" of file pages under the old strategy (represented by heat ranking). This reference heat value is decoupled from the specific strategy but can retain the relative hot and cold relationship. The relative hot and cold relationship of file pages in the old strategy is then transferred to the new strategy to obtain the converted heat value, which serves as the initial heat value of the new strategy, thus realizing the reasonable transfer of the accumulated hot and cold status. This method reduces the transient loss of resident file pages in the same cgroup during cache cold switching, ensuring that hot file pages do not all degenerate to a unified default state at the moment of switching. It also avoids rigidly copying the private state of the old policy when transferring accumulated hot and cold states. Instead, it limits the transferable content to "relative hot and cold relationships" and achieves executable semantic bridging through "quantized representation + conversion according to the new policy". This allows the new policy to retain hot spot identification capabilities to a certain extent after switching, reducing the short-term I / O performance degradation caused by policy switching.
[0050] It should be understood that the exemplary embodiments of this disclosure are not, in essence, a general strategy switching framework detached from page caching scenarios, but rather an order-preserving state migration for different file page caching strategies. The exemplary embodiments of this disclosure have applicable strategy boundaries, requiring that the strategies before and after the switch can derive a comparable priority order and accept ordered initialization. Such strategies can provide a monotonic priority order for pages, including, for example, the various strategies described above that can sort based on linked list order, segment queue order, frequency bucket order, or score. For strategies that cannot derive a comparable order and cannot accept ordered initialization, the direct applicability of the exemplary embodiments of this disclosure is not claimed.
[0051] Regarding the initialization of the target page caching strategy to be switched, since different strategies encode "hotness" differently, the core of the exemplary embodiments of this disclosure lies in defining executable mapping profiles for target page caching strategies such as LRU, MRU, frequency-based, and segmented strategies. In other words, it defines initialization mapping rules for different strategy types to achieve safe switching between strategies with comparable priorities, rather than vaguely claiming that "any strategy can be migrated without loss." In short, the old strategy needs to be able to rank pages in a relatively hot-cold order, and the new strategy also needs to be able to accept an initial priority, initial segment, or initial hotness level.
[0052] Hereinafter, a page caching strategy switching method, apparatus, electronic device, and storage medium according to exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
[0053] Figure 1 This is a flowchart of a page caching strategy switching method according to an exemplary embodiment of the present disclosure.
[0054] Reference Figure 1 In step 101, in response to the start of the policy switching session, under the first page caching policy, the page information of multiple file pages stored in the page cache is extracted.
[0055] The policy switching session is used to switch page caching policies. The session initiation request is an upstream request and can originate from manual intervention, offline analyzers, or other policy selection modules. Regardless of the upstream source, this disclosure can be established independently as a separate page caching policy security switching execution layer.
[0056] The first page caching strategy is the currently executing page caching strategy, which is the old strategy before the switch. Under the old strategy, multiple file pages are already stored in the page cache. This step is used to extract the page information of these file pages. The page information describes the caching status of the file pages, including their popularity ranking. The popularity ranking is the relative order of these file pages under the old strategy, formed by the definition of "the less likely they are to be eliminated, the more popular they are." This can be arranged in descending order of popularity or in ascending order of popularity; this disclosure does not impose any restrictions on this. Thus, before the old strategy is unloaded, the "page popularity ranking as seen by the old strategy" is exported. It should be understood that the exported popularity ranking here is not the entire internal structure of the old strategy, but rather the relative relationship between which pages are more popular and which are less popular.
[0057] As an example, the page information of multiple file pages can be viewed as a "migration snapshot," containing a set of relative popularity information of pages exported by the old strategy before uninstallation. This migration snapshot can be an array, with the page identifiers of multiple file pages arranged in order of popularity; it can also include multiple migration records, each containing the page information of a file page, including the page identifier of that file page and its sequence number in the popularity ranking. The page identifier is, for example, but not limited to, the stable page identifier `page_key`, which is a page identifier independent of the eBPF application's lifecycle, such as a combination key of "file object identifier + page offset". The sequence number of the file page in the popularity ranking can be represented by the symbol `rank_old`, and the sorting direction of the popularity ranking can be uniformly converted to the direction of "the larger the value, the hotter it is" before executing subsequent steps. If the old strategy uses a multi-segment structure, the symbol `class_old` can be further introduced to represent the original segment number, level number, or hot / cold zone number of the page. For a singly linked list-based page caching strategy, the linked list position can be directly used as rank_old; for a segmented strategy, the page can be sorted by segment priority first, and then the global rank can be formed by the intra-segment ranking to obtain rank_old; for a score-based strategy, the page can be sorted by score from high to low to generate a global rank to obtain rank_old. In other words, the purpose of step 101 is to "copy the old strategy's judgment of page hotness into a transferable list".
[0058] In step 102, the popularity ranking of multiple file pages is quantified to obtain reference popularity values for multiple file pages.
[0059] The purpose of this step is to first create a general intermediate representation, and then allow different new strategies to interpret it in their own way, rather than forcibly adding the original values of the old strategy to the new strategy, causing the new strategy to be unable to use the original values of the old strategy and degenerating into a cold switch.
[0060] Optionally, step 102 includes: mapping the popularity ranking of multiple file pages proportionally to corresponding values within a preset value range to obtain reference popularity values for multiple file pages. By proportionally mapping the popularity ranking according to the preset value range, that is, quantizing the popularity ranking to the preset value range, each file page can be represented by a value within the preset value range to indicate its popularity, ensuring that the reference popularity value has a unified value range for different page caching strategies. It should be understood that the preset value range is this unified value range.
[0061] As an example, the reference popularity value can be expressed by the following formula:
[0062] In the above formula, QHR (Quantized Heat Rank) represents the reference heat value. The function Q represents the floor function, where Q represents the upper bound of the preset value range. For example, it can take discrete precision values such as 256, 1024, or 10000, in which case the lower bound of the preset value range is 1. N represents the number of file pages stored in the page cache. Therefore, the value range of QHR (i.e., the preset value range) is [1, Q]. Of course, other value ranges can also be selected, and this disclosure does not impose any restrictions on them. Since the sorting direction of popularity has been uniformly converted to the direction of "the larger the value, the more popular," the larger the value of QHR, the more popular the page.
[0063] In step 103, the reference popularity values of multiple file pages are converted into popularity values under the second page caching strategy to obtain the converted popularity values of multiple file pages.
[0064] In step 104, the conversion popularity values of multiple file pages are used as the initial popularity values of multiple file pages under the second page caching strategy, and the system switches to the second page caching strategy.
[0065] The second page caching strategy is the target page caching strategy to be executed. Steps 103 and 104 can translate the reference heat value into an acceptable starting state for the new strategy based on the category of the target page caching strategy, so that the new strategy does not have to start from a completely blank state, thereby solving the cross-strategy state bridging problem for file page caching. It should be understood that the initial heat value is not equivalent to the actual heat value recorded inside the new strategy; the purpose of the mapping is only to prevent the new strategy from starting from a completely blank state. It should also be understood that this disclosure does not advocate "arbitrary strategy unified formula migration," but limits it to a finite mapping relationship of "relative hot / cold order → acceptable starting state of the target page caching strategy."
[0066] Operating systems often employ a two-tier architecture of "kernel mode + user mode": kernel mode is responsible for core resource management, while user mode is responsible for application execution, and the two interact through system calls. As an example, the page caching strategy switching method according to the exemplary embodiments of this disclosure can be executed in kernel mode, or a user mode relay scheme can be used, that is, the reference heat value and the converted heat value are calculated in user mode, and then written back to the readable storage of the new strategy. This disclosure does not impose any restrictions on this.
[0067] The following section will provide further details on step 103.
[0068] In some embodiments, optionally, step 103 includes: for each of the multiple file pages, if the reference popularity value of the file page is greater than or equal to a popularity threshold, converting the reference popularity value of the file page into a popularity value under the second page caching strategy to obtain the converted popularity value of the file page; if the reference popularity value of the file page is less than the popularity threshold, using the default popularity value under the second page caching strategy as the converted popularity value of the corresponding file page. By introducing a popularity threshold, prioritizing the migration of hot file pages with reference popularity values greater than or equal to the popularity threshold, and performing default initialization of the new strategy on the remaining file pages, the migration cost of cold and hot state migration between the old and new strategies can be reduced. For example, in large cache scenarios, since hot file pages are often the ones that truly affect the transient performance of switching, prioritizing the migration of the cold and hot states of these file pages is usually more cost-effective.
[0069] In some other embodiments, the page information may optionally include verification information; step 103 includes: performing validity verification on the file page based on the verification information of each file page among the multiple file pages; converting the reference popularity value of the file pages that pass the validity verification among the multiple file pages into popularity values under the second page caching strategy to obtain the conversion popularity value of the corresponding file page; for the file pages that fail the validity verification among the multiple file pages, using the default popularity value under the second page caching strategy as the conversion popularity value of the corresponding file page. By extracting the verification information of each file page and performing validity verification accordingly, the relative hot and cold status information of the expired file pages can be identified. For expired file pages, on the one hand, by abandoning the migration of the old strategy's hot and cold status, the risk of affecting subsequent page caching operations and weakening I / O performance due to the import of incorrect hot and cold status can be reduced; on the other hand, by not introducing an additional independent exception state machine, but directly ignoring the relative hot and cold status information of the file page under the old strategy and initializing it according to the default value of the new strategy, the new strategy can take over the current file page cache in a predictable way and reasonably control the migration cost. As an example, for a file page that fails the validity check, it can be marked as "invalid" or its page information can be deleted directly; this disclosure does not impose any restrictions on this.
[0070] As an example, an intermediate storage structure called "migration storage" can be constructed to save migration snapshots between the unloading of the old policy and the loading of the new policy. This can be understood as storing the "cold / hot handover record" left by the old policy in a location that remains visible across the program's lifecycle. This migration storage includes, but is not limited to, pinned BPF Maps (fixed BPF mappings that can continue to be accessed by subsequent programs after the policy program is unloaded), user-space shared memory, user-space mapping tables with persistent files, and other storage structures whose lifecycles are independent of the old / new policy programs. An example of validity verification can be seen as storing the migration snapshots left by the old policy in the migration storage and performing validity verification on each migration record in the snapshot. If the verification fails, the migration record is not used; instead, the corresponding file page is processed according to the default initial values of the new policy. The core principle is to allow the new policy to take over from a conservative starting point rather than forcibly importing erroneous states into the new policy.
[0071] In some of the above embodiments, optionally, the verification information for each file page includes at least one of the following: a session identifier of the policy switching session, the information validity period of the file page, and a verification value of the file page. The information validity period of the file page is determined based on the time when the file page's popularity ranking is extracted. The verification value of the file page is calculated by applying a set algorithm to other information in the file page's information besides the verification value. The session identifier of the policy switching session can be represented by the symbol epoch. Its corresponding validity verification checks whether the session identifier corresponding to the current file page is consistent with the session identifier of the current policy switching session. If they are consistent, the verification passes; otherwise, it fails, thus ensuring that the new policy only reads the migration records corresponding to this round of switching. The validity verification corresponding to the information validity period of the file page checks whether the current file page's information validity period has expired. If it has not expired, the verification passes; otherwise, it fails, thus enabling the removal of expired records from a time perspective. As an example, the symbol `ts_export` can represent the time when the file page's popularity ranking was extracted, which is the timestamp when the migration record for that file page was exported using the old strategy. The symbol `ttl` can represent the lifetime of the migration record, and the time obtained by `ts_export + ttl` can be used as the information validity period of that file page. The checksum of the file page is calculated by applying a set algorithm to the extracted information (i.e., information other than the checksum in the page information), and can be represented by the symbol `checksum`. It should be understood that the calculation can be applied to all other information except the checksum, or to some other information. For time information, the timestamp `ts_export` or the information validity period `ts_export + ttl` can be used, as long as the purpose of calculating the checksum based on the extracted information can be achieved. The validity check corresponding to the checksum is to recalculate the new checksum for the same field in the corresponding migration record according to the set algorithm, and then determine whether the new checksum is the same as the original checksum in the check information. If they are the same, the check passes; otherwise, it fails, thus verifying whether the extracted migration record has been corrupted. By using this check information, it is possible to check whether the migration record is missing, expired, or abnormally corrupted.
[0072] It should be understood that the step numbers in the exemplary embodiments of this disclosure do not constitute a limitation on the execution order of each step. As long as it is logically permissible, the execution order of each step can be adjusted, and other related steps can be adaptively adjusted. Specifically, in this embodiment, the step of performing validity verification can be performed before quantization processing (i.e., step 102), and step 102 can be adaptively adjusted to quantify the popularity ranking of file pages that pass the validity verification, and not to quantify the popularity ranking of file pages that fail the validity verification. Based on this, before calculating the conversion popularity value, validity verification may not be performed again, or validity verification may be performed again, and this time only some information may be verified, such as only verifying whether the information validity period of the file page has expired. This disclosure does not impose any restrictions on this.
[0073] It should also be understood that the above two types of embodiments, one of which uses a sufficiently high reference popularity value of the file page as a necessary condition for using the migration record of the current file page, and the other of which uses the file page passing validity verification as a necessary condition for using the migration record of the current file page, do not have a logical contradiction. Therefore, they can be implemented separately or in combination. When implemented together, for example, for each of multiple file pages, if the file page passes validity verification and its reference popularity value is greater than or equal to the popularity threshold, the reference popularity value of the file page is converted into a popularity value under the second page caching strategy to obtain the converted popularity value of the file page; if the file page fails validity verification or its reference popularity value is less than the popularity threshold, the default popularity value under the second page caching strategy is used as the converted popularity value of the corresponding file page. This disclosure does not limit this.
[0074] Optionally, step 103 includes: in response to the initiation of the policy switching session, setting the popularity conversion flags of multiple file pages to an unconverted state; for each file page among the multiple file pages, in response to determining that the popularity conversion flag of the file page is in an unconverted state, converting the reference popularity value of the file page into the popularity value under the second page caching policy to obtain the converted popularity value of the file page, and setting the popularity conversion flag of the file page to a converted state. By introducing a popularity conversion flag to indicate whether the reference popularity value of a file page has been converted into a converted popularity value, that is, whether the migration record import between the old and new policies has been completed for the file page, duplicate imports can be avoided, that is, duplicate initialization can be avoided, which helps to improve the efficiency of policy switching. As an example, the symbol imported_flag can be used as the popularity conversion flag.
[0075] As previously stated, the step numbers in the exemplary embodiments of this disclosure do not constitute a limitation on the execution order of each step. The execution order of each step can be adjusted as long as it is logically permissible. Specifically, in this embodiment, the step of "setting the popularity conversion flags of multiple file pages to an unconverted state in response to the initiation of a policy switching session" is included in step 103 for ease of description. However, in implementing this disclosure, this step can be performed before the step of calculating the conversion popularity value for each file page, for example, including but not limited to performing this step when executing step 101. This disclosure does not impose any limitations on this. It should also be understood that this embodiment can be combined with the two types of embodiments described above. In this case, the popularity conversion flag may also include a default state. When the default popularity value of a file page under the second page caching policy is used as the conversion popularity value of that file page, the popularity conversion flag of that file page is set to the default state.
[0076] The following section provides a further description of the page caching strategy switching method according to exemplary embodiments of this disclosure.
[0077] In related technologies, the risks of switching page caching strategies also lie in the fact that the effects of the switch are usually not immediately stable. Even if the new strategy has been successfully loaded, if its initial state is unreasonable or the current access phase has changed, problems such as decreased file cache hit rate, increased refaults (the phenomenon of pages being reclaimed and then re-entering the page cache within a short period of time, usually indicating that the previous reclamation may have been too early or the current strategy is not compatible with the load), increased page faults, increased pgscan (a count of pages scanned during Linux memory reclamation, the larger the increment, the higher the page reclamation pressure), and worsening tail latency may still occur. Therefore, for page caching strategy switching, the completion of the switch (i.e., the new strategy being successfully loaded) does not mean that the switch is successful.
[0078] To address this issue, optionally, after step 104, the page caching strategy switching method according to an exemplary embodiment of this disclosure further includes: executing a second page caching strategy within a set dimension range based on the initial popularity values of multiple file pages, and collecting preset performance monitoring indicators during the execution process, wherein the set dimension range is a set value range under a preset dimension; in response to completing the strategy execution within the set dimension range and determining that the preset performance monitoring indicators meet preset pass conditions, executing the second page caching strategy within the full dimension range, wherein the full dimension range is the complete value range that the second page caching strategy can be applied to under the preset dimension; and in response to determining that the preset performance monitoring indicators meet preset fallback conditions, reverting to the first page caching strategy. Unlike the crude approach of "freezing all triggers," the exemplary embodiments of this disclosure configure an observation and disaster rollback mechanism within a set dimension. This mechanism observes first and then decides whether to formally submit or revert to the old strategy. It allows for continuous monitoring of the new strategy within the set dimension, combined with preset performance monitoring indicators. It uses real page cache indicators (i.e., preset performance monitoring indicators) to confirm whether the switch is successful (i.e., whether the preset pass conditions are met). The switch is fully executed only after observation is completed (i.e., the strategy execution within the set dimension is completed) and the switch is confirmed to be successful. If there is a significant deterioration (i.e., the preset rollback conditions are met), the observation is immediately interrupted and the strategy is rolled back to the old strategy. This reduces the risk of mistaking "program loading successfully" for "page caching strategy switch successful" and improves the reliability and stability of strategy switching.
[0079] As an example, preset performance monitoring metrics include, but are not limited to, file cache hit rate, page faults, reclamation pressure, tail latency, and refault. Preset pass conditions may include all preset performance monitoring metrics being within a reasonable range, while preset fallback conditions may include any preset performance monitoring metric being within a significantly abnormal range. The preset pass and fallback conditions may use the same preset performance monitoring metric, or different or not entirely the same preset performance monitoring metric. Furthermore, for the same preset performance monitoring metric, its reasonable range and significantly abnormal range may be represented by different thresholds, which this disclosure does not restrict. For example, for file cache hit rate, the preset pass condition may be that for m_pass consecutive sampling points, the hit rate is greater than or equal to the difference between the baseline before the switch and δ_pass, where δ_pass is the hit rate drop tolerance. The preset fallback condition may be that any sampling point experiences a "hit rate drop exceeding δ_fail" or a "page fault increase exceeding φ_fail," where δ_fail is the hit rate drop that triggers a disaster fallback.
[0080] Optionally, the preset dimensions include at least one of the following: time dimension, file page dimension, and file page operation request dimension. Correspondingly, the defined dimension range includes at least one of the following: defined time range, defined file page range, and defined file page operation request range. The defined time range can be considered as setting an observation period within which the new strategy is executed and observed. The corresponding full dimension range is all time prior to initiating the new strategy switching session. The defined file page range and defined file page operation request range can be considered as implementing a small-volume warm-up plan, where after the switch, the new strategy initially only takes over a portion of the file pages or a portion of the file page operation requests. The corresponding full dimension range is all file pages under the responsibility of the second page caching strategy and all file page operation requests for these file pages, including but not limited to all file pages in the current cgroup and all file page operation requests for these file pages. Different dimension observation mechanisms can improve the flexibility of the solution.
[0081] Optionally, after step 104, the page caching strategy switching method according to the exemplary embodiment of this disclosure further includes: in response to completing the strategy execution within a set dimension range and determining that the preset performance monitoring indicators do not meet the preset pass conditions, executing the second page caching strategy again within the set dimension range, or outputting a strategy switching request to request the initiation of a new strategy switching session. When the observation within the set dimension range ends, but the performance is insufficient to meet the pass requirements, by appropriately extending the observation time, that is, executing the new strategy again within the set dimension range, the frequency of strategy switching can be reduced; by abandoning the observation of the new strategy and instead requesting the initiation of a new strategy switching session, a strategy more suitable for the current situation can be switched to in a timely manner, which helps to improve I / O performance. It should be understood that for the latter, this means that during the execution of the second page caching strategy within the set dimension range, the latest recommended strategy from upstream (which can be referred to as the third page caching strategy) continues to be received and retained, but its switching is temporarily suspended. When the observation ends and the preset pass conditions are not met, a request is made to switch to the third page caching strategy, which allows the system to neither blindly perform a second switch during the observation process nor be completely blind to new load changes. It should also be understood that the third-page caching strategy is the latest page caching strategy recommended by the upstream. This means that if a third-page caching strategy has already been saved, and a new recommended strategy is received, the previous record will be overwritten and updated, and the third-page caching strategy will be replaced with the new recommended strategy.
[0082] The following describes a page caching strategy switching method according to a specific embodiment of this disclosure.
[0083] like Figure 2As shown, the overall architecture of this specific embodiment includes an old policy side, a new policy side, and a migration control side located between the two. The operating system executing this specific embodiment includes a heat exporter belonging to the old policy side, a migration snapshot generator, migration storage, mapping profile executor, and observation controller belonging to the migration control side, and an initialization importer belonging to the new policy side. When performing a policy switch, the eBPF program on the old policy side first exports the heat order through the heat exporter and hands it over to the migration control side; the migration control side then sequentially uses the migration snapshot generator, migration storage, and mapping profile executor to realize the storage of migration records and heat conversion, and hands the conversion result over to the new policy side; the new policy side imports the valid conversion result as the initial heat according to the received conversion result through the initialization importer, and executes the new policy eBPF program during the observation period, while sending the running data during the observation period back to the observation controller on the migration control side. The observation controller processes the data to obtain preset performance monitoring indicators and stores them in the migration storage, and analyzes the preset performance monitoring indicators, confirms the observation results, and performs corresponding processing.
[0084] like Figure 3 As shown, the process in this specific embodiment corresponds to the main line of "exporting the old state—constructing the intermediate representation—mapping the new strategy—importing the new strategy—observing and confirming—rolling back from anomalies". For missing, expired, or abnormally corrupted migration records, they are directly ignored and the corresponding file pages are taken over according to the default initial values of the new strategy. The process specifically includes the following steps.
[0085] Step 301: Receive a page caching strategy switching request. This request is used to start a strategy switching session.
[0086] Step 302: Before uninstalling the old strategy, export the "page hot / cold order from the perspective of the old strategy," i.e., the popularity ranking. The migration record for each exported file page should include at least page_key, rank_old, class_old, epoch, and ts_export. The meanings of these symbols are explained above and will not be repeated here.
[0087] Step 303: Convert the popularity ranking derived from the old strategy into a unified popularity level QHR, i.e., the reference popularity value.
[0088] Step 304: Write {page_key, QHR, epoch, ttl, checksum} to the migration store.
[0089] To prevent the new strategy from reading outdated or corrupted data, this specific implementation adds the following to each migration record: epoch: Ensures that only records corresponding to the currently switched session are read; TTL: Records that have exceeded their lifespan will no longer be imported; checksum: Used to detect whether migration records are corrupted; coverage_counter: Used to count the number of records successfully imported so far.
[0090] Step 305: Based on the fields added to each migration record above, perform a validity check on each migration record. If an epoch mismatch, TTL timeout, or checksum failure is found, the migration record is considered invalid, and subsequent new strategies will not use this migration record, but will instead process the corresponding file page according to the default initial value of the new strategy.
[0091] Step 306: Determine the mapping profile based on the category of the new strategy, and convert the QHR of the file page into the conversion heat value accordingly to obtain the initial state state_new that the new strategy can accept.
[0092] For priority-based strategies (recency / inverse-recency), these strategies use queue position and the order of protected / removed ends to represent hot and cold pages, and can place each file page in its corresponding initial priority according to the QHR (Quick Retention Rate). If the priority direction of the new strategy is opposite to the QHR, then a reverse mapping is performed.
[0093] For frequency-based strategies, which use frequency buckets or integer counts to represent hot and cold pages, the QHR can be mapped to freq_init within the range of [fmin, fmax]. Here, fmin / fmax are the lower and upper bounds of the initial frequency allowed by the new frequency-based strategy, used to limit the starting frequency range during migration and import. freq_init is only a preliminary estimate and does not represent the actual historical access frequency of the file page; subsequent updates will still increment, decay, or reset according to the new strategy's own update rules.
[0094] For segmented strategies, file pages are divided into cold / warm / hot zones or multiple segment queues based on their popularity. The QHR can be divided into quantile intervals first, and then mapped to the corresponding segments. If necessary, the order within the segment can be added.
[0095] Step 307: After loading the new strategy, when it first takes over a file page, it queries the migration store for valid migration records for each file page by page_key. This step can be understood as: when the new strategy takes over a page, it first checks if there are any valid migration records left by the old strategy. If so, it inherits a reasonable starting point; otherwise, it starts using the default method. Specifically, if valid migration records exist, state_new is written to the initial state of the new strategy; if no valid migration records exist, it takes over according to the default state of the new strategy. Furthermore, for file pages that have been successfully imported, their imported_flag is set to avoid duplicate initialization.
[0096] Step 308: After the new strategy is successfully loaded, the switch is not yet successful. The system still needs to enter the observation and confirmation window, which is a time window during which continuous monitoring is allowed but the new recommended strategy switch is not executed. In this window: monitor preset performance monitoring indicators such as hit rate, page faults, reclamation pressure, and tail latency; if a catastrophic performance degradation occurs (i.e., the preset performance monitoring indicators meet the preset rollback conditions), the observation is immediately interrupted and the old strategy rollback is executed without waiting for the end of the observation period; if the preset pass conditions are met, the new strategy is confirmed to be officially effective; otherwise, monitoring continues until the end of the observation period; during the observation period, it is allowed to continue receiving new recommended page caching strategies, but only the last pending recommendation is cached, and no new switch is executed; if the preset pass conditions are not met by the end of the observation period, the new strategy is abandoned and the current switch round ends. For cases where the current switch round ends due to abandoning the new strategy, the last cached pending recommendation can be used as the new strategy to start a new round of switch and re-execute the entire process.
[0097] Figure 4 This is a schematic diagram illustrating the core differences between related technologies and page caching strategy switching methods according to specific embodiments of this disclosure.
[0098] like Figure 4 As shown, the cold switching or clearing and rebuilding methods in related technologies have the limitation of losing hotspot information and significant transient loss of I / O performance. The specific embodiments of this disclosure, by deriving the relative cold and hot order of comparable file pages from the old strategy and converting it into a unified intermediate representation, while ignoring invalid migration records and switching to the new strategy's default initial value takeover, retain the hotspot identification capability to a certain extent and reduce the transient loss of I / O performance.
[0099] While the adaptive methods within the same framework in related technologies can partially retain the hotspot information accumulated by the old strategy, they are limited to the same strategy framework and cannot solve the problem of lifecycle break between different types of new and old strategies. The specific embodiments of this disclosure are based on the aforementioned unified intermediate representation to achieve profile initialization according to the target strategy category, which can accept ordered initialization and realize cross-strategy state bridging.
[0100] While pre-switching shadow simulation or prediction methods in related technologies can simulate or predict before switching, prediction cannot replace the actual state transition. The specific embodiments of this disclosure introduce post-switching observation confirmation and catastrophic rollback mechanisms to achieve a switchover fallback.
[0101] Figure 5 This is a block diagram of a page caching strategy switching device according to an exemplary embodiment of the present disclosure. (Refer to...) Figure 5 The device includes an extraction unit 501, a quantization unit 502, a conversion unit 503, and a switching unit 504.
[0102] The extraction unit 501 is configured to extract page information of multiple file pages stored in the page cache in response to the start of a policy switching session, under the first page caching policy. The page information includes the popularity ranking, and the first page caching policy is the currently executed page caching policy.
[0103] The quantization unit 502 is configured to quantize the popularity ranking of multiple file pages to obtain reference popularity values for multiple file pages.
[0104] The conversion unit 503 is configured to convert the reference popularity values of multiple file pages into popularity values under the second page caching strategy, thereby obtaining the converted popularity values of multiple file pages, wherein the second page caching strategy is the target page caching strategy to be executed.
[0105] The switching unit 504 is configured to use the conversion heat value of multiple file pages as the initial heat value of multiple file pages under the second page caching strategy, and switch to the second page caching strategy.
[0106] Optionally, the quantization unit 502 is also configured to map the popularity ranking of multiple file pages proportionally to corresponding values within a preset range to obtain reference popularity values for multiple file pages.
[0107] Optionally, the conversion unit 503 is further configured to: for each of the multiple file pages, if the reference popularity value of the file page is greater than or equal to the popularity threshold, convert the reference popularity value of the file page into a popularity value under the second page caching strategy to obtain the converted popularity value of the file page; if the reference popularity value of the file page is less than the popularity threshold, use the default popularity value under the second page caching strategy as the converted popularity value of the corresponding file page.
[0108] Optionally, the page information also includes verification information; the conversion unit 503 is further configured to: perform validity verification on the file page according to the verification information of each file page in the multiple file pages; convert the reference popularity value of the file page that passes the validity verification in the multiple file pages into the popularity value under the second page caching strategy to obtain the conversion popularity value of the corresponding file page; and for the file page that fails the validity verification in the multiple file pages, use the default popularity value under the second page caching strategy as the conversion popularity value of the corresponding file page.
[0109] Optionally, the verification information for each file page includes at least one of the following: the session identifier of the policy switching session, the information validity period of the file page, and the verification value of the file page. The information validity period of the file page is determined based on the time when the popularity ranking of the file page is extracted, and the verification value of the file page is calculated by applying a set algorithm to other information in the page information of the file page, excluding the verification value.
[0110] Optionally, the conversion unit 503 is further configured to: in response to the start of the policy switching session, set the popularity conversion flags of multiple file pages to an unconverted state; for each of the multiple file pages, in response to determining that the popularity conversion flag of the file page is in an unconverted state, convert the reference popularity value of the file page into the popularity value under the second page caching policy to obtain the conversion popularity value of the file page, and set the popularity conversion flag of the file page to a converted state.
[0111] Optionally, the page caching strategy switching device according to an exemplary embodiment of the present disclosure further includes an execution unit configured to: execute a second page caching strategy within a set dimension range based on the initial popularity values of multiple file pages, and collect preset performance monitoring indicators during the execution process, wherein the set dimension range is a set value range under a preset dimension; in response to completing the strategy execution within the set dimension range and determining that the preset performance monitoring indicators meet preset pass conditions, execute the second page caching strategy within the full dimension range, wherein the full dimension range is the complete value range that the second page caching strategy can be applied to under the preset dimension; and in response to determining that the preset performance monitoring indicators meet preset fallback conditions, fall back to the first page caching strategy.
[0112] Optionally, the preset dimensions include at least one of the following: time dimension, file page dimension, and file page operation request dimension.
[0113] Optionally, the execution unit is also configured to, in response to completing the execution of the strategy within the set dimension and determining that the preset performance monitoring indicators do not meet the preset pass conditions, execute the second page caching strategy again within the set dimension, or output a strategy switching request to request the start of a new strategy switching session.
[0114] Regarding the apparatus in the above embodiments, the specific manner in which each unit performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0115] According to embodiments of this disclosure, an electronic device may be provided. Figure 6 This is a block diagram of an electronic device 600 according to an embodiment of the present disclosure. The electronic device includes at least one memory 601 and at least one processor 602. The at least one memory stores a set of computer-executable instructions 6011 and an operating system 6012. When the set of computer-executable instructions 6011 is executed by the at least one processor 602, a page caching strategy switching method according to an embodiment of the present disclosure is executed.
[0116] As an example, electronic device 600 may be a PC, tablet, personal digital assistant, smartphone, or other device capable of executing the aforementioned set of instructions. Here, electronic device 600 is not necessarily a single electronic device, but may be a collection of any devices or circuits capable of executing the aforementioned instructions (or instruction sets) individually or in combination. Electronic device 600 may also be part of an integrated control system or system manager, or may be configured to interconnect with a portable electronic device locally or remotely (e.g., via wireless transmission) through an interface.
[0117] In electronic device 600, processor 602 may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller, or a microprocessor. By way of example and not limitation, processor 602 may also include analog processors, digital processors, microprocessors, multi-core processors, processor arrays, network processors, etc.
[0118] The processor 602 can execute instructions or code stored in memory, wherein memory 601 can also store data. Instructions and data can also be sent and received via a network through a network interface device, wherein the network interface device can employ any known transmission protocol.
[0119] The memory 601 may be integrated with the processor 602, for example, by placing RAM or flash memory within an integrated circuit microprocessor. Alternatively, the memory 601 may include a separate device, such as an external disk drive, a storage array, or other storage device usable by any database system. The memory 601 and the processor 602 may be operatively coupled, or may communicate with each other, for example, via I / O ports, network connections, etc., enabling the processor 602 to read files stored in the memory 601.
[0120] In addition, the electronic device 600 may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, mouse, touch input device, etc.). All components of the electronic device can be interconnected via a bus and / or network.
[0121] According to embodiments of this disclosure, a computer-readable storage medium may also be provided, wherein when instructions in the computer-readable storage medium are executed by at least one processor, the at least one processor causes the processor to perform the page cache strategy switching method of embodiments of this disclosure. Examples of computer-readable storage media include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or optical disc storage, hard disk drive (HDD), solid-state drive (SSD), card storage (such as multimedia cards, secure digital (SD) cards, or ultra-fast digital (XD) cards), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, and any other device configured to store a computer program and any associated data, data files, and data structures in a non-transitory manner and to provide the computer program and any associated data, data files, and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the aforementioned computer-readable storage medium can run in an environment deployed in computer devices such as clients, hosts, agent devices, servers, etc. Furthermore, in one example, the computer program and any associated data, data files, and data structures are distributed across a networked computer system, such that the computer program and any associated data, data files, and data structures are stored, accessed, and executed in a distributed manner through one or more processors or computers.
[0122] According to an embodiment of this disclosure, a computer program product is provided, including computer instructions, which, when executed by a processor, implement the page caching strategy switching method of this disclosure.
[0123] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.
[0124] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method for switching page caching strategies, characterized in that, include: In response to the start of a policy switching session, under the first page caching policy, page information of multiple file pages stored in the page cache is extracted, wherein the page information includes the popularity ranking, and the first page caching policy is the currently executed page caching policy; The popularity ranking of the multiple file pages is quantified to obtain reference popularity values for the multiple file pages; The reference popularity values of the multiple file pages are converted into popularity values under the second page caching strategy to obtain the converted popularity values of the multiple file pages, wherein the second page caching strategy is the target page caching strategy to be executed. The conversion popularity value of the multiple file pages is used as the initial popularity value of the multiple file pages under the second page caching strategy, and then the second page caching strategy is switched.
2. The page caching strategy switching method as described in claim 1, characterized in that, The step of quantifying the popularity ranking of the multiple file pages to obtain reference popularity values for the multiple file pages includes: The popularity ranking of the multiple file pages is mapped proportionally to corresponding values within a preset range to obtain reference popularity values for the multiple file pages.
3. The page caching strategy switching method as described in claim 1, characterized in that, The step of converting the reference popularity values of the multiple file pages into popularity values under the second page caching strategy to obtain the converted popularity values of the multiple file pages includes: For each of the multiple file pages, if the reference popularity value of the file page is greater than or equal to the popularity threshold, the reference popularity value of the file page is converted into a popularity value under the second page caching strategy to obtain the converted popularity value of the file page. If the reference popularity value of the file page is less than the popularity threshold, the default popularity value under the second page caching strategy will be used as the conversion popularity value of the corresponding file page.
4. The page caching strategy switching method as described in claim 1, characterized in that, The page information also includes verification information; wherein, converting the reference popularity values of the multiple file pages into popularity values under the second page caching strategy to obtain the converted popularity values of the multiple file pages includes: The validity of each file page is verified based on the verification information of each of the multiple file pages. The reference popularity value of the file pages that pass the validity check among the multiple file pages is converted into a popularity value under the second page caching strategy to obtain the converted popularity value of the corresponding file page; For file pages that fail the validity check among the multiple file pages, the default popularity value under the second page caching strategy is used as the conversion popularity value of the corresponding file page.
5. The page caching strategy switching method as described in claim 4, characterized in that, The verification information for each file page includes at least one of the following: the session identifier of the policy switching session, the information validity period of the file page, and the verification value of the file page. The information validity period of the file page is determined based on the time when the file page's popularity ranking is extracted, and the verification value of the file page is calculated by applying a set algorithm to the other information in the page information of the file page, excluding the verification value.
6. The page caching strategy switching method as described in claim 1, characterized in that, The step of converting the reference popularity values of the multiple file pages into popularity values under the second page caching strategy to obtain the converted popularity values of the multiple file pages includes: In response to the initiation of the policy switching session, the popularity conversion flags of the multiple file pages are set to an unconverted state; For each of the plurality of file pages, in response to determining that the popularity conversion identifier of the file page is in the unconverted state, the reference popularity value of the file page is converted into the popularity value under the second page caching strategy to obtain the converted popularity value of the file page, and the popularity conversion identifier of the file page is set to the converted state.
7. The page caching strategy switching method according to any one of claims 1 to 6, characterized in that, After switching to the second page caching strategy, the following is also included: Based on the initial popularity values of the multiple file pages, the second page caching strategy is executed within a set dimension range, and preset performance monitoring indicators are collected during the execution process. The set dimension range is a set value range under a preset dimension. In response to completing the strategy execution within the set dimension range and determining that the preset performance monitoring indicator meets the preset pass condition, the second page caching strategy is executed within the full dimension range, wherein the full dimension range is the complete range of values for which the second page caching strategy can be applied under the preset dimension. In response to determining that the preset performance monitoring indicators meet the preset fallback conditions, the system reverts to the first page caching strategy.
8. The page caching strategy switching method as described in claim 7, characterized in that, The preset dimensions include at least one of the following: time dimension, file page dimension, and file page operation request dimension.
9. The page caching strategy switching method as described in claim 7, characterized in that, After switching to the second page caching strategy, the following is also included: In response to completing the execution of the strategy within the set dimension range and determining that the preset performance monitoring indicator does not meet the preset pass condition, the second page caching strategy is executed again within the set dimension range, or a strategy switching request is output to request the start of a new strategy switching session.
10. A page caching strategy switching device, characterized in that, include: The extraction unit is configured to extract page information of multiple file pages stored in the page cache in response to the start of a policy switching session, under the first page caching policy, wherein the page information includes the popularity ranking, and the first page caching policy is the currently executed page caching policy; The quantization unit is configured to quantize the popularity ranking of the plurality of file pages to obtain reference popularity values for the plurality of file pages; The conversion unit is configured to convert the reference popularity values of the plurality of file pages into popularity values under the second page caching strategy, thereby obtaining the converted popularity values of the plurality of file pages, wherein the second page caching strategy is the target page caching strategy to be executed. The switching unit is configured to use the conversion popularity value of the plurality of file pages as the initial popularity value of the plurality of file pages under the second page caching strategy, and switch to the second page caching strategy.
11. An electronic device, characterized in that, include: At least one processor; At least one memory that stores computer-executable instructions. Wherein, when the computer-executable instructions are executed by the at least one processor, the at least one processor causes the at least one processor to perform the page caching strategy switching method as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by at least one processor, they cause the at least one processor to perform the page caching strategy switching method as described in any one of claims 1 to 9.
13. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by at least one processor, they cause the at least one processor to perform the page caching strategy switching method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
File page cache recovery method and device, electronic equipment and storage medium
CN117931685A
Page caching method, system and equipment based on vue3
CN118690095A