Configuring a Virtual Machine on Memory Machine

To run a virtual machine (VM) on Memory Machine, add Memory Machine's LD_PRELOAD and MVMALLOC_CONFIG environment variable definitions to the VM configuration.

About this task

LD_PRELOAD
Contains the path of the TMS shared library, mvmalloc.so.
The shared library intercepts memory allocation calls so that Memory Machine can manage the VM process's memory. See "Transparent Memory Service" in the Memory Machine User Guide.
MVMALLOC_CONFIG
Contains the path of the Memory Machine application configuration file that defines memory allocation properties for a VM running on Memory Machine.

Procedure

  1. Power off any VMs that you want to run on Memory Machine.
    # virsh shutdown vm-name
    where vm-name is the name of the VM.
  2. Optional: Edit the Memory Machine application configuration file, mvmalloc.yml. The file controls Memory Machine configuration on a per-process basis. The file looks something like this:
    DpmeSocketName: /tmp/dpme_daemon.0
    MmapCapture: true
    MallocCapture: true
    LogName: /var/log/memverge/kvm.log
    CommPort: 5678
    EnableSnapshot: false
    DramTierGB: 4
    HugePageDram: true
    The default configuration is a good starting point, but you can copy and modify this file for different VMs. You can find a sample application configuration file at /etc/memverge/mvmalloc.yml. Many of the parameters can be ignored, but take note of the following:
    DramTierGB
    The amount of volatile memory (DRAM) that can be used for the DRAM tier. Can be any value up to the current amount of DRAM available. This is the most important parameter to adjust to optimize the trade-off between performance and memory cost.
    HugePageDram
    Setting this to true improves overall performance of a VM by using HugePages as the DRAM tier. If true, DRAM tier is allocated from /dev/hugepages; ensure that the qemu user has write permission to this directory. If false, DRAM tier is allocated from /dev/shm.
    LogName
    The base file path of the Memory Machine application log. This is where Memory Machine writes information about memory allocation for all of the KVM processes.
    To create a separate log file for each VM, use LogPrefix instead of LogName. With LogPrefix, a file is created from the file name prepended to a unique identifier for each VM process.
    MemVerge requests the process log file if there is a support issue.
    If you change the path of the Memory Machine application log, you must put the file path in the VM configuration file as described in the next two steps.
  3. Open the VM configuration file in edit mode with the virsh edit command.
    $ virsh edit vm-name
    where vm-name is the name of the VM configuration. The file should look similar to the following example.
    <domain type='kvm'>
      <name>vm-name</name>
      <uuid>84f4a36b-206b-4893-8e8a-e4d10ec0757a</uuid>
      <memory unit='KiB'>8388608</memory>
      <currentMemory unit='KiB'>8388608</currentMemory>
      <vcpu placement='static'>4</vcpu>
      <resource>
        <partition>/machine</partition>
      </resource>
      <os>
        <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
        <boot dev='hd'/>
      </os>
      <....>
    </domain>
    
  4. Edit the file to add the elements shown in bold below. The file paths shown in LD_PRELOAD and MVMALLOC_CONFIG are the defaults. You don't need to change the default LD_PRELOAD, but if you create a custom application configuration file for the VM as described in Step 2, ensure that the MVMALLOC_CONFIG is set to its file path.
    <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
      <name>vm-name</name>
      <uuid>84f4a36b-206b-4893-8e8a-e4d10ec0757a</uuid>
      <memory unit='KiB'>8388608</memory>
      <currentMemory unit='KiB'>8388608</currentMemory>
      <vcpu placement='static'>4</vcpu>
      <resource>
        <partition>/machine</partition>
      </resource>
      <os>
        <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
        <boot dev='hd'/>
      </os>
      <....>
      <qemu:commandline>
        <qemu:env name='MVMALLOC_CONFIG' value='/etc/memverge/mvmalloc.yml'/>
        <qemu:env name='LD_PRELOAD' value='/opt/memverge/lib64/mvmalloc.so'/>
      </qemu:commandline>
    </domain>
    
  5. Save the configuration.