Bug 1033505

Summary: Consider changing the algorithm for org.rhq.core.pc.plugin.CanonicalResourceKey#ancestorKeyTypePlugins
Product: [Other] RHQ Project Reporter: Heiko W. Rupp <hrupp>
Component: Performance, Plugin ContainerAssignee: Nobody <nobody>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.9CC: hrupp, jshaughn
Target Milestone: ---   
Target Release: RHQ 4.13   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Heiko W. Rupp 2013-11-22 09:31:01 UTC
The org.rhq.core.pc.plugin.CanonicalResourceKey#ancestorKeyTypePlugins is computed
by doing 

while (parent != null) {
     KeyTypePlugin ktp = new KeyTypePlugin(parent.getResourceKey(),
            parent.getResourceType());
     this.ancestorKeyTypePlugins.add(ktp);
     parent = parent.getParentResource();
}


This will create a new KeyTypePlugin object for every parent, which by itself is not
problematic. 
Unfortunately when you have 

platform->server->service->services1..10

You will end up with 3 KTP for p/s/s for each of the services1..10 even if they are effectively the same for all of the services 1..10.

For a case with 30k resources on an agent this can easily add up to 100k KTP objects where 30k of them repeatedly describe the platform.
33k CanonicalResourceKey objects currently (without making KTP a static inner class) allocate 7MB heap, where the KTPs take 4MB out of that.

Comment 1 Heiko W. Rupp 2014-05-08 14:42:49 UTC
Bump the target version now that 4.11 is out.