Memory control method, device, equipment and storage medium
By allocating memory upper limits for each process module in the storage system and periodically detecting and adjusting memory usage, the business interruption problem caused by improper memory control in the prior art is solved, and automatic memory control and system robustness enhancement are achieved.
Patent Information
- Application Number
- CN202210832771.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-15
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-07-15
AI Technical Summary
In the prior art, when using the Cgroup function of the Linux kernel for memory control, restarting the process with the largest memory occupancy cannot effectively control memory growth, which may lead to business interruptions and memory exceptions.
Allocate memory upper limit for each process module in the storage system, periodically detect the actual memory used, filter out the process modules that exceed the limit, and automatically adjust the memory usage of the target process module through memory upper limit adjustment, and use event manager to cache instructions to avoid business interruptions.
Automatic memory control is realized, the probability of system memory exceptions is reduced, the system's robustness is enhanced, and business interruption is avoided.
Smart Images

Figure CN115098266B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a memory control method, device, equipment and storage medium. Background Art
[0002] The browser / server model (B / S) leverages maturing web browser technology to implement powerful features that previously required specialized software, saving development costs. Existing mass storage management software, based on a B / S architecture, enables user-friendly interface management of storage systems, allowing users to manage storage resources through user interfaces. Furthermore, in addition to managing the storage system through a web interface, existing mass storage management software also utilizes independent backend modules for support. Consequently, memory leaks in management software modules can occasionally occur during long-term operation of storage systems.
[0003] Existing memory control techniques utilize Cgroups (control groups), a feature of the Linux kernel. This involves grouping modules into process groups and setting a memory usage cap. Once the memory usage of a module in a process group reaches the cap, the process with the largest memory usage is killed and restarted. However, restarting processes doesn't effectively control the time it takes to restart, and only the process with the largest memory usage can be restarted. This can cause further issues for modules with rapidly growing memory usage. Furthermore, directly restarting module processes can cause business interruptions. Summary of the Invention
[0004] In view of this, the present invention aims to provide a memory control method, apparatus, device, and medium that can achieve automatic memory control. The specific solution is as follows:
[0005] In a first aspect, the present application discloses a memory control method, comprising:
[0006] Allocate a memory limit for each process module in the storage system;
[0007] Periodically obtaining the actual memory usage corresponding to the process modules according to a preset time interval, and selecting the process modules whose actual memory usage is greater than the memory upper limit as target process modules;
[0008] Determine a memory upper limit adjustment method, and increase the memory upper limit of the target process module according to the memory upper limit adjustment method.
[0009] Optionally, determining a memory upper limit adjustment method and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method includes:
[0010] Calculate the remaining memory of the process modules except the target process module; the remaining memory is the difference between the upper memory limit and the actual used memory;
[0011] Determine a memory upper limit adjustment method based on the remaining memory and the filtering condition, and increase the memory upper limit of the target process module based on the memory upper limit adjustment method; the filtering condition is a condition determined based on the actual used memory of the target process module and a preset percentage.
[0012] Optionally, determining a memory upper limit adjustment method according to the remaining memory amount and a screening condition, and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method, includes:
[0013] Calculating a screening threshold according to the screening condition, and if there is a process module whose remaining memory is greater than the screening threshold, treating the process module as a partially occupied process module;
[0014] The memory upper limit of the partially occupied process module is lowered according to a preset lowering range to obtain free memory, and the free memory is allocated to the target process module to increase the memory upper limit of the target process module.
[0015] Optionally, determining a memory upper limit adjustment method according to the remaining memory amount and a preset screening condition, and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method, includes:
[0016] A screening threshold is calculated according to the screening condition. If there is no process module with a remaining memory greater than the screening threshold, the memory upper limit of the target process module is directly increased according to a preset increase range.
[0017] Optionally, if there is no process module with a remaining memory amount greater than the screening threshold, after directly increasing the memory upper limit of the target process module according to a preset increase amplitude, the method further includes:
[0018] Determining, based on the memory upper limit adjusted by the target process module, whether the total memory upper limit of the storage system is greater than the remaining memory of the storage system;
[0019] If so, restart the target process module and adjust the memory upper limit of the target process module back to the most recent historical memory upper limit.
[0020] Optionally, after selecting the process modules whose actual memory usage is greater than the memory upper limit as target process modules, the method further includes:
[0021] The target instruction set associated with the target process module is recorded in an exception list corresponding to the target process module, and a detection report is generated according to the exception list.
[0022] Optionally, the memory control method further includes:
[0023] Adding a corresponding event manager to the storage system and obtaining instructions through the event manager;
[0024] determining all associated process modules corresponding to the instruction, and detecting the running status of the associated process modules;
[0025] If the operating status of all the associated process modules is normal, the instruction is issued;
[0026] Otherwise, the instruction is cached until it is monitored that the running status of all the associated process modules is normal and then the instruction is issued.
[0027] In a second aspect, the present application discloses a memory control device, comprising:
[0028] The memory allocation module is used to allocate a memory limit for each process module in the storage system;
[0029] a target process module determination module, configured to periodically obtain the actual memory usage corresponding to the process modules at preset time intervals, and select the process modules whose actual memory usage is greater than the memory upper limit as target process modules;
[0030] The memory adjustment module is used to determine a memory upper limit adjustment method and increase the memory upper limit of the target process module according to the memory upper limit adjustment method.
[0031] In a third aspect, the present application discloses an electronic device, comprising:
[0032] Memory, used to store computer programs;
[0033] The processor is used to execute the computer program to implement the aforementioned memory control method.
[0034] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program implements the aforementioned memory control method when executed by a processor.
[0035] In this application, a memory upper limit is allocated to each process module in the storage system; the actual memory usage corresponding to the process module is periodically obtained according to a preset time interval, and the process modules whose actual memory usage is greater than the memory upper limit are screened out as target process modules; a memory upper limit adjustment method is determined, and the memory upper limit of the target process module is increased according to the memory upper limit adjustment method. It can be seen that by allocating a memory usage upper limit threshold to each process module, the usage of each memory is detected in each detection cycle, and the memory upper limit is adjusted if the memory usage exceeds the upper limit. Thus, by real-time detection of the memory usage of all process modules, the memory upper limit of the target process module is reallocated in real time in each detection cycle, thereby achieving automatic control of memory without affecting the business, minimizing the probability of memory anomalies in the entire system, and enhancing the robustness of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0037] Figure 1 A flow chart of a memory control method provided by this application;
[0038] Figure 2 A specific instruction issuance flow chart provided for this application;
[0039] Figure 3 A specific memory control flow chart provided for this application;
[0040] Figure 4 A schematic diagram of the structure of a memory control device provided in this application;
[0041] Figure 5 This is a structural diagram of an electronic device provided in this application. DETAILED DESCRIPTION
[0042] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0043] Prior art uses a Linux kernel feature called Cgroup for memory control. This involves dividing modules into process groups and setting a memory usage cap. Once the memory used by a module in a process group reaches the cap, the process with the largest memory usage is killed and restarted. However, restarting processes doesn't effectively control the time it takes to restart, and can only restart the process with the largest memory usage. This can cause further problems for modules with rapidly growing memory usage. To overcome these technical issues, this application proposes a memory control method that enables automatic memory control.
[0044] The present application discloses a memory control method. Figure 1 As shown, the method may include the following steps:
[0045] Step S11: Allocate a memory upper limit for each process module in the storage system.
[0046] In this embodiment, a memory cap is first assigned to each process module in the storage system. This cap must ensure that the total memory cap does not exceed the remaining system memory. Based on experience, specific memory cap thresholds can be assigned to different process modules. For example, a memory cap (a1, a2, ..., an) is assigned to each process module (A1, A2, ..., An), with the total memory cap being am = a1 + a2 + ... + an, where am does not exceed the remaining system memory M.
[0047] In this embodiment, before allocating a memory limit for each process module in the storage system, the following steps may be included: adding a corresponding event manager to the storage system and obtaining instructions through the event manager; determining all associated process modules corresponding to the instruction and detecting the operating status of the associated process modules; issuing the instruction if the operating status of all associated process modules is normal; otherwise, caching the instruction until the operating status of all associated process modules is normal, at which point the instruction is issued. That is, by adding an event manager to the storage system, all issued instructions are issued through the event manager; upon receiving the instruction, the event manager identifies all modules that the instruction depends on and checks whether all dependent module processes are normal. If they are normal, the instruction is issued directly; otherwise, the instruction is cached and waits for the next detection cycle until normal again before issuing the instruction. Thus, by utilizing the event manager's caching function, instructions are issued only after the modules are normal, thus avoiding service interruptions caused by a process restart. Furthermore, the memory control method disclosed in this embodiment can also be executed by the aforementioned event manager.
[0048] Step S12: periodically obtaining the actual used memory corresponding to the process module according to a preset time interval, and screening out the process modules whose actual used memory is greater than the memory upper limit as target process modules.
[0049] In this embodiment, after the system is operational, the actual memory usage corresponding to the process modules is periodically obtained at preset intervals, and process modules whose actual memory usage exceeds the upper memory limit are selected as target process modules. Specifically, the memory usage status of the process modules is detected according to the detection period to select process modules whose actual memory usage exceeds the upper memory limit as target process modules, facilitating subsequent adjustment of the upper memory limit for these target process modules. Specifically, the actual memory usage (b1, b2, ..., bn) of each process module (A1, A2, ..., An) is queried, and the target process module An is selected to determine if its memory usage bn exceeds the upper memory limit an.
[0050] In this embodiment, after selecting process modules whose actual memory usage exceeds the memory limit as target process modules, the method may further include recording the target instruction set associated with the target process module in an exception list corresponding to the target process module, and generating a detection report based on the exception list. Specifically, during each detection cycle, the instruction set of each target process module with memory anomalies is recorded, and an exception data report is output to facilitate recording and troubleshooting the cause of the memory anomaly.
[0051] Step S13: determining a memory upper limit adjustment method, and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method.
[0052] In this embodiment, after determining the target process module with memory abnormality, the memory upper limit adjustment method corresponding to the target process module is first determined, and then the memory upper limit of the target process module is increased according to the memory upper limit adjustment method to restore the memory to normal operation.
[0053] In this embodiment, determining a memory upper limit adjustment method and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method may include: calculating the remaining memory of the process modules other than the target process module; the remaining memory amount is the difference between the memory upper limit and the actual memory usage; determining a memory upper limit adjustment method based on the remaining memory amount and a screening condition, and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method; the screening condition is a condition determined based on the actual memory usage of the target process module and a preset percentage. Calculating the remaining memory of the remaining process modules, such as the difference ci between the memory upper limit ai and the actual memory bi of process Ai, ci = ai - bi; then determining a memory upper limit adjustment method based on the remaining memory amount and the screening condition, and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method, wherein the screening condition is a condition determined based on the actual memory usage of the target process module and a preset percentage.
[0054] In this embodiment, determining a memory upper limit adjustment method based on the remaining memory and a screening condition, and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method may include: calculating a screening threshold based on the screening condition; if a process module exists whose remaining memory is greater than the screening threshold, treating the process module as a partially occupied process module; lowering the memory upper limit of the partially occupied process module by a preset downward adjustment amount to obtain free memory, and allocating the free memory to the target process module to increase the memory upper limit of the target process module. For example, if the preset percentage is 30% and the actual used memory of the target process module An is bn, the screening threshold is bn*30%. Further, determining whether there is a process Ai whose actual memory bi differs from the threshold ai by ci>=bn*30%; if so, adjusting Ai's memory upper limit to ai=ai*80% according to a preset downward adjustment amount, such as 80%, and simultaneously allocating ai*20% to an. After adjustment, an=an+ai*20%, and then entering the next detection cycle.
[0055] In this embodiment, determining a memory upper limit adjustment method based on the remaining memory and preset screening conditions, and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method may include: calculating a screening threshold based on the screening conditions, and if no process module has a remaining memory greater than the screening threshold, directly increasing the memory upper limit of the target process module according to a preset increase. That is, if no process module has a remaining memory greater than the screening threshold, directly increasing the memory upper limit of the target process module according to a preset increase, such as 120%. After adjustment, the memory upper limit of the target process module is an = an * 120%. In other words, internal thresholds are reallocated. If internal allocation is impossible, the thresholds are directly increased. When insufficient memory occurs, some target process modules that exceed the threshold are restarted.
[0056] By monitoring memory usage in each module in real time and appropriately allocating memory usage limits for each module, the system restarts the offending module to free up memory if a memory anomaly impacts system memory usage. This also allows the event manager to cache instructions without disrupting normal storage operations. The preset percentages, decreases, and increases are customizable based on historical data and cluster size.
[0057] In this embodiment, if no process module has a remaining memory amount greater than the screening threshold, then directly increasing the memory limit of the target process module according to a preset increase, the process may further include: determining whether the total memory limit of the storage system is greater than the remaining memory of the storage system based on the adjusted memory limit of the target process module; if so, restarting the target process module and adjusting the memory limit of the target process module back to the most recent historical memory limit. That is, if increasing the threshold an would cause the total memory am to exceed the remaining memory M of the entire system, the process is restarted and the memory threshold is still adjusted back to an.
[0058] As can be seen from the above, in this embodiment, a memory upper limit is allocated to each process module in the storage system; the actual memory usage corresponding to the process module is periodically obtained according to a preset time interval, and the process modules whose actual memory usage is greater than the memory upper limit are screened out as target process modules; a memory upper limit adjustment method is determined, and the memory upper limit of the target process module is increased according to the memory upper limit adjustment method. It can be seen that by allocating a memory usage upper limit threshold to each process module, the usage of each memory is detected in each detection cycle, and the memory upper limit is adjusted if the memory usage exceeds the upper limit. Thus, by real-time detection of the memory usage of all process modules and reallocation of the memory upper limit of the target process module in real time in each detection cycle, automatic memory control is achieved without affecting the business, minimizing the probability of memory anomalies in the entire system, and enhancing the robustness of the system.
[0059] This embodiment also discloses a specific schematic diagram of the implementation process of the storage management software memory control method, such as Figure 2 and Figure 3 The specific implementation process is as follows:
[0060] (1) Add an event manager to the storage system, and all instructions are issued through the event manager;
[0061] (2) After receiving the instruction, the event manager identifies the modules that the instruction depends on and checks whether all dependent module processes are normal. If they are normal, the instruction is issued directly; otherwise, step (3) is executed;
[0062] (3) Store the instruction in the cache and wait for the next detection cycle until it is normal before issuing the instruction again;
[0063] (4) Allocate a memory limit (a1, a2, ..., an) to each process module (A1, A2, ..., An). The total memory limit is am = a1 + a2 + ... + an, and am does not exceed the remaining memory M of the entire system.
[0064] (5) Query the actual memory used (b1, b2, …, bn) of each process module (A1, A2, …, An);
[0065] (6) If the memory bn used by module An exceeds the threshold an, then execute step (7).
[0066] (7) Compare the actual memory used by other processes with the memory upper limit, and determine whether there is a process Ai whose actual memory bi and the threshold ai have a difference ci that satisfies ci>=bn*30%. If the condition is met, execute step (8), otherwise execute step (9);
[0067] (8) Adjust the Ai memory limit to ai = ai * 80%, and allocate ai * 20% to an (an = an + ai * 20%), execute step (5), and enter the next detection cycle;
[0068] (9) Directly increase the threshold an=an*120% and execute step (10);
[0069] (10) If increasing the threshold an causes the total memory am to exceed the remaining memory M of the entire system, the process is restarted and the memory threshold is still adjusted back to an. Execute step (11);
[0070] (11) Record the set of instructions that depend on the An process during the detection period into the An memory anomaly list and output a detection report;
[0071] It can be seen that by assigning a memory upper limit to each process module, the actual memory usage of each module is recorded in each detection cycle and compared with the memory upper limit threshold. When a module memory exceeds the threshold, the difference between the memory usage of other modules and the threshold is detected, and the upper limit value with a larger threshold difference is adjusted down, while the memory upper limit of the module exceeding the memory threshold is increased. If the difference between the memory usage of all modules and the threshold does not meet the allocation requirements, the memory upper limit of the module exceeding the memory threshold is directly increased. If the total memory exceeds the remaining memory of the system, the module is restarted. At the same time, the instruction set of each module with memory abnormality is recorded in each detection cycle, and an abnormal data report is output to record and troubleshoot the cause of the memory abnormality. In this way, automatic memory control is achieved without affecting business and enhancing the robustness of the system.
[0072] Correspondingly, the embodiment of the present application also discloses a memory control device, see Figure 4 As shown, the device includes:
[0073] A memory allocation module 11 is used to allocate a memory upper limit for each process module in the storage system;
[0074] The target process module determination module 12 is used to periodically obtain the actual memory usage corresponding to the process modules at preset time intervals, and select the process modules whose actual memory usage is greater than the memory upper limit as target process modules;
[0075] The memory adjustment module 13 is configured to determine a memory upper limit adjustment method and increase the memory upper limit of the target process module according to the memory upper limit adjustment method.
[0076] As can be seen from the above, in this embodiment, a memory upper limit is allocated to each process module in the storage system; the actual memory usage corresponding to the process module is periodically obtained according to a preset time interval, and the process modules whose actual memory usage is greater than the memory upper limit are screened out as target process modules; a memory upper limit adjustment method is determined, and the memory upper limit of the target process module is increased according to the memory upper limit adjustment method. It can be seen that by allocating a memory usage upper limit threshold to each process module, the usage of each memory is detected in each detection cycle, and the memory upper limit is adjusted if the memory usage exceeds the upper limit. Thus, by real-time detection of the memory usage of all process modules and reallocation of the memory upper limit of the target process module in real time in each detection cycle, automatic memory control is achieved without affecting the business, minimizing the probability of memory anomalies in the entire system, and enhancing the robustness of the system.
[0077] In some specific embodiments, the memory adjustment module 13 may specifically include:
[0078] A memory remaining amount calculation unit is used to calculate the memory remaining amount of the process modules except the target process module; the memory remaining amount is the difference between the memory upper limit and the actual used memory;
[0079] A memory adjustment unit is used to determine a memory upper limit adjustment method based on the remaining memory and a filtering condition, and to increase the memory upper limit of the target process module according to the memory upper limit adjustment method; the filtering condition is a condition determined based on the actual used memory of the target process module and a preset percentage.
[0080] In some specific embodiments, the memory adjustment unit may specifically include:
[0081] The first memory adjustment unit is used to calculate a filtering threshold according to the filtering condition. If there is a process module whose remaining memory is greater than the filtering threshold, the process module is regarded as a partially occupied process module; the memory upper limit of the partially occupied process module is lowered according to a preset downward adjustment range to obtain free memory, and the free memory is allocated to the target process module to increase the memory upper limit of the target process module.
[0082] In some specific embodiments, the memory adjustment unit may specifically include:
[0083] The second memory adjustment unit is used to calculate the screening threshold according to the screening condition, and if there is no process module with a remaining memory greater than the screening threshold, directly increase the memory upper limit of the target process module according to a preset increase range.
[0084] In some specific embodiments, the memory control device may specifically include:
[0085] The restart unit is used to determine whether the total memory upper limit of the storage system is greater than the remaining memory of the storage system based on the memory upper limit adjusted by the target process module; if so, restart the target process module and adjust the memory upper limit of the target process module back to the most recent historical memory upper limit.
[0086] In some specific embodiments, the memory control device may specifically include:
[0087] An instruction recording unit is used to record the target instruction set associated with the target process module into an exception list corresponding to the target process module, and generate a detection report according to the exception list.
[0088] In some specific embodiments, the memory control device may specifically include:
[0089] An instruction acquisition unit, configured to add a corresponding event manager to the storage system and acquire instructions through the event manager;
[0090] a state detection unit, configured to determine all associated process modules corresponding to the instruction and detect the running states of the associated process modules;
[0091] an instruction issuing unit, configured to issue the instruction if the operating status of all the associated process modules is normal;
[0092] The instruction delay issuing unit is used to cache the instruction and issue the instruction only when it is detected that the running status of all the associated process modules are normal.
[0093] Furthermore, the present application also discloses an electronic device, see Figure 5 The contents in the drawings should not be considered as any limitation on the scope of use of the present application.
[0094] Figure 5This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the memory control method disclosed in any of the aforementioned embodiments.
[0095] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0096] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223 including a memory upper limit, etc. The storage method can be temporary storage or permanent storage.
[0097] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, so as to enable the processor 21 to calculate and process the massive data 223 in the memory 22. The operating system 221 can be Windows Server, NetWare, Unix, Linux, etc. In addition to including computer programs capable of implementing the memory control method disclosed in any of the aforementioned embodiments and executed by the electronic device 20, the computer program 222 can further include computer programs capable of performing other specific tasks.
[0098] Furthermore, an embodiment of the present application also discloses a computer storage medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, the memory control method steps disclosed in any of the aforementioned embodiments are implemented.
[0099] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0100] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0101] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0102] The above is a detailed introduction to the memory control method, device, equipment and medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A memory control method, characterized in that: include: Allocate a memory upper limit for each process module in the storage system; wherein, when allocating a memory upper limit for each process module in the storage system, the total memory upper limit value does not exceed the remaining memory of the system; Periodically obtaining the actual memory usage corresponding to the process modules according to a preset time interval, and selecting the process modules whose actual memory usage is greater than the memory upper limit as target process modules; Determining a memory upper limit adjustment method, and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method; The method of determining the memory upper limit adjustment method includes: Calculate a screening threshold based on the actual memory usage of the target process module and a preset percentage; If there are other process modules whose remaining memory is greater than the screening threshold, then its memory upper limit is lowered according to the preset reduction range, and the recovered free memory is allocated to the target process module; If it does not exist, directly increase the memory limit of the target process module according to the preset increase range; the preset percentage, the preset decrease range and the preset increase range are configured based on historical data and cluster size; Among them, after raising the memory upper limit of the target process module according to the memory upper limit adjustment method, it also includes: when the total value of the memory upper limit after the increase exceeds the remaining memory of the system, restarting the target process module and restoring its memory upper limit to the most recent historical value.
2. The memory control method according to claim 1, wherein: The determining of a memory upper limit adjustment method and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method includes: Calculate the remaining memory of the process modules except the target process module; the remaining memory is the difference between the upper memory limit and the actual used memory; Determine a memory upper limit adjustment method based on the remaining memory and the filtering condition, and increase the memory upper limit of the target process module based on the memory upper limit adjustment method; the filtering condition is a condition determined based on the actual used memory of the target process module and a preset percentage.
3. The memory control method according to claim 2, wherein: The determining of a memory upper limit adjustment method according to the remaining memory amount and the screening condition, and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method, includes: Calculating a screening threshold according to the screening condition, and if there is a process module whose remaining memory is greater than the screening threshold, treating the process module as a partially occupied process module; The memory upper limit of the partially occupied process module is lowered according to a preset lowering range to obtain free memory, and the free memory is allocated to the target process module to increase the memory upper limit of the target process module.
4. The memory control method according to claim 2, wherein: The determining of a memory upper limit adjustment method according to the remaining memory amount and a preset screening condition, and increasing the memory upper limit of the target process module according to the memory upper limit adjustment method, includes: A screening threshold is calculated according to the screening condition. If there is no process module with a remaining memory greater than the screening threshold, the memory upper limit of the target process module is directly increased according to a preset increase range.
5. The memory control method according to claim 4, wherein: If there is no process module with a remaining memory amount greater than the screening threshold, directly increasing the memory upper limit of the target process module according to the preset increase range, the method further includes: Determining, based on the memory upper limit adjusted by the target process module, whether the total memory upper limit of the storage system is greater than the remaining memory of the storage system; If so, restart the target process module and adjust the memory upper limit of the target process module back to the most recent historical memory upper limit.
6. The memory control method according to claim 1, wherein: After filtering out the process modules whose actual memory usage is greater than the memory upper limit as target process modules, the method further includes: The target instruction set associated with the target process module is recorded in an exception list corresponding to the target process module, and a detection report is generated according to the exception list.
7. The memory control method according to any one of claims 1 to 6, characterized in that: Also includes: Adding a corresponding event manager to the storage system and obtaining instructions through the event manager; determining all associated process modules corresponding to the instruction, and detecting the running status of the associated process modules; If the operating status of all the associated process modules is normal, the instruction is issued; Otherwise, the instruction is cached until it is monitored that the running status of all the associated process modules is normal and then the instruction is issued.
8. A memory control device, characterized in that: include: A memory allocation module is configured to allocate a memory upper limit to each process module in the storage system; wherein, when allocating a memory upper limit to each process module in the storage system, the total memory upper limit value does not exceed the remaining memory of the system; a target process module determination module, configured to periodically obtain the actual memory usage corresponding to the process modules at preset time intervals, and select the process modules whose actual memory usage is greater than the memory upper limit as target process modules; A memory adjustment module, configured to determine a memory upper limit adjustment method and increase the memory upper limit of the target process module according to the memory upper limit adjustment method; The method of determining the memory upper limit adjustment method includes: Calculate a screening threshold based on the actual memory usage of the target process module and a preset percentage; If there are other process modules whose remaining memory is greater than the screening threshold, then its memory upper limit is lowered according to the preset reduction range, and the recovered free memory is allocated to the target process module; If it does not exist, directly increase the memory limit of the target process module according to the preset increase range; the preset percentage, the preset decrease range and the preset increase range are configured based on historical data and cluster size; Among them, after raising the memory upper limit of the target process module according to the memory upper limit adjustment method, it also includes: when the total value of the memory upper limit after the increase exceeds the remaining memory of the system, restarting the target process module and restoring its memory upper limit to the most recent historical value.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the memory control method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that Used to store computer programs; wherein when the computer program is executed by a processor, the memory control method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Adjusting method and limiting method of internal memory quota and device thereof
CN103116516A
Data processing method and device
CN111190707A
Resource management method, device, equipment, medium and product
CN114116230A