Usage of implicitResources in ClusterManagerBean#buildQuery

Andreas Veithen andreas.veithen at gmail.com
Tue Oct 9 14:57:29 UTC 2012


ClusterManagerBean#buildQuery contains the following code:

        // this is an authorization-related query, so use
implicitResource (not explicitResources)
        if (1 == size) {
            query
                .append("SELECT rgir FROM ResourceGroup rg JOIN
rg.implicitResources rgir WHERE rgir.inventoryStatus = 'COMMITTED' AND
rg = "
                + clusterKey.getClusterGroupId());
        } else {
            buildQuery(query, params, clusterKey, nodes.subList(0, size - 1));
        }

We have a situation where the usage of implicitResources instead of
explicitResources appears to cause a performance issue. This occurs
for depth 3 resources related to the JVM (e.g. as JVM > Memory
Subsystem > MarkSweepCompact) in a compatible group. When trying to
open the summary for such a resource, the request times out because
the database takes too much time to complete the query. Note that
other resources at depth 3 are not affected by this problem. My guess
is that this is related to the fact that the keys of the resources in
the hierarchy ('JVM', 'java.lang:type=Memory' and
'java.lang:name=MarkSweepCompact,type=GarbageCollector' in the
example) for these resources are "less unique" than for other
resources (we have 39 JVMs in the inventory).

I tested the problematic database query, and if I replace
RHQ_RESOURCE_GROUP_RES_IMP_MAP by RHQ_RESOURCE_GROUP_RES_EXP_MAP, then
it returns the same results, but much faster. Therefore I would like
to understand the meaning of the comment "this is an
authorization-related query, so use implicitResource (not
explicitResources)". Can somebody explain that to me?

Andreas

PS: I've investigated this with RHQ 4.5.1, but 3.0.0 had the same problem.


More information about the rhq-devel mailing list