tencent cloud

Feedback

Fine-Grained Memory Scheduling

Last updated: 2024-12-24 15:40:59
    The fine-grained scheduling capability of memory provides a series of features to ensure the service quality for business memories. It comprehensively enhances the memory performance and flexibly limits the memory usage of a container.

    Feature 1: Asynchronous Reclamation

    Overview

    During the memory asynchronous reclamation, a threshold is allowed to be set within the container. Once this threshold is exceeded, backend asynchronous reclamation will be triggered, ensuring a certain amount of idle memory to be used and maintained within the corresponding memcg. It provides assurance for the subsequent memory allocation and reduces the frequency of direct memory reclamation.

    Operation Steps

    1. Deploy QoS Agent.
    2. On the Add-on management page in the cluster, locate the successfully deployed QoS Agent, and click Update Configuration on the right.
    3. On the add-on configuration page for modifying QoS Agent, select Memory QoS Enhancement.
    4. Click Complete.
    5. Deploy a business.
    6. Deploy the PodQOS object associated with the business, and select the business to apply, as shown below:
    apiVersion: ensurance.crane.io/v1alpha1
    kind: PodQOS
    metadata:
    name: sql
    spec:
    labelSelector:
    matchLabels:
    k8s-app: low # Select the business label to apply 
    resourceQOS:
    memoryQOS:
    memAsyncReclaim:
    asyncRatio: 90 # asyncRatio represents the threshold for asynchronous reclamation. Reclamation starts when memory usage exceeds this proportion in the cgroup. The value range is [0-100]. It is recommended to set above 90. It is 0 by default, which means off
    asyncDistanceFactor: 200 # asyncDistanceFactor controls the total number of pages to be reclaimed each time asynchronous reclamation is triggered. It is 1 by default, with the value range of [1, 150000]

    Feature 2: Classification of Global Threshold

    Overview

    Global threshold classification of the memory means that the cgroups with different priorities have different global memory thresholds; high-priority containers have lower thresholds and are more likely to obtain the memory under the same conditions; and low-priority containers have higher thresholds and are more likely to trigger reclamation to enter the direct reclamation process under the same conditions.

    Operation Steps

    1. Deploy QoS Agent.
    2. On the Add-on management page in the cluster, locate the successfully deployed QoS Agent, and click the Update Configuration on the right.
    3. On the add-on configuration page, select the Memory QoS Enhancement.
    4. Click Complete.
    5. Deploy a business.
    6. Deploy the PodQOS object associated with the business, and select the business to apply, as shown below:
    apiVersion: ensurance.crane.io/v1alpha1
    kind: PodQOS
    metadata:
    name: test
    spec:
    labelSelector:
    matchLabels:
    k8s-app: low # Select the business label to apply
    resourceQOS:
    memoryQOS:
    memWatermark:
    watermarkRatio: 50 # The value range of watermarkRatio is [-75,75]; negative values indicate the reduced threshold, mainly for online containers; and positive values indicate the elevated threshold, mainly for offline containers;
    Create a PodQOS object for an offline business:
    apiVersion: ensurance.crane.io/v1alpha1
    kind: PodQOS
    metadata:
    name: sql
    spec:
    labelSelector:
    matchLabels:
    k8s-app: mysql
    resourceQOS:
    memoryQOS:
    memWatermark:
    watermarkRatio: -50

    Feature 3: pagecache limit

    Overview

    Isolate the pagecache at the container level.

    Operation Steps

    1. Deploy QoS Agent.
    2. On the Add-on management page in the cluster, locate the successfully deployed QoS Agent, and click the Update Configuration on the right.
    3. On the add-on configuration page, select Memory QoS Enhancement.
    4. Click Complete.
    5. Deploy a business.
    6. Deploy the PodQOS object associated with the business, and select the business to apply, as shown below:
    apiVersion: ensurance.crane.io/v1alpha1
    kind: PodQOS
    metadata:
    name: sql
    spec:
    labelSelector:
    matchLabels:
    k8s-app: mysql-pi-000006 # Select the business label to apply
    resourceQOS:
    memoryQOS:
    memPageCacheLimit:
    pageCacheMaxRatio: 20 # pageCacheMaxRatio represents the maximum ratio of pagecache usage to memory quota, based on the current memory limit. Therefore, to use this feature, memory thresholds must be set in the limits. For example, if the Pod memory threshold is 10 GB and pageCacheMaxRatio is 20%, then the pagecache is limited to using a maximum of 2 GB.
    pageCacheReclaimRatio: 5 # pageCacheReclaimRatio represents the reclamation ratio after pagecache exceeds its limit, specifically referring to the ratio of the maximum pagecache usage.
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support