Best Practices

Huge Page Configuration

Overview

StratoVirt supports the configuration of huge pages for VMs. Compared with the traditional 4K memory page mode, huge page memory can effectively reduce the number of TLB misses and page fault interrupts, significantly improving the performance of memory-intensive services.

Precautions

  • The directory to which the huge pages are mounted must be an absolute path.
  • Memory huge pages can be configured only during startup.
  • Only static huge pages are supported.
  • Configure huge pages on the host before use.
  • To use the huge page feature, ensure that the VM memory size is an integer multiple of huge page size.

Mutually Exclusive Features

  • If huge pages are configured, the balloon feature becomes invalid.

Configuration Methods

Configuring Huge Pages on the Host
Mounting

Mount the huge page file system to a specified directory. /path/to/hugepages is the user-defined empty directory.

$ mount -t hugetlbfs hugetlbfs /path/to/hugepages
Setting the Number of Huge Pages
  • Set the number of static huge pages. num indicates the specified number.

    $ sysctl vm.nr_hugepages=num
    
  • Query huge page statistics.

    $ cat /proc/meminfo | grep Hugepages
    

    To view statistics about huge pages of other sizes, view the related information in the /sys/kernel/mm/hugepages/hugepages-*/ directory.


Notice Configure the StratoVirt memory specifications and huge pages based on the huge page usage. If the huge page resources are insufficient, the VM fails to be started.

Huge Page Configuration During StratoVirt Startup

  • CLI

    -mem-path /page/to/hugepages
    

    In the preceding command, /page/to/hugepages indicates the directory to which the huge page file system is mounted. Only absolute paths are supported.

  • JSON file

    {
        "machine-config": {
            "mem_path": "/page/to/hugepages",
            ...    
        },
            ...
    }
    

    In the preceding command, /page/to/hugepages indicates the directory to which the huge page file system is mounted. Only absolute paths are supported.


Note Typical configuration: Set mem-path in the StratoVirt command line to the huge page file system mount directory. The StratoVirt huge page feature is recommended for the typical configuration.

Performance Improvement

Memory Noise Floor

To achieve the optimal memory noise floor, developers can use the methods provided by WIKI on the StratoVirt homepage for compilation and testing.

https://gitee.com/openeuler/stratovirt/wikis/%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95-%E5%86%85%E5%AD%98%E5%BA%95%E5%99%AA?sort_id=3879743

Cold Startup Time

To reduce the cold startup time, developers can also use the methods provided on by WIKI on the StratoVirt homepage to perform compilation tests.

https://gitee.com/openeuler/stratovirt/wikis/%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95-%E5%86%B7%E5%90%AF%E5%8A%A8%E6%97%B6%E9%97%B4?sort_id=3879744

有奖捉虫

“有虫”文档片段

存在的问题

提交类型 issue
有点复杂...
找人问问吧。
PR
小问题,全程线上修改...
一键搞定!
问题类型
规范和低错类

● 错别字或拼写错误;标点符号使用错误;

● 链接错误、空单元格、格式错误;

● 英文中包含中文字符;

● 界面和描述不一致,但不影响操作;

● 表述不通顺,但不影响理解;

● 版本号不匹配:如软件包名称、界面版本号;

易用性

● 关键步骤错误或缺失,无法指导用户完成任务;

● 缺少必要的前提条件、注意事项等;

● 图形、表格、文字等晦涩难懂;

● 逻辑不清晰,该分类、分项、分步骤的没有给出;

正确性

● 技术原理、功能、规格等描述和软件不一致,存在错误;

● 原理图、架构图等存在错误;

● 命令、命令参数等错误;

● 代码片段错误;

● 命令无法完成对应功能;

● 界面错误,无法指导操作;

风险提示

● 对重要数据或系统存在风险的操作,缺少安全提示;

内容合规

● 违反法律法规,涉及政治、领土主权等敏感词;

● 内容侵权;

您对文档的总体满意度

非常不满意
非常满意
创Issue赢奖品
根据您的反馈,会自动生成issue模板。您只需点击按钮,创建issue即可。