(Optional) Enabling Memory Overcommitment
If multiple cloud phone instances use the same image for containerized deployment on a server, there will be many identical memory pages, wasting memory resources. If you use the openEuler 5.10.0-182.0.0 or 5.10.0-216.0.0 kernel, you can enable the Kernel Samepage Merging (KSM) feature for container data deduplication. This feature merges identical anonymous pages to release memory space.
- Enable the KSM daemon on the server.
echo 1 > /sys/kernel/mm/ksm/run
Adjusting the KSM parameters pages_to_scan and sleep_millisecs can reduce the optimization time, but the CPU usage will increase.
- pages_to_scan indicates the number of pages to be scanned before the KSM daemon sleeps.
- sleep_millisecs indicates the sleep time (in milliseconds) of the kernel thread of the daemon after completing a scan.
You can run echo xx > /sys/kernel/mm/ksm/$param to change the parameter value. In the command, xx indicates the new parameter value, and $param indicates the parameter to be adjusted.
- Enable automatic full KSM deduplication for a container.
echo 1 > /sys/fs/cgroup/memory/docker/CONTAINER_ID/memory.ksm
CONTAINER_ID indicates the ID of the cloud phone container. Check whether the feature is enabled successfully.
cat /sys/fs/cgroup/memory/docker/CONTAINER_ID/memory.ksm
If the value of merge any tasks is not 0, the feature is enabled successfully.
- Disable KSM deduplication.
echo 0 > /sys/fs/cgroup/memory/docker/CONTAINER_ID/memory.ksm