Change in ovirt-engine[master]: core: GetUnregisteredCinderDisksByStorageDomainIdQuery perfo...

amureini at redhat.com amureini at redhat.com
Wed Nov 18 16:14:30 UTC 2015


Allon Mureinik has submitted this change and it was merged.

Change subject: core: GetUnregisteredCinderDisksByStorageDomainIdQuery performance
......................................................................


core: GetUnregisteredCinderDisksByStorageDomainIdQuery performance

GetUnregisteredCinderDisksByStorageDomainIdQuery had a naive
implementation to compare between the volumes retrieved from Cinder
and the disks stored in the engine database. In the old
implementation, a list of all the volumes was retrieved from the
Cinder provider (denoted as N volumes from now on) and a list of all
the disks in a given Cinder domain were retrieved from the database
(denoted as M disks from now on). Then the volumes were iterated over,
and for each volume, the disks were iterated over, in search of a disk
with a corresponding ID, resulting in an algorithm with an O(N * M)
time complexity.

In the implementation presented by this patch, the disks are first
iterated, and a Set of their IDs is produced (An O(N) operation).
Then, the volumes are iterated, and filtered according their ID being
present in the aforementioned Set (An O(M) operation, assuming the JDK
implements an efficient hash on Strings). The resulting algorithm has
an O(N+M) time complexity, and given n->inf, m->inf, should present a
significant improvement in large systems.

As an added bonus, this algorithm is implemented using Java 8's
built-in streaming APIs instead of the boiler-plated, ugly, LinqUtils
code.

Change-Id: I5fb243998255cac1936ac388729f3f933a9320e2
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/GetUnregisteredCinderDisksByStorageDomainIdQuery.java
1 file changed, 5 insertions(+), 13 deletions(-)

Approvals:
  Tal Nisan: Looks good to me, but someone else must approve
  Allon Mureinik: Verified; Passed CI tests
  Maor Lipchuk: Looks good to me, approved



-- 
To view, visit https://gerrit.ovirt.org/48656
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5fb243998255cac1936ac388729f3f933a9320e2
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Maor Lipchuk <mlipchuk at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list