Cache management method and device, server and computer readable storage medium

By using a hash table to manage cached pages between the host and virtual machines, updating hot information based on access patterns, and meticulously categorizing cached pages, the problem of redundant caches consuming memory in container technology is solved, improving memory usage and management efficiency.

CN115248717BActive Publication Date: 2026-01-30HUAWEI TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110454028.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-26
Publication Date
2026-01-30
Estimated Expiration
2041-04-26

AI Technical Summary

Technical Problem

In existing technologies, container technology creates redundant file caches in virtual machines, resulting in excessive memory consumption and high computational overhead for cache management, leading to low efficiency.

Method used

By using a hash table to manage cached pages between the host and virtual machines, updating popularity information based on access patterns, and meticulously classifying cached pages into cold, hot, or warm pages, and managing them according to popularity information, the occupation of redundant cached pages is reduced.

Benefits of technology

It improves memory utilization efficiency, reduces the computational overhead of cache management, and achieves efficient cache page management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115248717B_ABST
    Figure CN115248717B_ABST
Patent Text Reader

Abstract

This application discloses a cache management method, apparatus, server, and computer-readable storage medium, belonging to the field of storage technology. The method includes: a host determining the "hotness" information of multiple cache pages based on access information sent by multiple virtual machines; multiple virtual machines processing multiple cache pages based on the "hotness" information sent by the host, thereby reducing the memory footprint of cache pages on virtual machines and improving memory utilization efficiency. Because this method manages multiple cache pages using "hotness" information, the computational overhead is relatively small, enabling highly efficient cache management.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of storage, in particular to a cache management method and device, a server and a computer readable storage medium. BACKGROUND

[0002] Container technology refers to packaging an application program into a container to realize isolated running of different application programs on the same host without affecting each other. In order to improve security and isolation, secure container technology is developed, which refers to placing a container in an independent virtual machine for running. However, when the container running in the virtual machine initiates a file access request to a certain file of the host, a file cache in the form of a cache page will be created in the host and the virtual machine. When different virtual machines running on the same host initiate access requests to the same file, the same file cache will be created, resulting in a large number of redundant file caches occupying memory space. In related technologies, a cache scrubbing technology is used to solve the above problem. The cache scrubbing technology compares the contents of the cache pages to identify the cache pages with the same contents in the host and the virtual machine, and deletes the corresponding cache pages in the host.

[0003] In the process of implementing the present application, the inventors found that the above method identifies redundant cache pages based on content comparison, which requires scanning the cache pages of the host and the virtual machine, resulting in large calculation overhead and low efficiency. SUMMARY

[0004] To solve the problem of large calculation overhead and low efficiency of the cache management in the prior art, the embodiments of the present application provide a cache management method, device, server and computer readable storage medium. The technical solution is as follows:

[0005] In a first aspect, a cache management method is provided, which is executed by a host in a server, the server comprising the host and a plurality of virtual machines, and a container is running on the virtual machine. The method comprises:

[0006] Receiving at least one first hash table, the first hash table being used to record file information and access situation information corresponding to a plurality of cache pages on the corresponding virtual machine;

[0007] Updating a second hash table based on the at least one first hash table, the second hash table being used to record file information and access situation summary information corresponding to a plurality of cache pages on the plurality of virtual machines;

[0008] Determining heat information of the plurality of cache pages based on the updated second hash table, the heat information being used to represent the access situation summary information of the corresponding cache page;

[0009] The hotness information of the plurality of cache pages is sent to corresponding virtual machines respectively, and the hotness information is used as reference information for the virtual machines to delete cache pages.

[0010] In the embodiments of the present application, the host determines the hotness information of the plurality of cache pages based on the access condition information of the plurality of cache pages sent by the plurality of virtual machines, and the plurality of virtual machines process the plurality of cache pages based on the hotness information of the plurality of cache pages sent by the host, thereby reducing the occupation of the cache pages to the memory of the virtual machines and improving the memory use efficiency. Since the method manages the plurality of cache pages through the hotness information, the calculation overhead is small, and efficient cache management can be achieved.

[0011] In some embodiments, the updating the second hash table based on the at least one first hash table comprises:

[0012] For any first hash table, based on the file information corresponding to the plurality of cache pages in the first hash table, a plurality of target table entries of the plurality of cache pages are determined, the plurality of target table entries being table entries corresponding to the plurality of cache pages in the second hash table;

[0013] Based on the access condition information corresponding to the plurality of cache pages in the first hash table, the access condition summary information of the plurality of target table entries is updated.

[0014] In some embodiments, the file information corresponding to any cache page comprises a virtual block number, a file identifier, and a file offset;

[0015] The determining the plurality of target table entries of the plurality of cache pages based on the file information corresponding to the plurality of cache pages in the first hash table comprises:

[0016] For the file information corresponding to any cache page in the first hash table, based on the virtual block number of the cache page, a physical block number corresponding to the cache page in the second hash table is determined;

[0017] Based on the virtual machine identifier corresponding to the first hash table and the file identifier and the file offset of the cache page, a target table entry of the cache page is determined in at least one table entry corresponding to the physical block number of the cache page in the second hash table.

[0018] In some embodiments, the determining the hotness information of the plurality of cache pages based on the updated second hash table comprises:

[0019] For any virtual machine, based on the access condition summary information corresponding to the plurality of cache pages on the virtual machine in the updated second hash table, a target queue of the plurality of cache pages on the virtual machine in a multi-level queue is determined, the multi-level queue being used to represent a plurality of levels of hotness.

[0020] Determine the hotness information of the plurality of cache pages on the virtual machine based on the target queue of the plurality of cache pages on the virtual machine in the multi-level queue.

[0021] In some embodiments, the determining the target queue of the plurality of cache pages on the virtual machine in the multi-level queue based on the updated access summary information of the plurality of cache pages on the virtual machine in the second hash table comprises:

[0022] For the access summary information of any cache page on the virtual machine, scale the access summary information of the cache page based on the memory usage information of the virtual machine;

[0023] Determine the target queue of the cache page in the multi-level queue based on the scaled access summary information of the cache page.

[0024] By scaling the access summary information of the cache page, the access summary information of the cache page corresponds to the running state of the virtual machine, which plays a good guiding role in subsequent determination of the hotness information of the cache page.

[0025] In some embodiments, the determining the hotness information of the plurality of cache pages on the virtual machine based on the target queue of the plurality of cache pages on the virtual machine in the multi-level queue comprises:

[0026] Adjust the hot threshold and the cold threshold based on the memory usage information of the host;

[0027] Determine the hotness information of the plurality of cache pages on the virtual machine based on the target queue of the plurality of cache pages on the virtual machine in the multi-level queue, the adjusted hot threshold and the adjusted cold threshold, the hotness information being used to indicate whether the corresponding cache page is a cold page or a hot page.

[0028] By adjusting the cold threshold and the hot threshold, the determined hotness information of the cache page is more consistent with the running state of the host.

[0029] In some embodiments, the hotness information is used to indicate whether the corresponding cache page is a cold page, a hot page or a warm page.

[0030] By classifying the cache page more carefully, the management granularity of the virtual machine on the cache page is smaller, so that the running requirements of the virtual machine can be met.

[0031] In some embodiments, the method further comprises:

[0032] In response to the target cache page existing in the second hash table, lower the target queue of the target cache page in the multi-level queue to a lower queue, the hotness of the lower queue in the multi-level queue being lower than the hotness of the higher queue, the target cache page being a cache page that is not updated in a plurality of periods in the second hash table.

[0033] By downgrading the target queue of the target cache page, the level of the target queue can more accurately represent the access status of the corresponding cache page, which plays a good guiding role in determining the popularity information of the cache page.

[0034] In some embodiments, sending the heat information of the plurality of cached pages to the corresponding virtual machines includes any one of the following:

[0035] Send the heat information of the multiple cache pages to the corresponding virtual machines respectively;

[0036] The heat information and redundancy information of the multiple cache pages are sent to the corresponding virtual machines respectively. The redundancy information is used to indicate whether there are redundant cache pages in the host.

[0037] Secondly, a cache management method is provided, executed by any virtual machine in a server, which includes a host and multiple virtual machines, each running containers. This method includes:

[0038] Obtain the first hash table, which is used to record file information and access information corresponding to multiple cache pages on the virtual machine;

[0039] Send the first hash table to the host;

[0040] Receive the hotness information of multiple cache pages on the virtual machine returned by the host based on the updated second hash table, which is used to record the file information and access summary information corresponding to multiple cache pages on the multiple virtual machines;

[0041] Based on the popularity information of multiple cached pages on the virtual machine, multiple cached pages on the virtual machine are processed.

[0042] In some embodiments, obtaining the first hash table includes:

[0043] Collect statistics on the access information of multiple cache pages on this virtual machine;

[0044] Based on the access information of multiple cached pages on the virtual machine, the first hash table of the virtual machine is updated to obtain the updated first hash table.

[0045] In some embodiments, processing multiple cached pages on the virtual machine based on their popularity information includes:

[0046] For any cached page on the virtual machine, in response to the hotness information indicating that the cached page is a hot page, the cached page is retained;

[0047] If the popularity information indicates that the cached page is a cold page, then the cached page and the file information and access information corresponding to the cached page in the first hash table are deleted.

[0048] In some embodiments, the method further includes:

[0049] Receive redundant information from any cached page;

[0050] The processing of multiple cached pages on the virtual machine based on their popularity information also includes:

[0051] For any cached page on the virtual machine, in response to the heat information indicating that the cached page is a warm page and the redundancy information indicating that there is a redundant cached page in the host, the cached page and the file information and access information corresponding to the cached page in the first hash table are deleted.

[0052] If the heat information indicates that the cached page is a warm page, and the redundancy information indicates that there is no redundant cached page for the cached page in the host, then the cached page is retained.

[0053] Thirdly, a cache management apparatus is provided, which includes multiple functional modules for performing corresponding steps in the cache management method provided in the first aspect.

[0054] Fourthly, a cache management apparatus is provided, which includes multiple functional modules for performing corresponding steps in the cache management method provided in the second aspect.

[0055] Fifthly, a server is provided, comprising a communication bus, at least one network interface, a memory, and at least one processor. The communication bus is used to transmit information between the aforementioned components, the at least one network interface is used to communicate with other devices or a communication network, the memory stores program code, and the at least one processor implements any step of the cache management method in the first or second aspect by reading and executing the program code stored in the memory.

[0056] In a sixth aspect, a computer-readable storage medium is provided, wherein when program code in the computer-readable storage medium is executed by a processor of a server, the server is enabled to perform any step of the cache management method described in the first or second aspect above. Attached Figure Description

[0057] Figure 1 This is a schematic diagram of the implementation environment of a cache management method provided in an embodiment of this application;

[0058] Figure 2 This is a schematic diagram of the structure of a server 200 provided in an embodiment of this application;

[0059] Figure 3 This is a flowchart illustrating the steps of a cache management method provided in an embodiment of this application;

[0060] Figure 4 This is a schematic diagram of the structure of a first hash table provided in an embodiment of this application;

[0061] Figure 5 This is a schematic diagram of the data flow of a cache management method provided in an embodiment of this application;

[0062] Figure 6 This is a flowchart illustrating the steps of a cache management method provided in an embodiment of this application;

[0063] Figure 7 This is a schematic diagram of the structure of a server component provided in an embodiment of this application;

[0064] Figure 8 This is a flowchart illustrating the steps of a cache management method provided in an embodiment of this application;

[0065] Figure 9 This is a schematic diagram of a multi-level queue structure provided in an embodiment of this application;

[0066] Figure 10 This is a schematic diagram of the structure of a cache management device provided in an embodiment of this application;

[0067] Figure 11 This is a schematic diagram of the structure of a cache management device provided in an embodiment of this application. Detailed Implementation

[0068] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0069] Container technology is a lightweight virtualization technology based on namespaces and control groups. Currently, the most widely used container technology is Docker, which allows developers to package their applications and dependencies into a portable image, enabling different applications to run in isolation on the same system. To improve security and isolation, secure container technologies, such as KataContainer, have been developed. Secure container technologies provide a more secure container environment than general container technologies by running containers in independent virtual machines.

[0070] Taking secure container technology as an example, embodiments of this application provide, for example... Figure 1The diagram shows an implementation environment, which includes a server 100. The server 100 includes a host 101 and multiple virtual machines 102, each of which runs a container.

[0071] In some embodiments, the server 100 may be an independent physical server, a server cluster consisting of multiple physical servers, or a distributed file system. It may also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. This application embodiment does not limit this.

[0072] The host 101 provides system management services to the server 100, which are used to manage the multiple virtual machines 102 running on the server 100. The containers running on the multiple virtual machines 102 can provide a runtime environment for applications to realize the corresponding functions of the applications.

[0073] Host 101 can be an independent physical server, a server cluster consisting of multiple physical servers, or a distributed file system. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. This application embodiment does not limit this.

[0074] Multiple virtual machines 102 can run on a server or a terminal. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., and the server can be any of the above-mentioned servers. This application embodiment does not specify this. Optionally, multiple virtual machines 102 can run on the same hardware device, or there may be a situation where at least two virtual machines 102 are running on a single hardware device. This application embodiment does not limit this.

[0075] It should be noted that the host 101 and multiple virtual machines 102 can be on the same hardware device or on different hardware devices, and this application embodiment does not limit this.

[0076] Figure 2 This is a schematic diagram of the structure of a server 200 provided in an embodiment of this application. Figure 2 The server 200 shown is used to perform operations involved in the cache management method, such as... Figure 2As shown, the server 200 includes at least one processor 201, a communication bus 202, a memory 203, and at least one network interface 204.

[0077] Processor 201 may be, for example, a general-purpose central processing unit (CPU), a network processor (NP), a graphics processing unit (GPU), a neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor, or one or more integrated circuits for implementing the embodiments of this application. For example, processor 201 may include an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. A PLD may be, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0078] The communication bus 202 is used to transmit information between the aforementioned components. The communication bus 202 can optionally be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, Figure 2 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0079] Memory 203 may be, for example, read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions; random access memory (RAM) or other types of dynamic storage devices capable of storing information and instructions; electrically erasable programmable read-only memory (EEPROM); compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed discs, laser discs, optical discs, digital universal discs, Blu-ray discs, etc.); magnetic disk storage media or other magnetic storage devices; or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. Memory 203 may exist independently and be connected to processor 201 via communication bus 202. Alternatively, memory 203 and processor 201 may be integrated together.

[0080] Network interface 204 uses any transceiver-like device for communicating with other devices or communication networks. Network interface 204 includes a wired network interface and optionally also includes a wireless network interface. The wired network interface is, for example, an Ethernet interface. The Ethernet interface is, for example, an optical interface, an electrical interface, or a combination thereof. The wireless network interface is, for example, a wireless local area network (WLAN) interface, a cellular network interface, or a combination thereof.

[0081] In some embodiments, processor 201 includes one or more CPUs, such as Figure 2 CPU0 and CPU1 are shown in the diagram.

[0082] In some embodiments, the network device 200 may optionally include multiple processors, such as Figure 2 The processors 201 and 205 are shown. Each of these processors is, for example, a single-core processor or a multi-core processor. A processor here may optionally refer to one or more devices, circuits, and / or processing cores used to process data (such as computer program instructions).

[0083] In some embodiments, server 200 further includes output devices and input devices. The output device may optionally display information in various ways. For example, the output device may optionally be a liquid crystal display (LCD), a light-emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc. The input device communicates with processor 201 and may optionally receive user input in various ways. For example, the input device may optionally be a mouse, keyboard, touchscreen device, or sensing device, etc.

[0084] Optionally, the processor 201 implements the method in the following embodiments by reading the program code 210 stored in the memory 203, or the processor 201 implements the method in the following embodiments by internally stored program code. When the processor 201 implements the method in the following embodiments by reading the program code 210 stored in the memory 203, the memory 203 stores program code that implements the cache management method provided in the embodiments of this application.

[0085] For more details on how processor 201 implements the above functions, please refer to the descriptions in the various method embodiments below, which will not be repeated here.

[0086] This application also provides a computer-readable storage medium including program code, such as a memory 203 including program code, which can be executed by the processor 201 of the server 200 to complete the cache management method. Optionally, the computer-readable storage medium may be read-only memory (ROM), random access memory (RAM), compact-disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.

[0087] Figure 3 This is a flowchart illustrating the steps of a cache management method provided in an embodiment of this application. This method is applied in a server, such as... Figure 3 As shown, this cache management method includes the following steps:

[0088] 301. The virtual machine obtains the first hash table, which is used to record file information and access information corresponding to multiple cache pages on the virtual machine.

[0089] For any cached page in the first hash table, the corresponding file information includes a virtual block number, a file identifier, and a file offset. The virtual block number indicates that the cached page was generated by the virtual machine accessing the virtual disk block corresponding to that virtual block number; the file identifier indicates the file corresponding to the cached page; and the file offset indicates the position of the data in the cached page within the corresponding file. The access information for the cached page indicates the number of times the cached page was accessed in the previous period. The structure of the first hash table is as follows: Figure 4 As shown, the first hash table includes multiple entries, each labeled with a virtual block number. One virtual block number corresponds to one entry, and each entry includes the file identifier, file offset, and access information of the corresponding cache page.

[0090] The virtual machine obtains the first hash table in several ways, including the following.

[0091] In some embodiments, the virtual machine updates the first hash table in real time based on the access status of cached pages. That is, the steps for the virtual machine to obtain the first hash table include: in each cycle, the virtual machine clears the access status information in the first hash table to zero; in response to the virtual machine accessing any cached page, it increments the access status information corresponding to the cached page in the first hash table by 1, thereby completing the real-time update of the first hash table, and the virtual machine obtains the updated first hash table.

[0092] In some embodiments, the virtual machine counts accesses to multiple cache pages and updates the first hash table once per cycle based on the counted accesses to the multiple cache pages. That is, the steps for the virtual machine to obtain the first hash table include: at the beginning of any cycle, such as... Figure 5 As shown in section 501, the virtual machine sends the access counts of multiple cache pages in the previous period, which are counted by the monitoring service, to the recording service, and clears the access counts of multiple cache pages counted by the monitoring service. Based on the file identifier and file offset of the multiple cache pages, the recording service determines the corresponding entries of the multiple cache pages in the first hash table, and replaces the access counts in the corresponding entries of the first hash table with the received access counts of the multiple cache pages, thereby completing the update of the first hash table so that the virtual machine can obtain the updated first hash table.

[0093] 302. The virtual machine sends the first hash table to the host.

[0094] In some embodiments, such as Figure 5 As shown in section 502, the virtual machine sends an updated first hash table and its memory usage information to the host based on the cache access synchronization service. By sending the virtual machine's memory usage information, the host's determination of cache page popularity information can better reflect the actual operating conditions of the virtual machine.

[0095] It should be noted that steps 301 to 302 above are illustrated using the process of a virtual machine obtaining the first hash table as an example. Multiple virtual machines on the server use the same steps to obtain and send the hash table, and the cycle of each virtual machine is consistent.

[0096] 303. The host receives at least one first hash table, which is used to record file information and access information corresponding to multiple cache pages on the corresponding virtual machine.

[0097] In some embodiments, the host receives at least one first hash table and memory usage information of multiple virtual machines, the memory usage information being used to indicate whether the memory usage status of the corresponding virtual machine is high, medium or low.

[0098] In some embodiments, step 303 further includes, within each cycle, the host detects whether it has received the first hash table of all virtual machines. If the host detects that it has not received the first hash table of all virtual machines, the host sends a control message to the virtual machine that did not receive the first hash table, instructing the virtual machine to resend the first hash table. If the host detects that it has received the first hash table of all virtual machines, the following steps continue. By detecting whether data from all virtual machines has been received, the accurate determination of the hot / cold status of cached pages in the virtual machines is ensured.

[0099] 304. The host determines multiple target entries for multiple cached pages based on file information corresponding to multiple cached pages in at least one first hash table. These multiple target entries are entries corresponding to multiple cached pages in a second hash table. The second hash table is used to record file information and access summary information corresponding to multiple cached pages on multiple virtual machines.

[0100] For any cached page on any virtual machine in the second hash table, the file information corresponding to the cached page includes the physical block number, file identifier, and file offset. The physical block number indicates that the cached page was generated by the virtual machine accessing the physical disk block corresponding to that physical block number. In the second hash table, the summary access information for this cached page refers to the total number of accesses to that cached page over multiple periods.

[0101] The second hash table includes multiple entries, each labeled with a physical block number. Each physical block number corresponds to at least one entry, indicating a physical disk block. The at least one entry corresponds to a cached page generated by different virtual machines accessing that physical disk block. Each entry includes the file identifier, file offset, access information, and virtual machine identifier corresponding to the cached page.

[0102] In some embodiments, step 304 is implemented by steps 304A to 304B:

[0103] 304A. For any file information corresponding to any cache page in the first hash table, the host determines the physical block number corresponding to the cache page in the second hash table based on the virtual block number of the cache page.

[0104] In some embodiments, the host records a mapping table between physical block numbers and virtual block numbers of each virtual machine. The host determines the mapping table between physical block numbers and virtual block numbers of the virtual machine based on the virtual machine identifier in the first hash table, and determines the physical block number corresponding to the cache page in the second hash table based on the virtual block number of the cache page and the mapping table.

[0105] 304B. Based on the virtual machine identifier corresponding to the first hash table, and the file identifier and file offset of the cache page, the host determines the target entry of the cache page in at least one entry of the second hash table corresponding to the physical block number of the cache page.

[0106] In some embodiments, the host determines at least one entry in the second hash table corresponding to the physical block number of the cached page, and compares the virtual machine identifier, file identifier, and file offset of the cached page in the first hash table with the corresponding data in the at least one entry of the second hash table. If the virtual machine identifier, file identifier, and file offset of the cached page in the first hash table are the same as the corresponding data in any entry, the host determines the entry as the target entry, which refers to the entry in the second hash table corresponding to the cached page.

[0107] In this embodiment, the host determines the corresponding entries of multiple cache pages in the second hash table based on the file information of multiple cache pages, which provides good guidance for subsequent updates to the second hash table.

[0108] 305. The host updates the summary access information of multiple target table entries based on the access information of multiple cached pages corresponding to at least one first hash table.

[0109] In some embodiments, for access information of any cached page in any first hash table, the host adds the access information of the cached page to the access summary information in the corresponding target entry in the second hash table to update the access summary information of the target entry for the cached page.

[0110] 306. The host determines the popularity information of multiple cached pages based on the updated second hash table. This popularity information is used to represent the summary information of access to the corresponding cached pages.

[0111] In some embodiments, the access summary information is divided into multiple levels. For any cached page, the host compares the access summary information of the cached page with each level. If the access summary information of the cached page matches any level, the cached page is determined to be at that level. The host then determines the popularity information of the cached page based on its level.

[0112] In some embodiments, for multiple cached pages on any virtual machine, such as Figure 5 As shown in section 503, the host uses multi-level queues to implement level division, thereby determining the popularity information of multiple cache pages on the virtual machine. The process of determining the popularity information of multiple cache pages is described below based on steps 306A to 306B.

[0113] 306A. Based on the summary information of access to the multiple cached pages in the updated second hash table, the host determines the target queue of the multiple cached pages in a multi-level queue. The multi-level queue contains M levels of queues, where M is an integer greater than 0. The popularity represented by the lower-level queue is less than that represented by the higher-level queue.

[0114] In some embodiments, the host directly determines the target queue of multiple cache pages in a multi-level queue based on the summary access information of multiple cache pages. That is, step 306A includes: for any cache page on the virtual machine, the heat identification module calculates the level of the target queue of the cache page based on the summary access information of the cache page corresponding to the updated second hash table. The calculation method is shown in formula (1).

[0115]

[0116] Where i represents the level of the target queue of the cache page, i is an integer greater than or equal to 0, and f represents the access summary information of the cache page in the updated second hash table. For example, if there is a cache page on any virtual machine, and the access summary information f in the updated second hash table is 32, then the level i of the target queue of the cache page is calculated to be 5 by formula (1), that is, the target queue of the cache page is a level 5 queue.

[0117] In some embodiments, the host scales the summary access information of multiple cache pages based on the virtual machine's memory usage information, and then determines the target queue of the multiple cache pages in a multi-level queue based on the scaled summary access information. That is, step 306A includes: for any cache page on the virtual machine, the host scales the summary access information of the cache page corresponding to the cache page in the updated second hash table based on the virtual machine's memory usage information, where the memory usage information indicates whether the virtual machine's memory usage status is high, medium, or low. The host calculates the level of the target queue of the cache page based on the scaled summary access information of the cache page. The calculation method is the same as the method described above for directly obtaining the level of the target queue of the cache page based on the summary access information of the cache page, and will not be repeated here.

[0118] The scaling method includes any of the following:

[0119] In response to the memory usage information indicating that the virtual machine's memory usage is at a high level, the target factor for the summary information on access to the cached pages is reduced, optionally by a factor of 2;

[0120] In response to the memory usage information indicating that the virtual machine's memory usage status is at a medium level, the summary information of the cache page access remains unchanged;

[0121] In response to the memory usage information indicating that the virtual machine's memory usage is at a low level, the aggregated information on the access to the cached pages is amplified by a target factor, optionally, the target factor is 2x.

[0122] For example, if any cache page of any virtual machine has an access summary of 32 in the updated second hash table, and the memory usage of this virtual machine is at a high level, then the access summary of this cache page is scaled up to obtain a scaled access summary of 16. Based on the scaled access summary, the target queue level of this cache page is calculated to be 4, that is, the target queue of this cache page is a level 4 queue.

[0123] By scaling the summary information of cache page access, the summary information of cache page access is made to correspond with the running status of the virtual machine, which provides good guidance for subsequent determination of cache page popularity information.

[0124] 306B. The host determines the heat information of multiple cached pages on the virtual machine based on the target queue of multiple cached pages in a multi-level queue.

[0125] The procedure for step 306B is any of the following:

[0126] In some embodiments, for any cached page on the virtual machine, the host determines the hotness information of the cached page based on the target queue level, cold threshold, and hot threshold of the cached page, as described below:

[0127] In one possible implementation, the heat information is used to indicate whether the cached page is a cold page or a hot page. If the level of the target queue of the cached page is less than or equal to the cold threshold, the host determines the heat information of the cached page as a cold page. If the level of the target queue of the cached page is greater than or equal to the hot threshold, the host determines the heat information of the cached page as a hot page.

[0128] In another possible implementation, the heat information is used to indicate whether the cached page is a cold page, a hot page, or a warm page. In response to the target queue level of the cached page being less than or equal to the cold threshold, the host determines the heat information of the cached page as a cold page. In response to the target queue level of the cached page being greater than or equal to the hot threshold, the host determines the heat information of the cached page as a hot page. In response to the level of the cached page being less than the hot threshold and greater than the cold threshold, the host determines the heat information of the cached page as a warm page.

[0129] By classifying cached pages into hot and cold categories in a more granular way, the virtual machine can manage cached pages with a finer granularity, thus better meeting the operational needs of the virtual machine.

[0130] In some embodiments, for any cached page on the virtual machine, the host adjusts the cold threshold and hot threshold based on the host's memory usage information, which indicates whether the host's memory usage is high, medium, or low. Then, based on the target queue level of the cached page, the adjusted cold threshold, and the adjusted hot threshold, the hotness information of the cached page is determined. The process is the same as the process described above for determining the hotness information of the cached page based on the target queue level, cold threshold, and hot threshold, and will not be repeated here.

[0131] The adjustment methods include any of the following:

[0132] In response to the memory usage information indicating that the host's memory usage status is high, the cold threshold and hot threshold are increased by a target number, optionally, the target number is 1;

[0133] In response to this memory usage information indicating that the host's memory usage status is at a medium level, the cold threshold and hot threshold remain unchanged;

[0134] In response to the memory usage information indicating that the host's memory usage is at a low level, the target number for reducing the cold threshold and hot threshold is reduced, optionally by 1.

[0135] By adjusting the cold and hot thresholds, the determined cache page heat information is made more consistent with the host's operating status.

[0136] In some embodiments, step 306 further includes, in response to the existence of a target cache page in the second hash table, the host reduces the target queue of the target cache page to a lower-level queue. The target cache page refers to a cache page in the second hash table that has not been updated for N periods, where N is an integer greater than 1. For example, every N periods, the host checks the timestamps of all entries in the second hash table. In response to the existence of any entry whose timestamp indicates that the entry has not been updated for N periods, the host determines the cache page corresponding to that entry as the target cache page and reduces the target queue of the target cache page to a lower-level queue.

[0137] By downgrading the target queue of the target cache page, the level of the target queue can more accurately represent the access status of the corresponding cache page, which plays a good guiding role in determining the popularity information of the cache page.

[0138] In some embodiments, step 306 further includes the host determining redundancy information of the multiple cache pages based on the file information corresponding to the multiple cache pages in the updated second hash table. This redundancy information indicates whether a redundant cache page (i.e., the same cache page) exists in the host. The process of determining the redundancy information of the multiple cache pages includes: for any cache page, the host compares the file identifier and file offset corresponding to that cache page in the second hash table with the file identifiers and file offsets of multiple cache pages in the host memory. If the file identifier and file offset of any cache page in the host memory are the same as the information corresponding to that cache page in the second hash table, the host determines that the redundancy information of that cache page indicates the existence of a redundant cache page in the host. If the file identifier and file offset of all cache pages in the host memory are different from the information corresponding to that cache page in the second hash table, the host determines that the redundancy information of that cache page indicates the absence of a redundant cache page in the host.

[0139] By identifying redundancy information for multiple cache pages, reference information is provided for subsequent management of multiple cache pages by the virtual machine, enabling the virtual machine to perform more granular cache management.

[0140] 307. The host sends multiple cache page hotness information to the corresponding virtual machines.

[0141] The process of step 307 is any of the following:

[0142] In some embodiments, the host determines the virtual machine corresponding to the multiple cache pages based on the virtual machine identifiers corresponding to the multiple cache pages in the second hash table, and sends the heat information of the multiple cache pages to the corresponding virtual machines respectively.

[0143] In some embodiments, if the host determines redundancy information for the plurality of cache pages in step 306 above, then step 307 includes: the host determining the virtual machine corresponding to the plurality of cache pages based on the virtual machine identifiers corresponding to the plurality of cache pages in the second hash table, and sending the heat information and redundancy information of the plurality of cache pages to the corresponding virtual machines respectively.

[0144] It should be noted that after the host executes step 307 above, it manages the cache pages in the host memory based on the hotness and redundancy information of multiple cache pages on multiple virtual machines. In some embodiments, for any cache page in the host memory, in response to the hotness and redundancy information indicating that the cache page is of the first type, the host retains the cache page. The first type indicates that the cache page is a redundant cache page of any cache page on any virtual machine, and the cache page on that virtual machine is a hot page. In response to the hotness and redundancy information indicating that the cache page is of the second type, the host deletes the cache page and the corresponding entry in the second hash table. The second type indicates that the cache page is a redundant cache page of any cache page on any virtual machine, and the cache page on that virtual machine is a cold page or a warm page.

[0145] 308. The virtual machine receives the popularity information of multiple cached pages on the virtual machine returned by the host based on the updated second hash table.

[0146] The process of step 308 is any of the following:

[0147] In some embodiments, the virtual machine receives heat information of multiple cached pages on the virtual machine returned by the host based on an updated second hash table.

[0148] In some embodiments, if the host sends the redundancy information of the multiple cache pages to the virtual machine in step 307 above, then step 308 includes: the virtual machine receiving the heat information and redundancy information of the multiple cache pages on the virtual machine returned by the host based on the updated second hash table.

[0149] 309. The virtual machine processes multiple cached pages based on their popularity information.

[0150] The process of step 309 is any of the following: Figure 5 As shown in section 504:

[0151] In some embodiments, for any cached page on the virtual machine, in response to the popularity information indicating that the cached page is a hot page, the virtual machine retains the cached page; in response to the popularity information indicating that the cached page is a cold page, the virtual machine deletes the cached page and the file information and access information corresponding to the cached page in the first hash table.

[0152] In some embodiments, if the virtual machine receives the redundancy information of the plurality of cache pages in step 308 above, then step 309 includes: for any cache page on the virtual machine, such as Figure 6 As shown, in response to the popularity information indicating that the cached page is a warm page, and the redundancy information indicating that there is a redundant cached page in the host, the virtual machine deletes the cached page and the file information and access information corresponding to the cached page in the first hash table. In response to the popularity information indicating that the cached page is a warm page, and the redundancy information indicating that there is no redundant cached page in the host, the virtual machine retains the cached page. In response to the popularity information indicating that the cached page is a hot page, the virtual machine retains the cached page. In response to the popularity information indicating that the cached page is a cold page, the virtual machine deletes the cached page and the file information and access information corresponding to the cached page in the first hash table.

[0153] It should be noted that steps 308 to 309 above are illustrated using the process of a virtual machine receiving popularity information and managing multiple cache pages as an example. Multiple virtual machines on the server use the same steps to receive popularity information and manage multiple cache pages, and the cycle of each virtual machine is consistent.

[0154] The cache management method proposed in this application involves the host determining the popularity information of multiple cache pages based on access information of multiple cache pages sent by multiple virtual machines. Multiple virtual machines then process multiple cache pages based on the popularity information of the cache pages sent by the host, thereby reducing the memory occupation of cache pages on virtual machines and improving memory utilization efficiency. Since this method manages multiple cache pages through popularity information, the computational overhead is small, and high-efficiency cache management can be achieved.

[0155] Based on the above Figure 3 The method described in the corresponding embodiment is illustrated below using a server that includes a host and four virtual machines, with one cache page in each virtual machine as an example. For ease of explanation, V1, V2, V3, and V4 represent the four virtual machines, and V1P1, V2P1, V3P1, and V4P1 represent one cache page in each of V1, V2, V3, and V4, respectively. Figure 7 This is a schematic diagram of the structure of a server component provided in an embodiment of this application, such as... Figure 7 As shown, the server components include underlying hardware, a host kernel, a virtual machine monitor, and four virtual machines. Each virtual machine includes a virtual machine kernel and a container running on that virtual machine. The container includes a container environment and an application running on that container.

[0156] Figure 8 This is a flowchart illustrating the steps of a cache management method provided in an embodiment of this application, such as... Figure 8As shown, the process of this cache management method includes:

[0157] 801. Each of the four virtual machines obtains the first hash table, which is used to record the file information and access information corresponding to the cache pages on the corresponding virtual machine.

[0158] In some embodiments, the four virtual machines obtain the first hash table using a method similar to step 301, which will not be described in detail here.

[0159] For example, in the current cycle, the four virtual machines update the access information of V1P1, V2P1, V3P1, and V4P1 to 5, 12, 6, and 0 respectively in their respective first hash tables, and the four virtual machines obtain the updated first hash tables respectively.

[0160] 802. Each of the four virtual machines sends the first hash table to the host.

[0161] In some embodiments, the four virtual machines synchronize the cache access information service and send the updated first hash table and the virtual machine's memory usage information to the host.

[0162] 803. The host receives four first hash tables sent by four virtual machines. These first hash tables are used to record file information and access information corresponding to cache pages on the corresponding virtual machines.

[0163] In some embodiments, the host receives four first hash tables and memory usage information of the four virtual machines from the four virtual machines.

[0164] 804. Based on the file information corresponding to the four cached pages in the four first hash tables, the host determines the four target entries for the four cached pages. These four target entries are the entries corresponding to the four cached pages in the second hash table, which is used to record the file information and access summary information of the cached pages on the four virtual machines.

[0165] In some embodiments, the host determines the four target entries for the four cached pages using a method similar to step 304, which will not be described in detail here.

[0166] 805. The host updates the summary access information of the four target table entries based on the access information corresponding to the four cached pages in the four first hash tables.

[0167] In some embodiments, the host updates the access summary information of the four target entries using a method similar to step 305, which will not be described in detail here.

[0168] For example, in the current cycle, the access summary information for V1P1, V2P1, V3P1, and V4P1 in the second hash table is 30, 52, 12, and 3, respectively. The access summary information for V1P1, V2P1, V3P1, and V4P1 in the four first hash tables is 5, 12, 6, and 0, respectively. Then, the host will update the access summary information for V1P1, V2P1, V3P1, and V4P1 in the second hash table to 35, 64, 18, and 3, respectively.

[0169] 806. Based on the updated second hash table, the host determines the popularity information of four cached pages. This popularity information is used to represent the summary information of access to the corresponding cached pages.

[0170] In some embodiments, the host determines the hotness and redundancy information of the four cache pages using a method similar to step 306, which will not be described in detail here.

[0171] For example, in the current cycle, the updated access summary information for V1P1, V2P1, V3P1, and V4P1 in the second hash table is 35, 64, 18, and 3 respectively. The memory usage information of the four virtual machines indicates that the memory usage status of V1, V2, V3, and V4 is low, high, medium, and medium respectively. The host will then scale the access summary information for V1P1, V2P1, V3P1, and V4P1 to 70, 32, 18, and 3 respectively, and determine the target queue for the four cache pages in the multi-level queue based on the scaled access summary information. Figure 9 As shown, the multi-level queue includes nine levels of queues. In the previous period, the target queues for V1P1, V2P1, V3P1, and V4P1 in the multi-level queue were level 4, level 5, level 3, and level 1, respectively. Based on the summary information of the access status of the four pages after adjustment in the current period, the host determines the target queues for V1P1, V2P1, V3P1, and V4P1 in the multi-level queue as level 6, level 5, level 4, and level 1, respectively. In the current period, the hot threshold and cold threshold are 5 and 2, respectively. The host's memory usage information indicates that the host's memory usage status is high. Therefore, the host adjusts the hot threshold and cold threshold to 6 and 3, respectively, and determines the hot page, warm page, warm page, and cold page information for V1P1, V2P1, V3P1, and V4P1, respectively. Based on the file information corresponding to the four cached pages in the second hash table, the host determines the redundancy information of V1P1, V2P1, V3P1, and V4P1 as follows: no redundant cached pages in the host, redundant cached pages in the host, no redundant cached pages in the host, and no redundant cached pages in the host.

[0172] 807. The host sends the popularity information of the cached pages to the corresponding virtual machines.

[0173] In some embodiments, the host sends the hotness information and redundancy information of the cached pages to the corresponding virtual machines using a method similar to step 307, which will not be described in detail here.

[0174] 808, the four virtual machines respectively receive the popularity information of cached pages returned by the host based on the updated second hash table.

[0175] In some embodiments, the four virtual machines respectively receive the hotness information and redundancy information of the cached pages returned by the host based on the updated second hash table.

[0176] 809. The four virtual machines process the four cache pages based on the popularity information of the four cache pages respectively.

[0177] In some embodiments, the four virtual machines process the four cache pages using a method similar to that in step 309, which will not be described in detail here.

[0178] For example, in the current cycle, in response to the heat information indicating that V1P1 is a hot page, V1 retains V1P1; in response to the heat information indicating that V2P1 is a warm page, and the redundancy information indicating that V2P1 has a redundant cache page in the host, V2 deletes V2P1 and the file information and access information corresponding to V2P1 in the first hash table; in response to the heat information indicating that V3P1 is a warm page, and the redundancy information indicating that V3P1 does not have a redundant cache page in the host, V3 retains V3P1; in response to the heat information indicating that V4P1 is a cold page, V4 deletes V4P1 and the file information and access information corresponding to V4P1 in the first hash table.

[0179] Table 1 shows the memory usage of four virtual machines (VMs) on the server over a single period. As shown in Table 1, the second row displays the memory usage of the four VMs without using the cache management method proposed in this application embodiment. The third row displays the memory usage of the four VMs with the cache management method employed. The fourth row shows the difference in memory usage between the two scenarios. The data in Table 1 demonstrates that the cache management method proposed in this application embodiment can delete some cached pages from VMs based on popularity information, reducing the memory footprint of cached pages and thus improving the server's memory utilization efficiency.

[0180] Table 1

[0181]

[0182] The cache management method proposed in this application involves the host determining the popularity information of multiple cache pages based on access information of multiple cache pages sent by multiple virtual machines. Multiple virtual machines then process multiple cache pages based on the popularity information of the cache pages sent by the host, thereby reducing the memory occupation of cache pages on virtual machines and improving memory utilization efficiency. Since this method manages multiple cache pages through popularity information, the computational overhead is small, and high-efficiency cache management can be achieved.

[0183] Figure 10 This is a schematic diagram of a cache management device provided in an embodiment of this application. This cache management device is used to execute the steps of the above-described cache management method. (See also...) Figure 10 The cache management device includes: a receiving module 1001, an updating module 1002, a determining module 1003, and a sending module 1004.

[0184] The receiving module 1001 is used to receive at least one first hash table, which is used to record file information and access information corresponding to multiple cache pages on the corresponding virtual machine;

[0185] Update module 1002 is used to update a second hash table based on the at least one first hash table, the second hash table being used to record file information and access summary information corresponding to multiple cache pages on the multiple virtual machines;

[0186] The determination module 1003 is used to determine the popularity information of the multiple cache pages based on the updated second hash table. The popularity information is used to represent the summary information of the access status of the corresponding cache pages.

[0187] The sending module 1004 is used to send the heat information of the multiple cache pages to the corresponding virtual machines respectively. The heat information is used as reference information for the virtual machine to delete the cache pages.

[0188] In some embodiments, the update module 1002 includes:

[0189] The first determining submodule is used to determine, for any first hash table, multiple target entries of multiple cache pages based on file information corresponding to multiple cache pages in the first hash table, wherein the multiple target entries are the entries corresponding to the multiple cache pages in the second hash table;

[0190] The update submodule is used to update the summary access information of multiple target table entries based on the access information of multiple cached pages in the first hash table.

[0191] In some embodiments, the file information corresponding to any cache page includes the virtual block number, file identifier, and file offset;

[0192] The first determining submodule is used to determine the physical block number of the cache page in the second hash table based on the virtual block number of the cache page, for any cache page corresponding to the file information in the first hash table, and to determine the target entry of the cache page in at least one entry of the cache page corresponding to the physical block number of the cache page in the second hash table based on the virtual machine identifier corresponding to the first hash table, as well as the file identifier and file offset of the cache page.

[0193] In some embodiments, the determining module 1003 includes:

[0194] The second determining submodule is used to determine, for any virtual machine, the target queue of multiple cache pages in a multi-level queue based on the access information summary of multiple cache pages on the virtual machine in the updated second hash table. The multi-level queue is used to represent multiple levels of popularity.

[0195] The second determining submodule is used to determine the heat information of multiple cache pages on the virtual machine based on the target queue of multiple cache pages on the virtual machine in a multi-level queue.

[0196] In some embodiments, the second determining submodule is used to scale the access summary information of any cache page on the virtual machine based on the memory usage information of the virtual machine.

[0197] Based on the aggregated access information of the scaled cache page, the target queue of the cache page in the multi-level queue is determined.

[0198] In some embodiments, the second determining submodule is used to adjust the hot threshold and the cold threshold based on the host's memory usage information;

[0199] Based on the target queues of multiple cached pages on the virtual machine in the multi-level queues, the adjusted hot threshold, and the adjusted cold threshold, the hotness information of multiple cached pages on the virtual machine is determined. This hotness information is used to indicate whether the corresponding cached page is a cold page or a hot page.

[0200] In some embodiments, the heat information is used to indicate whether the corresponding cached page is a cold page, a hot page, or a warm page.

[0201] In some embodiments, the device further includes:

[0202] The adjustment module is used to respond to the existence of a target cache page in the second hash table by demoting the target cache page in the target queue of the multi-level queue to a lower-level queue. The lower-level queue has a lower popularity than the higher-level queue. The target cache page refers to a cache page in the second hash table that has not been updated for multiple periods.

[0203] In some embodiments, the sending module 1004 is used to send the heat information of the plurality of cache pages to the corresponding virtual machines respectively;

[0204] The heat information and redundancy information of the multiple cache pages are sent to the corresponding virtual machines respectively. The redundancy information is used to indicate whether there are redundant cache pages in the host.

[0205] It should be noted that the cache management device provided in the above embodiments is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the cache management device and cache management method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0206] Figure 11 This is a schematic diagram of a cache management device provided in an embodiment of this application. This cache management device is used to execute the steps of the above-described cache management method. (See also...) Figure 11 The cache management device includes: an acquisition module 1101, a sending module 1102, a receiving module 1103, and a processing module 1104.

[0207] The module 1101 is used to obtain a first hash table, which is used to record file information and access information corresponding to multiple cache pages on the virtual machine.

[0208] Sending module 1102 is used to send the first hash table to the host;

[0209] The receiving module 1103 is used to receive the popularity information of multiple cache pages on the virtual machine returned by the host based on the updated second hash table. The second hash table is used to record the file information and access summary information corresponding to the multiple cache pages on the multiple virtual machines.

[0210] The processing module 1104 is used to process multiple cache pages on the virtual machine based on the popularity information of multiple cache pages on the virtual machine.

[0211] In some embodiments, the acquisition module 1101 is used to collect access information of multiple cache pages on the virtual machine;

[0212] Based on the access information of multiple cached pages on the virtual machine, the first hash table of the virtual machine is updated to obtain the updated first hash table.

[0213] In some embodiments, the processing module 1104 is configured to retain any cached page on the virtual machine in response to the hotness information indicating that the cached page is a hot page;

[0214] If the popularity information indicates that the cached page is a cold page, then the cached page and the file information and access information corresponding to the cached page in the first hash table are deleted.

[0215] In some embodiments, the receiving module 1103 is further configured to receive redundant information of any cached page;

[0216] The processing module 1104 is used to, for any cached page on the virtual machine, in response to the hotness information indicating that the cached page is a warm page and the redundancy information indicating that there is a redundant cached page in the host, delete the cached page and the file information and access information corresponding to the cached page in the first hash table;

[0217] If the heat information indicates that the cached page is a warm page, and the redundancy information indicates that there is no redundant cached page for the cached page in the host, then the cached page is retained.

[0218] It should be noted that the cache management device provided in the above embodiments is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the cache management device and cache management method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0219] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0220] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A cache management method characterized by, The method is performed by a host in a server, the server comprising the host and a plurality of virtual machines, and a container is running on the virtual machines, the method comprising: receiving at least one first hash table, the first hash table being used to record file information and access information corresponding to a plurality of cache pages on a corresponding virtual machine; for any first hash table, determining a plurality of target entries of the plurality of cache pages based on file information corresponding to the plurality of cache pages in the first hash table, the plurality of target entries being entries corresponding to the plurality of cache pages in a second hash table, the second hash table being used to record file information and access summary information corresponding to a plurality of cache pages on the plurality of virtual machines; updating access summary information of the plurality of target entries in the second hash table based on access information corresponding to the plurality of cache pages in the first hash table; determining hotness information of the plurality of cache pages based on the updated second hash table, the hotness information being used to represent access summary information of a corresponding cache page; sending the determined hotness information of the plurality of cache pages to the corresponding virtual machine respectively, the hotness information being used as reference information for the virtual machine to delete cache pages.

2. The method of claim 1, wherein, The file information corresponding to any cache page in the first hash table comprises a virtual block number, a file identifier, and a file offset; The determining of the plurality of target entries of the plurality of cache pages based on the file information corresponding to the plurality of cache pages in the first hash table comprises: for the file information corresponding to any cache page in the first hash table, determining a physical block number corresponding to the cache page in the second hash table based on the virtual block number of the cache page; determining the target entry of the cache page in at least one entry corresponding to the physical block number of the cache page in the second hash table based on the virtual machine identifier corresponding to the first hash table, and the file identifier and the file offset of the cache page.

3. The method of claim 1, wherein, The determining of the hotness information of the plurality of cache pages based on the updated second hash table comprises: for any virtual machine, determining a target queue of a plurality of cache pages on the virtual machine in a multi-level queue based on access summary information corresponding to the plurality of cache pages on the virtual machine in the updated second hash table, the multi-level queue being used to represent a plurality of levels of hotness; determining the hotness information of the plurality of cache pages on the virtual machine based on the target queue of the plurality of cache pages on the virtual machine in the multi-level queue.

4. The method of claim 3, wherein, The determining of the target queue of the plurality of cache pages on the virtual machine in the multi-level queue based on the access summary information corresponding to the plurality of cache pages on the virtual machine in the updated second hash table comprises: for the access summary information corresponding to any cache page on the virtual machine, scaling the access summary information of the cache page based on memory usage information of the virtual machine; determining the target queue of the cache page in the multi-level queue based on the scaled access summary information of the cache page.

5. The method of claim 3, wherein, The determining of the hotness information of the plurality of cache pages on the virtual machine based on the target queue of the plurality of cache pages on the virtual machine in the multi-level queue comprises: adjust a hot threshold and a cold threshold based on memory usage information of the host; determine hotness information of the plurality of cache pages on the virtual machine based on a target queue of a multi-level queue of the plurality of cache pages on the virtual machine, the adjusted hot threshold, and the adjusted cold threshold, the hotness information indicating whether a corresponding cache page is a cold page or a hot page.

6. The method of claim 5, wherein, The hotness information indicates whether a corresponding cache page is a cold page, a hot page, or a warm page.

7. The method of claim 3, wherein, The method further comprises: in response to the target cache page existing in the second hash table, lowering a target queue of the target cache page in a multi-level queue to a lower-level queue, the hotness of the lower-level queue being lower than that of a higher-level queue, the target cache page being a cache page that has not been updated in a plurality of periods in the second hash table.

8. The method of claim 1, wherein, The sending of the hotness information of the plurality of cache pages to the corresponding virtual machine respectively comprises any of the following: sending the hotness information of the plurality of cache pages to the corresponding virtual machine respectively; sending the hotness information of the plurality of cache pages and redundancy information to the corresponding virtual machine respectively, the redundancy information indicating whether a corresponding cache page has a redundant cache page in the host.

9. A cache management method characterized by, executed by any virtual machine in a server, the server comprising a host and a plurality of virtual machines, and a container running on the virtual machine, the method comprising: obtaining a first hash table, the first hash table recording file information and access information corresponding to a plurality of cache pages on the virtual machine; sending the first hash table to the host; receiving hotness information of the plurality of cache pages on the virtual machine returned by the host based on an updated second hash table, the second hash table recording file information and access summary information corresponding to a plurality of cache pages on the plurality of virtual machines, the hotness information of the plurality of cache pages being determined based on the updated second hash table, the hotness information indicating the access summary information of a corresponding cache page, the second hash table being updated based on the file information of the plurality of cache pages in the first hash table; processing the plurality of cache pages on the virtual machine based on the hotness information of the plurality of cache pages on the virtual machine.

10. The method of claim 9, wherein, The obtaining of the first hash table comprises: respectively counting access information of the plurality of cache pages on the virtual machine; updating the first hash table of the virtual machine based on the access information of the plurality of cache pages on the virtual machine, and obtaining an updated first hash table.

11. The method of claim 9, wherein, The processing of the plurality of cache pages on the virtual machine based on the hotness information of the plurality of cache pages on the virtual machine comprises: for any cache page on the virtual machine, in response to the hotness information indicating that the cache page is a hot page, retaining the cache page; in response to the hotness information indicating that the cache page is a cold page, deleting the cache page and the file information and access information of the cache page in the first hash table.

12. The method of claim 11, wherein, The method further comprises: receiving redundancy information of any cache page; The processing of the plurality of cache pages on the virtual machine based on the hotness information of the plurality of cache pages on the virtual machine further comprises: In response to the hotness information indicating that the cache page is a warm page and the redundancy information indicating that there is a redundant cache page in the host for the cache page, the cache page and file information and access information corresponding to the cache page in the first hash table are deleted. In response to the hotness information indicating that the cache page is a warm page and the redundancy information indicating that there is no redundant cache page in the host for the cache page, the cache page is retained.

13. A cache management device, characterized by, The apparatus includes a receiving module, an updating module, a determining module, and a sending module, the updating module includes a first determining submodule and an updating submodule; The receiving module is configured to receive at least one first hash table, the first hash table being used to record file information and access information corresponding to a plurality of cache pages on a corresponding virtual machine. The first determining submodule is configured to, for any first hash table, determine a plurality of target table entries of the plurality of cache pages based on file information corresponding to the plurality of cache pages in the first hash table, the plurality of target table entries being table entries corresponding to the plurality of cache pages in a second hash table, the second hash table being used to record file information and access information corresponding to a plurality of cache pages on a plurality of virtual machines. The updating submodule is configured to update access information of the plurality of target table entries in the second hash table based on access information corresponding to the plurality of cache pages in the first hash table. The determining module is configured to determine hotness information of the plurality of cache pages based on the updated second hash table, the hotness information being used to represent access information of a corresponding cache page. The sending module is configured to send the determined hotness information of the plurality of cache pages to a corresponding virtual machine respectively, the hotness information being used as reference information for the virtual machine to delete a cache page.

14. The apparatus of claim 13, wherein, File information corresponding to any cache page in the first hash table includes a virtual block number, a file identifier, and a file offset. The first determining submodule is configured to, for file information corresponding to any cache page in the first hash table, determine a physical block number corresponding to the cache page in the second hash table based on the virtual block number of the cache page, and determine a target table entry of the cache page in at least one table entry corresponding to the physical block number of the cache page in the second hash table based on a virtual machine identifier corresponding to the first hash table, and the file identifier and the file offset of the cache page.

15. The apparatus of claim 13, wherein, The determining module includes: The second determining submodule is configured to, for any virtual machine, determine a target queue of a plurality of cache pages on the virtual machine in a multi-level queue based on access information corresponding to the plurality of cache pages on the virtual machine in the updated second hash table, the multi-level queue being used to represent a plurality of levels of hotness. The second determining submodule is configured to determine hotness information of the plurality of cache pages on the virtual machine based on the target queue of the plurality of cache pages on the virtual machine in the multi-level queue.

16. The apparatus of claim 15, wherein, The second determining submodule is configured to scale the access summary information of the cache page based on the memory usage information of the virtual machine; The target queue of the cache page in the multi-level queue is determined based on the scaled access summary information of the cache page.

17. The apparatus of claim 15, wherein, The second determining submodule is configured to adjust the hot threshold and the cold threshold based on the memory usage information of the host; The hotness information of the plurality of cache pages on the virtual machine is determined based on the target queue of the plurality of cache pages in the multi-level queue, the adjusted hot threshold, and the adjusted cold threshold, and the hotness information is used to indicate whether the corresponding cache page is a cold page or a hot page.

18. The apparatus of claim 17, wherein, The hotness information is used to indicate whether the corresponding cache page is a cold page, a hot page, or a warm page.

19. The apparatus of claim 15, wherein, The device further includes: The adjusting module is configured to, in response to the target cache page existing in the second hash table, lower the target queue of the target cache page in the multi-level queue to a lower-level queue, the hotness of the lower-level queue in the multi-level queue being lower than that of a higher-level queue, and the target cache page being a cache page that has not been updated in a plurality of periods in the second hash table.

20. The apparatus of claim 13, wherein, The sending module is configured to send the hotness information of the plurality of cache pages to the corresponding virtual machines respectively. The hotness information and redundancy information of the plurality of cache pages are sent to the corresponding virtual machines respectively, and the redundancy information is used to indicate whether a redundancy cache page exists in the host for the corresponding cache page.

21. A cache management device, comprising: The device includes: The obtaining module is configured to obtain a first hash table, and the first hash table is used to record file information and access information corresponding to a plurality of cache pages on a virtual machine. The sending module is configured to send the first hash table to a host. The receiving module is configured to receive hotness information of the plurality of cache pages on the virtual machine returned by the host based on an updated second hash table, the second hash table is used to record file information and access summary information corresponding to a plurality of cache pages on a plurality of virtual machines, the hotness information of the plurality of cache pages is determined based on the updated second hash table, the hotness information is used to represent the access summary information of the corresponding cache page, and the second hash table is updated based on the file information corresponding to the plurality of cache pages in the first hash table. The processing module is configured to process the plurality of cache pages on the virtual machine based on the hotness information of the plurality of cache pages on the virtual machine.

22. The apparatus of claim 21, wherein, The obtaining module is configured to respectively count access information of the plurality of cache pages on the virtual machine. The first hash table of the virtual machine is updated based on the access information of the plurality of cache pages on the virtual machine, and an updated first hash table is obtained.

23. The apparatus of claim 21, wherein, The processing module is configured to, for any cache page on the virtual machine, in response to the hotness information indicating that the cache page is a hot page, retain the cache page; in response to the hotness information indicating that the cache page is a cold page, delete the cache page and the file information and access information corresponding to the cache page in the first hash table.

24. The apparatus of claim 23, wherein, The receiving module is further configured to receive redundancy information of any cache page. The processing module is configured to, for any cache page on the virtual machine, in response to the hotness information indicating that the cache page is a warm page and the redundancy information indicating that there is a redundant cache page of the cache page in the host, delete the cache page and file information and access situation information corresponding to the cache page in the first hash table. In response to the hotness information indicating that the cache page is a warm page and the redundancy information indicating that there is no redundant cache page of the cache page in the host, the cache page is retained.

25. A server, comprising: The server comprises a communication bus, at least one network interface, a memory, and at least one processor, the communication bus is used to transmit information between the above components, the at least one network interface is used to communicate with other devices or communication networks, the memory stores program codes, and the at least one processor reads and executes the program codes stored in the memory to realize the operations performed by any one of the cache management methods in claims 1-12.

26. A computer-readable storage medium, characterized in that, When the program codes in the computer readable storage medium are executed by the processor of the server, the server can perform the operations performed by any one of the cache management methods in claims 1-12.

Citation Information

Patent Citations

  • Caching method for caching content, related device, and computer readable storage medium

    CN109040153A

  • Virtual machine migration method and device, electronic equipment and storage medium

    CN112559119A