[jboss-jira] [JBoss JIRA] (DROOLS-3412) Performance degradation with session pools
Christian Liebhardt (Jira)
issues at jboss.org
Fri Dec 14 07:41:01 EST 2018
[ https://issues.jboss.org/browse/DROOLS-3412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13674800#comment-13674800 ]
Christian Liebhardt edited comment on DROOLS-3412 at 12/14/18 7:40 AM:
-----------------------------------------------------------------------
Hi, I am still in the tests. One additional thought which came up: For operations it would be good if we could get the size of a KieSessionsPool. This way operations could monitor the number of open sessions and react to issues like session leaks. I think the change for that would be quite simple too. So something like this should be sufficient:
{code:java}
diff --git a/drools-core/src/main/java/org/drools/core/impl/AbstractKieSessionsPool.java b/drools-core/src/main/java/org/drools/core/impl/AbstractKieSessionsPool.java
index 26068a6477..ee3bee8916 100644
--- a/drools-core/src/main/java/org/drools/core/impl/AbstractKieSessionsPool.java
+++ b/drools-core/src/main/java/org/drools/core/impl/AbstractKieSessionsPool.java
@@ -62,4 +62,8 @@ public abstract class AbstractKieSessionsPool implements KieSessionsPool {
protected abstract StatefulSessionPool createStatefulSessionPool( String kSessionName, KieSessionConfiguration conf, boolean stateless );
protected abstract String getKey(String kSessionName, KieSessionConfiguration conf, boolean stateless);
+
+ public int size() {
+ return pools.size();
+ }
}
{code}
Would this be something you would want to add?
was (Author: christianl):
Hi, I am still in the tests. One additional thought which came up: For operations it would be good if we could get the size of a KieSessionsPool. This way operations could monitor the number of open sessions and react to issues like session likes. I think the change for that would be quite simple too. So something like this should be sufficient:
{code:java}
diff --git a/drools-core/src/main/java/org/drools/core/impl/AbstractKieSessionsPool.java b/drools-core/src/main/java/org/drools/core/impl/AbstractKieSessionsPool.java
index 26068a6477..ee3bee8916 100644
--- a/drools-core/src/main/java/org/drools/core/impl/AbstractKieSessionsPool.java
+++ b/drools-core/src/main/java/org/drools/core/impl/AbstractKieSessionsPool.java
@@ -62,4 +62,8 @@ public abstract class AbstractKieSessionsPool implements KieSessionsPool {
protected abstract StatefulSessionPool createStatefulSessionPool( String kSessionName, KieSessionConfiguration conf, boolean stateless );
protected abstract String getKey(String kSessionName, KieSessionConfiguration conf, boolean stateless);
+
+ public int size() {
+ return pools.size();
+ }
}
{code}
Would this be something you would want to add?
> Performance degradation with session pools
> ------------------------------------------
>
> Key: DROOLS-3412
> URL: https://issues.jboss.org/browse/DROOLS-3412
> Project: Drools
> Issue Type: Bug
> Reporter: Christian Liebhardt
> Assignee: Mario Fusco
> Priority: Major
> Attachments: gc.png
>
>
> Hello,
> We've today updates to Drools 7.15 and as discussed with DROOLS-3228 we changed our code from calling _StatefulKnowledgeSessionImpl.reset_ ourselves to _KieSessionsPool_. However we then recognized that our application quickly became slower and slower over time (roughly after a few minutes of uptime, or a couple of hundred session create/dispose cycles).
> I haven't yet found the reason what is causing the slow down. However I think there is a difference in how we reset our sessions before session pools and how session pools do it. Perhaps that is a lead.
> *What we did*
> # Create a session
> # Use the session
> # Dispose and reset the session and go back to 2 for the next facts
> *What happens with session pools*
> # Create a session
> # Use the session
> # Skip dispose (because of _pool != null_ in the dispose method), reset the session and go back to 2 for the next facts
> So the difference seems to be that with session pools the session doesn't get disposed before reset it called. If I do the same without session pools then I also see the same slow down. So it seems that something is left behind and causes a slow down. The results however seem to be correct, so the right consequences appear to be triggered.
> An example on how we use the session pool can be found here: https://github.com/liebharc/JavaRules/blob/master/src/main/java/com/github/liebharc/JavaRules/StatefulReusingDroolsEngine.java
> Thanks once more for your help.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the jboss-jira
mailing list