tencent cloud

Feedback

Configuring Persistent Memory in M6p Instances

Last updated: 2024-01-06 17:49:56

    Overview

    This document describes how to configure the persistent memory for an M6p instance.

    Instance Configuration

    This document uses a CVM instance with the following configuration. The obtained relevant information shall be subject to the actual conditions.
    Instance specification: MEM Optimized M6p instance M6p.LARGE16 (4C16G). For the configuration of other specifications, see Instance Types.
    OS: TencentOS Server 3.1 (TK4).
    Note:
    Recommended configurations:
    TencentOS Server 3.1
    CentOS 7.6 or above
    Ubuntu 18.10 or above

    Prerequisites

    You have created and logged in to an M6p instance.
    For detailed directions on how to create an instance, see Creating Instances via CVM Purchase Page.
    For detailed directions on how to log in to an instance, see Logging in to Linux Instance Using Standard Login Method.

    Overview of Intel® Optane™ Persistent Memory (PMem) Modes

    Memory mode

    In Memory mode, the regular DRAM serves as a cache for the most frequently accessed data, while the persistent memory is used as the backup memory. High-speed cache management operations are automatically processed by the memory controller.

    App Direct mode

    The M6p model uses this mode. In an M6p instance, the BPS hardware configuration is set to App Direct mode and passed through to a CVM. In this mode, an application can use the PMem device as the memory or local SSD disk.

    Directions

    Initializing PMem

    For the first time using the instance, run the following commands in sequence to initialize the PMem device. If you have initialized it, skip this step.
    yum install -y ndctl
    ndctl destroy-namespace all --force
    Note:
    An instance with the highest specification has two regions. After running the following commands, replace region0 with region1 and run them again:
    ndctl disable-region region0
    ndctl init-labels all
    ndctl enable-region region0

    Configuring PMem in App Direct mode

    You can use the persistent memory as memory or local SSD disk based on your actual needs:
    Use as memory
    Use as local SSD disk
    PMem can be provided to upper-level applications (such as Redis) as a character device for assignment of persistent memory and can be used with a PMDK framework such as memkind. It is configured as follows:
    1. Run the following command to generate a character device:
    ndctl create-namespace -r region0 -m devdax
    The returned result is as shown below, indicating that the dax0.0 character device has been generated:
    
    An instance with the highest specification has two regions. If you use such an instance, you also need to run the following command:
    ndctl create-namespace -r region1 -m devdax -f
    After the configuration, the dax0.0 character device is generated under the /dev directory, which can be mapped to the persistent memory.
    2. Run the following command to view the persistent memory size:
    ndctl list -R
    The following information appears:
    

    Extended feature (optional)

    You can perform this step to use an extended feature. Run the following commands in sequence to use PMem to expand the CVM instance memory:
    1. With the support of the kernel on a high version (above 5.1 and with KMEM DAX driver, such as kernel of TencentOS Server 3.1), you can configure PMem in devdax mode to KMEM DAX mode so as to use PMem to expand the CVM instance memory.
    yum install -y daxctl
    daxctl migrate-device-model
    reboot
    daxctl reconfigure-device --mode=system-ram --no-online dax0.0
    The following information appears:
    
    2. Run the following command to view the system memory expansion status:
    numactl -H
    The following information appears:
    
    PMem in App Direct mode can be configured as a general high-speed block device, where you can perform operations such as file system creation and raw disk read/write. It is configured as follows:
    1. Run the following command to generate the pmem0 block device under the /dev directory:
    ndctl create-namespace -r region0 -m fsdax
    The following information appears:
    
    An instance with the highest specification has two regions. If you use such an instance, you also need to run the following command:
    ndctl create-namespace -r region1 -m fsdax -f
    2. Run the following command to create a file system or mount:
    2.1 Create a file system.
    mkfs.ext4 /dev/pmem0
    The returned result is as shown below, indicating that a file system is created successfully.
    
    2.2 Mount to /mnt/.
    mount -o dax,noatime /dev/pmem0 /mnt/

    References

    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