An Adaptive Memory Recycling Control Method, Device, Terminal, and Storage Medium

By dynamically adjusting the memory waterline difference and starting asynchronous recycling in advance, the Linux system memory recovery mechanism is optimized, and the problem of low memory utilization under high load is solved, improving the stability of the system and business execution efficiency.

CN115168052BActive Publication Date: 2025-07-08INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210909660.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-29
Publication Date
2025-07-08
Estimated Expiration
2042-07-29

AI Technical Summary

Technical Problem

The existing Linux operating system memory recovery mechanism is inefficient when it is high load and high capacity requirements, resulting in slow business response and process lag, and it is impossible to effectively reserve memory resources to cope with sudden demands.

Method used

By monitoring the ratio of memory consumption rate to recovery rate, dynamically adjust the memory waterline difference, start the asynchronous recycling process in advance, increase the buffer time and memory recovery amount of asynchronous recycling, and optimize the memory utilization rate.

Benefits of technology

Improve memory utilization efficiency, avoid slow process response caused by direct recycling, ensure the system runs stably under high load conditions, and provide internal storage to cope with sudden demands.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115168052B_ABST
    Figure CN115168052B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of memory recycling, and specifically discloses an adaptive memory recycling control method, device, terminal, and storage medium. It monitors whether a direct recycling operation occurs within a preset time interval; if a direct recycling operation occurs, it starts an asynchronous recycling process; in the asynchronous recycling process, it adjusts the memory waterline difference according to the ratio of the memory consumption rate to the recycling rate, and the greater the ratio of the memory consumption rate to the recycling rate, the greater the memory waterline difference; where the memory waterline difference refers to the difference between the high waterline and the low waterline. The present invention monitors the direct recycling behavior in the system, starts the asynchronous recycling in advance, and increases the asynchronous recycling time; by dynamically adjusting the memory waterline difference parameter, it adjusts the difference between the low waterline and the high waterline, reserves more buffers for asynchronous recycling, and recycles more memory; it realizes adjusting the system memory recycling start point and recycling time, gives more buffers to the memory recycling behavior, and avoids triggering direct recycling due to a large number of memory applications at one time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of memory recycling, and particularly to an adaptive memory recycling control method, device, terminal and storage medium. Background Art

[0002] With the development of data centers and cloud computing services, making services efficient, stable and fast has always been the pursued goal. For different services and peak and trough situations of services, there are always differences in memory requirements. Currently, there are mainly two memory recycling paths under the Linux operating system: asynchronous recycling and direct recycling. The trigger of memory recycling is related to the memory waterline. Currently, the waterlines in the Linux system are divided into the minimum waterline (WMARK_MIN), the low waterline (WMARK_LOW), and the high waterline (WMARK_HIGH).

[0003] The existing memory recycling mechanism of the operating system is strongly related to the memory allocation process. The trigger of memory recycling starts when the memory allocation is insufficient. In this case, the trigger condition for asynchronous memory recycling is that the current available memory has dropped to the low waterline, the memory is slightly insufficient, and the asynchronous recycling thread is awakened to perform memory recycling; the trigger condition for direct recycling is that the current available memory has dropped to the minimum waterline, the system memory is severely insufficient, and the current process needs to wait for the memory release of other processes to be allocated memory, which will cause process delay and damage the isolation between processes.

[0004] Currently, some researchers monitor the state of memory pages, and at the same time add some low-speed memory devices on physical devices to migrate the cold memory pages in the system, and reserve the high-speed memory resources for the processes being allocated by the system. However, this only adds physical devices and does not optimize the mechanism from the perspective of technical control.

[0005] It can be seen that the current memory recycling mechanism is controlled by the allocation process. In this case, the utilization rate of system memory resources may usually be in a relatively high state, but at the same time, the high-utilization memory state brings some problems to various services in the application layer. For example, when the recycling efficiency is lower than the allocation efficiency, the system runs in a high-memory usage state for a long time. When there is a short-term large batch of memory usage requirements, it causes slow response of service states, process jams, etc., and even causes serious service interruptions. Therefore, in view of these problems, it is necessary to optimize the existing mechanism or create a new recycling mechanism to ensure that the system can provide a large-capacity memory reserve for services for a long time under the condition of a fixed memory capacity, reserve a buffer for sudden high-load and high-capacity needs, and ensure the stable operation of service states. Summary of the Invention

[0006] To solve the above problems, the present invention provides an adaptive memory recycling control method, apparatus, terminal and storage medium, which dynamically adjusts and controls memory recycling according to the real-time business's demand for memory resources. By monitoring the direct recycling behavior occurring in the system, asynchronous recycling is started in advance and the asynchronous recycling time is increased; by dynamically adjusting the memory waterline difference parameter, the difference between the low waterline and the high waterline is adjusted to reserve more buffer for asynchronous recycling and recycle more memory; through these two measures, the system memory recycling start point and recycling time are adjusted to give more buffer to the memory recycling behavior and avoid direct recycling triggered by a large batch of memory applications at one time.

[0007] In a first aspect, the technical solution of the present invention provides an adaptive memory recycling control method, including the following steps:

[0008] S1, monitor whether a direct recycling operation occurs within a preset time interval;

[0009] S2, if a direct recycling operation occurs, start an asynchronous recycling process;

[0010] S3, in the asynchronous recycling process, adjust the memory waterline difference according to the ratio of the memory consumption rate to the recycling rate, and the greater the ratio of the memory consumption rate to the recycling rate, the greater the memory waterline difference; where the memory waterline difference refers to the difference between the high waterline and the low waterline.

[0011] Further, the method further includes the following steps:

[0012] S0, pre-configure the memory waterline difference step adjustment parameters corresponding to the ratio of the memory consumption rate to the recycling rate;

[0013] Correspondingly, adjusting the memory waterline difference according to the ratio of the memory consumption rate to the recycling rate in step S3 specifically includes:

[0014] S31, detect the ratio of the memory consumption rate to the recycling rate;

[0015] S32, in the pre-configured step adjustment parameters, find the memory waterline difference adjustment parameter corresponding to the currently detected ratio of the memory consumption rate to the recycling rate;

[0016] S33, judge whether the current memory waterline difference is consistent with the found memory waterline difference adjustment parameter;

[0017] S34, if they are consistent, do nothing; if they are inconsistent, adjust the memory waterline difference according to the found memory waterline difference adjustment parameter.

[0018] Further, the memory waterline difference step adjustment parameters corresponding to the ratio of the memory consumption rate to the recycling rate configured in step S0 specifically include:

[0019] The ratio of the memory consumption rate to the recycling rate is less than 1, and the memory waterline difference is 10;

[0020] 1 ≤ the ratio of the memory consumption rate to the recycling rate < 1.2, and the memory waterline difference is 30;

[0021] The ratio of the memory consumption rate to the recycling rate ≥ 1.2, and the memory waterline difference is 80.

[0022] Furthermore, the method further includes the following steps:

[0023] S4. Monitor whether there is no direct recycling operation within a preset time interval;

[0024] S5. If a direct recycling operation occurs, continuously execute step S3;

[0025] S6. If there is no direct recycling operation again, determine whether the ratio of the memory consumption rate to the recycling rate is less than 1, and whether the current available memory of the system has been recycled to the high waterline state;

[0026] S7. If so, put the asynchronous recycling process into sleep; otherwise, continuously execute step S3.

[0027] Furthermore, step S0 further includes: pre-configuring a preset time interval.

[0028] Furthermore, step S1 monitors whether a direct recycling operation occurs within a preset time interval, specifically including:

[0029] S11. Detect whether the direct recycling count increases within a preset time interval;

[0030] S12. If it increases, it indicates that a direct recycling operation occurs.

[0031] In a second aspect, the technical solution of the present invention provides an adaptive memory recycling control device, including,

[0032] A monitoring module: monitor whether a direct recycling operation occurs within a preset time interval;

[0033] An asynchronous recycling start / stop module: if a direct recycling operation occurs, start the asynchronous recycling process;

[0034] An asynchronous recycling control module: in the asynchronous recycling process, adjust the memory waterline difference according to the ratio of the memory consumption rate to the recycling rate, and the greater the ratio of the memory consumption rate to the recycling rate, the greater the memory waterline difference; where the memory waterline difference refers to the difference between the high waterline and the low waterline.

[0035] Further, the device further includes a pre-configuration module: pre-configuring a preset time interval, and pre-configuring a memory waterline difference step adjustment parameter corresponding to the ratio of the memory consumption rate to the recycling rate.

[0036] In a third aspect, a technical solution of the present invention provides a terminal, including:

[0037] A memory for storing an adaptive memory recycling control program;

[0038] A processor for implementing the steps of the adaptive memory recycling control method as described in any one of the above when executing the adaptive memory recycling control program.

[0039] In a fourth aspect, a technical solution of the present invention provides a computer-readable storage medium, on which an adaptive memory recycling control program is stored, and when the adaptive memory recycling control program is executed by a processor, the steps of the adaptive memory recycling control method as described in any one of the above are implemented.

[0040] An adaptive memory recycling control method, device, terminal and storage medium provided by the present invention, under the condition of not destroying the current system recycling mechanism, through appropriate adjustment, achieve the following effects: 1. Through monitoring services, adaptively start (or close) the kswapd process in advance for asynchronous memory recycling, reduce the available memory consumption speed, and to a certain extent avoid direct recycling; 2. Dynamically adjust the waterline difference under the current system, increase the recycling time of the asynchronous recycling process, give the asynchronous recycling process a larger buffer time, improve the memory recycling volume, and avoid direct recycling, resulting in slow process service response; 3. Through the custom configuration of parameters, adapt to the control intensity of memory recycling in various service states, adjust the enthusiasm of the asynchronous recycling process to recycle, make the passive memory recycling more active, and to a certain extent improve the memory utilization efficiency and improve the service execution efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions of 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, other drawings can be obtained based on these drawings without creative efforts.

[0042] Figure 1 It is a schematic diagram of the architecture principle of an adaptive memory recycling control method provided by Embodiment 1 of the present invention.

[0043] Figure 2 It is a schematic diagram of the process of an adaptive memory recycling control method provided by Embodiment 1 of the present invention.

[0044] Figure 3 It is a schematic flowchart of an adaptive memory recycling control method provided in the second embodiment of the present invention.

[0045] Figure 4 It is a schematic block diagram of the structure of an adaptive memory recycling control device provided in the third embodiment of the present invention.

[0046] Figure 5 It is a schematic diagram of the structure of a terminal provided in the fourth embodiment of the present invention. Specific Embodiments

[0047] In order to enable those skilled in the art to better understand the solutions of the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the scope of protection of the present application.

[0048] The core of the present invention is to provide an adaptive memory recycling control method, which can be applied to the Linux system. An adaptive kswapd wake-up mechanism is designed. According to the count of direct recycling in the kernel under the current Linux system, the kswapd recycling thread is woken up in advance, without waiting for the available memory of the current system to drop to the low watermark before starting the process. Without affecting the memory application of the process, active memory recycling actions are carried out in advance; an adaptive watermark_scale_factor parameter adjustment mechanism is designed. By increasing the watermark_scale_factor parameter, the difference between the waterlines in the memory is controlled, and the difference between the low watermark and the high watermark is increased, reserving a larger buffer space for kswapd, so that the kswapd thread can recycle as much memory value as possible in one recycling, avoiding the situation where the speed of large batch memory applications is greater than the kswapd recycling speed in a short time, thereby avoiding triggering direct recycling.

[0049] Embodiment 1

[0050] The first embodiment of the present invention provides an adaptive memory recycling control method. Figure 1 It is a schematic diagram of the architecture principle of this method. Figure 2 It is a schematic diagram of the process principle of this method. This method specifically includes the following steps.

[0051] S1. Monitor whether a direct recycling operation occurs within a preset time interval.

[0052] S2. If a direct recycling operation occurs, start an asynchronous recycling process.

[0053] It should be noted that if a direct recycling operation does not occur, step S1 is continuously executed.

[0054] S3. In the asynchronous recycling process, adjust the memory waterline difference according to the ratio of the memory consumption rate to the recycling rate.

[0055] The larger the ratio of the memory consumption rate to the recycling rate, the larger the memory waterline difference; where the memory waterline difference refers to the difference between the high waterline and the low waterline.

[0056] Such as Figure 1 and 2 shown, create a monitoring service to monitor whether direct recycling behavior occurs in the kernel under the current system, monitor the memory recycling efficiency and the memory waterline difference in the asynchronous recycling process. If direct recycling behavior is detected within a certain time α, wake up the asynchronous recycling process and start abnormal recycling in advance, otherwise continue to monitor the direct recycling behavior. During the asynchronous recycling process, the monitoring service continues to be responsible for judging the possible changes in the memory of the current system, that is, dynamically perceiving the ratio of the memory consumption rate to the recycling rate. If the ratio of the memory consumption rate to the recycling rate is large, increase the memory waterline difference to win more time for the abnormal recycling process to recycle. If the ratio of the memory consumption rate to the recycling rate is small, reduce the memory waterline difference, reduce the running time of the asynchronous recycling process, and reduce the system resource occupancy.

[0057] Embodiment 2

[0058] Figure 3 is a schematic flowchart of an adaptive memory recycling control method provided by Embodiment 2 of the present invention. Such as Figure 3 shown, the method includes the following steps.

[0059] S0. Pre-configure the memory waterline difference step adjustment parameters corresponding to the ratio of the memory consumption rate to the recycling rate; pre-configure the preset time interval.

[0060] For example, configure the preset time interval α to be 30 seconds.

[0061] For example, configure the memory waterline difference step adjustment parameters corresponding to the ratio of the memory consumption rate to the recycling rate, specifically:

[0062] The ratio of the memory consumption rate to the recycling rate < 1, the memory waterline difference is 10;

[0063] 1 ≤ the ratio of the memory consumption rate to the recycling rate < 1.2, the memory waterline difference is 30;

[0064] The ratio of the memory consumption rate to the recycling rate ≥ 1.2, the memory waterline difference is 80.

[0065] The memory waterline difference step adjustment parameter is a multi-level configuration adjustment, which can be customized according to the service status, adjusting the number of parameter steps, as well as the trigger conditions and control strengths in each step.

[0066] S1, monitor whether a direct recycling operation occurs within a preset time interval.

[0067] Specifically, it is judged whether a direct recycling operation occurs by monitoring the change of the direct recycling count.

[0068] The monitoring service monitors the change of the direct recycling count. If the direct recycling count changes within the preset time interval of 30 seconds (in one system operation state, the value of the direct recycling count can only increase, so monitoring the change state is to monitor the increase of the direct recycling count), it means that a direct recycling operation occurs. At this time, the asynchronous recycling process is awakened for memory recycling.

[0069] S2, if a direct recycling operation occurs, start the asynchronous recycling process; otherwise, continuously execute step S1.

[0070] If a direct recycling operation occurs, it indicates that the system memory has not reached a serious shortage, and the asynchronous recycling is started in advance.

[0071] S3, in the asynchronous recycling process, adjust the memory waterline difference according to the ratio of the memory consumption rate to the recycling rate, specifically including:

[0072] S31, detect the ratio of the memory consumption rate to the recycling rate;

[0073] S32, in the pre-configured step adjustment parameters, find the memory waterline difference adjustment parameter corresponding to the ratio of the currently detected memory consumption rate to the recycling rate;

[0074] S33, judge whether the current memory waterline difference is consistent with the found memory waterline difference adjustment parameter;

[0075] S34, if they are consistent, do nothing; if they are inconsistent, adjust the memory waterline difference according to the found memory waterline difference adjustment parameter.

[0076] If the system sends a direct recycling within a certain period of time, it is necessary to set the memory waterline difference in the current environment based on the ratio of the memory consumption rate to the recycling rate and the step adjustment parameter, and adjust it up or down. At this time, the memory occasionally shows a serious shortage, and the memory recycling rate is lower than the memory consumption rate. It is necessary to increase the recycling time and enthusiasm of the asynchronous recycling process, and probably adjust the memory waterline difference upward.

[0077] Specifically, if the ratio < 1, set the memory waterline difference in the current environment to 10. At this time, the difference between the high waterline and the low waterline is small, and the execution time of the asynchronous recycling process is shortened.

[0078] If 1 <= ratio < 1.2, set the memory waterline difference in the current environment to 30. At this time, the difference between the high waterline and the low waterline is medium, and the execution time of the asynchronous recycling process is medium.

[0079] If 1.2 <= ratio, set the memory waterline difference in the current environment to 80. At this time, the difference between the high waterline and the low waterline is large, and the execution time of the asynchronous recycling process is long.

[0080] If the current ratio exactly corresponds to the current memory waterline difference parameter, there is no need to adjust the memory waterline difference parameter.

[0081] S4. Monitor whether a direct recycling operation has not occurred again within a preset time interval.

[0082] S5. If a direct recycling operation occurs, continuously execute step S3.

[0083] S6. If a direct recycling operation has not occurred again, determine whether the ratio of the memory consumption rate to the recycling rate is less than 1, and the currently available memory of the system has been recycled to the high waterline state.

[0084] S7. If so, put the asynchronous recycling process into sleep; otherwise, continuously execute step S3.

[0085] If the direct recycling count does not increase within a period of time, and the ratio of the memory consumption rate to the recycling rate is less than 1, and the currently available memory of the system has been recycled to the high waterline state, then put the asynchronous recycling process into sleep to reduce resource consumption; the monitoring service enters the daemon state. Further, if the direct recycling count increases, repeat steps S2 - S7.

[0086] Embodiment III

[0087] In the above, the embodiments of an adaptive memory recycling control method have been described in detail. Based on the adaptive memory recycling control method described in the above embodiments, the embodiments of the present invention also provide an adaptive memory recycling control device corresponding to this method.

[0088] Figure 4 is a schematic block diagram of the structure of an adaptive memory recycling control device provided by Embodiment III of the present invention. As Figure 4 shown, the device includes a pre - configuration module, a monitoring module, an asynchronous recycling start - stop module, and an asynchronous recycling control module.

[0089] Pre - configuration module: Pre - configure a preset time interval, and pre - configure the memory waterline difference step - adjustment parameter corresponding to the ratio of the memory consumption rate to the recycling rate.

[0090] Monitoring module: Monitor whether a direct recycling operation occurs within a preset time interval.

[0091] Asynchronous recycling start-stop module: If a direct recycling operation occurs, start the asynchronous recycling process.

[0092] Asynchronous recycling control module: In the asynchronous recycling process, adjust the memory waterline difference according to the ratio of the memory consumption rate to the recycling rate, and the greater the ratio of the memory consumption rate to the recycling rate, the greater the memory waterline difference; where the memory waterline difference refers to the difference between the high waterline and the low waterline.

[0093] Among them, after the asynchronous recycling process is started, the monitoring module is also used to monitor whether a direct recycling operation has occurred within a preset time interval. If a direct recycling operation occurs, continuously run the asynchronous recycling control module; if no direct recycling operation has occurred again, monitor and determine whether the ratio of the memory consumption rate to the recycling rate is less than 1, and the current available memory of the system has been recycled to the high waterline state; if so, notify the recycling start-stop module to put the asynchronous recycling process into sleep; otherwise, continuously run the asynchronous recycling control module.

[0094] The adaptive memory recycling control device of this embodiment is used to implement the foregoing adaptive memory recycling control method. Therefore, the specific implementation in this device can be seen in the embodiment part of the adaptive memory recycling control method in the previous text. Therefore, its specific implementation can refer to the descriptions of the corresponding parts of each embodiment, and will not be elaborated here.

[0095] In addition, since the adaptive memory recycling control device of this embodiment is used to implement the foregoing adaptive memory recycling control method, its function corresponds to that of the above method and will not be repeated here.

[0096] Embodiment 4

[0097] Figure 5 FIG. 500 is a schematic structural diagram of a terminal device 500 provided by an embodiment of the present invention, including: a processor 510, a memory 520, and a communication unit 530. When the processor 510 implements the adaptive memory recycling control program stored in the memory 520, the following steps are implemented:

[0098] S1, monitor whether a direct recycling operation occurs within a preset time interval;

[0099] S2, if a direct recycling operation occurs, start the asynchronous recycling process;

[0100] S3, in the asynchronous recycling process, adjust the memory waterline difference according to the ratio of the memory consumption rate to the recycling rate, and the greater the ratio of the memory consumption rate to the recycling rate, the greater the memory waterline difference; where the memory waterline difference refers to the difference between the high waterline and the low waterline.

[0101] Without disrupting the current system's recycling mechanism, through appropriate adjustments, the present invention achieves the following effects: 1. By monitoring services, adaptively start (or shut down) the kswapd process in advance for asynchronous memory recycling, reducing the consumption speed of available memory, and to a certain extent, avoiding direct recycling; 2. Dynamically adjust the difference between the waterlines in the current system, increasing the recycling time of the asynchronous recycling process, giving the asynchronous recycling process more buffer time, increasing the amount of memory recycled, and avoiding direct recycling, which may cause slow response of process services; 3. Through custom configuration of parameters, adapt to the control intensity of memory recycling in various business states, adjust the enthusiasm of the asynchronous recycling process for recycling, make passive memory recycling more proactive, and to a certain extent, improve memory utilization efficiency and business execution efficiency.

[0102] The terminal device 500 includes a processor 510, a memory 520, and a communication unit 530. These components communicate through one or more buses. Those skilled in the art can understand that the structure of the server shown in the figure does not constitute a limitation on the present invention. It can be a bus structure, a star structure, and can also include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0103] Among them, the memory 520 can be used to store the execution instructions of the processor 510. The memory 520 can be implemented by any type of volatile or non-volatile storage terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. When the execution instructions in the memory 520 are executed by the processor 510, the terminal 500 can execute some or all of the steps in the above method embodiments.

[0104] The processor 510 is the control center of the storage terminal, connecting various parts of the entire electronic terminal through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 520, and by calling the data stored in the memory, it executes various functions of the electronic terminal and / or processes data. The processor can be composed of an integrated circuit (IC). For example, it can be composed of a single packaged IC, or can be composed of multiple packaged ICs with the same or different functions connected together. For example, the processor 510 can only include a central processing unit (CPU). In the embodiment of the present invention, the CPU can be a single operation core or can include multiple operation cores.

[0105] A communication unit 530 is configured to establish a communication channel, enabling the storage terminal to communicate with other terminals. It receives user data sent by other terminals or sends user data to other terminals.

[0106] Embodiment 5

[0107] The present invention also provides a computer storage medium, which can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), etc.

[0108] The computer storage medium stores an adaptive memory recycling control program, which, when executed by a processor, implements the following steps:

[0109] S1, monitor whether a direct recycling operation occurs within a preset time interval;

[0110] S2, if a direct recycling operation occurs, start an asynchronous recycling process;

[0111] S3, in the asynchronous recycling process, adjust the memory waterline difference according to the ratio of the memory consumption rate to the recycling rate, and the greater the ratio of the memory consumption rate to the recycling rate, the greater the memory waterline difference; where the memory waterline difference refers to the difference between the high waterline and the low waterline.

[0112] Without disrupting the current system recycling mechanism, the present invention achieves the following effects through appropriate adjustment: 1. By monitoring services, adaptively start (or stop) the kswapd process for asynchronous memory recycling in advance, reducing the consumption speed of available memory and avoiding direct recycling to a certain extent; 2. Dynamically adjust the waterline difference in the current system, increase the recycling time of the asynchronous recycling process, provide a larger buffer time for the asynchronous recycling process, increase the amount of memory recycled, and avoid direct recycling, which may cause slow response of process services; 3. Through custom configuration of parameters, adapt to the control intensity of memory recycling in various service states, adjust the enthusiasm of the asynchronous recycling process for recycling, make passive memory recycling more active, and improve the memory utilization efficiency and business execution efficiency to a certain extent.

[0113] Those skilled in the art can clearly understand that the technologies in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solutions in the embodiments of the present invention, in essence, or the parts that contribute to the prior art can be embodied in the form of a software product. This computer software product is stored in a storage medium such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc, etc., various media that can store program codes, including several instructions for causing a computer terminal (which can be a personal computer, a server, or a second terminal, a network terminal, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0114] In several embodiments provided by the present invention, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.

[0115] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0116] In addition, in each embodiment of the present invention, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.

[0117] The above-disclosed are only the preferred embodiments of the present invention, but the present invention is not limited thereto. Any non-creative changes that can be thought of by those skilled in the art, as well as several improvements and refinements made without departing from the principle of the present invention, should fall within the protection scope of the present invention.

Claims

1. An adaptive memory recycling control method, characterized in that, It includes the following steps: S0. Pre-configure the memory waterline difference step adjustment parameter corresponding to the ratio of the memory consumption rate to the recovery rate; S1. Monitor whether a direct recovery operation occurs within a preset time interval; S2. If a direct recovery operation occurs, start an asynchronous recovery process; S3. In the asynchronous recovery process, adjust the memory waterline difference according to the ratio of the memory consumption rate to the recovery rate, and the greater the ratio of the memory consumption rate to the recovery rate, the greater the memory waterline difference; where the memory waterline difference refers to the difference between the high waterline and the low waterline; Among them, adjusting the memory waterline difference according to the ratio of the memory consumption rate to the recovery rate specifically includes: S31. Detect the ratio of the memory consumption rate to the recovery rate; S32. In the pre-configured step adjustment parameters, find the memory waterline difference adjustment parameter corresponding to the currently detected ratio of the memory consumption rate to the recovery rate; S33. Judge whether the current memory waterline difference is consistent with the found memory waterline difference adjustment parameter; S34. If they are consistent, do nothing; if they are inconsistent, adjust the memory waterline difference according to the found memory waterline difference adjustment parameter.

2. The adaptive memory recycling control method according to claim 1, characterized in that The memory waterline difference step adjustment parameter corresponding to the ratio of the memory consumption rate to the recovery rate configured in step S0 specifically includes: When the ratio of the memory consumption rate to the recovery rate < 1, the memory waterline difference is 10; When 1 ≤ the ratio of the memory consumption rate to the recovery rate < 1.2, the memory waterline difference is 30; When the ratio of the memory consumption rate to the recovery rate ≥ 1.2, the memory waterline difference is 80.

3. The adaptive memory recycling control method according to claim 2, wherein This method further includes the following steps: S4. Monitor whether a direct recovery operation no longer occurs within a preset time interval; S5. If a direct recovery operation occurs, continuously execute step S3; S6. If a direct recovery operation no longer occurs, judge whether the ratio of the memory consumption rate to the recovery rate is less than 1 and the current available memory of the system has been recycled to the high waterline state; S7. If so, suspend the asynchronous recovery process; otherwise, continuously execute step S3.

4. The adaptive memory recycling control method according to claim 3, wherein Step S0 further includes: pre-configuring a preset time interval.

5. The adaptive memory recycling control method according to claim 4, wherein Step S1 monitors whether a direct recovery operation occurs within a preset time interval, specifically including: S11. Detect whether the direct recovery count increases within a preset time interval; S12. If it increases, it means that a direct recovery operation occurs.

6. An adaptive memory recycling control device, characterized in that, It includes Pre-configuration module: Pre-configure the memory waterline difference step adjustment parameter corresponding to the ratio of the memory consumption rate to the recovery rate; Monitoring module: Monitor whether a direct recovery operation occurs within a preset time interval; Asynchronous recovery start / stop module: If a direct recovery operation occurs, start an asynchronous recovery process; Asynchronous recovery control module: In the asynchronous recovery process, adjust the memory waterline difference according to the ratio of the memory consumption rate to the recovery rate, and the greater the ratio of the memory consumption rate to the recovery rate, the greater the memory waterline difference; where the memory waterline difference refers to the difference between the high waterline and the low waterline; Among them, the memory waterline difference is adjusted according to the ratio of the memory consumption rate to the recycling rate, which specifically includes: detecting the ratio of the memory consumption rate to the recycling rate; looking up the memory waterline difference adjustment parameter corresponding to the currently detected ratio of the memory consumption rate to the recycling rate among the pre-configured step adjustment parameters; judging whether the current memory waterline difference is consistent with the found memory waterline difference adjustment parameter; if they are consistent, no action is taken; if they are inconsistent, the memory waterline difference is adjusted according to the found memory waterline difference adjustment parameter.

7. The adaptive memory reclaim control device according to claim 6, wherein The pre-configuration module is further used to pre-configure a preset time interval.

8. A terminal, characterized in that, Including: A memory for storing an adaptive memory recycling control program; A processor for implementing the steps of the adaptive memory recycling control method as described in any one of claims 1-5 when executing the adaptive memory recycling control program.

9. A computer-readable storage medium, characterized in that, An adaptive memory recycling control program is stored on the readable storage medium, and when the adaptive memory recycling control program is executed by a processor, the steps of the adaptive memory recycling control method as described in any one of claims 1-5 are implemented.

Citation Information

Patent Citations

  • Memory recovery method and device, storage medium and electronic equipment

    CN111831441A

  • System memory analysis method and electronic equipment

    CN113961427A