A memory allocation speed control method, device, equipment and medium

By setting memory allocation speed limits for containers and dynamically adjusting target speeds, the problem of traditional memory processing methods being unable to respond to sudden memory demands in a timely manner is solved, achieving efficient and stable memory resource management in container scenarios.

CN121116652BActive Publication Date: 2026-05-01CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CLOUD TECH CO LTD
Filing Date
2025-11-13
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Traditional memory management methods cannot respond to sudden memory demands in container scenarios in a timely manner, leading to stuttering and anomalies, especially when memory is scarce, as they treat all containers equally and cannot effectively distinguish priorities.

Method used

By determining the priority of containers, setting memory allocation speed limits, and combining the current memory allocation speed with the amount of free memory, the target memory allocation speed is dynamically adjusted to control memory allocation in a targeted manner.

Benefits of technology

It enables more targeted and real-time control in memory resource management, avoiding system lag and anomalies, and improving the stability and controllability of memory resource management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121116652B_ABST
    Figure CN121116652B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a memory allocation speed control method, device, equipment and medium, the method comprises: determining the memory allocation speed limit of a container according to priority; performing memory allocation for the container according to the memory allocation speed limit; detecting the current memory allocation speed and the current free memory amount; determining a first amount threshold; in the case that the current memory allocation speed is greater than the memory allocation speed limit and the current free memory amount is lower than the first amount threshold, determining a target memory allocation speed; performing memory allocation for the container according to the target memory allocation speed. Embodiments of the present application determine the corresponding memory allocation speed limit for containers of different priorities, so that the monitoring is more targeted, so as to adjust the memory allocation speed of the speed overrun container when the memory allocation speed is overrun and the free memory is lower than the amount threshold, avoiding system lag or abnormality caused by response lag, and improving the real-time performance and stability of memory resource management.
Need to check novelty before this filing date? Find Prior Art

Description

A method, apparatus, device, and medium for controlling memory allocation speed. Technical Field

[0001] This invention relates to the field of cloud computing technology, and in particular to a memory allocation speed control method and a memory allocation speed control device. Background Technology

[0002] In container scenarios, traditional memory management typically involves periodic or reactive memory reclamation mechanisms triggered after the memory threshold is breached, treating all containers equally. However, when memory is scarce, especially when sudden surges in memory allocation demands cause the memory usage threshold to be rapidly exceeded, this traditional approach, treating all containers equally, may fail to respond and resolve the issue promptly. This can lead to prolonged lag or even trigger various anomalies, such as kernel soft deadlocks or kernel hard deadlocks. Summary of the Invention

[0003] In view of the above problems, embodiments of the present invention are proposed to provide a memory allocation speed control method, apparatus, device and medium that overcomes or at least partially solves the above problems.

[0004] According to a first aspect of the present invention, a memory allocation speed control method is provided, the method comprising:

[0005] Determine the priority of the container in which the task resides;

[0006] The memory allocation speed limit for the container is determined based on the container's priority.

[0007] Memory is allocated to the container according to the memory allocation speed limit;

[0008] Detect the current memory allocation speed and the current amount of free memory.

[0009] Determine the first remaining threshold for free memory;

[0010] If the current memory allocation speed is greater than the memory allocation speed limit, and the current free memory balance is lower than the first balance threshold, then the target memory allocation speed of the container is determined; the target memory allocation speed is less than the current memory allocation speed.

[0011] Memory is allocated to the container according to the target memory allocation speed.

[0012] Optionally, determining the priority of the container where the task resides includes:

[0013] Obtain task information; the task information includes at least one of business attributes, importance, and operational characteristics.

[0014] The priority of the container containing the task is determined based on the task information.

[0015] Optionally, the priority of the container is positively correlated with the memory allocation speed limit of the container.

[0016] Optionally, determining the target memory allocation speed of the container includes:

[0017] Adjust the memory allocation speed of the tasks within the container until the current memory allocation speed is less than or equal to the memory allocation speed limit, and the current free memory balance of the system is greater than or equal to the balance threshold.

[0018] The adjusted memory allocation speed is determined as the target memory allocation speed.

[0019] Optionally, the method further includes:

[0020] Determine a second reserve threshold for the free memory of the container; the second reserve threshold is less than the first reserve threshold;

[0021] If the current memory allocation speed is greater than the memory allocation speed limit and the current free memory balance of the container is lower than the second balance threshold, determine the duration for which memory allocation to the container will be stopped.

[0022] After the specified time has elapsed, memory will be reallocated to the container.

[0023] Optionally, determining the time period for stopping memory allocation for the container includes:

[0024] Determine the speed difference between the current memory allocation speed of the container and the memory allocation speed limit;

[0025] Determine the ratio of the speed difference to the memory allocation speed limit;

[0026] Obtain the preset coefficients;

[0027] The duration for which memory allocation for the container is stopped is determined by multiplying the preset coefficient by the ratio.

[0028] Optionally, the method further includes:

[0029] A third margin threshold for the free memory of the container is determined; the third margin threshold is less than the second margin threshold.

[0030] If the current memory allocation speed is greater than the memory allocation speed limit and the current container's free memory is less than the third reserve threshold, stop allocating memory for the target container until the current system's free memory is greater than the third reserve threshold.

[0031] According to a second aspect of the present invention, a memory allocation speed control device is provided, the device comprising:

[0032] The priority determination module is used to determine the priority of the container in which the task resides;

[0033] A memory allocation speed limit determination module is used to determine the memory allocation speed limit of the container based on the priority of the container;

[0034] The first memory allocation module is used to allocate memory to the container according to the memory allocation speed limit;

[0035] The detection module is used to detect the current memory allocation speed and the current amount of free memory.

[0036] The first margin threshold determination module is used to determine the first margin threshold of free memory;

[0037] A target memory allocation speed determination module is used to determine the target memory allocation speed of the container when the current memory allocation speed is greater than the memory allocation speed limit and the current free memory balance is lower than the first balance threshold; the target memory allocation speed is less than the current memory allocation speed.

[0038] The second memory allocation module is used to allocate memory to the container according to the target memory allocation speed.

[0039] Optionally, the priority determination module includes:

[0040] The task information acquisition submodule is used to acquire task information; the task information includes at least one of business attributes, importance, and operational characteristics.

[0041] The priority determination submodule is used to determine the priority of the container where the task is located based on the task information.

[0042] Optionally, the priority of the container is positively correlated with the memory allocation speed limit of the container.

[0043] Optionally, the target memory allocation speed determination module includes:

[0044] The speed adjustment submodule is used to adjust the memory allocation speed of tasks within the container until the current memory allocation speed is less than or equal to the memory allocation speed limit, and the current system's free memory balance is greater than or equal to the balance threshold.

[0045] The target memory allocation speed determination submodule is used to determine the adjusted memory allocation speed as the target memory allocation speed.

[0046] Optionally, the device further includes:

[0047] The second reserve threshold determination module is used to determine a second reserve threshold of the free memory of the container; the second reserve threshold is less than the first reserve threshold.

[0048] The duration determination module is used to determine the duration for which memory allocation for the container will be stopped when the current memory allocation speed is greater than the memory allocation speed limit and the current free memory balance of the container is lower than the second balance threshold.

[0049] The third memory allocation module is used to reallocate memory for the container after the specified time has elapsed.

[0050] Optionally, the duration determination module includes:

[0051] The speed difference determination submodule is used to determine the speed difference between the current memory allocation speed of the container and the memory allocation speed limit;

[0052] The ratio determination submodule is used to determine the ratio of the speed difference to the memory allocation speed limit;

[0053] The coefficient acquisition submodule is used to acquire preset coefficients;

[0054] The duration determination submodule is used to determine the duration for which memory allocation for the container is stopped based on the product of the preset coefficient and the ratio.

[0055] Optionally, the device further includes:

[0056] The third margin threshold determination module is used to determine a third margin threshold for the free memory of the container; the third margin threshold is less than the second margin threshold.

[0057] The allocation stop module is used to stop allocating memory to the target container when the current memory allocation speed is greater than the memory allocation speed limit and the current container's free memory balance is lower than the third balance threshold, until the current system's free memory balance is greater than the third balance threshold.

[0058] According to a third aspect of the present invention, an electronic device is provided, the electronic device comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the memory allocation speed control method as described in any of the preceding claims.

[0059] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the memory allocation speed control method as described in any of the preceding claims.

[0060] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects:

[0061] This invention provides a method for controlling memory allocation speed. The method involves: determining a memory allocation speed limit for a container based on its priority; allocating memory to the container according to the memory allocation speed limit; detecting the current memory allocation speed and the current free memory balance; determining a first reserve threshold; determining a target memory allocation speed when the current memory allocation speed exceeds the memory allocation speed limit and the current free memory balance is lower than the first reserve threshold; and allocating memory to the container according to the target memory allocation speed. By determining corresponding memory allocation speed limits for containers with different priorities, this invention makes monitoring more targeted. When the memory allocation speed exceeds the limit and free memory is lower than the reserve threshold, the memory allocation speed of the container exceeding the limit can be adjusted accordingly, avoiding system stuttering or anomalies caused by response lag and improving the real-time performance and stability of memory resource management. Attached Figure Description

[0062] Figure 1 is a flowchart of a memory allocation speed control method provided in an embodiment of the present invention;

[0063] Figure 2 is a flowchart of another memory allocation speed control method provided in an embodiment of the present invention;

[0064] Figure 3 is a schematic diagram of a scenario for a memory allocation speed control method provided in an embodiment of the present invention;

[0065] Figure 4 is a structural block diagram of a memory allocation speed control device provided in an embodiment of the present invention. Detailed Implementation

[0066] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0067] One of the core concepts of this invention is that by determining corresponding memory allocation speed limits for containers with different priorities, the monitoring becomes more targeted. When the memory allocation speed exceeds the limit and the free memory is below the margin threshold, the memory allocation speed of the container that exceeds the limit can be adjusted in a targeted manner, avoiding system lag or abnormalities caused by response delays and improving the real-time performance and stability of memory resource management.

[0068] Referring to Figure 1, a flowchart of a memory allocation speed control method according to an embodiment of the present invention is shown. The method may specifically include the following steps:

[0069] Step 101: Determine the priority of the container where the task resides;

[0070] For example, when memory resources are scarce or there are sudden allocation requests, treating all containers equally for memory allocation or reclamation can easily lead to critical services laging or even crashing due to insufficient resources, while low-priority tasks continue to consume large amounts of resources. By mapping task information to priorities, the system can establish a "priority-based" resource scheduling logic: high-priority containers can obtain higher memory allocation speed limits to ensure their performance is not affected; low-priority containers are actively speed-limited when the system is under heavy pressure to prevent them from excessively consuming resources. This priority-based speed control mechanism makes memory management proactive and adaptive, enabling timely intervention in high-risk containers before idle memory is exhausted, preventing the system from falling into an irreversible overload state. In addition, the priority mechanism also enhances the maintainability and policy flexibility of the system, making it easier for operations and maintenance personnel to dynamically adjust policies according to business objectives. Therefore, determining container priorities based on task information is a core element in achieving efficient, stable, and controllable memory management.

[0071] Step 102: Determine the memory allocation speed limit of the container based on its priority;

[0072] For example, different containers carry tasks with varying degrees of importance, real-time requirements, and tolerance for response latency. High-priority containers typically run core business services (such as payment, authentication, and real-time communication), which have extremely high requirements for the timeliness and continuity of memory allocation. If memory allocation is delayed or blocked due to resource contention, it may lead to service timeouts, degraded user experience, or even business interruptions. Low-priority containers, on the other hand, may run batch processing tasks, log collection, or non-critical background services, and have a higher tolerance for resource fluctuations. Applying a uniform memory allocation speed limit to all containers can easily lead to resource mismatch: on the one hand, critical tasks may experience performance degradation due to the inability to acquire memory in a timely manner; on the other hand, non-critical tasks may continue to request memory at high speed, exacerbating system stress. By binding container priority to memory allocation speed limits, the system can allocate higher memory acquisition bandwidth to high-priority containers, ensuring their rapid response under sudden loads; at the same time, speed limits are imposed on low-priority containers to prevent them from "preempting" resources when memory is scarce, thereby achieving orderly resource scheduling. Furthermore, this priority-based speed quota mechanism boasts excellent scalability and policy flexibility, allowing for dynamic adjustment of quota policies based on business needs and enabling proactive resource control through real-time monitoring. Therefore, setting memory allocation speed quotas based on container priority is a key technical means for building highly available and responsive container platforms. It helps avoid system jitter, stuttering, and even deadlocks caused by resource contention, significantly improving the real-time performance and controllability of memory management.

[0073] Step 103: Allocate memory for the container according to the memory allocation speed limit;

[0074] For example, in a containerized environment, memory resources are limited and shared. If the memory allocation rate of each container is not constrained, some containers with sudden and rapidly increasing memory demands may request a large amount of memory in a short period of time, quickly consuming the system's idle memory. This can trigger the kernel-level global memory reclamation mechanism, causing the entire system to lag, experience latency fluctuations, or even service interruptions. By pre-setting memory allocation rate limits based on container priority and strictly enforcing these limits during the allocation process, the memory allocation rate is kept within a reasonable range. This mechanism can smooth out sudden fluctuations in memory demand, prevent resources from being exhausted instantly, and allow the system sufficient response time to schedule resources or initiate reclamation strategies. More importantly, the quota-based allocation method achieves predictability and fairness in resource allocation: high-priority containers can obtain higher allocation bandwidth, ensuring the smooth operation of their critical services; low-priority containers, although rate-limited, can still obtain resources on demand, avoiding complete starvation. In addition, this mechanism forms a closed-loop control with subsequent dynamic adjustment strategies (such as further reducing the allocation rate of over-limited containers when idle memory is insufficient), improving the initiative and fine-grained level of memory management. Therefore, allocating memory according to the speed limit is not only an effective constraint on resource abuse, but also a core guarantee for building a stable, controllable, and high-quality service container operating environment.

[0075] Step 104: Detect the current memory allocation speed and the current amount of free memory.

[0076] For example, the current memory allocation speed reflects how quickly each container requests memory per unit of time, and is a core indicator for measuring the intensity of its resource consumption behavior. If a container's memory allocation speed consistently exceeds its preset limit, it indicates potential memory leaks, sudden loads, or resource abuse, posing a potential threat to system stability. Meanwhile, the current free memory directly reflects the sufficiency of the system's remaining available resources, and is an important global indicator for determining whether the system is under memory pressure. Monitoring only a single indicator cannot comprehensively assess the risk: for example, even if there is sufficient free memory, if multiple containers request memory at high speed, the system may quickly exhaust its resources; conversely, if free memory is low but all containers are running at low speed, the system remains under control. Therefore, both parameters must be monitored simultaneously to accurately identify the high-risk combination of "high memory request rate + low free memory," enabling timely warnings and the activation of control mechanisms. This dual-parameter joint monitoring mechanism enhances the system's ability to perceive memory pressure, enabling resource management to shift from passive response to proactive prevention. It effectively avoids resource out-of-control situations caused by information lag and provides real-time, reliable input data for subsequent priority-based speed adjustment strategies. It is a fundamental step in achieving refined and intelligent memory management.

[0077] Step 105: Determine the first remaining threshold for free memory;

[0078] For example, the first margin threshold is a pre-defined critical waterline representing the safe level of free memory the system can tolerate. When the current free memory margin is higher than this threshold, it indicates that system resources are relatively abundant, and containers can request memory normally according to their limits. Once the free memory falls below this threshold, it means that the system is approaching a resource bottleneck, and intervention measures must be initiated to prevent further deterioration. By setting this threshold, the system can shift memory management from "post-event processing" to "pre-event prevention," avoiding extreme measures (such as forcibly killing processes) only after memory is completely exhausted. In addition, the setting of the first margin threshold can be dynamically adjusted in conjunction with factors such as total system memory, core service guarantee requirements, and page reclamation efficiency, providing good flexibility and adaptability. It works in conjunction with the memory allocation speed limit to form a dual judgment condition, ensuring that the control strategy is only activated when truly needed, avoiding misjudgment and over-intervention. Therefore, the first margin threshold is a "safety barrier" in the entire memory speed control mechanism, providing the system with a time window to respond to memory pressure in advance, and is a key design for ensuring system stability and service quality.

[0079] Step 106: If the current memory allocation speed is greater than the memory allocation speed limit and the current free memory balance is lower than the first balance threshold, determine the target memory allocation speed of the container; the target memory allocation speed is less than the current memory allocation speed.

[0080] For example, judging any one condition alone can lead to misjudgment: if speed is reduced solely due to memory allocation exceeding limits, even if the system has sufficient free memory, it may unnecessarily suppress normal business bursts, impacting service performance; conversely, if speed is limited for all containers simply because of low free memory, even if some containers actually request very little memory, it will cause "false positives," reducing resource utilization. Therefore, both the "overspeed" and "low margin" conditions must be met simultaneously to confirm that the container is the main contributor to the current system pressure, making it reasonable and urgent to adjust its behavior. In this case, the system determines a lower target memory allocation speed, which is essentially implementing a dynamic, priority-based resource throttling strategy. This target speed is typically set in stages based on container priority, the degree of exceeding limits, and the system pressure level, ensuring that high-priority containers still receive relatively more resource quotas, while low-priority "resource hogs" are significantly speed-limited. This mechanism achieves precise and differentiated resource control, effectively curbing resource abuse while ensuring the basic operational needs of critical businesses. By reducing the target allocation rate, the system can slow down the rate of memory consumption, buying valuable time for the background memory reclamation mechanism and preventing the triggering of more serious global events. Therefore, the combination of this conditional judgment and speed adjustment strategy reflects a shift from passive response to proactive defense, significantly improving the real-time performance, intelligence, and overall system stability of memory management.

[0081] Step 107: Allocate memory for the container according to the target memory allocation speed.

[0082] For example, the target memory allocation rate is a new, lower resource quota generated by the system after comprehensively evaluating container behavior and system status. It represents the highest memory request rate allowed for the container under current pressure. By forcing allocation at this rate, the system can effectively curb the container's memory consumption momentum, preventing it from further exacerbating the already strained system. This rate-limiting allocation mechanism is similar to traffic shaping in networks, smoothing fluctuations in memory demand by throttling resource flows, and providing sufficient response time for the kernel's memory reclamation mechanism to gradually release reclaimable memory and restore free memory levels. Simultaneously, this strategy is selective and priority-aware, limiting the rate only for non-compliant and high-risk containers, while having minimal impact on normal or high-priority containers, ensuring the continuity of core business operations. Furthermore, allocating at the target rate is a reversible and gradual controllable method, with less impact on applications and more controllable system behavior compared to directly rejecting memory requests or terminating processes. Therefore, the execution target allocation speed is a key execution link in the entire memory speed control closed loop, ensuring the complete implementation of the strategy from "monitoring" to "decision-making" and then to "action", and is the core guarantee for improving system elasticity, stability and resource utilization efficiency.

[0083] This invention provides a method for controlling memory allocation speed. The method involves: determining a memory allocation speed limit for a container based on its priority; allocating memory to the container according to the memory allocation speed limit; detecting the current memory allocation speed and the current free memory balance; determining a first reserve threshold; determining a target memory allocation speed when the current memory allocation speed exceeds the memory allocation speed limit and the current free memory balance is lower than the first reserve threshold; and allocating memory to the container according to the target memory allocation speed. By determining corresponding memory allocation speed limits for containers with different priorities, this invention makes monitoring more targeted. When the memory allocation speed exceeds the limit and free memory is lower than the reserve threshold, the memory allocation speed of the container exceeding the limit can be adjusted accordingly, avoiding system stuttering or anomalies caused by response lag and improving the real-time performance and stability of memory resource management.

[0084] Referring to Figure 2, a flowchart of another memory allocation speed control method provided by an embodiment of the present invention is shown. The method may specifically include the following steps:

[0085] Step 201: Obtain task information; the task information includes at least one of business attributes, importance, and operational characteristics;

[0086] For example, in a containerized environment, the tasks carried by different containers vary significantly in terms of business functions, system impact, and operating modes. Therefore, it is necessary to obtain task information (including business attributes, importance, and operational characteristics) to comprehensively characterize the actual needs and system role of each task. Business attributes reflect the application type or service category to which the task belongs, such as whether it is a front-end service, back-end computing, or data storage, which determines its sensitivity to memory response speed. Importance indicators are used to distinguish the criticality of tasks; for example, the weight of core transaction services and log collection services in system stability is significantly different. Operational characteristics include dynamic behavioral data such as historical memory allocation rates, burst frequencies, and peak loads, which help predict future resource demand trends. By collecting this multi-dimensional task information, objective and fine-grained judgment criteria can be provided for subsequent prioritization.

[0087] Step 202: Determine the priority of the container where the task is located based on the task information;

[0088] For example, determining the priority of a container based on task information is crucial for differentiated and intelligent scheduling of memory resources. This ensures that high-value, highly sensitive tasks receive adequate protection in resource competition, thereby improving the overall responsiveness and stability of the system. When memory resources are scarce or there are sudden allocation requests, treating all containers equally for memory allocation or reclamation can easily lead to critical services becoming sluggish or even crashing due to insufficient resources, while low-priority tasks continue to consume significant resources. By mapping task information to priorities, the system can establish a "priority-based" resource scheduling logic: high-priority containers receive higher memory allocation speed limits to ensure their performance is unaffected; low-priority containers are proactively speed-limited when the system is under heavy load to prevent excessive resource consumption. This priority-based speed control mechanism makes memory management proactive and adaptable, enabling timely intervention in high-risk containers before idle memory is exhausted, preventing the system from falling into an irreversible overload state. Furthermore, the priority mechanism enhances system maintainability and policy flexibility, allowing operations personnel to dynamically adjust strategies based on business objectives. Therefore, determining container priorities based on task information is a core element in achieving efficient, stable, and controllable memory management.

[0089] Step 203: Determine the memory allocation speed limit of the container based on its priority;

[0090] For example, different containers carry tasks with varying degrees of importance, real-time requirements, and tolerance for response latency. High-priority containers typically run core business services (such as payment, authentication, and real-time communication), which have extremely high requirements for the timeliness and continuity of memory allocation. If memory allocation is delayed or blocked due to resource contention, it may lead to service timeouts, degraded user experience, or even business interruptions. Low-priority containers, on the other hand, may run batch processing tasks, log collection, or non-critical background services, and have a higher tolerance for resource fluctuations. Applying a uniform memory allocation speed limit to all containers can easily lead to resource mismatch: on the one hand, critical tasks may experience performance degradation due to the inability to acquire memory in a timely manner; on the other hand, non-critical tasks may continue to request memory at high speed, exacerbating system stress. By binding container priority to memory allocation speed limits, the system can allocate higher memory acquisition bandwidth to high-priority containers, ensuring their rapid response under sudden loads; at the same time, speed limits are imposed on low-priority containers to prevent them from "preempting" resources when memory is scarce, thereby achieving orderly resource scheduling. Furthermore, this priority-based speed quota mechanism boasts excellent scalability and policy flexibility, allowing for dynamic adjustment of quota policies based on business needs and enabling proactive resource control through real-time monitoring. Therefore, setting memory allocation speed quotas based on container priority is a key technical means for building highly available and responsive container platforms. It helps avoid system jitter, stuttering, and even deadlocks caused by resource contention, significantly improving the real-time performance and controllability of memory management.

[0091] Step 204: Allocate memory for the container according to the memory allocation speed limit;

[0092] For example, in a containerized environment, memory resources are limited and shared. If the memory allocation rate of each container is not constrained, some containers with sudden and rapidly increasing memory demands may request a large amount of memory in a short period of time, quickly consuming the system's idle memory. This can trigger the kernel-level global memory reclamation mechanism, causing the entire system to lag, experience latency fluctuations, or even service interruptions. By pre-setting memory allocation rate limits based on container priority and strictly enforcing these limits during the allocation process, the memory allocation rate is kept within a reasonable range. This mechanism can smooth out sudden fluctuations in memory demand, prevent resources from being exhausted instantly, and allow the system sufficient response time to schedule resources or initiate reclamation strategies. More importantly, the quota-based allocation method achieves predictability and fairness in resource allocation: high-priority containers can obtain higher allocation bandwidth, ensuring the smooth operation of their critical services; low-priority containers, although rate-limited, can still obtain resources on demand, avoiding complete starvation. In addition, this mechanism forms a closed-loop control with subsequent dynamic adjustment strategies (such as further reducing the allocation rate of over-limited containers when idle memory is insufficient), improving the initiative and fine-grained level of memory management. Therefore, allocating memory according to the speed limit is not only an effective constraint on resource abuse, but also a core guarantee for building a stable, controllable, and high-quality service container operating environment.

[0093] Step 205: Detect the current memory allocation speed and the current amount of free memory.

[0094] For example, the current memory allocation speed reflects how quickly each container requests memory per unit of time, and is a core indicator for measuring the intensity of its resource consumption behavior. If a container's memory allocation speed consistently exceeds its preset limit, it indicates potential memory leaks, sudden loads, or resource abuse, posing a potential threat to system stability. Meanwhile, the current free memory directly reflects the sufficiency of the system's remaining available resources, and is an important global indicator for determining whether the system is under memory pressure. Monitoring only a single indicator cannot comprehensively assess the risk: for example, even if there is sufficient free memory, if multiple containers request memory at high speed, the system may quickly exhaust its resources; conversely, if free memory is low but all containers are running at low speed, the system remains under control. Therefore, both parameters must be monitored simultaneously to accurately identify the high-risk combination of "high memory request rate + low free memory," providing timely warnings and initiating control mechanisms. Furthermore, a monitoring cycle can be set to control the resource overhead of memory allocation speed monitoring and minimize performance loss. This dual-parameter joint monitoring mechanism enhances the system's ability to perceive memory pressure, enabling resource management to shift from passive response to proactive prevention. It effectively avoids resource out-of-control situations caused by information lag and provides real-time, reliable input data for subsequent priority-based speed adjustment strategies. It is a fundamental step in achieving refined and intelligent memory management.

[0095] Referring to Figure 3, a schematic diagram of a memory allocation speed control method according to an embodiment of the present invention is shown. The user configuration module configures the upper threshold for memory allocation speed and the remaining threshold information of idle memory for the memory allocation speed control function. Alternatively, the system can automatically optimize the settings. The memory allocation speed monitoring module monitors and calculates the memory allocation speed of each container in real time and updates the corresponding statistical data. The memory allocation speed control module, based on real-time memory allocation monitoring data and the remaining threshold information of idle memory, determines whether the standard for triggering the relevant control capabilities of the memory allocation control module has been met. If so, the corresponding module function is triggered. Simultaneously, based on the current real-time memory allocation speed and its own design and mechanisms, the module reduces the speed or suppresses the execution of memory allocation processes, and adjusts its suppression logic according to the set upper threshold for memory allocation speed to accurately limit the memory allocation speed.

[0096] Step 206: Determine the first remaining threshold for free memory;

[0097] For example, the first margin threshold is a pre-defined critical waterline representing the safe level of free memory the system can tolerate. When the current free memory margin is higher than this threshold, it indicates that system resources are relatively abundant, and containers can request memory normally according to their limits. Once the free memory falls below this threshold, it means that the system is approaching a resource bottleneck, and intervention measures must be initiated to prevent further deterioration. By setting this threshold, the system can shift memory management from "post-event processing" to "pre-event prevention," avoiding extreme measures (such as forcibly killing processes) only after memory is completely exhausted. In addition, the setting of the first margin threshold can be dynamically adjusted in conjunction with factors such as total system memory, core service guarantee requirements, and page reclamation efficiency, providing good flexibility and adaptability. It works in conjunction with the memory allocation speed limit to form a dual judgment condition, ensuring that the control strategy is only activated when truly needed, avoiding misjudgment and over-intervention. Therefore, the first margin threshold is a "safety barrier" in the entire memory speed control mechanism, providing the system with a time window to respond to memory pressure in advance, and is a key design for ensuring system stability and service quality.

[0098] Step 207: If the current memory allocation speed is greater than the memory allocation speed limit and the current free memory balance is lower than the first balance threshold, determine the target memory allocation speed of the container; the target memory allocation speed is less than the current memory allocation speed.

[0099] For example, judging any one condition alone can lead to misjudgment: if speed is reduced solely due to memory allocation exceeding limits, even if the system has sufficient free memory, it may unnecessarily suppress normal business bursts, impacting service performance; conversely, if speed is limited for all containers simply because of low free memory, even if some containers actually request very little memory, it will cause "false positives," reducing resource utilization. Therefore, both the "overspeed" and "low margin" conditions must be met simultaneously to confirm that the container is the main contributor to the current system pressure, making it reasonable and urgent to adjust its behavior. In this case, the system determines a lower target memory allocation speed, which is essentially implementing a dynamic, priority-based resource throttling strategy. This target speed is typically set in stages based on container priority, the degree of exceeding limits, and the system pressure level, ensuring that high-priority containers still receive relatively more resource quotas, while low-priority "resource hogs" are significantly speed-limited. This mechanism achieves precise and differentiated resource control, effectively curbing resource abuse while ensuring the basic operational needs of critical businesses. By reducing the target allocation rate, the system can slow down the rate of memory consumption, buying valuable time for the background memory reclamation mechanism and preventing the triggering of more serious global events. Therefore, the combination of this conditional judgment and speed adjustment strategy reflects a shift from passive response to proactive defense, significantly improving the real-time performance, intelligence, and overall system stability of memory management.

[0100] In one embodiment, step 207 includes the following sub-steps:

[0101] Sub-step S11: Adjust the memory allocation speed of the tasks within the container until the current memory allocation speed is less than or equal to the memory allocation speed limit, and the current system's free memory balance is greater than or equal to the balance threshold.

[0102] For example, when a container is detected to be requesting memory at an excessively high speed and the system's free memory has fallen below the first reserve threshold, it indicates that the system is facing the risk of resource exhaustion. At this point, simply setting a target speed is insufficient to ensure the problem is resolved; the container's memory allocation behavior must be continuously adjusted to force its actual allocation rate to gradually decrease until it no longer exceeds its allocated quota. More importantly, the termination condition for this adjustment not only requires speed compliance but also that the system's free memory recovers to a safe level. This means that the kernel's memory reclamation mechanism must have sufficient time to release resources, and the overall system pressure must be substantially alleviated. If only speed compliance is restored but free memory remains insufficient, the system remains vulnerable, and a sudden memory request from another container could immediately trigger another crisis. Therefore, the design of dual recovery conditions ensures the thoroughness of the adjustment and system stability. By continuously adjusting until both conditions are met, the system achieves a smooth transition from emergency response to normal recovery, improving the robustness of resource management and the quality of service assurance capabilities.

[0103] Sub-step S12: Determine the adjusted memory allocation speed as the target memory allocation speed.

[0104] For example, after continuously adjusting the container's memory allocation speed, the system has brought the container's actual allocation behavior back to compliance (within limits), and the system's free memory has recovered to above a safe threshold, indicating that the system has moved beyond an emergency state. At this point, setting the allocation speed that reached a stable state during the adjustment process as the target memory allocation speed essentially records this safe and controllable operating parameter as a new benchmark for the container in the current system environment. This target speed may be lower than its original limit, reflecting the system's constraints on its resource usage behavior and demonstrating the dynamic adaptability of the priority scheduling strategy. Specifying it as a target helps the system continuously enforce this rate-limiting strategy in subsequent allocations, preventing the container from immediately accelerating memory requests again after recovery, thus avoiding a recurrence of the problem. Furthermore, this target speed can serve as data for future strategy optimization, such as analyzing container behavior patterns, optimizing initial limits, or adjusting priorities.

[0105] Step 208: Allocate memory for the container according to the target memory allocation speed.

[0106] For example, the target memory allocation rate is a new, lower resource quota generated by the system after comprehensively evaluating container behavior and system status. It represents the highest memory request rate allowed for the container under current pressure. By forcing allocation at this rate, the system can effectively curb the container's memory consumption momentum, preventing it from further exacerbating the already strained system. This rate-limiting allocation mechanism is similar to traffic shaping in networks, smoothing fluctuations in memory demand by throttling resource flows, and providing sufficient response time for the kernel's memory reclamation mechanism to gradually release reclaimable memory and restore free memory levels. Simultaneously, this strategy is selective and priority-aware, limiting the rate only for non-compliant and high-risk containers, while having minimal impact on normal or high-priority containers, ensuring the continuity of core business operations. Furthermore, allocating at the target rate is a reversible and gradual controllable method, with less impact on applications and more controllable system behavior compared to directly rejecting memory requests or terminating processes. Therefore, the execution target allocation speed is a key execution link in the entire memory speed control closed loop, ensuring the complete implementation of the strategy from "monitoring" to "decision-making" and then to "action", and is the core guarantee for improving system elasticity, stability and resource utilization efficiency.

[0107] In one embodiment, the priority of the container is positively correlated with the memory allocation speed limit of the container.

[0108] For example, different containers carry significantly different business functions and levels of criticality. High-priority containers, such as core transaction services and real-time computing tasks, have extremely high requirements for response latency and operational continuity, while low-priority containers, such as log collection and monitoring agents, have strong resource elasticity. If all containers use the same memory allocation speed limit, in scenarios of system resource scarcity or sudden load, high-priority containers may experience lag, timeouts, or even service interruptions due to their inability to acquire memory in a timely manner, severely impacting user experience and business availability. By establishing a positive correlation between priority and memory allocation speed limit, the system can allocate higher memory request bandwidth to high-priority containers, enabling them to quickly obtain the necessary resources when needed, reducing the risk of performance degradation caused by memory allocation latency. At the same time, although low-priority containers are given lower allocation speed limits, they can still make full use of resources when the system is idle, ensuring resource utilization. More importantly, this design supports dynamic policy adjustment; priority can be adjusted according to changes in business load, time policies, or operational instructions, and memory quotas can be adjusted accordingly, enhancing the system's flexibility and manageability.

[0109] In one embodiment, the method further includes: determining a second reserve threshold for the free memory of the container; the second reserve threshold being less than a first reserve threshold; determining a duration for stopping memory allocation for the container when the current memory allocation speed is greater than the memory allocation speed limit and the current free memory reserve of the container is less than the second reserve threshold; and reallocating memory for the container after the duration has elapsed.

[0110] For example, the first margin threshold is used to trigger regular memory allocation rate limiting, suitable for moderate resource pressure scenarios, aiming to balance supply and demand by reducing the allocation rate. The second margin threshold, as a more stringent "red alert line," represents a scenario under greater resource pressure, where rate limiting alone may not be sufficient to prevent free memory from being rapidly exhausted. In this critical state, if a container is still requesting memory at an excessively high rate, it indicates extremely aggressive resource consumption behavior, highly likely due to memory leaks, program abnormalities, or malicious load. Continuing to allocate memory to it will greatly increase the risk of triggering OOM (Out-of-Memory), kernel soft deadlock, system crashes, etc. Therefore, when the system detects the dual extreme conditions of "allocation rate exceeding the limit + free memory falling below the second threshold," it no longer uses gradual rate limiting but takes a more decisive measure—temporarily and completely stopping memory allocation to the container, equivalent to "resource circuit breaking." This pause operation can immediately cut off further consumption of the system's remaining memory, buying a critical time window for the kernel reclamation mechanism and preventing the entire system from becoming unusable. Meanwhile, setting a "pause duration" and resuming allocation after it ends demonstrates the temporary and controllable nature of this mechanism: on the one hand, it avoids permanent interruptions that could lead to complete service failure; on the other hand, by forcing abnormal containers to pause requests through a brief "cooling-off" period, it may prompt them to trigger internal error handling or release some memory. After recovery, the system can reassess its behavior and decide whether to rate limit or stop again. Therefore, this design achieves a progressive defense from "rate limiting" to "circuit breaking," significantly enhancing the system's survivability and self-healing capabilities under extreme pressure.

[0111] In one embodiment, determining the time period for stopping memory allocation for the container includes: determining the speed difference between the current memory allocation speed of the container and the memory allocation speed limit; determining the ratio of the speed difference to the memory allocation speed limit; obtaining a preset coefficient; and determining the duration for stopping memory allocation for the container based on the product of the preset coefficient and the ratio.

[0112] For example, the relative degree of container overspeeding—for instance, a container with a 100MB / s limit running at 120MB / s exceeds the limit by 20%; another container with the same limit running at 200MB / s exceeds the limit by 100%, the latter being clearly more harmful. This ratio reflects the severity of resource abuse and serves as a basis for dynamically adjusting the penalty intensity. Introducing a preset coefficient allows for configuring the overall system's control sensitivity; for example, a smaller coefficient can be set in high-availability scenarios to mitigate the impact, while a larger coefficient can be set in testing or security-priority scenarios to strengthen constraints. Finally, the duration obtained by multiplying the coefficient by the ratio implements an intelligent control logic where the more severe the violation, the longer the suspension, ensuring that the circuit breaker mechanism is both deterrent and reasonable. This method improves the flexibility and intelligence of memory management, enabling the system to effectively curb high-risk containers under extreme pressure while dynamically adjusting strategies based on actual behavior, ensuring a balance between overall stability and business continuity.

[0113] In one embodiment, the method further includes: determining a third margin threshold for the free memory of the container; the third margin threshold being less than a second margin threshold; and stopping memory allocation for the target container when the current memory allocation speed is greater than the memory allocation speed limit and the current free memory margin of the container is less than the third margin threshold, until the current system's free memory margin is greater than the third margin threshold.

[0114] For example, the first and second margin thresholds correspond to the gradual responses of rate limiting and brief circuit breaking, respectively, while the third margin threshold represents a critical "life-or-death" state where the system has entered a state of extreme vulnerability. At this point, free memory is extremely low, barely enough to maintain basic kernel operation and critical interrupt handling. Any additional memory allocation request could directly lead to allocation failure or trigger an OutOfMemoryError (OOM), resulting in large-scale process killing and severely impacting system availability. In this situation, if a container is still requesting memory at a high speed exceeding its limit, it is highly likely to have a serious memory leak, an infinite loop, or malware. Continuing to serve it would greatly increase the risk of system crash. Therefore, the system must take the most decisive measure—permanently suspending memory allocation for it until the overall system free memory recovers to above the third threshold. Unlike the "timed pause" at the second threshold, the pause at the third threshold is "condition-driven," without a preset duration, but continuously blocking until system resources are substantially restored, ensuring that the resource supply for high-risk containers is never restarted before the system is out of danger. This mechanism provides an undisturbed execution window for kernel memory reclamation (such as page reclamation and cache cleanup), allowing it to fully release reclaimable memory and rebuild the safety buffer. Meanwhile, this strategy features automatic recovery capabilities, eliminating the need for manual intervention. Once free memory recovers, the system can reassess the container's behavior and decide whether to restore its normal quota. Therefore, the third margin threshold mechanism acts as the "ultimate circuit breaker" or "emergency brake" function within the entire memory control system, significantly enhancing the system's resilience and self-healing capabilities under extreme pressure, and ensuring platform-level stability and security.

[0115] This invention provides a method for controlling memory allocation speed. The method involves: determining a memory allocation speed limit for a container based on its priority; allocating memory to the container according to the memory allocation speed limit; detecting the current memory allocation speed and the current free memory balance; determining a first reserve threshold; determining a target memory allocation speed when the current memory allocation speed exceeds the memory allocation speed limit and the current free memory balance is lower than the first reserve threshold; and allocating memory to the container according to the target memory allocation speed. By determining corresponding memory allocation speed limits for containers with different priorities, this invention makes monitoring more targeted. When the memory allocation speed exceeds the limit and free memory is lower than the reserve threshold, the memory allocation speed of the container exceeding the limit can be adjusted accordingly, avoiding system stuttering or anomalies caused by response lag and improving the real-time performance and stability of memory resource management.

[0116] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0117] Referring to Figure 4, a structural block diagram of a memory allocation speed control device provided in an embodiment of the present invention is shown, which may specifically include the following modules:

[0118] Priority determination module 301 is used to determine the priority of the container where the task resides;

[0119] The memory allocation speed limit determination module 302 is used to determine the memory allocation speed limit of the container based on the priority of the container.

[0120] The first memory allocation module 303 is used to allocate memory to the container according to the memory allocation speed limit;

[0121] Detection module 304 is used to detect the current memory allocation speed and the current amount of free memory.

[0122] The first margin threshold determination module 305 is used to determine the first margin threshold of free memory;

[0123] The target memory allocation speed determination module 306 is used to determine the target memory allocation speed of the container when the current memory allocation speed is greater than the memory allocation speed limit and the current free memory balance is lower than the first balance threshold; the target memory allocation speed is less than the current memory allocation speed.

[0124] The second memory allocation module 307 is used to allocate memory to the container according to the target memory allocation speed.

[0125] In one embodiment, the priority determination module includes:

[0126] The task information acquisition submodule is used to acquire task information; the task information includes at least one of business attributes, importance, and operational characteristics.

[0127] The priority determination submodule is used to determine the priority of the container where the task is located based on the task information.

[0128] In one embodiment, the priority of the container is positively correlated with the memory allocation speed limit of the container.

[0129] In one embodiment, the target memory allocation speed determination module includes:

[0130] The speed adjustment submodule is used to adjust the memory allocation speed of tasks within the container until the current memory allocation speed is less than or equal to the memory allocation speed limit, and the current system's free memory balance is greater than or equal to the balance threshold.

[0131] The target memory allocation speed determination submodule is used to determine the adjusted memory allocation speed as the target memory allocation speed.

[0132] In one embodiment, the device further includes:

[0133] The second reserve threshold determination module is used to determine a second reserve threshold of the free memory of the container; the second reserve threshold is less than the first reserve threshold.

[0134] The duration determination module is used to determine the duration for which memory allocation for the container will be stopped when the current memory allocation speed is greater than the memory allocation speed limit and the current free memory balance of the container is lower than the second balance threshold.

[0135] The third memory allocation module is used to reallocate memory for the container after the specified time has elapsed.

[0136] In one embodiment, the duration determination module includes:

[0137] The speed difference determination submodule is used to determine the speed difference between the current memory allocation speed of the container and the memory allocation speed limit;

[0138] The ratio determination submodule is used to determine the ratio of the speed difference to the memory allocation speed limit;

[0139] The coefficient acquisition submodule is used to acquire preset coefficients;

[0140] The duration determination submodule is used to determine the duration for which memory allocation for the container is stopped based on the product of the preset coefficient and the ratio.

[0141] In one embodiment, the device further includes:

[0142] The third margin threshold determination module is used to determine a third margin threshold for the free memory of the container; the third margin threshold is less than the second margin threshold.

[0143] The allocation stop module is used to stop allocating memory to the target container when the current memory allocation speed is greater than the memory allocation speed limit and the current container's free memory balance is lower than the third balance threshold, until the current system's free memory balance is greater than the third balance threshold.

[0144] This invention provides a memory allocation speed control device that determines a memory allocation speed limit for containers based on their priority; allocates memory to containers according to the memory allocation speed limit; detects the current memory allocation speed and the current free memory balance; determines a first balance threshold; determines a target memory allocation speed when the current memory allocation speed exceeds the memory allocation speed limit and the current free memory balance is lower than the first balance threshold; and allocates memory to containers according to the target memory allocation speed. This invention, by determining corresponding memory allocation speed limits for containers with different priorities, makes monitoring more targeted. When the memory allocation speed exceeds the limit and the free memory is lower than the balance threshold, the memory allocation speed of containers exceeding the limit can be adjusted accordingly, avoiding system stuttering or anomalies caused by response lag, and improving the real-time performance and stability of memory resource management.

[0145] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0146] This invention also provides an electronic device, comprising:

[0147] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described memory allocation speed control method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0148] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described memory allocation speed control method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0149] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0150] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0151] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in one or more blocks of the flowchart illustrations and / or one or more blocks of the block diagrams.

[0152] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.

[0153] These computer program instructions may also be loaded onto a computer or other programmable data processing terminal equipment to cause a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable terminal equipment, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.

[0154] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0155] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0156] The present invention has provided a detailed description of a memory allocation speed control method and a memory allocation speed control device. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for controlling memory allocation speed, characterized in that, The method includes: determining the priority of the container where the task is located; determining the memory allocation speed limit of the container based on the priority of the container; the priority of the container is positively correlated with the memory allocation speed limit of the container; allocating memory to the container according to the memory allocation speed limit; detecting the current memory allocation speed and the current free memory balance; and determining a first free memory balance threshold. If the current memory allocation speed is greater than the memory allocation speed limit and the current free memory balance is lower than the first balance threshold, adjust the memory allocation speed of the tasks in the container until the current memory allocation speed is less than or equal to the memory allocation speed limit and the current system free memory balance is greater than or equal to the first balance threshold. The adjusted memory allocation speed is determined as the target memory allocation speed; The target memory allocation speed is less than the current memory allocation speed; memory is allocated to the container according to the target memory allocation speed; the method further includes: determining a second reserve threshold for the free memory of the container; the second reserve threshold is less than the first reserve threshold; when the current memory allocation speed is greater than the memory allocation speed limit and the current free memory reserve of the container is lower than the second reserve threshold, determining a duration for which memory allocation to the container is stopped; and re-allocating memory to the container after the specified duration.

2. The memory allocation speed control method according to claim 1, characterized in that, Determining the priority of the container where the task is located includes: obtaining task information; the task information includes at least one of business attributes, importance, and operational characteristics; and determining the priority of the container where the task is located based on the task information.

3. The memory allocation speed control method according to claim 1, characterized in that, The process of determining the time period for stopping memory allocation for the container includes: determining the speed difference between the current memory allocation speed of the container and the memory allocation speed limit; determining the ratio of the speed difference to the memory allocation speed limit; obtaining a preset coefficient; and determining the duration for stopping memory allocation for the container based on the product of the preset coefficient and the ratio.

4. The memory allocation speed control method according to claim 1, characterized in that, The method further includes: determining a third margin threshold for the free memory of the container; the third margin threshold is less than the second margin threshold; and when the current memory allocation speed is greater than the memory allocation speed limit and the current free memory margin of the container is lower than the third margin threshold, stopping memory allocation for the target container until the current system's free memory margin is greater than the third margin threshold.

5. A memory allocation speed control device, characterized in that, The device includes: a priority determination module for determining the priority of the container where the task resides; a memory allocation speed limit determination module for determining a memory allocation speed limit for the container based on the container's priority; the container's priority is positively correlated with the container's memory allocation speed limit; a first memory allocation module for allocating memory to the container according to the memory allocation speed limit; a detection module for detecting the current memory allocation speed and the current free memory balance; a first balance threshold determination module for determining a first free memory threshold; a target memory allocation speed determination module for determining a target memory allocation speed for the container when the current memory allocation speed is greater than the memory allocation speed limit and the current free memory balance is lower than the first balance threshold; the target memory allocation speed is less than the current memory allocation speed; and a second memory allocation module for allocating memory according to the target memory allocation speed. The device performs memory allocation for the container; wherein the target memory allocation speed determination module includes: a speed adjustment submodule, used to adjust the memory allocation speed of tasks within the container until the current memory allocation speed is less than or equal to the memory allocation speed limit, and the current system's free memory balance is greater than or equal to the balance threshold; a target memory allocation speed determination submodule, used to determine the adjusted memory allocation speed as the target memory allocation speed; the device further includes: a second balance threshold determination module, used to determine a second balance threshold of the container's free memory; the second balance threshold is less than the first balance threshold; a duration determination module, used to determine the duration for which memory allocation to the container will be stopped when the current memory allocation speed is greater than the memory allocation speed limit and the current container's free memory balance is lower than the second balance threshold; and a third memory allocation module, used to reallocate memory to the container after the duration has elapsed.

6. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the memory allocation speed control method as described in any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when executed by a processor, the computer program implements the steps of the memory allocation speed control method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Memory allocation method and device, electronic equipment and readable storage medium

    CN119149213A

  • Container resource adjustment method and device of virtualization system, equipment and storage medium

    CN119883645A