Memory recovery method and device, equipment and medium

By deploying the quality service agent component and the memory recovery agent component in the container, accurately calculate and execute the memory recovery amount, the problem of low memory resource utilization in the existing technology is solved, and more efficient memory recovery and resource management is achieved.

CN120162275APending Publication Date: 2025-06-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202311737450.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-15
Publication Date
2025-06-17

AI Technical Summary

Technical Problem

Existing memory recycling methods cannot quantitatively adjust the memory usage limit based on the actual operation requirements of computer equipment, resulting in low memory resource utilization.

Method used

Through the Quality Service Agent component and the Memory Recycling Agent component deployed in the container, determine the memory node to be recycled, obtain its memory usage and memory recovery indicators, calculate and execute the memory recovery amount to accurately recycle physical memory.

Benefits of technology

It improves the accuracy of memory recycling and memory resource utilization, and is suitable for improving the memory resource management efficiency of computer equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120162275A_ABST
    Figure CN120162275A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a memory recovery method and device, equipment and a medium, the method is executed by computer equipment deployed with a container, and the container comprises a quality service agent component and a memory recovery agent component. The method comprises the following steps: determining a to-be-recycled memory node in a memory control group managed by a container through a quality service agent component, and transmitting the to-be-recycled memory node to a memory recycling agent component; obtaining a memory usage amount and a memory recovery index corresponding to the to-be-recovered memory node through the memory recovery agent component, and determining a memory recovery amount corresponding to the to-be-recovered memory node according to the memory usage amount and the memory recovery index; and calling a memory recovery interface through the memory recovery agent component, and recovering the physical memory in the memory node to be recovered based on the memory recovery amount. By implementing the embodiment of the invention, the memory resource utilization rate can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of memory recycling, and in particular, to a memory recycling method, device, equipment, and medium. Background Art

[0002] In order to improve performance, most application programs in computer devices adopt a memory-intensive strategy, that is, they try to utilize memory as much as possible to improve cache performance. As a result, there are many cases where application programs occupy memory for a long time. However, as the memory of computer devices is gradually consumed, application programs cannot obtain more memory for use, so memory recycling is required.

[0003] In the current memory recycling scenario, the method of adjusting the memory usage upper limit is usually used for memory recycling. The memory usage upper limit is adjusted through the Pressure Stall Information (PSI) that can reflect the delay situation of resource scheduling in computer devices. A smaller PSI indicates that the delay of resource scheduling in the computer device is small at this time, so the memory usage upper limit is lowered to recycle more memory; a larger PSI indicates that the delay of resource scheduling in the computer device is large at this time, so the memory usage upper limit is raised to avoid the impact of recycling more memory on the normal operation of the computer device.

[0004] However, the above memory recycling method can only trigger memory recycling according to the numerical value of the PSI value, and the specific memory recycling amount is determined by the memory usage upper limit; in the current memory recycling scenario, only the adjustment trend (for example, increase or decrease) of the memory usage upper limit can be determined according to the numerical value of the PSI value, and the memory usage upper limit cannot be quantitatively adjusted. Furthermore, the PSI cannot be used to recycle memory according to the actual operation requirements of the computer device, resulting in low memory resource utilization. Summary of the Invention

[0005] Embodiments of this application provide a memory recycling method, device, equipment, and medium, which can improve the accuracy of memory recycling and thus improve the utilization rate of memory resources.

[0006] On the one hand, an embodiment of this application provides a memory recycling method, which is executed by a computer device deployed with containers. The containers include a quality service proxy component and a memory recycling proxy component. The method includes:

[0007] Determine the memory nodes to be recycled in the memory control group managed by the container through the quality service proxy component, and transmit the memory nodes to be recycled to the memory recycling proxy component;

[0008] Obtain the memory usage amount and memory recycling metrics corresponding to the memory nodes to be recycled through the memory recycling proxy component, and determine the memory recycling amount corresponding to the memory nodes to be recycled according to the memory usage amount and memory recycling metrics;

[0009] The memory recovery interface is called through the memory recovery proxy component, and based on the memory recovery amount, the physical memory in the memory nodes to be recovered is recovered.

[0010] On the one hand, an embodiment of the present application provides a memory recovery device, which is applied to a computer device deployed with containers. The containers include a quality service proxy component and a memory recovery proxy component. The device includes:

[0011] A recovery node determination module, configured to determine, through the quality service proxy component, the memory nodes to be recovered in the memory control group managed by the container, and transmit the memory nodes to be recovered to the memory recovery proxy component;

[0012] A recovery amount determination module, configured to obtain, through the memory recovery proxy component, the memory usage amount and memory recovery metrics corresponding to the memory nodes to be recovered, and determine the memory recovery amount corresponding to the memory nodes to be recovered according to the memory usage amount and the memory recovery metrics;

[0013] A memory recovery module, configured to call the memory recovery interface through the memory recovery proxy component, and recover the physical memory in the memory nodes to be recovered based on the memory recovery amount.

[0014] Among them, the recovery node determination module determines the memory nodes to be recovered in the memory control group managed by the container through the quality service proxy component, including:

[0015] Calling the device service interface through the quality service proxy component to obtain the memory node tree corresponding to the memory control group managed by the container;

[0016] Determining, through the quality service proxy component, the memory nodes that meet the memory recovery conditions in the memory node tree as the memory nodes to be recovered.

[0017] Among them, the memory recovery conditions include at least one of the following:

[0018] Belonging to the node white list, the node white list includes memory nodes that can perform memory recovery;

[0019] Not belonging to the node black list, the node black list includes memory nodes that cannot perform memory recovery.

[0020] Among them, the memory recovery metrics include node pressure blocking information and memory thrashing coefficient; the recovery amount determination module determines the memory recovery amount corresponding to the memory nodes to be recovered according to the memory usage amount and the memory recovery metrics, including:

[0021] Determining the inactive memory usage amount from the memory usage amount; the inactive memory usage amount includes the inactive file page usage amount and the inactive anonymous page usage amount;

[0022] Determine the recycling coefficient corresponding to the memory node to be recycled according to the overall change value of pressure blockage in the node pressure blockage information; the overall change value of pressure blockage is used to indicate the change in the pause time of one or more processes managed by the memory node to be recycled in multiple cycles, and the recycling coefficient is negatively correlated with the overall change value of pressure blockage;

[0023] Determine the memory recycling rate corresponding to the memory node to be recycled according to the overall change value of pressure blockage and the memory thrashing coefficient; the memory recycling rate is negatively correlated with the overall change value of pressure blockage, and the memory recycling rate is negatively correlated with the file page thrashing coefficient;

[0024] Determine the memory recycling amount corresponding to the memory node to be recycled as the product of the inactive memory usage, the recycling coefficient, and the memory recycling rate.

[0025] Among them, the memory recycling amount includes the memory recycling amount corresponding to file pages and the memory recycling amount corresponding to anonymous pages, and the memory recycling interface includes the file page recycling interface and the anonymous page recycling interface; the memory recycling module calls the memory recycling interface through the memory recycling proxy component, and based on the memory recycling amount, recycles the physical memory in the memory node to be recycled, including:

[0026] Call the file page recycling interface through the memory recycling proxy component, and based on the memory recycling amount corresponding to the file pages, recycle the file pages in the memory node to be recycled to the disk space;

[0027] Call the anonymous page recycling interface through the memory recycling proxy component, and based on the memory recycling amount corresponding to the anonymous pages, recycle the anonymous pages in the memory node to be recycled to the compressed memory space.

[0028] Among them, the number of memory nodes to be recycled is M, and the M memory nodes to be recycled belong to the memory node tree corresponding to the memory control group; M is an integer greater than 1; the memory recycling module calls the memory recycling interface through the memory recycling proxy component, and based on the memory recycling amount, recycles the physical memory in the memory node to be recycled, including:

[0029] Obtain the hierarchical identifier of the M memory nodes to be recycled in the memory node tree through the memory recycling proxy component;

[0030] Determine the recycling priority corresponding to each memory node to be recycled according to the hierarchical identifier; when the memory node i to be recycled among the M memory nodes to be recycled is a leaf node in the memory node tree, the memory node i to be recycled has the highest recycling priority; when the memory node i to be recycled is the root node in the memory node tree, the memory node i to be recycled has the lowest recycling priority;

[0031] Call the memory recycling interface, and based on the memory recycling amount and the recycling priority corresponding to the M memory nodes to be recycled, perform memory recycling on the physical memory in the M memory nodes to be recycled.

[0032] Among them, the memory recycling module determines the recycling priorities corresponding to each memory node to be recycled according to the hierarchical identifier, including:

[0033] Add the memory nodes to be recycled with the same hierarchical identifier among the M memory nodes to be recycled to the same first node set, obtaining N first node sets; N is a positive integer less than or equal to M;

[0034] Add the memory nodes to be recycled that belong to the leaf nodes in the N first node sets to the leaf node set, and set the memory nodes to be recycled in the leaf node set to the highest recycling priority;

[0035] Determine the N first node sets after excluding the leaf nodes as N second node sets, and set the recycling priorities for the memory nodes to be recycled in each second node set according to the hierarchical identifier;

[0036] Among them, the memory nodes to be recycled in the same second node set have the same recycling priority; the recycling priorities corresponding to each second node set are negatively correlated with the levels of the memory nodes to be recycled included in each second node set in the memory node tree.

[0037] Among them, the memory recycling module calls the memory recycling interface through the memory recycling proxy component, and based on the memory recycling amount, recycles the physical memory in the memory nodes to be recycled, including:

[0038] If the memory node to be recycled is a leaf node in the memory node tree corresponding to the memory control group, then call the memory recycling interface through the memory recycling proxy component, and based on the memory recycling amount corresponding to the memory node to be recycled, recycle the physical memory in the memory node to be recycled;

[0039] If the memory node to be recycled is not a leaf node in the memory node tree, then call the memory recycling interface through the memory recycling proxy component, and based on the difference recycling amount between the memory recycling amount corresponding to the memory node to be recycled and the memory recycling amount corresponding to the child node of the memory node to be recycled in the memory node tree, recycle the physical memory in the memory node to be recycled.

[0040] Among them, the memory recycling module calls the memory recycling interface through the memory recycling proxy component, and based on the memory recycling amount, recycles the physical memory in the memory nodes to be recycled, including:

[0041] Obtain the service delay information, disk read and write parameters, and memory thrashing coefficient in the memory recycling metrics corresponding to the memory node to be recycled through the memory recycling proxy component;

[0042] If the service delay information is greater than the delay threshold, cancel the recycling of the physical memory in the memory node to be recycled, generate a recycling cancellation message corresponding to the memory node to be recycled, and transmit the recycling cancellation message to the quality service proxy component through the memory recycling proxy component;

[0043] If the disk read / write parameter is greater than the read / write threshold or the memory thrashing coefficient is greater than the thrashing threshold, obtain the swap ratio and access status parameter transmitted by the quality service proxy component through the memory recycling proxy component, reduce the memory recycling amount according to the swap ratio and access status parameter, obtain the service recycling amount corresponding to the memory node to be recycled, call the memory recycling interface, and recycle the physical memory in the memory node to be recycled based on the service recycling amount.

[0044] An embodiment of the present application provides a computer device on the one hand, including a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the processor executes the steps of the method in the one aspect of the embodiment of the present application.

[0045] An embodiment of the present application provides a computer-readable storage medium on the one hand. The computer-readable storage medium stores a computer program. The computer program includes program instructions. When the program instructions are executed by the processor, the steps of the method in the one aspect of the embodiment of the present application are executed.

[0046] According to one aspect of the present application, a computer program product or a computer program is provided. The computer program product or the computer program includes computer instructions. The computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional manners in the above one aspect.

[0047] In the embodiment of the present application, the quality service proxy component and the memory recycling proxy component can be deployed in the same container. After determining the memory node to be recycled in the memory control group managed by the container through the quality service proxy component, the memory node to be recycled can be transmitted to the memory recycling proxy component; obtain the memory usage amount and memory recycling index corresponding to the memory node to be recycled through the memory recycling proxy component, and according to the memory usage amount and memory recycling index, quantitative calculation of the memory recycling amount corresponding to the memory node to be recycled can be realized. Further, by calling the memory recycling interface through the memory recycling proxy component and recycling the physical memory in the memory node to be recycled according to the calculated memory recycling amount, the memory recycling accuracy of the memory node to be recycled can be improved, and further, it is helpful to improve the memory resource utilization rate of the computer device. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0049] Figure 1 is a structural schematic diagram of a computer device provided by an embodiment of the present application Figure 1 ;

[0050] Figure 2 is a system architecture diagram provided by an embodiment of the present application;

[0051] Figure 3 is a flowchart of a memory recycling method provided by an embodiment of the present application Figure 1 ;

[0052] Figure 4 is a flowchart of a memory recycling method provided by an embodiment of the present application Figure 2 ;

[0053] Figure 5 is a schematic diagram of adjusting a memory recycling policy provided by an embodiment of the present application;

[0054] Figure 6 is a flowchart of a memory recycling method provided by an embodiment of the present application Figure 3 ;

[0055] Figure 7 is a schematic diagram of memory recycling of a memory control group provided by an embodiment of the present application;

[0056] Figure 8 is a structural schematic diagram of a memory recycling device provided by an embodiment of the present application;

[0057] Figure 9 is a structural schematic diagram of a computer device provided by an embodiment of the present application Figure 2 . Detailed implementation manners

[0058] The following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.

[0059] The embodiments of this application relate to cloud technology, which refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.

[0060] Cloud technology is the general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, be used on demand, and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark and needs to be transmitted to the background system for logical processing. Data at different levels will be processed separately, and various industry data requires the support of a powerful system background, which can only be achieved through cloud computing.

[0061] Among them, the system run by the computer device in the embodiments of this application may include a cloud native system. For example, a cloud system built based on the Kubernetes (K8S) framework. Among them, K8S is an open-source system for automatically deploying, scaling, and managing containerized applications. Different from virtualization deployment, container technology represented by K8S shares the operating system (OS), is more lightweight in deployment operations, and can be ported across clouds and OS distribution versions.

[0062] To facilitate the understanding of the technical solutions proposed in the embodiments of this application, the following explains the basic concepts involved in the embodiments of this application:

[0063] Out of Memory (OOM): An error state in which an application program cannot continue to execute due to insufficient available memory space when applying for memory resources. When an OOM error occurs, the application program will crash or stop running, affecting the stability and reliability of the system.

[0064] Container: A type of operating system virtualization. Multiple operating systems share the same kernel in the kernel state through a kernel-state isolation mechanism and remain independent in the user state. Among them, resources between containers are isolated from each other, and each container has its own file system, Central Processing Unit (CPU), memory, process space, etc.

[0065] Pod (Container Cluster): A collection of containers running on a node.

[0066] Node: A virtual machine or a physical machine.

[0067] Workload: The applications running in the system.

[0068] Control group (cgroup): A function provided by the operating system layer in a computer system, used to control and limit the resource usage (such as CPU, memory, disk input / output, etc.) of one or more processes.

[0069] Quality of Service (QoS): Provide customized service quality assurance for different applications or services. The goal is to ensure that critical applications or services can obtain sufficient resources and priorities to meet their performance and reliability requirements.

[0070] Quality of Service agent component (QoS agent): An extended component enhanced based on Quality of Service. The Quality of Service agent component can provide rich capabilities, while improving the utilization rate of cluster resources, providing stability quality assurance. For example, the Quality of Service agent component can comprehensively improve the memory performance and flexibly limit the memory usage of containers.

[0071] Memory reclaim agent component (memory reclaim agent): Used to perform memory reclaim of the control group.

[0072] SWAP partition: The temporary storage space of the memory in a computer system. When the physical memory of the computer system is insufficient, a part of the storage space in the physical memory is released and temporarily saved in the SWAP partition.

[0073] Swappiness: Represents the aggressiveness of swapping out. The larger the value, the more inclined to compress anonymous pages (anon page) into compressed memory blocks (zram) to reclaim memory. The smaller the value, the more inclined to reclaim file pages (filepage).

[0074] Access status parameter (age): An indicator used to mark the activity level of a page. The access status parameter includes the page access timestamp and the page generation number. The page access timestamp represents the access time of the page, and the page generation number is an increasing number used to identify the order in which the page is accessed. The page generation number is positively correlated with the page activity level. The larger the page generation number, the more inclined the page is to be an active page. The smaller the page generation number, the more inclined the page is to be an inactive page. For example, if page 1 has the largest page generation number, then page 1 is the most recently accessed page and has the largest page access timestamp.

[0075] Pressure Stall Information (PSI): An indicator used to represent system pressure, reflecting the situation where one or more processes in the system are blocked or stalled due to waiting for resources.

[0076] Memory thrashing coefficient (number of refaults): The number of times a memory page is accessed again after being reclaimed.

[0077] File Page: A file page refers to the virtual memory page occupied by the content of a file read from disk. The data of a file page all comes from a disk file, aiming to reduce the latency of reading and writing to disk. A file page needs to be associated with a disk file first, and then establish a mapping with the process virtual address space and be stored in the page table. The process realizes the operation of the file by operating on the virtual memory, which is also called a Memory-mapped File.

[0078] Anonymous Page: Used to store the temporary data generated during the operation of a process, directly establish a mapping with the process virtual address space and be stored in the page table, without relying on a hard disk file as the data source.

[0079] When a computer device runs an application program, it needs to apply to the system for memory resources to store the data related to the operation of the application program. However, some application programs do not release cold memory (also known as resident memory, the memory that the application program does not access for a long time) for a long time after calculating the final result, and the cold memory occupies the system memory resources. Since memory is an uncompressible resource, once it is allocated to a certain process at a certain moment, it cannot be quickly released for other processes to apply. Once the memory is insufficient, there is a high probability of an OOM situation, resulting in the computer device becoming stuck or even crashing. Therefore, other application programs need to release this part of the memory before applying for memory resources.

[0080] The embodiments of this application aim to perform memory recycling in advance, that is, to reclaim cold memory earlier, so as to effectively reduce the system memory pressure, reduce the latency of memory resource application, and thus improve the utilization rate of memory resources and business performance.

[0081] The solution provided by the embodiments of this application can be applied to computer devices with container deployment scenarios. Specifically, please refer to Figure 1 , Figure 1 which is the structural schematic diagram of a computer device provided by the embodiments of this application. Figure 1 As Figure 1As shown, the computer device 100 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms; or the computer device 100 can also be an electronic device such as a smart phone, a tablet computer, a laptop computer, a handheld computer, a mobile internet device (MID), a wearable device (such as a smart watch, a smart bracelet, etc.), a smart voice interaction device, a smart home appliance (such as a smart TV, etc.), a vehicle-mounted device, an aircraft, etc. The present application does not limit the type of the terminal device.

[0082] As Figure 1 shown, the computer device 100 may include a hardware layer 110, an operating system layer 120, and an application layer 130. Among them, the hardware layer 110 may include one or more of a power supply, a processor (for example, a CPU), a memory, a hard disk, a network device, an I / O device, a fan, and an optical drive. The hardware layer 110 may also include a SWAP partition 1131. The SWAP partition 1131 refers to a virtual memory space for temporarily storing the memory data of the computer device 100; the SWAP partition 1131 is mainly used to release a part of the memory space in the physical memory when the physical memory in the computer device 100 is insufficient, and save the memory data in the released part of the memory space to the SWAP partition 1131.

[0083] The application layer 130 may include one or more application programs running in the computer device 100. As Figure 1 shown, it may include Application Program 1, Application Program 2, Application Program 3, and Application Program 4. Here, taking four application programs as an example, those skilled in the art can know that the number of the application programs can be more or less. For example, the above application programs can be only one, or the above application programs can be dozens or hundreds, or more. The embodiments of the present application do not limit the number of the application programs. Each application program includes one or more processes. For example, Application Program 1 includes at least one process when running, Application Program 2 includes at least one process when running, Application Program 3 includes at least one process when running, and Application Program 4 includes at least one process when running.

[0084] In the embodiments of the present application, in the computer device 100, one or more application programs can be packaged into one or more containers through container technology. As Figure 1As shown, application 1 and application 2 can be packaged to form container 131, and application 3 and application 4 can be packaged to form container 132. According to the isolation of the containers, container 131 and container 132 do not interfere with each other. Exemplarily, only application 1 and application 2 in container 131 can be run, and application 3 and application 4 in container 132 are not run. Exemplarily, only application 3 and application 4 in container 132 can be run, and application 1 and application 2 in container 131 are not run. Exemplarily, while running application 1 and application 2 in container 131, application 3 and application 4 in container 132 can be run. Exemplarily, application 1 and application 2 in container 131 can be run first, and then application 3 and application 4 in container 132 can be run.

[0085] The operating system layer 120 is mainly used to implement the allocation of various resources and the management of multiple processes in the computer device 100. The operating system corresponding to the operating system layer 120 can be: Linux operating system or Unix operating system, etc. The operating system layer 120 may include a control group (control group, cgroup). The control group is a function provided by the operating system layer 120, which can be used to control and limit the resource usage of one or more processes. In the embodiments of the present application, the version of the control group may be cgroup v1 or cgroup v2.

[0086] Since each container has isolation, when the operating system layer 120 uses the control group to control and limit the memory resource usage of one or more processes, the number of corresponding control groups can be set according to the number of containers, that is, one container corresponds to one control group, and multiple containers correspond to multiple control groups. Containers and control groups are in one-to-one correspondence. Unless otherwise specified, the control group mentioned in the embodiments of the present application refers to the memory control group (memory control group, memcg). As Figure 1 shown, the operating system layer 120 in the computer device 100 can provide the memory control group 1310 corresponding to container 131 and the memory control group 1320 corresponding to container 132.

[0087] In the memory control group 1310, any resource that can be controlled by any of the computer devices 100 is defined as a subsystem. For example, the memory subsystem 122, the CPU subsystem (not shown in the figure), the network subsystem (not shown in the figure), and the IO subsystem (not shown in the figure), etc. Among them, the memory subsystem 122 can be used to control memory resources, and the memory resources can be used by one or more processes of the application programs in the computer device 100. For example, the memory resources can be used by process 11, process 12, process 21, and process 13. Process 11 can be a process in application program 1 in container 131, process 12 can be a process in application program 1 in container 131, process 21 can be a process in application program 2 in container 131, and process 13 can be a process in application program 1 in container 131.

[0088] In the memory control group 1310, the resource limits on memory resources can be represented by memory nodes. Exemplarily, the resource limits on memory resources can be represented by memory node 1321, memory node 1322, memory node 1323, memory node 1324, memory node 1325, memory node 1326, and memory node 1327. The memory control group 1310 supports multiple levels, and a hierarchical structure (Hierarchy) can be obtained in the form of a tree composed of multiple nodes. Exemplarily, a tree can be formed by memory node 1321, memory node 1322, memory node 1323, memory node 1324, memory node 1325, memory node 1326, and memory node 1327 to obtain the hierarchical structure 1302. Memory node 1321, memory node 1322, memory node 1323, memory node 1324, memory node 1325, memory node 1326, and memory node 1327 can also be referred to as cgroup structures.

[0089] As Figure 1 shown, the memory node 1321 in the hierarchical structure 1302 is the root node and can be used to mount with the memory subsystem 122. For the child nodes in the hierarchical structure 1302, the sum of the resource weights set in the child nodes at the next level is less than or equal to the resource weights set in the child nodes at the previous level. The leaf nodes in the hierarchical structure 1302 are the last child nodes obtained by associating child nodes with child nodes in the hierarchical structure. For example, memory node 1324, memory node 1325, memory node 1326, and memory node 1327 are all leaf nodes. The leaf nodes can be used to associate the processes in the corresponding application programs. For example, memory node 1324 associates with process 12, memory node 1325 associates with process 21, memory node 1326 associates with process 13, and memory node 1327 associates with process 11.

[0090] Memory nodes in the hierarchical structure 1302 can set the limit weights for memory resources. For example, in memory node 1321, it is set that 50% of the memory resources can be used; in memory node 1322 connected to memory node 1321, it is set that 30% of the memory resources can be used; in memory node 1323 connected to memory node 1321, it is set that 20% of the memory resources can be used; in memory node 1324 connected to memory node 1322, it is set that 20% of the memory resources can be used; in memory node 1325 connected to memory node 1322, it is set that 10% of the memory resources can be used; in memory node 1326 connected to memory node 1323, it is set that 10% of the memory resources can be used; in memory node 1327 connected to memory node 1323, it is set that 10% of the memory resources can be used.

[0091] Among them, the sum of the memory resources that can be used set in memory node 1322 and memory node 1323 is less than or equal to the sum of the memory resources that can be used set in memory node 1321; the sum of the memory resources that can be used set in memory node 1324 and memory node 1325 is less than or equal to the sum of the memory resources that can be used set in memory node 1322; the sum of the memory resources that can be used set in memory node 1326 and memory node 1327 is less than or equal to the sum of the memory resources that can be used set in memory node 1323.

[0092] Similarly, in the memory control group 1320, any resource that can be controlled by the computer device 100 is defined as a subsystem. For example, the memory subsystem 122, the CPU subsystem (not shown in the figure), the network subsystem (not shown in the figure), and the IO subsystem (not shown in the figure), etc. Among them, the memory subsystem 122 can be used to control memory resources, and the memory resources can be used by one or more processes of the application programs in the computer device 100. For example, the memory resources can be used by process 31, process 32, and process 41. Among them, process 31 can be a process in application program 3 in container 132, process 32 can be a process in application program 3 in container 132, and process 41 can be a process in application program 4 in container 132.

[0093] In the memory control group 1320, resource restrictions on memory resources can be represented by memory nodes. Exemplarily, the restrictions on memory resources can be represented by memory node 1341, memory node 1342, memory node 1343, and memory node 1344. The memory control group 1320 supports multiple levels and can obtain a hierarchical structure in the form of a tree composed of multiple nodes. Exemplarily, a tree can be formed by memory node 1341, memory node 1342, memory node 1343, and memory node 1344 to obtain the hierarchical structure 1304. Memory node 1341, memory node 1342, memory node 1343, and memory node 1344 can also be referred to as cgroup structures.

[0094] As Figure 1 shown, the memory node 1341 in the hierarchical structure 1304 is the root node and can be used for mounting with the memory subsystem 122. For the child nodes in the hierarchical structure 1304, the sum of the resource weights set in the child nodes at the next level is less than or equal to the resource weights set in the child nodes at the previous level. The leaf nodes in the hierarchical structure 1304 are the last child nodes obtained by associating child nodes with child nodes in the hierarchical structure. For example, memory node 1342, memory node 1343, and memory node 1344 are all leaf nodes. The leaf nodes can be used to associate the processes in the corresponding application. For example, memory node 1342 associates with process 41, memory node 1343 associates with process 31, and memory node 1344 associates with process 32.

[0095] The memory nodes in the hierarchical structure 1304 can set the restriction weights on memory resources. For example, it is set in memory node 1341 that 30% of the memory resources can be used, in the memory node 1342 connected to memory node 1341 that 15% of the memory resources can be used, in the memory node 1343 connected to memory node 1341 that 5% of the memory resources can be used, and in the memory node 1344 connected to memory node 1341 that 10% of the memory resources can be used. Among them, the sum of the memory resources that can be used set in memory node 1342, memory node 1343, and memory node 1344 is less than or equal to the sum of the memory resources that can be used set in memory node 1341.

[0096] Please refer to Figure 2 , Figure 2 which is a system architecture diagram provided by an embodiment of the present application. Figure 1 The computer device 100 shown can run a system as Figure 2 shown. As Figure 2As shown, the system provided by the embodiments of the present application may be a cloud-native system, and this cloud-native system may be a cloud system built based on the K8S framework. Optionally, this cloud-native system may be applied in a hybrid scenario. That is to say, in the embodiments of the present application, multiple containers may be deployed on the same Node, and the business applications in these containers may include both online services and offline services. For example, container cluster 1 (Pod1) is used to manage online services, and container cluster 2 (Pod2) is used to manage offline services; the business applications in container cluster 1 and the business applications in container cluster 2 may share resources such as the CPU, memory, and disk input / output (I / O) of the computer device, but the resource usage between container cluster 1 and container cluster 2 is isolated from each other.

[0097] As Figure 2 shown, the system may include: a control platform, a cloud-native enhanced scheduling platform, a node process scheduling platform, a kernel, etc. The control platform is mainly used to output information to management objects. The control platform may include modules such as a cost observation and waste dashboard, platform optimization strategy management, and business resource optimization. Among them, the cost observation and waste dashboard can be used for cost observation (Cost Observation) and waste dashboard (Waste Dashboard) to help management objects better understand and detect the costs and resource usage of the server cluster, so as to timely discover and solve potential resource waste problems. The platform optimization strategy management is used to define, implement, and detect the optimization strategies of the server cluster to improve the performance, efficiency, and reliability of the server cluster. The business resource optimization can be used to reasonably allocate and schedule resources according to business requirements and priorities to ensure the stable operation and performance of the application program; it can also be used to optimize the application program management and resource allocation across multiple cloud platforms or data centers.

[0098] The cloud-native enhanced scheduling platform is mainly used to achieve intelligent resource scheduling and optimization, thereby improving the performance and reliability of the application program. As Figure 2 shown, the cloud-native enhanced scheduling platform may include modules such as load-aware scheduling and rescheduling, and topology-aware scheduling. Among them, the load-aware scheduling can, according to the actual load situation of the Node, preferentially schedule the Pod to the Node with a lower load to achieve Node load balancing and reduce the Node failure risk; the rescheduling can, when a Pod on a certain Node is removed due to certain reasons (Node failure, or resource shortage, etc.), attempt to recreate this Pod on other Nodes, thereby ensuring the availability of the business application. This helps to maintain the availability of the application and ensure that tasks can be completed according to the scheduled plan. The rescheduling can also help restore the balance and performance of the cluster in the event of Node failure or other abnormal situations. The topology-aware scheduling can schedule the Pod to a suitable Node according to the topology structure and resource usage of the cluster.

[0099] The node process scheduling platform is mainly used to manage and schedule node processes in the cluster. It is responsible for creating, starting, and detecting the processes of Pods on the Node to ensure that each process can run correctly. As Figure 2 shown, the node process scheduling platform may include modules such as memory asynchronous recycling and idle resource reuse. Among them, memory asynchronous recycling can start recycling memory resources without waiting for the process to complete, thereby optimizing memory usage and improving resource utilization. The specific memory recycling method will be described in detail below and will not be elaborated here. Idle resource reuse can reuse idle resources to meet the resource requirements of new Pods without having to schedule these Pods to new nodes.

[0100] As Figure 2 shown, the kernel in the system involved in the embodiments of the present application can provide functions such as processor quality of service (CPUQoS), memory quality of service (Mem QoS), and disk quality of service (Disk QoS). The embodiments of the present application mainly relate to memory quality of service. A Pod can include different QoS levels, and different QoS levels can be represented by setting the quality of service class (QOSClass) field. The QoS levels from high to low are: Guaranteed, Burstable, and BestEffort.

[0101] Among them, BestEffort is the QoS class with the lowest priority and will share system resources with other high-priority Pods. It may be restricted or even evicted when the system is under heavy pressure and resources are scarce. For example, the node agent (kubelet) can ensure that Guaranteed Pods can preempt BestEffort Pods when resources are insufficient by setting cgroups, or ensure that BestEffort Pods are preferentially shut down when memory is insufficient by setting the out-of-memory score adjustment parameter (oom_score_adj). By using QoS levels, resources can be reasonably allocated and managed according to the requirements and priorities of business applications to improve resource utilization and the performance and reliability of business applications.

[0102] In the embodiments of the present application, it is possible to support setting specific labels (Labels) for Nodes and Pods. For example, a Label field can be added to the YAML (scalable delimited values) configuration files of Nodes and Pods. This Label field is used to indicate the enabling of active memory asynchronous recycling, thereby specifying that the corresponding Nodes and Pods enable active memory asynchronous recycling. The value of the Label will be written back to the Annotation field for confirmation. Optionally, the embodiments of the present application can also support defining evasion rules (Taints and Tolerations) in the custom resource PodQoS (used to manage resource allocation and scheduling of pods). Through the multi-dimensional selection ability of the custom resource PodQoS, by fields such as the label (Label), priority (Priority), and QoSClass of the Pod, PodQoS is bound to the Pod, thereby implementing complex QoS operations and further reducing the number of times Pods are wrongly evicted. For example, a tolerations field can be added to the YAML configuration files of Nodes and Pods. This tolerations field can contain the definition of one or more evasion rules. For example, rules can be defined for memory pressure. When there is memory pressure on a Node, this rule will prevent scheduling new Pods to that Node, thereby reducing the scheduling of Pods to Nodes with resource pressure.

[0103] The embodiments of the present application relate to quality of service, mainly memory quality of service. Specifically, the memory quality of service provided by the embodiments of the present application can include functions such as reserved memory and releasing memory based on priority during OOM. Among them, the reserved memory function can refer to: the upper-layer platform (such as a cloud-native enhanced scheduling platform, etc.) specifies the priority of container memory pre-recycling through configuration and system recognition capabilities, so that a certain amount of free memory is reserved in the system to ensure the latency and success rate of high-priority container memory allocation. When the memory is insufficient, the memory below the specified priority is recycled. The function of releasing memory based on priority during OOM can refer to: the OOM function based on priority can, when the system needs to release memory due to lack of memory, according to the cgroup priority, preferentially close low-priority containers to release memory, thereby ensuring the stability and availability of high-priority container services.

[0104] The embodiments of the present application can deploy a quality of service agent component (QoS Agent) and a memory recycling agent component in the container, perform memory recycling on the Pods with the recycling ability enabled, and control the amount of memory recycled by detecting the memory usage and memory recycling metrics of the Pods, reducing the memory usage pressure and the OOM phenomenon, thereby improving the business performance, stability, and the utilization rate of memory resources.

[0105] The memory recovery method involved in the embodiments of the present application will be described in detail below. Specifically, please refer to Figure 3 , Figure 3 which is a flowchart showing a memory recovery method provided by an embodiment of the present application. Figure 1 This memory recovery method can be executed by a computer device deployed with containers (for example, Figure 1 executed by the computer device 100 shown). The container can include a quality service proxy component and a memory recovery proxy component. As Figure 3 shown, this memory recovery method can include steps S101 to S103:

[0106] Step S101: Determine the memory nodes to be recycled in the memory control group managed by the container through the quality service proxy component, and transmit the memory nodes to be recycled to the memory recovery proxy component.

[0107] In the embodiments of the present application, the quality service proxy component and the memory recovery proxy component can be deployed in the same container, and the image of this container can be uploaded to the image repository for storage; then create a DaemonSet (a type of Pod controller), and deploy the quality service proxy component and the memory recovery proxy component to the Node where memory asynchronous recovery is desired to be enabled, so that the Node where memory asynchronous recovery is enabled can run the container deployed with the quality service proxy component and the memory recovery proxy component at the same time.

[0108] It can be understood that deploying the quality service proxy component and the memory recovery proxy component in the same container can effectively reduce the overhead of the Pod. When running a Pod on a Node, the Pod itself occupies system resources, so optimizing the overhead of the quality service proxy component is also a key point to be considered. Compared with deploying the quality service proxy component and the memory recovery proxy component in different containers, the deployment method of the embodiments of the present application, when performing memory asynchronous recovery, the running containers are reduced from two containers to one container, which can effectively reduce the occupation of disk and memory, and thus can improve resource utilization.

[0109] In addition, the deployment method of the embodiments of the present application can also reduce the information synchronization cost between the quality service proxy component and the memory recycling proxy component. If they are deployed in different containers, a whitelist file (storing Pod information) needs to be defined as the information synchronization source for the quality service proxy component and the memory recycling proxy component. The memory recycling proxy component needs to poll and detect changes in this whitelist file to obtain information about new Pods, and needs to traverse the system regularly to update the cgroup tree structure, resulting in an increase in the CPU resource usage of the memory recycling proxy component. In an actual business scenario, some services bind processes to all CPU cores on a machine. When recycling memory recycling processes that have entered the kernel state, they will compete with business processes for the CPU, thus affecting business performance. In the embodiments of the present application, since the quality service proxy component and the memory recycling proxy component are deployed in the same container, the quality service proxy component and the memory recycling proxy component can directly perform data interaction, reducing the information synchronization cost, and thus saving the CPU usage of the memory recycling proxy component. Optionally, in a co-location scenario, a CPU limit can also be set for the memory recycling process, and by utilizing the co-location anti-interference ability of the quality service proxy component, the impact on business applications can be minimized, further reducing the CPU occupancy rate.

[0110] It can be understood that each container has isolation. When using memory control groups to control and limit the memory resource usage of one or more processes, the number of memory control groups managed by the container can be set according to the number of containers, that is, one container corresponds to one memory control group, and multiple containers correspond to multiple memory control groups. The container and the memory control group are in one-to-one correspondence. For ease of understanding, the embodiments of the present application describe the memory recycling process of the memory control group managed by one container. The memory recycling processes of the memory control groups managed by other containers in the Node can refer to the relevant descriptions.

[0111] Among them, the memory control group may include a memory node tree, and the memory node tree can be understood as a hierarchical structure in the form of a tree composed of a root node and child nodes (for example, Figure 1 the hierarchical structure 1302 or the hierarchical structure 1304 shown), and each memory node in the memory node tree can be used to manage the use of physical memory by one or more processes. Among them, the memory node to be recycled can be understood as one or more memory nodes in the memory node tree that need to perform memory recycling.

[0112] In the application embodiment, the memory nodes included in the memory node tree can be traversed through the quality service proxy component to determine the memory nodes to be recycled that currently need to perform memory recycling, and then the memory nodes to be recycled can be transmitted to the memory recycling proxy component. For example, the quality service proxy component can determine any one or more memory nodes in the memory node tree as the memory nodes to be recycled. Alternatively, the quality service proxy component can also call the memory query interface to obtain the memory usage of the memory nodes included in the memory node tree, and then can determine the memory nodes with a memory usage greater than the memory usage threshold in the memory node tree as the memory nodes to be recycled. Among them, the memory usage threshold is a parameter set in advance, and its specific value can be determined according to the actual situation. Further, after determining the memory nodes to be recycled, the quality service proxy component can transmit information such as the node identifier corresponding to the memory node to be recycled and the hierarchical identifier corresponding to the memory node to be recycled to the memory recycling proxy component.

[0113] Step S102: Obtain the memory usage and memory recycling metrics corresponding to the memory nodes to be recycled through the memory recycling proxy component, and determine the memory recycling amount corresponding to the memory nodes to be recycled according to the memory usage and the memory recycling metrics.

[0114] The memory usage corresponding to the memory nodes to be recycled can refer to the usage of the physical memory occupied by various resources in the memory nodes to be recycled. The memory usage corresponding to the memory nodes to be recycled can include active memory usage, inactive memory usage, and buffer (cache). The active memory usage can refer to the usage of data that is frequently accessed. The inactive memory usage can refer to the data that has not been accessed for a period of time or is not frequently used. The active memory usage can include active file page usage (active_file_current) and active anonymous page usage (active_anon_current). The inactive memory usage can include inactive file page usage (inactive_file_current) and inactive anonymous page usage (inactive_anon_current). Among them, the memory recycling proxy component can call the memory query interface to obtain the memory usage corresponding to the memory nodes to be recycled from the memory usage file (memory.stat).

[0115] The memory recovery metrics can refer to the metrics involved in calculating the memory recovery amount corresponding to the memory nodes to be recovered, and specifically can include but are not limited to: node pressure stall information (PSI), memory thrashing coefficient (refault), and the page briefly returning to the LRU (Least Recently Used) linked list, etc. Among them, the node pressure stall information can include the overall change value of pressure stall and the average value of pressure stall. Among them, the overall change value of pressure stall can refer to the change in the total pause time of one or more processes within a period of time (for example, 60 seconds, 300 seconds, etc.), and can be used to indicate the change in the pause time of one or more processes managed by the memory nodes to be recovered in multiple cycles; the average value of pressure stall can refer to the percentage of the process pause time of the memory nodes to be recovered.

[0116] In a possible implementation manner, the determination method of the memory recovery amount corresponding to the memory nodes to be recovered can include: determining the recovery coefficient corresponding to the memory nodes to be recovered according to the overall change value of pressure stall in the node pressure stall information; among them, the recovery coefficient is negatively correlated with the overall change value of pressure stall, that is, the larger the overall change value of pressure stall, the smaller the recovery coefficient, and the smaller the overall change value of pressure stall, the larger the recovery coefficient; then, determining the memory recovery rate corresponding to the memory nodes to be recovered according to the overall change value of pressure stall and the memory thrashing coefficient; among them, the memory recovery rate is negatively correlated with the overall change value of pressure stall, that is, the larger the overall change value of pressure stall, the smaller the memory recovery rate, and the smaller the overall change value of pressure stall, the larger the memory recovery rate; the memory recovery rate is also negatively correlated with the memory thrashing coefficient, that is, the larger the memory thrashing coefficient, the smaller the memory recovery rate, and the smaller the memory thrashing coefficient, the larger the memory recovery rate. Further, the product of the memory usage amount, the recovery coefficient, and the memory recovery rate can be determined as the memory recovery amount corresponding to the memory nodes to be recovered. Among them, the memory recovery amount corresponding to the memory nodes to be recovered can be expressed as the following formula (1):

[0117] ΔMem = Mem current ×coeff×ratio (1)

[0118] Among them, ΔMem represents the memory recovery amount corresponding to the memory nodes to be recovered, Mem current represents the memory usage amount corresponding to the memory nodes to be recovered, coeff represents the recovery coefficient corresponding to the memory nodes to be recovered, and ratio represents the memory recovery rate corresponding to the memory nodes to be recovered.

[0119] It can be understood that frequent recycling of active pages may lead to an increase in the number of page loads, thereby increasing the burden on the CPU. Therefore, when recycling the physical memory in the memory node to be recycled, it is desirable to recycle non-active pages as much as possible. In one possible implementation, the method for determining the memory recycling amount corresponding to the memory node to be recycled may include: determining the non-active memory usage amount from the memory usage amount; determining the recycling coefficient corresponding to the memory node to be recycled according to the overall change value of pressure blocking in the node pressure blocking information; determining the memory recycling rate corresponding to the memory node to be recycled according to the overall change value of pressure blocking and the memory thrashing coefficient; and then multiplying the non-active memory usage amount, the recycling coefficient, and the memory recycling rate to determine the memory recycling amount corresponding to the memory node to be recycled. Among them, the memory recycling amount corresponding to the memory node to be recycled can be expressed by the following formula (2):

[0120] ΔMem = Mem inactive_current ×coeff×ratio (2)

[0121] Where Mem inactive_current represents the non-active memory usage amount corresponding to the memory node to be recycled.

[0122] In the embodiments of the present application, the memory recycling amount corresponding to the memory node to be recycled is determined by the non-active memory usage amount of the memory node to be recycled and the memory recycling metrics. According to the calculated memory recycling amount, the physical memory in the memory node to be recycled is recycled, which can recycle the non-active pages in the memory node to be recycled as much as possible and reduce the number of recycled active pages as much as possible, improve the accuracy of memory recycling, and thus improve the memory resource utilization rate and service stability.

[0123] Step S103: Call the memory recycling interface through the memory recycling proxy component, and recycle the physical memory in the memory node to be recycled based on the memory recycling amount.

[0124] Specifically, the memory recycling interface can be called through the memory recycling proxy component to recycle the file pages and anonymous pages in the memory node to be recycled based on the memory recycling amount. For example, the file pages in the memory node to be recycled can be recycled to the disk space, and the anonymous pages in the memory node to be recycled can be recycled to the compressed memory space.

[0125] In an embodiment of the present application, the quality service proxy component and the memory recovery proxy component can be deployed in the same container. After determining the memory nodes to be recovered in the memory control group managed by the container through the quality service proxy component, the memory nodes to be recovered can be transmitted to the memory recovery proxy component; the memory usage and memory recovery metrics corresponding to the memory nodes to be recovered are obtained through the memory recovery proxy component, and based on the memory usage and memory recovery metrics, quantitative calculation of the memory recovery amount corresponding to the memory nodes to be recovered can be achieved. Further, by the memory recovery proxy component calling the memory recovery interface and recovering the physical memory in the memory nodes to be recovered according to the calculated memory recovery amount, the memory recovery accuracy of the memory nodes to be recovered can be improved, which in turn helps to improve the memory resource utilization rate of the computer device.

[0126] Please refer to Figure 4 , Figure 4 which is a schematic flow of a memory recovery method provided by an embodiment of the present application. Figure 2 This memory recovery method can be executed by a computer device deployed with a container (for example, Figure 1 executed by the computer device 100 shown). The container can include a quality service proxy component and a memory recovery proxy component. As Figure 4 shown, this memory recovery method can include steps S201 to S206:

[0127] Step S201: Detect that the container cluster (Pod) needs to compress memory.

[0128] In an embodiment of the present application, the quality service proxy component and the memory recovery proxy component can be deployed in the same container. A Label field can be added to the YAML configuration file of the Pod. This Label field is used to indicate the enabling of active memory asynchronous recovery. That is to say, after the Pod carrying this Label field is scheduled to the Node, it needs to compress memory. In this case, after the Pod (including the container in which the quality service proxy component and the memory recovery proxy component are simultaneously deployed) with the active memory asynchronous recovery ability enabled is scheduled to a certain Node, the quality service proxy component can call the device service interface (API Server) to obtain the running status information of the Pod, and then it can detect from this running status information that the Pod needs to compress memory.

[0129] Step S202: Set the swap ratio, access status parameter (age), and compressed memory space (zram) configuration information of the Pod.

[0130] Further, the memory reclaim parameters such as the swap ratio (swapiness), access status parameter (age), zram configuration information, reclaim period, and reclaim frequency corresponding to the memory control group managed by the Pod can be set through the quality service proxy component. Among them, the swap ratio (swapiness) is mainly used to adjust the reclaim tendency of the memory nodes to be reclaimed in the memory control group for file pages and anonymous pages; the setting of the access status parameter (age) enables the memory nodes to be reclaimed in the memory control group to identify as many non-active pages (pages with a small page generation number, including non-active file pages and non-active anonymous pages) as possible during memory reclaim and wait for subsequent reclaim. Based on the kernel feature that supports setting the zram configuration information of the whole machine, the zram configuration information of the memory control group can be set separately (for example, the specific zram compression algorithm and compression limit).

[0131] After the memory reclaim parameters corresponding to the memory nodes in the memory control group are set, the memory reclaim parameters corresponding to each memory node can be transmitted to the memory reclaim proxy component through the quality service proxy component. In the embodiment of this application, the memory reclaim parameters corresponding to each memory node in the memory node tree included in the memory control group can be the same. In this case, the memory reclaim parameters of the root node in the memory node tree can be set through the quality service proxy component, and the root node transmits the memory reclaim parameters to the child nodes so that the child nodes inherit the memory reclaim parameters of the root node. The memory reclaim parameters corresponding to each memory node can also be different, and the memory reclaim parameters can be set separately for each memory node through the quality service proxy component. In addition, the specific values of each reclaim parameter can be determined according to the actual situation, and the embodiment of this application does not limit this.

[0132] Step S203: Notify the memory control group (cgroup) that needs to be concerned about.

[0133] Specifically, the quality service proxy component can call the device service interface to obtain the hierarchical structure (memory node tree) corresponding to the memory control group managed by the Pod and notify the memory reclaim proxy component to pay attention to this memory control group. Further, the quality service proxy component can also determine the memory nodes to be reclaimed from the memory node tree and transmit the memory nodes to be reclaimed to the memory reclaim proxy component. The determination method of the memory nodes to be reclaimed can refer to Figure 3 the description of step S101 shown in Figure 6 and the description of step S301 and step S302 shown in

[0134] Step S204: Write back the Annotation of the Pod.

[0135] After the quality service proxy component notifies the memory recycling proxy component to pay attention to the memory control group, it can generate status change information. At this time, the quality service proxy component can write the status change information back to the Annotation of the Pod.

[0136] Step S205: Read the memory usage / Node Pressure Stall Information (PSI) / memory refault coefficient.

[0137] The memory recycling proxy component can call the memory query interface to read information such as the memory usage, Node Pressure Stall Information, and memory refault coefficient corresponding to the memory node to be recycled.

[0138] Step S206: Call the file page recycling interface to recycle file pages and call the anonymous page recycling interface to recycle anonymous pages.

[0139] In the embodiment of the present application, file pages and anonymous pages can be recycled separately. For example, the memory recycling amount corresponding to file pages and the memory recycling amount corresponding to anonymous pages can be calculated respectively, and then different memory recycling interfaces can be called to recycle the file pages and anonymous pages in the memory node to be recycled respectively.

[0140] Among them, the memory refault coefficient can include the memory refault coefficient corresponding to file pages and the memory refault coefficient corresponding to anonymous pages. The determination method of the memory recycling amount corresponding to file pages can include: determining the inactive file page usage from the memory usage; determining the recycling coefficient corresponding to the memory node to be recycled according to the overall change value of pressure stall in the Node Pressure Stall Information; determining the memory recycling rate corresponding to the file pages of the memory node to be recycled according to the overall change value of pressure stall and the memory refault coefficient corresponding to file pages; the memory recycling rate corresponding to file pages is negatively correlated with the overall change value of pressure stall, and the memory recycling rate corresponding to file pages is also negatively correlated with the memory refault coefficient corresponding to file pages; further, the product of the inactive file page usage, the recycling coefficient, and the file recycling rate can be determined as the memory recycling amount corresponding to the file pages of the memory node to be recycled. Among them, the memory recycling amount corresponding to file pages can be expressed by the following formula (3):

[0141] ΔMem file =Mem inactive_file_current ×coeff×ratio file (3)

[0142] Among them, ΔMem file represents the memory recycling amount corresponding to the file pages of the memory node to be recycled, Mem inactive_file_current represents the inactive file page usage corresponding to the memory node to be recycled, coeff represents the recycling coefficient corresponding to the memory node to be recycled, ratio fileIndicates the memory recovery rate corresponding to the file pages of the memory nodes to be reclaimed.

[0143] Among them, the determination method of the memory recovery amount corresponding to anonymous pages may include: determining the usage amount of inactive anonymous pages from the memory usage amount; determining the recovery coefficient corresponding to the memory nodes to be reclaimed according to the overall change value of pressure blocking in the node pressure blocking information; determining the memory recovery rate corresponding to the anonymous pages of the memory nodes to be reclaimed according to the overall change value of pressure blocking and the memory thrashing coefficient corresponding to anonymous pages; the memory recovery rate corresponding to anonymous pages has a negative correlation with the overall change value of pressure blocking, and the memory recovery rate corresponding to anonymous pages also has a negative correlation with the memory thrashing coefficient corresponding to anonymous pages; further, the product of the usage amount of inactive anonymous pages, the recovery coefficient, and the anonymous recovery rate can be determined as the memory recovery amount corresponding to the anonymous pages of the memory nodes to be reclaimed. Among them, the memory recovery amount corresponding to anonymous pages can be expressed as the following formula (4):

[0144] ΔMem anon =Mem inactive_anon_current ×coeff×ratio anon (4)

[0145] Among them, ΔMem anon Indicates the memory recovery amount corresponding to the anonymous pages of the memory nodes to be reclaimed, Mem inactive_anon_current Indicates the usage amount of inactive anonymous pages corresponding to the memory nodes to be reclaimed, ratio anon Indicates the memory recovery rate corresponding to the anonymous pages of the memory nodes to be reclaimed.

[0146] Further, the memory recovery proxy component can be used to call the file page recovery interface (for example, memory.file_reclaim), and based on the memory recovery amount corresponding to the file pages, reclaim the file pages in the memory nodes to be reclaimed to the disk space and release the page cache (pagecache); the memory recovery proxy component can be used to call the anonymous page recovery interface (for example, memory.anon_reclaim), and based on the memory recovery amount corresponding to the anonymous pages, reclaim the anonymous pages in the memory nodes to be reclaimed to the compressed memory space (zram). In the embodiments of the present application, separate recovery of file pages and anonymous pages can achieve refined memory recovery according to the usage conditions of different types of pages, and thus can improve the utilization rate of memory resources.

[0147] Optionally, information such as the service delay information, disk read / write parameters (IOPS), and memory thrashing coefficient (refault) corresponding to the memory node to be recycled can be obtained through the memory recycling proxy component, and the memory recycling parameters and memory recycling amount corresponding to the memory node to be recycled can be adjusted in real time. Based on the adjusted memory recycling parameters and memory recycling amount, the physical memory in the memory node to be recycled is recycled, so that inactive pages can be recycled more accurately without affecting service performance, thereby improving the memory recycling rate and reducing recycling thrashing.

[0148] Specifically, the memory thrashing coefficient in the service delay information, disk read / write parameters, and memory recycling metrics corresponding to the memory node to be recycled can be obtained through the memory recycling proxy component; if the service delay information is greater than the delay threshold, the recycling of the physical memory in the memory node to be recycled is cancelled, a recycling cancellation message corresponding to the memory node to be recycled is generated, and the recycling cancellation message is transmitted to the quality service proxy component through the memory recycling proxy component; if the disk read / write parameters are greater than the read / write threshold or the memory thrashing coefficient is greater than the thrashing threshold, the swap ratio and access status parameters transmitted by the quality service proxy component are obtained through the memory recycling proxy component; furthermore, the memory recycling amount can be reduced according to the swap ratio and access status parameters to obtain the service recycling amount corresponding to the memory node to be recycled, and the memory recycling interface is called to recycle the physical memory in the memory node to be recycled based on the service recycling amount. Among them, the delay threshold, read / write threshold, and thrashing threshold are all pre-set parameters, and their specific values can be set according to actual situations;

[0149] Please refer to Figure 5 , Figure 5 which is a schematic diagram of an adjustment of the memory recycling policy provided by an embodiment of the present application. As Figure 5 shown, conventional recycling can be understood as recycling the physical memory in the memory node to be recycled based on the memory recycling amount; skipped recycling can be understood as not recycling the physical memory in the memory node to be recycled in the current recycling cycle; forced recycling can be understood as forcibly recycling all the physical memory in the memory node to be recycled.

[0150] As Figure 5 shown, the operating status of the memory node to be recycled can be detected by calling the device service interface through the quality service proxy interface, the service delay information, disk read / write parameters, and memory thrashing coefficient corresponding to the memory node to be recycled are obtained, and the service delay information and disk read / write parameters corresponding to the memory node to be recycled are transmitted to the memory recycling proxy component. Alternatively, the service delay information, disk read / write parameters, and memory thrashing coefficient corresponding to the memory node to be recycled can also be obtained by the memory recycling proxy component calling the device service interface. Among them, the service delay information corresponding to the memory node to be recycled may include the number of processes with delays and the total delay time in the processes mounted on the memory node to be recycled.

[0151] Furthermore, the memory recycling proxy component can determine whether the service delay information corresponding to the memory node to be recycled exceeds the expectation. For example, whether the number of delayed processes and the total delay time in the service delay information are greater than the delay threshold. If the service delay information is greater than the delay threshold, it indicates that recycling the physical memory in the memory node to be recycled may lead to a decrease in service stability. Therefore, the memory recycling policy for the memory node to be recycled can be adjusted to cancel the recycling of the physical memory in the memory node to be recycled (skip recycling). Optionally, the memory recycling proxy component can also generate a recycling cancellation message corresponding to the memory node to be recycled, transmit the recycling cancellation message to the quality service proxy component through the memory recycling proxy component, and output the recycling cancellation message corresponding to the memory node to be recycled through the quality service proxy component, so as to timely regulate the resources corresponding to the memory node to be recycled according to the recycling cancellation message. If the service delay information is greater than the delay threshold, the memory recycling proxy component can call the memory recycling interface and recycle the physical memory corresponding to the memory node to be recycled based on the memory recycling amount corresponding to the memory node to be recycled (conventional recycling).

[0152] As Figure 5 shown, the memory recycling proxy component can determine whether the disk read / write parameters corresponding to the memory node to be recycled are too large. If the disk read / write parameters are less than or equal to the read / write threshold, the memory recycling proxy component can call the memory recycling interface and recycle the physical memory corresponding to the memory node to be recycled based on the memory recycling amount corresponding to the memory node to be recycled (conventional recycling). If the disk read / write parameters are greater than the read / write threshold, the memory recycling policy for the memory node to be recycled can be adjusted to reduce the recycling of file pages; the memory recycling proxy component can generate a recycling parameter adjustment request, and send the recycling parameter adjustment request to the quality service proxy component through the memory recycling proxy component, so that the quality service proxy component can adjust the memory recycling parameters such as the swap ratio and access status parameters of the memory node to be recycled, and transmit the swap ratio and access status parameters to the memory recycling proxy component. The memory recycling proxy component obtains the swap ratio and access status parameters transmitted by the quality service proxy component, adjusts the memory recycling amount according to the swap ratio and access status parameters, and obtains the service recycling amount corresponding to the memory node to be recycled. Among them, the number of file page recycling in the service recycling amount is less than the number of file page recycling in the memory recycling amount. Furthermore, the memory recycling proxy component can call the memory recycling interface and recycle the physical memory in the memory node to be recycled based on the service recycling amount.

[0153] In addition, it is also possible to determine whether the memory thrashing coefficient corresponding to the memory node to be recycled is too high through the memory recycling proxy component. If the memory thrashing coefficient is less than or equal to the thrashing threshold, the memory recycling proxy component can call the memory recycling interface to recycle the physical memory corresponding to the memory node to be recycled based on the memory recycling amount corresponding to the memory node to be recycled (conventional recycling). If the memory thrashing coefficient is greater than the thrashing threshold, the memory recycling policy of the memory node to be recycled can be adjusted to reduce the memory recycling amount and increase the recycling interval; the memory recycling proxy component can generate a recycling parameter adjustment request and send the recycling parameter adjustment request to the quality service proxy component through the memory recycling proxy component, so that the quality service proxy component can adjust memory recycling parameters such as the swap ratio, access status parameter, and recycling frequency of the memory node to be recycled, and transmit the swap ratio, access status parameter, and recycling frequency to the memory recycling proxy component, and adjust the memory recycling amount according to the swap ratio and access status parameter to obtain the service recycling amount corresponding to the memory node to be recycled. Among them, the service recycling amount is less than the memory recycling amount. Furthermore, the memory recycling proxy component can call the memory recycling interface to recycle the physical memory in the memory node to be recycled based on the service recycling amount.

[0154] It can be understood that the embodiments of the present application support separate recycling of file pages and anonymous pages, and the memory thrashing coefficient can include the memory thrashing coefficient corresponding to file pages and the memory thrashing coefficient corresponding to anonymous pages. As Figure 5 shown, it is possible to determine whether the memory thrashing coefficient corresponding to the file pages of the memory node to be recycled is too high and determine whether the memory thrashing coefficient corresponding to the anonymous pages of the memory node to be recycled is too high through the memory recycling proxy component, so as to adjust the memory recycling policy.

[0155] As Figure 5As shown, the memory recycling proxy component can determine whether the memory thrashing coefficient corresponding to the file page of the memory node to be recycled is too high. If the memory thrashing coefficient corresponding to the file page is less than or equal to the first thrashing threshold (the thrashing threshold includes the first thrashing threshold), the memory recycling proxy component can call the memory recycling interface to recycle the physical memory corresponding to the memory node to be recycled based on the memory recycling amount corresponding to the memory node to be recycled (conventional recycling). If the memory thrashing coefficient of the file page is greater than the first thrashing threshold, the memory recycling policy of the memory node to be recycled can be adjusted to reduce the memory recycling amount corresponding to the file page and increase the file page recycling interval; the memory recycling proxy component can generate a recycling parameter adjustment request, and send the recycling parameter adjustment request to the quality service proxy component through the memory recycling proxy component, so that the quality service proxy component can adjust memory recycling parameters such as the swap ratio, access status parameter, and file page recycling frequency of the memory node to be recycled, and transmit the swap ratio, access status parameter, and file page recycling frequency to the memory recycling proxy component. The memory recycling proxy component can adjust the memory recycling amount corresponding to the file page according to the swap ratio and access status parameter to obtain the service recycling amount corresponding to the file page of the memory node to be recycled. Among them, the number of file pages recycled in the service recycling amount corresponding to the file page is less than the number of file pages recycled in the memory recycling amount corresponding to the file page. Furthermore, the memory recycling proxy group can call the file page recycling interface to recycle the file pages in the memory node to be recycled based on the memory recycling amount corresponding to the file page and the file page recycling frequency.

[0156] As Figure 5As shown in the figure, the memory recycling proxy component can determine whether the memory thrashing coefficient corresponding to the file pages of the memory node to be recycled is too high. If the memory thrashing coefficient corresponding to the anonymous page is less than or equal to the second thrashing threshold (the thrashing threshold includes the second thrashing threshold), the memory recycling proxy component can call the memory recycling interface to recycle the physical memory corresponding to the memory node to be recycled (conventional recycling) based on the memory recycling amount corresponding to the memory node to be recycled. If the memory thrashing coefficient of the anonymous page is greater than the second thrashing threshold, the memory recycling policy of the memory node to be recycled can be adjusted to reduce the memory recycling amount corresponding to the anonymous page and increase the anonymous page recycling interval; the memory recycling proxy component can generate a recycling parameter adjustment request and send the recycling parameter adjustment request to the quality service proxy component through the memory recycling proxy component, so that the quality service proxy component can adjust the memory recycling parameters such as the swap ratio, access status parameter, and anonymous page recycling frequency of the memory node to be recycled, and transmit the swap ratio, access status parameter, and anonymous page recycling frequency to the memory recycling proxy component. The memory recycling proxy component can adjust the memory recycling amount corresponding to the anonymous page according to the swap ratio and access status parameter to obtain the service recycling amount corresponding to the anonymous page of the memory node to be recycled. Among them, the number of anonymous page recycling in the service recycling amount corresponding to the anonymous page is less than the number of anonymous page recycling in the memory recycling amount corresponding to the anonymous page. Furthermore, the memory recycling proxy group can call the anonymous page recycling interface to recycle the anonymous pages in the memory node to be recycled based on the memory recycling amount corresponding to the anonymous page and the anonymous page recycling frequency.

[0157] As Figure 5 shown in the figure, the memory recycling proxy component can determine whether the swapping-in and swapping-out frequencies of the anonymous pages corresponding to the memory node to be recycled are too high. If the swapping-in and swapping-out frequencies of the anonymous page are less than or equal to the swap threshold (the specific value is set according to the actual situation), the memory recycling proxy component can call the memory recycling interface to recycle the physical memory corresponding to the memory node to be recycled (conventional recycling) based on the memory recycling amount corresponding to the memory node to be recycled. If the swapping-in and swapping-out frequencies of the anonymous page are greater than the swap threshold, the memory recycling policy of the memory node to be recycled can be adjusted to increase the anonymous page recycling interval; the memory recycling proxy component can generate a recycling parameter adjustment request and send the recycling parameter adjustment request to the quality service proxy component through the memory recycling proxy component, so that the quality service proxy component can adjust the anonymous page recycling frequency of the memory node to be recycled, and transmit the anonymous page recycling frequency to the memory recycling proxy component, so that the memory recycling proxy group can call the anonymous page recycling interface to recycle the anonymous pages in the memory node to be recycled based on the memory recycling amount corresponding to the anonymous page and the anonymous page recycling frequency.

[0158] As Figure 5As shown, it is also possible to determine whether the memory usage corresponding to the memory node to be recycled exceeds the water level line through the memory recycling proxy component. If the memory usage does not exceed the water level line, the memory recycling proxy component can call the memory recycling interface to recycle the physical memory corresponding to the memory node to be recycled based on the memory recycling amount corresponding to the memory node to be recycled (conventional recycling). If the memory usage exceeds the water level line, the memory recycling policy of the memory node to be recycled is adjusted to forced recycling.

[0159] After the memory node to be recycled is recycled, the memory recycling proxy component can generate a memory recycling result corresponding to the memory node to be recycled based on the memory recycling amount corresponding to the memory node to be recycled, the memory recycling amount corresponding to the file page, the memory recycling amount corresponding to the anonymous page, and the memory saving rate, and the memory recycling proxy component can send the memory recycling result back to the quality service proxy component. The quality service proxy component outputs the memory recycling result so as to dynamically adjust the memory recycling parameters in the memory control group of the next recycling cycle according to the memory recycling result, thereby improving the accuracy of memory recycling.

[0160] The memory recycling method provided by the embodiments of the present application has a good memory recycling effect without affecting the business stability, and is applicable to scenarios such as Pod downgrading memory downgrading, dynamic amplification, and memory oversubscription. Using the memory saving rate and business metrics as evaluation metrics for memory recycling, the memory recycling method provided by the embodiments of the present application is significantly better than the existing solutions (memory recycling methods that adjust the water level line). Among them, the calculation method of the memory saving rate is: memory saving rate = (memory recycling amount of file pages + memory recycling amount of anonymous pages) / (memory usage + memory recycling amount of file pages + memory recycling amount of anonymous pages); business metrics can include business latency metrics, disk read and write parameters (IOPS), OOM occurrence rate, etc. Specifically, in the business of artificial intelligence (AI) model training, using the memory recycling method provided by the embodiments of the present application, multiple Pods related to game AI can be downgraded, and on the premise of ensuring no obvious impact on business performance, the average memory saving rate reaches 30%-40%. Therefore, using the embodiments of the present application for memory recycling has a good memory recycling effect and helps to improve the utilization rate of memory resources of computer devices.

[0161] Please refer to Figure 6 , Figure 6 is a flowchart of a memory recycling method provided by an embodiment of the present application Figure 3 , and this memory recycling method can be executed by a computer device deployed with containers (for example, Figure 1 executed by the computer device 100 shown), and the containers can include a quality service proxy component and a memory recycling proxy component. As Figure 6 shown, this memory recycling method can include steps S301 to S306:

[0162] Step S301: Invoke the device service interface through the quality service proxy component to obtain the memory node tree corresponding to the memory control group managed by the container.

[0163] Step S302: Determine, through the quality service proxy component, the memory nodes in the memory node tree that meet the memory recycling conditions as the memory nodes to be recycled, and transmit the memory nodes to be recycled to the memory recycling proxy component.

[0164] For ease of description, in the embodiments of the present application, Figure 1 taking the memory control group 1320 managed by the container 132 shown as an example, the determination process of the memory nodes to be recycled will be described. Specifically, the device service interface can be invoked through the quality service proxy component to obtain the running status information corresponding to the container 132, and then the hierarchical structure 1304 corresponding to the memory control group 1320 can be obtained from the running status information. The hierarchical structure 1304 is the memory node tree included in the memory control group 1320.

[0165] Furthermore, each memory node in the hierarchical structure 1304 can be traversed through the quality service proxy component, and then it can be determined whether the traversed memory node meets the memory recycling conditions. The memory nodes that meet the memory recycling conditions are determined as the memory nodes to be recycled, and the memory nodes to be recycled are transmitted to the memory recycling proxy component.

[0166] The traversal order can start from the root node and end after traversing to the leaf node. For example, for the hierarchical structure 1304, the traversal order of each memory node can be: memory node 1341, memory node 1342, memory node 1343, and memory node 1344. The memory recycling conditions can include at least one of the following: ① belonging to the node white list, where the node white list can include memory nodes that can perform memory recycling; ② not belonging to the node black list, where the node black list includes memory nodes that cannot perform memory recycling.

[0167] Specifically, it can be determined through the quality service component whether the traversed memory node belongs to the grounded white list or does not belong to the node black list. For example, when traversing to the memory node 1341, it can be determined whether the memory node 1341 belongs to the node white list or does not belong to the memory black list. The memory white list means that the memory in the memory nodes in the list is allowed to be recycled, and the node black list means that the memory in the memory nodes in the list is not allowed to be recycled.

[0168] In a possible implementation, it is possible to only determine whether the traversed memory node belongs to the node whitelist. For example, if the memory node 1341 belongs to the node whitelist, the memory node 1341 is determined as the memory node to be recycled; if the memory node 1341 does not belong to the node whitelist, the memory node 1342 is traversed until the memory node 1344 is traversed, the traversal ends, and the memory nodes among the memory node 1341, the memory node 1342, the memory node 1343, and the memory node 1344 that belong to the node whitelist are determined as the memory nodes to be recycled. For example, if the memory node 1341 and the memory node 1344 belong to the node whitelist, the memory node 1341 and the memory node 1344 are determined as the memory nodes to be recycled.

[0169] In a possible implementation, it is possible to only determine whether the traversed memory node belongs to the node blacklist. For example, if the memory node 1341 does not belong to the node blacklist, the memory node 1341 is determined as the memory node to be recycled; if the memory node 1341 belongs to the node blacklist, the memory node 1342 is traversed until the memory node 1344 is traversed and the traversal ends. Further, the memory nodes among the memory node 1341, the memory node 1342, the memory node 1343, and the memory node 1344 that do not belong to the node blacklist can be determined as the memory nodes to be recycled. For example, if the memory node 1342 and the memory node 1343 do not belong to the node blacklist, the memory node 1342 and the memory node 1343 are determined as the memory nodes to be recycled.

[0170] In a possible implementation, it is determined whether the traversed memory node belongs to the node whitelist and does not belong to the node blacklist. Among them, the priority of the node blacklist is higher than that of the node whitelist. For example, if the memory node 1341 belongs to the node whitelist and does not belong to the node blacklist, the memory node 1341 is determined as the memory node to be recycled; if the memory node 1341 belongs to the node whitelist and belongs to the node blacklist, the memory node 1342 is continued to be traversed; if the memory node 1341 does not belong to the node whitelist and does not belong to the node blacklist, the memory node 1341 is determined as the memory node to be recycled; if the memory node 1341 does not belong to the node whitelist and belongs to the node blacklist, the memory node 1342 is continued to be traversed. The determination method of whether the remaining memory nodes in the hierarchical structure 1304 meet the memory recycling conditions can refer to the implementation method of the memory node 1341, which will not be elaborated here.

[0171] Step S303: Obtain the memory usage amount and memory recycling index corresponding to the memory node to be recycled through the memory recycling proxy component, and determine the memory recycling amount corresponding to the memory node to be recycled according to the memory usage amount and the memory recycling index.

[0172] Among them, the specific implementation process of step S303 can be referred to the aboveFigure 3 Step S102 in the corresponding embodiment or the above Figure 4 Step S206 in the corresponding embodiment will not be elaborated here.

[0173] Step S304: Obtain the hierarchical identifiers of M memory nodes to be recycled in the memory node tree through the memory recycling proxy component.

[0174] Step S305: Determine the recycling priorities corresponding to each memory node to be recycled according to the hierarchical identifiers.

[0175] Among them, the number of memory nodes to be recycled is M, and the M memory nodes to be recycled belong to the memory node tree corresponding to the memory control group; where M represents the number of memory nodes to be recycled, M is an integer greater than 1, and the specific value of M can be 2, 3, 5, etc.

[0176] In a scenario with container deployment, the processes corresponding to the application programs are usually mounted on the child nodes or leaf nodes in the memory node tree. Exemplarily, as Figure 1 shown, processes 41, 31, and 32 can be respectively mounted through memory node 1342, memory node 1343, and memory node 1344. In the embodiment of the present application, the memory recycling of each memory node to be recycled in the memory node tree is performed in a bottom-up recycling order, that is, first recycle the memory nodes to be recycled that are leaf nodes in the memory node tree, and finally recycle the memory nodes to be recycled that are root nodes in the memory node tree, which can make the recycling order of each memory node to be recycled match the business deployment logic, and thus can improve the efficiency and accuracy of memory recycling.

[0177] Among them, the recycling order corresponding to the memory node to be recycled can be determined according to the recycling priority corresponding to the memory node to be recycled. The recycling priority is positively correlated with the recycling order. The higher the recycling priority corresponding to the memory node to be recycled, the earlier the recycling order corresponding to the memory node to be recycled. The recycling priority corresponding to the memory node to be recycled can be visually represented in one or more forms of numbers, words, or symbols. For example, a set of increasing numbers (e.g., 1, 2, 3) can be used to represent the recycling priority. When the recycling priority is "1", it has the highest recycling priority; when the recycling priority is "3", it has the lowest recycling priority.

[0178] The recycling priority corresponding to the memory node to be recycled can be determined according to the level identifier of the memory node to be recycled in the memory node tree. When the memory node i among the M memory nodes to be recycled is a leaf node in the memory node tree, the memory node i to be recycled has the highest recycling priority; when the memory node i to be recycled is the root node in the memory node tree, the memory node i to be recycled has the lowest recycling priority; the memory node i is any one of the M memory nodes to be recycled. That is to say, in the memory node tree, the leaf node has the highest recycling priority, and the root node has the lowest recycling priority. Memory recycling is first performed on the leaf nodes and finally on the root node.

[0179] The level of a memory node can be understood as the depth of the memory node in the memory node tree. The level identifier can be used to identify the information indicating the depth of the memory node in the memory node tree. Memory nodes at the same level in the memory node tree have the same level identifier. For example, in the memory node tree, if the level of the root node in the memory node tree is 1, the level identifier of the root node in the memory node tree can be set to "1"; if the first-order neighbor node of the root node has a level of 2 in the memory node tree, the level identifier of this first-order neighbor node in the memory node tree can be set to "2", and so on. In the embodiments of the present application, when the quality of service proxy component transmits the memory node to be recycled to the memory recycling proxy component, it can transmit the level identifier of the memory node to be recycled in the memory node tree to the memory recycling proxy component together; therefore, the level identifier of the memory node to be recycled in the memory node tree can be obtained through the memory recycling proxy component.

[0180] Further, the memory nodes to be recycled with the same level identifier among the M memory nodes to be recycled can be added to the same first node set to obtain N first node sets; where N is a positive integer less than or equal to M, and the specific value of N can be 1, 2, or M, etc.; the level identifiers corresponding to the memory nodes to be recycled included in different first node sets are different; the memory nodes to be recycled belonging to the leaf nodes in the N first node sets are added to the leaf node set, and the memory nodes to be recycled in the leaf node set are set to the highest recycling priority. Furthermore, the leaf nodes in the N first node sets can be removed, and the N first node sets after removing the leaf nodes are determined as N second node sets, and the recycling priority is set for the memory nodes to be recycled in each second node set according to the level identifier; where the memory nodes to be recycled in the same second node set have the same recycling priority; the recycling priorities corresponding to the respective second node sets are negatively correlated with the levels of the memory nodes to be recycled included in the respective second node sets in the memory node tree.

[0181] Please refer to Figure 7 , Figure 7It is a schematic diagram of memory recovery for a memory control group provided by an embodiment of the present application. As Figure 7 shown, the memory nodes 401, 402, 403, 404, and 405 in the memory node tree 40 are all memory nodes to be recovered. The memory node 401 is the root node in the memory node tree 40, and the hierarchical identifier of the memory node 401 in the memory node tree 40 can be set to "1"; the memory nodes 402, 403, and 404 are the child nodes of the memory node 401 and are the first-order neighbor nodes of the memory node 401. The hierarchical identifiers of the memory nodes 402, 403, and 404 in the memory node tree 40 can be set to "2"; the memory node 405 is the second-order neighbor node of the memory node 401, and the hierarchical identifier of the memory node 404 in the memory node tree 40 can be set to "3".

[0182] For example, Figure 7 the memory node 401 with a hierarchical identifier of "1" in the middle layer can be added to the first node set 1, the memory nodes 402, 403, and 404 with the same hierarchical identifier "2" can be added to the first node set 2, and the memory node 405 with a hierarchical identifier of "3" can be added to the first node set 3. Among them, the memory nodes 403 and 404 in the first node set 2 are the leaf nodes of the memory node tree 40. The memory nodes 403 and 404 can be added to the leaf node set. The memory node 405 in the first node set 3 is the leaf node of the memory node tree 40. The memory node 405 can be added to the leaf node set, and the memory nodes 403, 404, and 405 in the leaf node set can be set to the highest recovery priority.

[0183] Furthermore, the first node set after removing the leaf nodes can be determined as the second node set. For example, the second node set obtained by removing the leaf nodes from the first node set 1, the first node set 2, and the first node set 3 includes: the second node set 1 and the second node set 2. Among them, the second node set 1 includes the memory node 401, and the second node set 2 includes the memory node 402. In the embodiment of the present application, the recovery priority corresponding to the second node set is negatively correlated with the level of the memory nodes to be recovered included in the second node set in the memory node tree. Specifically, the level of the memory node 401 included in the second node set 1 in the memory node tree 40 (the level is 1) is less than that of the memory node 402 included in the second node set 2 (the level is 2). The recovery priority corresponding to the memory nodes to be recovered in the second node set 2 can be set to be higher than the recovery priority corresponding to the memory nodes to be recovered in the second node set 1.

[0184] Therefore, for each memory node to be recycled in the memory node tree 40, the memory nodes 403, 404, and 405 all have the highest recycling priority; the memory node 401 has the lowest recycling priority; the recycling priority of the memory node 402 is higher than that of the memory node 401 and lower than the corresponding recycling priorities of the memory nodes 403, 404, and 405.

[0185] Step S306: Invoke the memory recycling interface, and based on the memory recycling amounts and recycling priorities corresponding to the M memory nodes to be recycled, recycle the physical memory in the M memory nodes to be recycled.

[0186] As Figure 7 shown, since the memory nodes 403, 404, and 405 have the highest recycling priorities, the physical memory in the memory nodes 403, 404, and 405 can be recycled first. It can be understood that if the memory nodes 403, 404, and 405 are leaf nodes in the memory node tree 40, the memory recycling interface can be invoked to recycle the physical memory in the memory nodes 403, 404, and 405 based on the memory recycling amount corresponding to the memory node 403, the memory recycling amount corresponding to the memory node 404, and the memory recycling amount corresponding to the memory node 405.

[0187] When recycling the physical memory in the memory nodes 403, 404, and 405, the physical memory in each memory node can be recycled in parallel or serially. For example, the memory recycling interface can be invoked to recycle the physical memory in the memory nodes 403, 404, and 405 in parallel based on the memory recycling amount corresponding to the memory node 403, the memory recycling amount corresponding to the memory node 404, and the memory recycling amount corresponding to the memory node 405. For example, the memory recycling interface can be invoked to recycle the physical memory in the memory nodes 403, 404, and 405 sequentially based on the memory recycling amount corresponding to the memory node 403, the memory recycling amount corresponding to the memory node 404, and the memory recycling amount corresponding to the memory node 405.

[0188] Since the recycling priority corresponding to memory node 402 is lower than that of memory nodes 403, 404, and 405, after the recycling of memory nodes 403, 404, and 405 is completed, the memory recycling interface will be called to recycle the physical memory in memory node 402; similarly, after the recycling of memory node 402 is completed, the memory recycling interface will be called to recycle the physical memory in memory node 401. When the recycling of memory node 401 is completed, the memory recycling of the current cycle will stop. In addition, when recycling the physical memory of each memory node to be recycled in the memory node tree 40, the file pages and anonymous pages of each memory node to be recycled can be recycled separately. For example, the file page recycling interface can be called to recycle the file pages in each memory node to be recycled, and the anonymous page recycling interface can be called to recycle the anonymous pages in the memory node to be recycled. The specific implementation method can refer to Figure 4 the description of step S206 in

[0189] It can be understood that for the parent node in the memory node tree, its memory usage is the sum of the memory usage of the processes mounted on this memory node and the memory usage of the processes mounted on its corresponding child nodes. For example, for Figure 7 the memory node 402 shown, if the memory usage corresponding to memory node 402 is 100M and the memory usage of the process mounted on memory node 405 is 60M, then the memory usage of the process mounted on memory node 402 is 40M; if the memory recycling amount calculated based on the memory usage of 100M is used to recycle memory node 402, it is very likely that the memory recycling amount of memory node 402 will be too large, the memory recycling time will increase, the time spent in the kernel state will increase, and then the CPU occupancy rate will increase, the system will freeze, and the memory recycling effect will be affected.

[0190] Therefore, in the embodiments of this application, when recycling the parent node, the physical memory in the parent node can be recycled based on the difference recycling amount between the parent node and its corresponding child nodes instead of the memory recycling amount corresponding to the parent node. The difference recycling amount is the difference between the memory recycling amount corresponding to the parent node and the memory recycling amount corresponding to the child node. That is to say, if the memory node to be recycled is not a leaf node in the memory node tree, the memory recycling interface can be called through the memory recycling proxy component, and the physical memory in the memory node to be recycled can be recycled based on the difference recycling amount between the memory recycling amount corresponding to the memory node to be recycled and the memory recycling amount corresponding to its child nodes in the memory node tree, so as to alleviate the problem of excessive memory recycling amount corresponding to the parent node in the memory node tree, and then improve the memory recycling effect and service stability.

[0191] Suppose Figure 7The memory recovery amount corresponding to the memory node 405 shown is 65M, and the memory recovery amount corresponding to the memory node 405 is 105M. After the memory recovery of the memory node 405 is completed, the memory recovery amount of 70M corresponding to the memory node 405 can be transmitted to the memory node 402. At this time, the difference recovery amount of 40M between the memory recovery amount of 105M corresponding to the memory node 402 and the memory recovery amount of 70M corresponding to the memory node 405 can be obtained. Then, the memory recovery interface is called, and based on the difference recovery amount of 40M, the physical memory in the memory node 402 is recovered. Similarly, when performing memory recovery on the memory node 401, the recovery method of the memory node 402 can be referred to, which will not be elaborated here.

[0192] In the embodiment of the present application, the quality service proxy component and the memory recovery proxy component can be deployed in the same container. After determining the memory node to be recovered in the memory control group managed by the container through the quality service proxy component, the memory node to be recovered can be transmitted to the memory recovery proxy component; the memory usage amount and the memory recovery index corresponding to the memory node to be recovered are obtained through the memory recovery proxy component. According to the memory usage amount and the memory recovery index, the quantitative calculation of the memory recovery amount corresponding to the memory node to be recovered can be realized. Further, the memory recovery interface is called through the memory recovery proxy component, and the physical memory in the memory node to be recovered is recovered according to the calculated memory recovery amount, which can improve the memory recovery accuracy of the memory node to be recovered, and thus contribute to improving the memory resource utilization rate of the computer device.

[0193] In the present application, regarding the implementation of the technical solution for obtaining the resource data of the control group, when the above embodiments of the present application are applied to specific products or technologies, the collection, use, and processing processes of relevant data (such as memory usage amount, PSI, etc.) should comply with the requirements of laws and regulations, conform to the principles of legality, propriety, and necessity, and do not involve obtaining data types prohibited or restricted by laws and regulations.

[0194] Please refer to Figure 8 , Figure 8 which is a schematic structural diagram of a memory recovery device provided by an embodiment of the present application. It can be understood that this memory recovery device can be applied to a computer device (such as Figure 1 the computer device 100 shown) deployed with containers, where the containers can include a quality service proxy component and a memory recovery proxy component. As Figure 8 shown, the memory recovery device 1 can include: a recovery node determination module 11, a recovery amount determination module 12, and a memory recovery module 13:

[0195] The recovery node determination module 11 is used to determine the memory node to be recovered in the memory control group managed by the container through the quality service proxy component, and transmit the memory node to be recovered to the memory recovery proxy component;

[0196] A recycling amount determination module 12, configured to obtain the memory usage amount and memory recycling metrics corresponding to the memory nodes to be recycled through a memory recycling proxy component, and determine the memory recycling amount corresponding to the memory nodes to be recycled according to the memory usage amount and the memory recycling metrics;

[0197] A memory recycling module 13, configured to call a memory recycling interface through a memory recycling proxy component, and recycle the physical memory in the memory nodes to be recycled based on the memory recycling amount.

[0198] In a possible implementation manner, the recycling node determination module 11 determines the memory nodes to be recycled in the memory control group managed by the container through a quality of service proxy component, including:

[0199] Calling a device service interface through a quality of service proxy component to obtain a memory node tree corresponding to the memory control group managed by the container;

[0200] Determining, through a quality of service proxy component, the memory nodes that meet the memory recycling conditions in the memory node tree as the memory nodes to be recycled.

[0201] In a possible implementation manner, the memory recycling conditions include at least one of the following:

[0202] Belonging to a node white list, where the node white list includes memory nodes that can perform memory recycling;

[0203] Not belonging to a node black list, where the node black list includes memory nodes that cannot perform memory recycling.

[0204] In a possible implementation manner, the memory recycling metrics include node pressure blocking information and memory thrashing coefficient; the recycling amount determination module 12 determines the memory recycling amount corresponding to the memory nodes to be recycled according to the memory usage amount and the memory recycling metrics, including:

[0205] Determining the inactive memory usage amount from the memory usage amount; the inactive memory usage amount includes the inactive file page usage amount and the inactive anonymous page usage amount;

[0206] Determining a recycling coefficient corresponding to the memory nodes to be recycled according to the overall change value of pressure blocking in the node pressure blocking information; the overall change value of pressure blocking is used to indicate the change in the pause time of one or more processes managed by the memory nodes to be recycled in multiple cycles, and the recycling coefficient has a negative correlation with the overall change value of pressure blocking;

[0207] Determining a memory recycling rate corresponding to the memory nodes to be recycled according to the overall change value of pressure blocking and the memory thrashing coefficient; the memory recycling rate has a negative correlation with the overall change value of pressure blocking, and the memory recycling rate has a negative correlation with the file page thrashing coefficient;

[0208] Determine the product of the inactive memory usage, the recycling coefficient, and the memory recycling rate as the memory recycling amount corresponding to the memory node to be recycled.

[0209] In a possible implementation, the memory recycling amount includes the memory recycling amount corresponding to file pages and the memory recycling amount corresponding to anonymous pages. The memory recycling interface includes a file page recycling interface and an anonymous page recycling interface; the memory recycling module 13 calls the memory recycling interface through the memory recycling proxy component, and based on the memory recycling amount, recycles the physical memory in the memory node to be recycled, including:

[0210] Call the file page recycling interface through the memory recycling proxy component, and based on the memory recycling amount corresponding to the file pages, recycle the file pages in the memory node to be recycled to the disk space;

[0211] Call the anonymous page recycling interface through the memory recycling proxy component, and based on the memory recycling amount corresponding to the anonymous pages, recycle the anonymous pages in the memory node to be recycled to the compressed memory space.

[0212] In a possible implementation, the number of memory nodes to be recycled is M, and the M memory nodes to be recycled belong to the memory node tree corresponding to the memory control group; M is an integer greater than 1; the memory recycling module 13 calls the memory recycling interface through the memory recycling proxy component, and based on the memory recycling amount, recycles the physical memory in the memory node to be recycled, including:

[0213] Obtain the hierarchical identifiers of the M memory nodes to be recycled in the memory node tree through the memory recycling proxy component;

[0214] Determine the recycling priority corresponding to each memory node to be recycled according to the hierarchical identifier; when the memory node i to be recycled among the M memory nodes to be recycled is a leaf node in the memory node tree, the memory node i to be recycled has the highest recycling priority; when the memory node i to be recycled is the root node in the memory node tree, the memory node i to be recycled has the lowest recycling priority;

[0215] Call the memory recycling interface, and based on the memory recycling amount and the recycling priority corresponding to the M memory nodes to be recycled, perform memory recycling on the physical memory in the M memory nodes to be recycled.

[0216] In a possible implementation, the memory recycling module 13 determines the recycling priority corresponding to each memory node to be recycled according to the hierarchical identifier, including:

[0217] Add the memory nodes to be recycled with the same hierarchical identifier among the M memory nodes to be recycled to the same first node set, and obtain N first node sets; N is a positive integer less than or equal to M;

[0218] Add the memory nodes to be recycled that belong to the leaf nodes in the N first node sets to the leaf node set, and set the memory nodes to be recycled in the leaf node set to the highest recycling priority;

[0219] Determine the N first node sets after removing the leaf nodes as N second node sets, and set the recycling priorities for the memory nodes to be recycled in each second node set according to the hierarchical identifier;

[0220] Among them, the memory nodes to be recycled in the same second node set have the same recycling priority; the recycling priorities corresponding to each second node set are negatively correlated with the levels of the memory nodes to be recycled included in each second node set in the memory node tree.

[0221] In a possible implementation manner, the memory recycling module 13 calls the memory recycling interface through the memory recycling proxy component, and based on the memory recycling amount, recycles the physical memory in the memory nodes to be recycled, including:

[0222] If the memory node to be recycled is a leaf node in the memory node tree corresponding to the memory control group, then call the memory recycling interface through the memory recycling proxy component, and based on the memory recycling amount corresponding to the memory node to be recycled, recycle the physical memory in the memory node to be recycled;

[0223] If the memory node to be recycled is not a leaf node in the memory node tree, then call the memory recycling interface through the memory recycling proxy component, and based on the difference recycling amount between the memory recycling amount corresponding to the memory node to be recycled and the memory recycling amount corresponding to the child node of the memory node to be recycled in the memory node tree, recycle the physical memory in the memory node to be recycled.

[0224] In a possible implementation manner, the memory recycling module 13 calls the memory recycling interface through the memory recycling proxy component, and based on the memory recycling amount, recycles the physical memory in the memory nodes to be recycled, including:

[0225] Obtain the service delay information, disk read and write parameters, and memory thrashing coefficient in the memory recycling metrics corresponding to the memory node to be recycled through the memory recycling proxy component;

[0226] If the service delay information is greater than the delay threshold, then cancel the recycling of the physical memory in the memory node to be recycled, generate a recycling cancellation message corresponding to the memory node to be recycled, and transmit the recycling cancellation message to the quality service proxy component through the memory recycling proxy component;

[0227] If the disk read / write parameter is greater than the read / write threshold or the memory thrashing coefficient is greater than the thrashing threshold, obtain the swap ratio and access status parameters transmitted by the quality of service proxy component through the memory reclaim proxy component; reduce the memory reclaim amount according to the swap ratio and access status parameters to obtain the service reclaim amount corresponding to the memory node to be reclaimed, and call the memory reclaim interface to reclaim the physical memory in the memory node to be reclaimed based on the service reclaim amount.

[0228] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the function of the module or unit.

[0229] According to an embodiment of the present application, the foregoing Figure 3 , Figure 4 and Figure 6 The steps involved in the memory reclaim method shown can be executed by each module in the memory reclaim device 1 shown in Figure 8 . For example, Figure 3 The step S101 shown can be executed by the reclaim node determination module 11 shown in Figure 8 , Figure 3 The step S102 shown can be executed by the reclaim amount determination module 12 shown in Figure 8 , Figure 3 The step S103 shown can be executed by the memory reclaim module 13 shown in Figure 8 and so on.

[0230] According to an embodiment of the present application, Figure 8 Each module in the memory reclaim device 1 shown can be separately or all combined into one or several units to form, or some of the units can be further split into at least two smaller sub-units in terms of function, and the same operations can be achieved without affecting the realization of the technical effects of the embodiments of the present application. The above modules are divided based on logical functions. In practical applications, the function of one module can also be realized by at least two units, or the functions of at least two modules can be realized by one unit. In other embodiments of the present application, the blockchain-based data processing device 1 can also include other units. In practical applications, these functions can also be assisted by other units and can be realized by the cooperation of at least two units.

[0231] In an embodiment of the present application, the quality service proxy component and the memory recycling proxy component can be deployed in the same container. After determining the memory nodes to be recycled in the memory control group managed by the container through the quality service proxy component, the memory nodes to be recycled can be transmitted to the memory recycling proxy component; the memory usage and memory recycling metrics corresponding to the memory nodes to be recycled are obtained through the memory recycling proxy component, and based on the memory usage and memory recycling metrics, quantitative calculation of the memory recycling amount corresponding to the memory nodes to be recycled can be achieved. Further, by the memory recycling proxy component calling the memory recycling interface and recycling the physical memory in the memory nodes to be recycled according to the calculated memory recycling amount, the memory recycling accuracy of the memory nodes to be recycled can be improved, which in turn helps to improve the memory resource utilization rate of the computer device.

[0232] Please refer to Figure 9 , Figure 9 is a schematic structural diagram of a computer device provided by an embodiment of the present application Figure 2 . The computer device can be a computer device deployed with containers, and the containers can include a quality service proxy component and a memory recycling proxy component. The computer device 1000 can include: a processor 1001, a network interface 1004, and a memory 1005. In addition, the computer device 1000 can further include a user interface 1003 and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components; the user interface 1003 can include a standard wired interface and a wireless interface. The network interface 1004 can optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The memory 1005 can optionally also be at least one storage device located far from the aforementioned processor 1001. As Figure 9 shown, the memory 1005, as a computer-readable storage medium, can include an operating system, a network communication module, a user interface module, and a device control application program.

[0233] Among them, in Figure 9 the computer device 1000 shown, the network interface 1004 can provide network communication functions, while the user interface 1003 is mainly used to provide an input interface for users; and the processor 1001 can be used to call the device control application program stored in the memory 1005 to achieve:

[0234] Determine the memory nodes to be recycled in the memory control group managed by the container through the quality service proxy component, and transmit the memory nodes to be recycled to the memory recycling proxy component;

[0235] Obtain the memory usage and memory recycling metrics corresponding to the memory node to be recycled through the memory recycling proxy component, and determine the memory recycling amount corresponding to the memory node to be recycled according to the memory usage and the memory recycling metrics;

[0236] Call the memory recycling interface through the memory recycling proxy component, and recycle the physical memory in the memory node to be recycled based on the memory recycling amount.

[0237] It should be understood that the computer device 1000 described in the embodiments of the present application can execute the descriptions of the memory recycling methods in the corresponding embodiments of any of the foregoing, Figure 4 and Figure 6 and can also execute the descriptions of the memory recycling device 1 in the corresponding embodiments of the foregoing, which will not be elaborated herein. In addition, the descriptions of the beneficial effects of adopting the same method will not be elaborated either. Figure 8 In addition, it should be pointed out here that: the embodiments of the present application also provide a computer-readable storage medium, and the computer-readable storage medium stores the computer program executed by the foregoing memory recycling device 1, and the computer program includes computer instructions. When the processor executes the computer instructions, it can execute the descriptions of the memory recycling methods in the corresponding embodiments of any of the foregoing,

[0238] therefore, it will not be elaborated herein. In addition, the descriptions of the beneficial effects of adopting the same method will not be elaborated either. For the technical details not disclosed in the embodiments of the computer-readable storage medium involved in the present application, please refer to the descriptions of the method embodiments of the present application. As an example, the computer instructions can be deployed to be executed on one computer device, or on multiple computer devices located at one location, or on multiple computer devices distributed at multiple locations and interconnected through a communication network. The multiple computer devices distributed at multiple locations and interconnected through a communication network can form a blockchain system. Figure 3 、 Figure 4 and Figure 6 In addition, it should be noted that: the embodiments of the present application also provide a computer program product or a computer program. The computer program product or the computer program may include computer instructions, and the computer instructions may be stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor can execute the computer instructions, so that the computer device executes the foregoing,

[0239] 、 Figure 3 、 Figure 4 and Figure 6The description of the memory recycling method in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated either. For the technical details not disclosed in the computer program product or computer program embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0240] It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, some steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0241] The steps in the method embodiments of this application can be adjusted, combined, and deleted according to actual needs.

[0242] The modules in the device embodiments of this application can be combined, divided, and deleted according to actual needs.

[0243] Those of ordinary skill in the art can understand that all or part of the processes of implementing the above method embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.

[0244] The foregoing disclosure is only the preferred embodiment of this application, and of course it cannot be used to limit the scope of rights of this application. Therefore, equivalent changes made according to the claims of this application still fall within the scope covered by this application.

Claims

1. A memory recycling method, characterized in that, The method is executed by a computer device deployed with containers, where the containers include a quality service proxy component and a memory recycling proxy component. The method includes: Determine, by the quality service proxy component, memory nodes to be recycled in the memory control group managed by the container, and transmit the memory nodes to be recycled to the memory recycling proxy component; Obtain, by the memory recycling proxy component, the memory usage amount and memory recycling metrics corresponding to the memory nodes to be recycled, and determine the memory recycling amount corresponding to the memory nodes to be recycled according to the memory usage amount and the memory recycling metrics; Call, by the memory recycling proxy component, a memory recycling interface, and recycle the physical memory in the memory nodes to be recycled based on the memory recycling amount.

2. The method according to claim 1, characterized in that, The determining, by the quality service proxy component, the memory nodes to be recycled in the memory control group managed by the container includes: Call, by the quality service proxy component, a device service interface to obtain a memory node tree corresponding to the memory control group managed by the container; Determine, by the quality service proxy component, the memory nodes that meet the memory recycling conditions in the memory node tree as the memory nodes to be recycled.

3. The method according to claim 2, characterized in that, The memory recycling conditions include at least one of the following: Belong to a node white list, where the node white list includes memory nodes that can be recycled; Do not belong to a node black list, where the node black list includes memory nodes that cannot be recycled.

4. The method according to claim 1, characterized in that, The memory recycling metrics include node pressure blocking information and a memory thrashing coefficient; The determining, according to the memory usage amount and the memory recycling metrics, the memory recycling amount corresponding to the memory nodes to be recycled includes: Determine the inactive memory usage amount from the memory usage amount; the inactive memory usage amount includes the inactive file page usage amount and the inactive anonymous page usage amount; Determine, according to the overall change value of pressure blocking in the node pressure blocking information, the recycling coefficient corresponding to the memory nodes to be recycled; the overall change value of pressure blocking is used to indicate the change in the pause time of one or more processes managed by the memory nodes to be recycled in multiple cycles, and the recycling coefficient is negatively correlated with the overall change value of pressure blocking; Determine, according to the overall change value of pressure blocking and the memory thrashing coefficient, the memory recycling rate corresponding to the memory nodes to be recycled; the memory recycling rate is negatively correlated with the overall change value of pressure blocking, and the memory recycling rate is negatively correlated with the file page thrashing coefficient; Determine the product of the inactive memory usage amount, the recycling coefficient, and the memory recycling rate as the memory recycling amount corresponding to the memory nodes to be recycled.

5. The method according to claim 1, characterized in that, The memory recycling amount includes the memory recycling amount corresponding to file pages and the memory recycling amount corresponding to anonymous pages, and the memory recycling interface includes a file page recycling interface and an anonymous page recycling interface; The calling, by the memory recycling proxy component, a memory recycling interface and recycling the physical memory in the memory nodes to be recycled based on the memory recycling amount includes: Call the file page reclaim interface through the memory reclaim proxy component, and reclaim the file pages in the memory nodes to be reclaimed to the disk space based on the memory reclaim amount corresponding to the file pages; Call the anonymous page reclaim interface through the memory reclaim proxy component, and reclaim the anonymous pages in the memory nodes to be reclaimed to the compressed memory space based on the memory reclaim amount corresponding to the anonymous pages.

6. The method according to claim 1, characterized in that, The number of memory nodes to be reclaimed is M, and the M memory nodes to be reclaimed belong to the memory node tree corresponding to the memory control group; M is an integer greater than 1; The step of calling the memory reclaim interface through the memory reclaim proxy component to reclaim the physical memory in the memory nodes to be reclaimed based on the memory reclaim amount includes: Obtain the level identifiers of the M memory nodes to be reclaimed in the memory node tree through the memory reclaim proxy component; Determine the reclaim priorities corresponding to the respective memory nodes to be reclaimed according to the level identifiers; when the memory node i to be reclaimed among the M memory nodes to be reclaimed is a leaf node in the memory node tree, the memory node i to be reclaimed has the highest reclaim priority; when the memory node i to be reclaimed is the root node in the memory node tree, the memory node i to be reclaimed has the lowest reclaim priority; Call the memory reclaim interface, and perform memory reclaim on the physical memory in the M memory nodes to be reclaimed based on the memory reclaim amounts and reclaim priorities corresponding to the M memory nodes to be reclaimed.

7. The method according to claim 6, characterized in that, The step of determining the reclaim priorities corresponding to the respective memory nodes to be reclaimed according to the level identifiers includes: Add the memory nodes to be reclaimed with the same level identifier among the M memory nodes to be reclaimed to the same first node set, obtaining N first node sets; N is a positive integer less than or equal to M; Add the memory nodes to be reclaimed that belong to leaf nodes in the N first node sets to the leaf node set, and set the memory nodes to be reclaimed in the leaf node set to the highest reclaim priority; Determine the N first node sets after excluding the leaf nodes as N second node sets, and set the reclaim priorities for the memory nodes to be reclaimed in each second node set according to the level identifiers; Among them, the memory nodes to be reclaimed in the same second node set have the same reclaim priority; the reclaim priorities corresponding to the respective second node sets are negatively correlated with the levels of the memory nodes to be reclaimed included in the respective second node sets in the memory node tree.

8. The method according to claim 1, characterized in that, The step of calling the memory reclaim interface through the memory reclaim proxy component to reclaim the physical memory in the memory nodes to be reclaimed based on the memory reclaim amount includes: If the memory node to be reclaimed is a leaf node in the memory node tree corresponding to the memory control group, then call the memory reclaim interface through the memory reclaim proxy component, and reclaim the physical memory in the memory node to be reclaimed based on the memory reclaim amount corresponding to the memory node to be reclaimed; If the memory node to be recycled is not a leaf node in the memory node tree, the memory recycling interface is called through the memory recycling proxy component, and based on the difference recycling amount between the memory recycling amount corresponding to the memory node to be recycled and the memory recycling amount corresponding to the child nodes of the memory node to be recycled in the memory node tree, the physical memory in the memory node to be recycled is recycled.

9. The method according to claim 1, wherein, The step of calling the memory recycling interface through the memory recycling proxy component and recycling the physical memory in the memory node to be recycled based on the memory recycling amount includes: Obtaining, through the memory recycling proxy component, the service delay information, disk read / write parameters, and memory thrashing coefficient in the memory recycling metrics corresponding to the memory node to be recycled; If the service delay information is greater than the delay threshold, cancel the recycling of the physical memory in the memory node to be recycled, generate a recycling cancellation message corresponding to the memory node to be recycled, and transmit the recycling cancellation message to the quality service proxy component through the memory recycling proxy component; If the disk read / write parameters are greater than the read / write threshold or the memory thrashing coefficient is greater than the thrashing threshold, obtain the swap ratio and access status parameters transmitted by the quality service proxy component through the memory recycling proxy component, reduce the memory recycling amount according to the swap ratio and the access status parameters to obtain the service recycling amount corresponding to the memory node to be recycled, call the memory recycling interface, and recycle the physical memory in the memory node to be recycled based on the service recycling amount.

10. A memory recycling device, wherein, The device is applied to a computer device deployed with containers. The containers include a quality service proxy component and a memory recycling proxy component. The device includes: A recycling node determination module, configured to determine, through the quality service proxy component, a memory node to be recycled in the memory control group managed by the container, and transmit the memory node to be recycled to the memory recycling proxy component; A recycling amount determination module, configured to obtain, through the memory recycling proxy component, the memory usage amount and memory recycling metrics corresponding to the memory node to be recycled, and determine the memory recycling amount corresponding to the memory node to be recycled according to the memory usage amount and the memory recycling metrics; A memory recycling module, configured to call a memory recycling interface through the memory recycling proxy component and recycle the physical memory in the memory node to be recycled based on the memory recycling amount.

11. A computer device, wherein, Including a memory and a processor; The memory is connected to the processor. The memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1 to 9.

12. A computer-readable storage medium, wherein, A computer program is stored in the computer-readable storage medium. The computer program is suitable for being loaded and executed by a processor so that a computer device having the processor executes the method according to any one of claims 1 to 9.

13. A computer program product, wherein, Including computer programs / instructions, and when the computer programs / instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Cited By

  • Memory recovery method, electronic equipment, storage medium and computer program product

    CN122044885A

  • Page caching method and system for multi-priority memory control group

    CN122412077A

  • Page cache method and system for multi-priority memory control groups

    CN122412077B