Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

We are recently started supporting parallel requests in our RuleEngine. Total of 4 threads and each thread handles a request to get or save rules. Previously, we were using default release ID and static constant source filename in KieFileSystem and since the requests were handled sequentially, it did not cause any issue.

Now, for each request, I am generating a unique releaseId and writing to KieFileSystem, like so:

String uniqueSourceFilename = generateUniqueSourceFilename(namespace);
        ReleaseId releaseId = kieServices.newReleaseId(RELEASE_ID_GROUP, uniqueSourceFilename, RELEASE_ID_VERSION);
        kieFileSystem.generateAndWritePomXML(releaseId);

kieFileSystem.write(kieResources.newInputStreamResource(ruleFile)
                        .setSourcePath(uniqueSourceFilename)
                        .setResourceType(ResourceType.DRL));

final KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem).buildAll();
final KieContainer kContainer = kieServices.newKieContainer(releaseId);

return kContainer.newStatelessKieSession();

Since this change, we have started observing that the heap memory usage has started increasing steadily (Heap set at 2GB). I read that the stateless session does not require to be disposed off (after we call execute on it) explicitly.

Is there a possibility of objects (kiefilesystem, kiemodule or kiecontainer) still remaining in memory even after GC? Can I explicitly delete/remove these objects after I execute rules in the session?

And do I even need to have a unique releaseId for each KieFileSystem/KieModule (even if they are on different threads)?

question from:https://stackoverflow.com/questions/65914947/should-i-use-unique-releaseid-in-each-kiefilesystem

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
482 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...