Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate memory usage for KieModule / KieBase build #6082

Open
tkobayas opened this issue Sep 12, 2024 · 0 comments
Open

Investigate memory usage for KieModule / KieBase build #6082

tkobayas opened this issue Sep 12, 2024 · 0 comments
Assignees

Comments

@tkobayas
Copy link
Contributor

tkobayas commented Sep 12, 2024

50000 rules (a 53MB file) resulted in 3.7GB with Drools 8.44.0.Final with non-exec-model.

Executable model required more memory at the build time.

https://github.com/tkobayas/drools-heap-check
https://github.com/tkobayas/drools-heap-check-kjar

To be updated with more detailed data

Drools 8.44.0.Final

non-exec-model

KieFileSystem

5000 rules (a 5MB file)
after build -> 309 MB
after getKieBase -> 405 MB heap

  • org.drools.mvel.MVELConstraint : 205000 objects, 238MB retained heap
    • compilationUnit is not shared between the same expression constraint. Not sure if there is a room to improve.
    • evaluationContext takes some heap. In drools 7.62+, setting system property drools.evaluationContext.maxRuleDefs = 0 may reduce some heap.
  • org.drools.compiler.kie.builder.impl.MemoryKieModule : 1 object, 44MB retained heap
    • held by KieContainer, so there is not much to do

exec-model

KieFileSystem

500 rules ( a 5MB file)
after build -> 304 MB
after getKiebase -> 334 MB
almost 10 times larger than non-exec-model

  • org.drools.model.codegen.execmodel.PackageModel : 214MB

    • retains many javaparser objects (e.g. MethodDeclaration). Can we free them after build?
  • PredicateInformation takes non-negligible amount of heap. drools.predicateInformation.maxRuleDefs = 0 may reduce some heap. We may consider an option to completely disable PredicateInformation.

kjar

500 rules ( a 5MB file)
after build a kjar with kie-maven-plugin -> With VisualVM, footprint is around 420MB (code gen) and 970MB (compile)
after getKiebase with kjar client -> 69 MB (much smaller than KieFileSystem, but still larger than non-exec-model?)

5000 rules ( a 53MB file)
after build a kjar with kie-maven-plugin -> With VisualVM, footprint is around 3.7GB (code gen) and 11.8GB (compile)
after getKiebase with kjar client -> 485 MB (still larger than non-exec-model)

This GH issue is to investigate the memory usage and look for improvements.

@tkobayas tkobayas self-assigned this Sep 12, 2024
@tkobayas tkobayas changed the title Investigate memory usage for kbase build Investigate memory usage for KieModule / KieBase build Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant