Liran Zelkha has uploaded a new change for review. Change subject: core: Reduce # of calls to getVdsGroupByVdsGroupId ......................................................................
core: Reduce # of calls to getVdsGroupByVdsGroupId Since vds view is built on top of the vds_groups table (in addition to other tables), this patch adds to vds the enable_ballon property so that we don't need to load the full VdsGroup to get this value. This saves ~90% of calls to getVdsGroupByVdsGroupId in an idle scenario, each of these calls takes ~300us (depending on the number of clusters a customer has). Change-Id: I9d838a19e0496951b9821936bd3af215e3a31c0d Signed-off-by: [email protected] <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java M packaging/dbscripts/create_views.sql 4 files changed, 16 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/03/32303/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java index 6f7fc60..9e88ff7 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java @@ -24,6 +24,7 @@ private ArrayList<VdsNetworkInterface> mInterfaceList; private ArrayList<Network> mNetworkList; private String activeNic; + private boolean enableBalloon; /** * This map holds the disk usage reported by the host. The mapping is path to usage (in MB). @@ -64,6 +65,7 @@ result = prime * result + ((vdsGroupName == null) ? 0 : vdsGroupName.hashCode()); result = prime * result + ((vdsGroupVirtService == null) ? 0 : vdsGroupVirtService.hashCode()); result = prime * result + ((vdsGroupGlusterService == null) ? 0 : vdsGroupGlusterService.hashCode()); + result = prime * result + (enableBalloon ? 0 : 1); return result; } @@ -87,6 +89,7 @@ && ObjectUtils.objectsEqual(mInterfaceList, other.mInterfaceList) && ObjectUtils.objectsEqual(mNetworkList, other.mNetworkList) && maxVdsMemoryOverCommit == other.maxVdsMemoryOverCommit + && enableBalloon == other.enableBalloon && ObjectUtils.objectsEqual(privateDomains, other.privateDomains) && ObjectUtils.objectsEqual(vdsSpmId, other.vdsSpmId) && ObjectUtils.objectsEqual(storagePoolId, other.storagePoolId) @@ -182,6 +185,7 @@ vds.setHighlyAvailableIsActive(getHighlyAvailableIsActive()); vds.setHighlyAvailableGlobalMaintenance(getHighlyAvailableGlobalMaintenance()); vds.setHighlyAvailableLocalMaintenance(getHighlyAvailableLocalMaintenance()); + vds.setEnableBalloon(isEnableBalloon()); return vds; } @@ -1420,4 +1424,13 @@ public boolean getLiveMergeSupport() { return this.mVdsDynamic.getLiveMergeSupport(); } + + public boolean isEnableBalloon() { + return enableBalloon; + } + + public void setEnableBalloon(boolean enableBalloon) { + this.enableBalloon = enableBalloon; + } + } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java index d47b759..b1e3447 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java @@ -361,6 +361,7 @@ entity.setNumaSupport(rs.getBoolean("is_numa_supported")); entity.setLiveSnapshotSupport(rs.getBoolean("is_live_snapshot_supported")); entity.setLiveMergeSupport(rs.getBoolean("is_live_merge_supported")); + entity.setEnableBalloon(rs.getBoolean("enable_balloon")); return entity; } } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java index ba2bff7..e7b875d 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java @@ -32,7 +32,6 @@ import org.ovirt.engine.core.common.businessentities.OriginType; import org.ovirt.engine.core.common.businessentities.UnchangeableByVdsm; import org.ovirt.engine.core.common.businessentities.VDS; -import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VDSStatus; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; @@ -1415,7 +1414,7 @@ } private void proceedBalloonCheck() { - if (isBalloonActiveOnHost()) { + if (_vds.isEnableBalloon()) { for (VmInternalData vmInternalData : _runningVms.values()) { VmBalloonInfo balloonInfo = vmInternalData.getVmStatistics().getVmBalloonInfo(); Guid vmId = vmInternalData.getVmDynamic().getId(); @@ -1486,11 +1485,6 @@ vmsWithBalloonDriverProblem.put(vmId, 0); } } - } - - private boolean isBalloonActiveOnHost() { - VDSGroup cluster = getDbFacade().getVdsGroupDao().get(_vds.getVdsGroupId()); - return cluster != null && cluster.isEnableBallooning(); } private boolean isBalloonDeviceActiveOnVm(VmInternalData vmInternalData) { diff --git a/packaging/dbscripts/create_views.sql b/packaging/dbscripts/create_views.sql index a191a71..469a575 100644 --- a/packaging/dbscripts/create_views.sql +++ b/packaging/dbscripts/create_views.sql @@ -751,7 +751,7 @@ CREATE OR REPLACE VIEW vds as -SELECT vds_groups.vds_group_id as vds_group_id, vds_groups.name as vds_group_name, vds_groups.description as vds_group_description, vds_groups.architecture as architecture, +SELECT vds_groups.vds_group_id as vds_group_id, vds_groups.name as vds_group_name, vds_groups.description as vds_group_description, vds_groups.architecture as architecture, vds_groups.enable_balloon as enable_balloon, vds_static.vds_id as vds_id, vds_static.vds_name as vds_name, vds_static.ip as ip, vds_static.vds_unique_id as vds_unique_id, vds_static.host_name as host_name, vds_static.free_text_comment as free_text_comment, vds_static.port as port, vds_static.vds_strength as vds_strength, vds_static.server_SSL_enabled as server_SSL_enabled, vds_static.vds_type as vds_type, -- To view, visit http://gerrit.ovirt.org/32303 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9d838a19e0496951b9821936bd3af215e3a31c0d Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liran Zelkha <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
