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

[incubator-kie-issues#1753] Load SessionConfiguration at startup in project templates; remove outdated comment in ChainedProperties #6218

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

martinweiler
Copy link
Contributor

…roject templates; remove outdated comment in ChainedProperties
Copy link
Contributor

@yesamer yesamer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martinweiler Thank you for your PR, can you please share a brief description of the reason those changes resolve the issue? I'm still not familiar with this codegen area. Thanks :)

@martinweiler
Copy link
Contributor Author

Hi @yesamer - thanks for looking into this. Let's take a look at the stacktrace posted in apache/incubator-kie-issues#1753, from the bottom up:

"kogito-event-executor-12" #68 daemon prio=5 os_prio=0 cpu=4286.47ms elapsed=215.32s tid=0x00007f2f3d989670 nid=0x6a waiting for monitor entry [0x00007f2f3c7b6000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.util.zip.ZipFile.getEntry(java.base@17.0.13/ZipFile.java:337)
- locked <0x00000007408c6270> (a sun.net.www.protocol.jar.URLJarFile)
at java.util.jar.JarFile.getEntry(java.base@17.0.13/JarFile.java:513)
at sun.net.www.protocol.jar.URLJarFile.getEntry(java.base@17.0.13/URLJarFile.java:131)
at sun.net.www.protocol.jar.JarURLConnection.connect(java.base@17.0.13/JarURLConnection.java:135)
at sun.net.www.protocol.jar.JarURLConnection.getInputStream(java.base@17.0.13/JarURLConnection.java:175)
at java.net.URL.openStream(java.base@17.0.13/URL.java:1161)
at org.kie.internal.utils.ChainedProperties.read(ChainedProperties.java:229)
        at org.kie.internal.utils.ChainedProperties.getChainedProperties(ChainedProperties.java:74)
        at org.kie.internal.utils.ChainedProperties.getChainedProperties(ChainedProperties.java:70)
        at org.drools.core.impl.RuleBaseFactory.newKnowledgeSessionConfiguration(RuleBaseFactory.java:155)
        at org.drools.project.model.ProjectRuntime.getConfForSession(ProjectRuntime.java:83)
        at org.drools.project.model.ProjectRuntime.newKieSession(ProjectRuntime.java:67)
        at com.test.SampleProcess.lambda$process$136(DataProcess.java:2337)
        at com.test.SampleProcess$$Lambda$1018/0x0000000800706cc0.get(Unknown Source)
        at org.jbpm.workflow.instance.rule.AbstractRuleTypeEngine.getKieRuntime(AbstractRuleTypeEngine.java:35)
        at org.jbpm.bpmn2.rule.RuleFlowGroupRuleTypeEngineImpl.evaluate(RuleFlowGroupRuleTypeEngineImpl.java:39)
  • RuleFlowGroupRuleTypeEngineImpl is the integration code that calls Drools from the BPMN process, on each BusinessRuleTask handler node
  • It obains a KieRuntime at the beginning of the evaluate method
  • The next lines in the stack are from the code generated classes, including the org.drools.project.model.ProjectRuntime class, which is generated based on the template that's being modified in this PR
  • The ProjectRuntime.newKieSession method invocation results in the getConfForSession method being called
  • In this method, we are seeing the contention under load, due to the ChainedProperties trying to read the same file in multiple threads
  • The proposed fix moves the reading of the creation of the SessionConfiguration to the application startup, instead of having it recreated on each bpmn -> drools invocation
  • In addition, it removes the comment regarding a cache in ChainedProperties, as this cache no longer exists.

I hope this helps to clarify. If you see any other optimization in the whole integration code, please let us know. Thanks!

Copy link
Contributor

@yesamer yesamer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @martinweiler for the detailed explanation.

@martinweiler martinweiler merged commit d481f22 into apache:main Jan 20, 2025
10 checks passed
rgdoliveira pushed a commit to rgdoliveira/drools that referenced this pull request Jan 27, 2025
…roject templates; remove outdated comment in ChainedProperties (apache#6218)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance issue obtaining KieSession in workflow orchestration
3 participants