Boot a virtual machine with Huge Pages

Boot a virtual machine with Huge PagesΒΆ

This section explains how to boot a VM with Huge Pages.

To boot a virtual machine with Huge Pages:

  1. Create a new flavor or use an existing one to use with Huge Pages. To create a new image flavor:

    . openrc admin admin
    nova flavor-create huge 999 1024 4 1
    
  2. Add the size of huge pages to the image flavor:

    nova flavor-key huge set hw:mem_page_size=2048
    
  3. Verify the image flavor exists:

    nova flavor-show huge
    

    Example of system response

    +----------------------------+------------------------------+
    | Property                   | Value                        |
    +----------------------------+------------------------------+
    | OS-FLV-DISABLED:disabled   | False                        |
    | OS-FLV-EXT-DATA:ephemeral  | 0                            |
    | disk                       | 4                            |
    | extra_specs                | {"hw:mem_page_size": "2048"} |
    | id                         | 7                            |
    | name                       | huge                         |
    | os-flavor-access:is_public | True                         |
    | ram                        | 1024                         |
    | rxtx_factor                | 1.0                          |
    | swap                       |                              |
    | vcpus                      | 1                            |
    +----------------------------+------------------------------+
    
  4. Create a new image or use an existing image. You need an Ubuntu image and the default Cirros image.

    To create a new Ubuntu image:

    glance --os-image-api-version 1 image-create --name ubuntu \
       --location https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img \
       --disk-format qcow2 --container-format bare
    
  5. Boot a new instance using the created flavor:

    nova boot --flavor huge --image ubuntu inst1
    
  6. Verify that the new VM uses 512 huge pages:

    grep Huge /proc/meminfo
    

    Example of system response

    AnonHugePages:   1138688 kB
    HugePages_Total:    1024
    HugePages_Free:      512
    HugePages_Rsvd:        0
    HugePages_Surp:        0
    Hugepagesize:       2048 kB