This document describes how to configure the persistent memory for an M6p instance.
This document uses a CVM instance with the following configuration. The obtained relevant information shall be subject to the actual conditions.
- TencentOS Server 3.1
- CentOS 7.6 or above
- Ubuntu 18.10 or above
You have created and logged in to an M6p instance.
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.
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.
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
An instance with the highest specification has two regions. After running the following commands, replace
region1and run them again:
ndctl disable-region region0
ndctl init-labels all
ndctl enable-region region0
You can use the persistent memory as memory or local SSD disk based on your actual needs:
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:
ndctl create-namespace -r region0 -m devdax
dax0.0character device has been generated:
ndctl create-namespace -r region1 -m devdax -f
dax0.0character device is generated under the
/devdirectory, which can be mapped to the persistent memory.
ndctl list -R
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:
yum install -y daxctl
daxctl reconfigure-device --mode=system-ram --no-online dax0.0
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:
pmem0block device under the
ndctl create-namespace -r region0 -m fsdax
ndctl create-namespace -r region1 -m fsdax -f
mount -o dax,noatime /dev/pmem0 /mnt/