Super Size my VM

ESX ignore totalement la nature et l’importance du contenu des pages de vos VM (il connait uniquement les statistiques d’utilisation), mais il peut faire appel au driver qui controle le ballooning “In-Guest” pour forcer le “Guest OS” à liberer des pages disponibles ou à deplacer des pages peut ou pas utilisées dans le swap du “Guest OS”. Cela fonctionne très bien seulement si la VM à le temps d’effectuer cette opération. Ainsi, lors d’une forte contention meme brève, ESX n’attendra pas que la VM “rende” des pages et commencera à compresser (si possible et uniquement à partir de la version 4.1) puis swapper aléatoirement des pages vers le fichier de swap de la VM (potentiellement catastrophique pour les performances) :

(1-contention rapide / 2-contention lente)

De plus, comme indiqué dans le Resource Management Guide, plus la VM est riche en vCPU et en vRAM, plus elle imposera un overhead important au VMkernel. Cet overhead est réservé et donc totalement “perdu”. Il ne sera pas non plus soumis aux differents mécanismes de récupération d’ESX (Transparent Page Sharing > Memory Idle Tax/Ballooning > Memory Compression > Hypervisor Swapping).

On ne parle que d’une centaine de Mo pour une VM avec 1 vCPU et 1Go de vRAM, mais un petit one-liner de PowerCLI nous permet de savoir de combien on parle pour une infra de plus de 1200 VM :

Write-Host -ForegroundColor Red -BackgroundColor Yellow $([math]::round((Get-View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState -eq "poweredOn"}|select -ExpandProperty Summary|select -ExpandProperty Runtime|Measure-Object -Sum -Property MemoryOverhead).sum/1GB,1)) / $([math]::round((Get-View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState -eq "poweredOn"}|select -ExpandProperty Summary|select -ExpandProperty Config|Measure-Object -Sum -Property MemorySizeMB).sum/1KB,1))

Presque 220Go d’overhead sur environ 3,8To de vRAM attribué, soit près de 6% !

Il est donc nettement plus judicieux de bien determiner la taille de vRAM nécéssaire au Guest OS et de tailler au plus juste plutot que mettre une valeur trop large au risque de voir la VM en souffrir plutot que d’en bénéficier (idem pour les vCPU d’ailleurs).

A lire tous les soirs après s’etre brossé les dents : Understanding Memory Resource Management in VMware ESX 4.1

Tags: ,

15 Responses to “Super Size my VM”

  1. Battu !

    vCenter 1 : 237,3 / 3334,1
    vCenter 2 : 322,6 / 4615

  2. Pas mal !
    Ça sent la grosse vm sur le vc #1 ?

  3. [...] Contact « Super Size my VM [...]

  4. Tntteam Says:
    March 30th, 2011 at 9:04

    [vSphere PowerCLI] C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI
    > Write-Host -ForegroundColor Red -BackgroundColor Yellow $([math]::round((Get-V
    iew -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState -
    eq “poweredOn”}|select -ExpandProperty Summary|select -ExpandProperty Runtime|Me
    asure-Object -Sum -Property MemoryOverhead).sum/1GB,1)) / $([math]::round((Get-V
    iew -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState -
    eq “poweredOn”}|select -ExpandProperty Summary|select -ExpandProperty Config|Mea
    sure-Object -Sum -Property MemorySizeMB).sum/1KB,1))
    Select-Object : Cannot expand property “Summary” because it has nothing to expa
    nd.
    At line:1 char:181
    + Write-Host -ForegroundColor Red -BackgroundColor Yellow $([math]::round((Get-
    View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState
    -eq “poweredOn”}|select <<<< -ExpandProperty Summary|select -ExpandProperty R
    untime|Measure-Object -Sum -Property MemoryOverhead).sum/1GB,1)) / $([math]::ro
    und((Get-View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.P
    owerState -eq "poweredOn"}|select -ExpandProperty Summary|select -ExpandPropert
    y Config|Measure-Object -Sum -Property MemorySizeMB).sum/1KB,1))
    Select-Object : Cannot expand property "Summary" because it has nothing to expa
    nd.
    At line:1 char:181
    + Write-Host -ForegroundColor Red -BackgroundColor Yellow $([math]::round((Get-
    View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState
    -eq "poweredOn"}|select <<<< -ExpandProperty Summary|select -ExpandProperty R
    untime|Measure-Object -Sum -Property MemoryOverhead).sum/1GB,1)) / $([math]::ro
    und((Get-View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.P
    owerState -eq "poweredOn"}|select -ExpandProperty Summary|select -ExpandPropert
    y Config|Measure-Object -Sum -Property MemorySizeMB).sum/1KB,1))
    Select-Object : Cannot expand property "Summary" because it has nothing to expa
    nd.
    At line:1 char:181
    + Write-Host -ForegroundColor Red -BackgroundColor Yellow $([math]::round((Get-
    View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState
    -eq "poweredOn"}|select <<<< -ExpandProperty Summary|select -ExpandProperty R
    untime|Measure-Object -Sum -Property MemoryOverhead).sum/1GB,1)) / $([math]::ro
    und((Get-View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.P
    owerState -eq "poweredOn"}|select -ExpandProperty Summary|select -ExpandPropert
    y Config|Measure-Object -Sum -Property MemorySizeMB).sum/1KB,1))
    Select-Object : Cannot expand property "Summary" because it has nothing to expa
    nd.
    At line:1 char:181
    + Write-Host -ForegroundColor Red -BackgroundColor Yellow $([math]::round((Get-
    View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState
    -eq "poweredOn"}|select <<<< -ExpandProperty Summary|select -ExpandProperty R
    untime|Measure-Object -Sum -Property MemoryOverhead).sum/1GB,1)) / $([math]::ro
    und((Get-View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.P
    owerState -eq "poweredOn"}|select -ExpandProperty Summary|select -ExpandPropert
    y Config|Measure-Object -Sum -Property MemorySizeMB).sum/1KB,1))
    Select-Object : Cannot expand property "Summary" because it has nothing to expa
    nd.
    At line:1 char:181
    + Write-Host -ForegroundColor Red -BackgroundColor Yellow $([math]::round((Get-
    View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState
    -eq "poweredOn"}|select <<<< -ExpandProperty Summary|select -ExpandProperty R
    untime|Measure-Object -Sum -Property MemoryOverhead).sum/1GB,1)) / $([math]::ro
    und((Get-View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.P
    owerState -eq "poweredOn"}|select -ExpandProperty Summary|select -ExpandPropert
    y Config|Measure-Object -Sum -Property MemorySizeMB).sum/1KB,1))
    Select-Object : Cannot expand property "Summary" because it has nothing to expa
    nd.
    At line:1 char:421
    + Write-Host -ForegroundColor Red -BackgroundColor Yellow $([math]::round((Get-
    View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState
    -eq "poweredOn"}|select -ExpandProperty Summary|select -ExpandProperty Runtime
    |Measure-Object -Sum -Property MemoryOverhead).sum/1GB,1)) / $([math]::round((G
    et-View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerSt
    ate -eq "poweredOn"}|select <<<< -ExpandProperty Summary|select -ExpandPropert
    y Config|Measure-Object -Sum -Property MemorySizeMB).sum/1KB,1))
    Select-Object : Cannot expand property "Summary" because it has nothing to expa
    nd.
    At line:1 char:421
    + Write-Host -ForegroundColor Red -BackgroundColor Yellow $([math]::round((Get-
    View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState
    -eq "poweredOn"}|select -ExpandProperty Summary|select -ExpandProperty Runtime
    |Measure-Object -Sum -Property MemoryOverhead).sum/1GB,1)) / $([math]::round((G
    et-View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerSt
    ate -eq "poweredOn"}|select <<<< -ExpandProperty Summary|select -ExpandPropert
    y Config|Measure-Object -Sum -Property MemorySizeMB).sum/1KB,1))
    Select-Object : Cannot expand property "Summary" because it has nothing to expa
    nd.
    At line:1 char:421
    + Write-Host -ForegroundColor Red -BackgroundColor Yellow $([math]::round((Get-
    View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState
    -eq "poweredOn"}|select -ExpandProperty Summary|select -ExpandProperty Runtime
    |Measure-Object -Sum -Property MemoryOverhead).sum/1GB,1)) / $([math]::round((G
    et-View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerSt
    ate -eq "poweredOn"}|select <<<< -ExpandProperty Summary|select -ExpandPropert
    y Config|Measure-Object -Sum -Property MemorySizeMB).sum/1KB,1))
    Select-Object : Cannot expand property "Summary" because it has nothing to expa
    nd.
    At line:1 char:421
    + Write-Host -ForegroundColor Red -BackgroundColor Yellow $([math]::round((Get-
    View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState
    -eq "poweredOn"}|select -ExpandProperty Summary|select -ExpandProperty Runtime
    |Measure-Object -Sum -Property MemoryOverhead).sum/1GB,1)) / $([math]::round((G
    et-View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerSt
    ate -eq "poweredOn"}|select <<<< -ExpandProperty Summary|select -ExpandPropert
    y Config|Measure-Object -Sum -Property MemorySizeMB).sum/1KB,1))
    Select-Object : Cannot expand property "Summary" because it has nothing to expa
    nd.
    At line:1 char:421
    + Write-Host -ForegroundColor Red -BackgroundColor Yellow $([math]::round((Get-
    View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerState
    -eq "poweredOn"}|select -ExpandProperty Summary|select -ExpandProperty Runtime
    |Measure-Object -Sum -Property MemoryOverhead).sum/1GB,1)) / $([math]::round((G
    et-View -ViewType virtualmachine -Property Summary,Runtime|?{$_.runtime.PowerSt
    ate -eq "poweredOn"}|select <<<< -ExpandProperty Summary|select -ExpandPropert
    y Config|Measure-Object -Sum -Property MemorySizeMB).sum/1KB,1))
    0 / 0

  5. @Tntteam : quelle version ton vcenter ?

  6. 4.1 build 258902

    Mais c’est peut-être parceque j’ai des ESXi ?

  7. No ideas? :(

  8. essai la commande Get-View -ViewType virtualmachine -Property Summary|select -ExpandProperty Summary

  9. Tntteam Says:
    April 1st, 2011 at 8:46

    [vSphere PowerCLI] C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI
    > Get-View -ViewType virtualmachine -Property Summary|select -ExpandProperty Sum
    mary
    Select-Object : Cannot expand property “Summary” because it has nothing to expa
    nd.
    At line:1 char:59
    + Get-View -ViewType virtualmachine -Property Summary|select <<<< -ExpandPrope
    rty Summary
    Select-Object : Cannot expand property "Summary" because it has nothing to expa
    nd.
    At line:1 char:59
    etc.

  10. Tntteam Says:
    April 1st, 2011 at 8:47

    [vSphere PowerCLI] C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI
    > Get-View -ViewType virtualmachine -Property Summary

    Capability :
    Config :
    Layout :
    LayoutEx :
    Storage :
    EnvironmentBrowser :
    ResourcePool :
    ParentVApp :
    ResourceConfig :
    Runtime :
    Guest :
    Summary : VMware.Vim.VirtualMachineSummary
    Datastore :
    Network :
    Snapshot :
    RootSnapshot :
    GuestHeartbeatStatus : gray
    Parent :
    CustomValue :
    OverallStatus : gray
    ConfigStatus : gray
    ConfigIssue :
    EffectiveRole :
    Permission :
    Name :
    DisabledMethod :
    RecentTask :
    DeclaredAlarmState :
    TriggeredAlarmState :
    AlarmActionsEnabled : False
    Tag :
    Value :
    AvailableField :
    MoRef : VirtualMachine-vm-146
    Client : VMware.Vim.VimClient

    Capability :
    Config :
    Layout :
    LayoutEx :
    Storage :
    EnvironmentBrowser :
    ResourcePool :
    ParentVApp :
    ResourceConfig :
    Runtime :
    Guest :
    Summary : VMware.Vim.VirtualMachineSummary
    Datastore :
    Network :
    Snapshot :
    RootSnapshot :
    GuestHeartbeatStatus : gray
    Parent :
    CustomValue :
    OverallStatus : gray
    ConfigStatus : gray
    ConfigIssue :
    EffectiveRole :
    Permission :
    Name :
    DisabledMethod :
    RecentTask :
    DeclaredAlarmState :
    TriggeredAlarmState :
    AlarmActionsEnabled : False
    Tag :
    Value :
    AvailableField :
    MoRef : VirtualMachine-vm-161
    Client : VMware.Vim.VimClient

    Capability :
    Config :
    Layout :
    LayoutEx :
    Storage :
    EnvironmentBrowser :
    ResourcePool :
    ParentVApp :
    ResourceConfig :
    Runtime :
    Guest :
    Summary : VMware.Vim.VirtualMachineSummary
    Datastore :
    Network :
    Snapshot :
    RootSnapshot :
    GuestHeartbeatStatus : gray
    Parent :
    CustomValue :
    OverallStatus : gray
    ConfigStatus : gray
    ConfigIssue :
    EffectiveRole :
    Permission :
    Name :
    DisabledMethod :
    RecentTask :
    DeclaredAlarmState :
    TriggeredAlarmState :
    AlarmActionsEnabled : False
    Tag :
    Value :
    AvailableField :
    MoRef : VirtualMachine-vm-31
    Client : VMware.Vim.VimClient

    etc…

  11. Tntteam Says:
    April 5th, 2011 at 13:23

    Alors je suis seul dans ce cas ? :/

  12. “OverallStatus : gray” c’est pas bon, t’as des vm disconnected/inacessible/orphaned dans ton vc ?

  13. Tntteam Says:
    April 6th, 2011 at 8:48

    Humm je ne penses pas mais ça remonte ce status pour toutes les VMs (là j’ai tronqué, mais ça remonte toutes les VMs comme ça)

  14. c’est pas normal, t’as pas d’erreurs dans ton vc ?

  15. Tntteam Says:
    April 6th, 2011 at 16:00

    Non, rien à signaler.

    Quand je fait une requête genre

    Get-VM | Select Name,
    @{N=”AverageIO”;
    E={($_ | Get-Stat -Stat disk.usage.average -Start (Get-Date).adddays(-1) | Measure-Object -Average -Property Value).Average}} | `
    Sort-Object -Property AverageIO -Descending | Select -First 10

    Pour avoir la top 10 conso des VM en terme d’io disk, ça fonctionne nickel

Leave a Reply