Hello Stephen

 

Your suggestion improved a lot the performance, but after a while the application still started to execute poorly.

 

After more analysis, we identified that there was a memory leak behavior in Drools 5.2. I upgraded to the 5.5 version and the performance now is fantastic.

 

Tks

 

 

De: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] Em nome de Stephen Masters
Enviada em: terça-feira, 22 de janeiro de 2013 15:57
Para: Rules Users List
Assunto: Re: [rules-users] Drools locking threads

 

Hi there,

 

If I understand correctly, you're creating the stateless knowledge session once and then providing access to execute it from multiple threads. That's not going to work too well … especially on 5.2. For each request using a stateless knowledge session you should call kbase.newStatelessKnowledgeSession()

 

i.e. Create the knowledge base once, but create a session for each request.

 

Steve

 

 

On 22 Jan 2013, at 15:14, nalvesp <npereira@cielo.com.br> wrote:



I need some support with Drools. I'm using Drools 5.2 in a multi-threaded
environment. Basicaly, every login into a website is calling an execute
method in a StatelessKnowledgeSession. After some time, threads start to
lock as below:

"[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default
(self-tuning)'" id=18 idx=0xc0 tid=7267 prio=5 alive, in native, blocked,
daemon
   -- Blocked trying to get lock:
org/drools/event/RuleBaseEventSupport@0x2aab52d6f518[fat lock]
   at jrockit/vm/Threads.waitForUnblockSignal()V(Native Method)
   at jrockit/vm/Locks.fatLockBlockOrSpin(Locks.java:1679)[optimized]
   at jrockit/vm/Locks.lockFat(Locks.java:1780)[optimized]
   at
jrockit/vm/Locks.monitorEnterSecondStageHard(Locks.java:1312)[optimized]
   at jrockit/vm/Locks.monitorEnterSecondStage(Locks.java:1259)[optimized]
   at
org/drools/event/AbstractEventSupport.addEventListener(AbstractEventSupport.java:65)[inlined]
   at
org/drools/common/AbstractRuleBase.addEventListener(AbstractRuleBase.java:1018)[optimized]
   at
org/drools/impl/KnowledgeBaseImpl.addEventListener(KnowledgeBaseImpl.java:127)[optimized]
   at
org/jbpm/process/instance/ProcessRuntimeImpl.initProcessEventListeners(ProcessRuntimeImpl.java:201)
   at
org/jbpm/process/instance/ProcessRuntimeImpl.<init>(ProcessRuntimeImpl.java:68)[optimized]
   at
org/jbpm/process/instance/ProcessRuntimeFactoryServiceImpl.newProcessRuntime(ProcessRuntimeFactoryServiceImpl.java:10)
   at
org/jbpm/process/instance/ProcessRuntimeFactoryServiceImpl.newProcessRuntime(ProcessRuntimeFactoryServiceImpl.java:6)
   at
org/drools/runtime/process/ProcessRuntimeFactory.newProcessRuntime(ProcessRuntimeFactory.java:12)
   at
org/drools/common/AbstractWorkingMemory.createProcessRuntime(AbstractWorkingMemory.java:359)[inlined]
   at
org/drools/common/AbstractWorkingMemory.setKnowledgeRuntime(AbstractWorkingMemory.java:1260)[inlined]
   at
org/drools/impl/StatefulKnowledgeSessionImpl.<init>(StatefulKnowledgeSessionImpl.java:116)[inlined]
   at
org/drools/impl/StatelessKnowledgeSessionImpl.newWorkingMemory(StatelessKnowledgeSessionImpl.java:129)[inlined]
   at
org/drools/impl/StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:293)[optimized]
   at
br/com/cielo/engineRules/services/impl/CancelamentoRuleBean.validarRegrasCancelamento(CancelamentoRuleBean.java:79)[optimized]
   at
br/com/cielo/engineRules/services/impl/CancelamentoRuleEJB_vyscvn_EOImpl.validarRegrasCancelamento(CancelamentoRuleEJB_vyscvn_EOImpl.java:205)[optimized]
   at
br/com/cielo/engineRules/services/impl/CancelamentoRuleEJB_vyscvn_EOImpl_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown
Source)[optimized]
   at
weblogic/rmi/internal/BasicServerRef.invoke(BasicServerRef.java:589)[optimized]
   at
weblogic/rmi/cluster/ClusterableServerRef.invoke(ClusterableServerRef.java:230)[optimized]
   at
weblogic/rmi/internal/BasicServerRef$1.run(BasicServerRef.java:477)[inlined]
   at
weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)[inlined]
   at
weblogic/security/service/SecurityManager.runAs(Lweblogic/security/acl/internal/AuthenticatedSubject;Lweblogic/security/acl/internal/AuthenticatedSubject;Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;(Unknown
Source)[inlined]
   at
weblogic/rmi/internal/BasicServerRef.handleRequest(BasicServerRef.java:473)[inlined]
   at
weblogic/rmi/internal/wls/WLSExecuteRequest.run(WLSExecuteRequest.java:118)[optimized]
   at
weblogic/work/ExecuteThread.execute(ExecuteThread.java:201)[optimized]
   at weblogic/work/ExecuteThread.run(ExecuteThread.java:173)
   at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)
   -- end of trace

I went to Drool's source code and there's a synchronized section right
before the lock. I'm afraid Drools doesn't support multi-thread processing.

Does anyone know anything about this issue???

Tks




--
View this message in context: http://drools.46999.n3.nabble.com/Drools-locking-threads-tp4021732.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users