[rules-users] OutOfMemoryError happens when dynamic loading of Rules from Guvnor frequently

Oliver Liu liuyy2000 at hotmail.com
Sat Jun 18 11:28:20 EDT 2011


I am using Drools 5.1.1 to design our rule engine, the rule engine need to
dynamic loading of rules from Guvnor because our marking team need to change
the rules frequently(about 40~100 times every day), we have over 5000 rules
in Guvnor.

This is my code ahout that:
	public KnowledgeBase getKnowledgeBase() {		
	    // hold a static reference in class
	    if(kagent != null) {
	        return kagent.getKnowledgeBase();
	    }

	    ResourceChangeScannerConfiguration sconf =
	       
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();     
		sconf.setProperty("drools.resource.scanner.interval", "5");
		
		ResourceFactory.getResourceChangeScannerService().configure(sconf);
		ResourceFactory.getResourceChangeScannerService().start();
		ResourceFactory.getResourceChangeNotifierService().start();
		 
		kagent = KnowledgeAgentFactory.newKnowledgeAgent("myagent");
	
kagent.applyChangeSet(ResourceFactory.newClassPathResource("changeset-url.xml"));

		return kagent.getKnowledgeBase();
    } 

This is content of changeset-url.xml:
<change-set xmlns='http://drools.org/drools-5.0/change-set'
    xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
    xs:schemaLocation='http://drools.org/drools-5.0/change-set
   
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd'
>
   <add>
      <resource
     
source='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/PackageName/snapshot_release'
      type='PKG'  />
   </add>
</change-set>

After i start my service, i found each time When i rebuild package and
created new snapshot to snapshot_release, my service indeed can find the
changing and start to reload rules from guvnor, but memory increased about
50M, it didn't down even if the reloading had finished. After i reput do
this step many times(about 25 times), OutOfMemoryError happened.

So, I want to know, why memory increased continually?It sames drools didn't
do garbage collection. 

Has anyone experienced this?

Thanks 

- Oliver

--
View this message in context: http://drools.46999.n3.nabble.com/OutOfMemoryError-happens-when-dynamic-loading-of-Rules-from-Guvnor-frequently-tp3079965p3079965.html
Sent from the Drools: User forum mailing list archive at Nabble.com.




More information about the rules-users mailing list