Bug 1431578 - improve V3 performance of retrieving VM disks
Summary: improve V3 performance of retrieving VM disks
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ovirt-4.1.2
: 4.1.2
Assignee: Juan Hernández
QA Contact: Aleksei Slaikovskii
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-13 10:46 UTC by Oved Ourfali
Modified: 2017-05-23 08:22 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-23 08:22:40 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.1+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 73904 0 master MERGED restapi: Don't use GetAllDisksByVmId 2017-03-13 18:52:06 UTC
oVirt gerrit 74009 0 ovirt-engine-4.1 MERGED restapi: Don't use GetAllDisksByVmId 2017-03-15 08:28:52 UTC

Description Oved Ourfali 2017-03-13 10:46:18 UTC
Currently when version 3 of the API is used to request the disks of a
virtual machine, the API uses the GetAllDisksByVmId query, which in turn
uses the GetDisksbyVmGuid stored procedure to retrive the disks. In
addition this query, for each disk, calls the GetSnapshotByLeafGuid
stored procedure, to retrieve snapshot details, and the
GetDiskVmElementVyDiskVmElementId, to get attachment details. The
GetSnapshotByLeafGuid stored procedure is complex, and consumes a
important amount of database time. Version 4 of the API uses lighter
stored procedures. This patch changes the V3 compatibility layer of the
API so that it calls the V4 disk attachments and disk resources instead
of using the GetAllDisksByVmId query. In an otherwise idle enviroment
with approxy 4000 virtual machines this reduces the total use of CPU
(85% database + 15% engine) from 57 minutes to 14 minutes.

Reproducer:

This can be reproduced using the following Ruby script, which uses the
'ovirt' gem to retrieve the virtual machines and their disks:

  require 'active_support/all'
  require 'ovirt'

  service = Ovirt::Service.new(
    server: 'rhvm41.local',
    port: 443,
    domain: 'internal',
    username: 'admin',
    password: '...',
    verify_ssl: false,
    timeout: 1.hour
  )

  vms = Ovirt::Vm.all(service)

  vms.each do |vm|
    vm.disks.each do |disk|
      puts "#{vm[:name]}: #{disk[:name]}"
    end
  end

  service.disconnect

Comment 1 Aleksei Slaikovskii 2017-05-03 15:29:22 UTC
Verified on ovirt-engine-4.1.2-0.1.el7.noarch

6 vms:
4.1.1.2-0.1.el7 time: 3.567 sec
4.1.2-0.1.el7 time: 1.735 sec


Note You need to log in before you can comment on or make changes to this bug.