[rules-users] Re: BRMS Server - memory Issue while execution - Critical

2007-07-23 Thread Arjun Dhar
Michael Neale michael.neale at gmail.com writes:

 
 
 Hi Arjun - I wouldn't recommend re-using session unless there is some 
expensive state you wish to reuse. Pooling them will use up far more resources 
then freeing them. You should only pool expensive to obtain resources.


Hi Michael,
 thanks a lot for your help.

I wish to share something that might be news:
Well I tried two models:
1. Create a new stateless session, everytime you recieve a request
2. Share the same session among multiple threads.
(Million Loops, Zero ramp up time - JMeter settings)

.. As I increased the number of threads the performance output for 1 dipped 
around. But for 2 there was a minor exponential increase in performance.

Ofcourse, this depends on the rules and the way the business obejcts are also 
written. But this was m personal experience.

Functionally there was no difference and also no memory leaks in the latest 
build.

I'm pretty happy.
Thanks,
Arjun

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Re: BRMS Server - memory Issue while execution - Critical

2007-07-20 Thread Arjun Dhar
 QUESTION:: Is the session maintaining references to those objects ever after 
 executing them? Why are the objects not being released? 
 
 Specially I'd imagine for a STATELESS session (which is what I've set as 
 default).
 
 Using JMeter this system crashes every time under load, even with a single 
 Thread. Clearly objects are not being released.
 
 The error I get may help you: (Along with out of memory). This exception only 
 comes under Load conditions.
 Admin:ERROR: [com.myserver.brms.demos.certify.web.servlet.CertifyWebRequests]
 [service] :org.drools.spi.ConsequenceException: java.lang.NullPointerException
 
   at org.drools.common.DefaultAgenda.fireActivation
 (DefaultAgenda.java:501)
 
   at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:461)
 
   at org.drools.common.AbstractWorkingMemory.fireAllRules
 (AbstractWorkingMemory.java:373)
 
   at org.drools.reteoo.ReteooStatelessSession.execute
 (ReteooStatelessSession.java:72)
 
   at com.myserver.brms.sessions.RulesEngineSessionJBossRules4.execute
 (RulesEngineSessionJBossRules4.java:113)
 at 
 
com.myserver.brms.services.execute.recore.batch.ExecuteSessionBatch.executeBatch
 (ExecuteSessionBatch.java:160)
 
 Please help me! This is the only downtime issue I face and unfortunatley its 
 the most critical point of failure.


Ok, I think I figured it out. But please confirm.

The Rule Engine Session DOES NOT release objects. (But hten why have a 
Stateless session?) if the duration of use of the session is not going to be 
long?

The solution: Pool the RuleBase and on a request createa freesh session from it 
each time a request comes in!

Let me know if the cocept is sound or what I'm thinking is now correct.

Thanks,
Arjun




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Re: BRMS Server - memory Issue while execution - Critical

2007-07-20 Thread Arjun Dhar
 Stateless sessions should not hold onto any references. Stateful do,
 and dispose() must be called when its finished - otherwise the rulebase
 holds a reference forever. If the rulebase is holding onto stateless
 sessions, then that is a bug.
 Mark
 

Thanks a lot Mark,
 taking the latest binary passed the load testing one a single thread atleast. 
Though I need to confirm due to removal of modify() none of the functionality 
has got altered. It chokes a little in the middle but is not going out of 
memory so I guess the leak is really fixed.

One last question on this:
On the Build 4MR2, I disposed the session and created a new one from the cached 
RuleBase and it took the load (on the code that had the memory leak)

So what approach is conceptually better; Keep the same statless session for 
ever or for each execution request use a new one?? I talking pure 
performance/memory?!?!

I remember you saying creating sessions is cheap; so if I have a million 
requests and for each one I create a new session is it still cheap? or a single 
stateless session servicing the requests is better?
Typical Application: telephone exchange; where numbers are bombarding the 
engine. For each incomming request I'd assume a single session would be the 
most optimal solution as long as the rules are common. Right?!

I'm wondering if I should also maintain an image, object = {RuleBase + Globals} 
so I can create a session. but I think this would have a huge performance cost 
to create new sessions per request. Right?

Thanks for the Fix, its  life saver!


Thanks,
Arjun



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Re: BRMS Server - memory Issue while execution - Critical

2007-07-20 Thread Michael Neale

Hi Arjun - I wouldn't recommend re-using session unless there is some
expensive state you wish to reuse. Pooling them will use up far more
resources then freeing them. You should only pool expensive to obtain
resources.

On 7/21/07, Arjun Dhar [EMAIL PROTECTED] wrote:


 Stateless sessions should not hold onto any references. Stateful do,
 and dispose() must be called when its finished - otherwise the rulebase
 holds a reference forever. If the rulebase is holding onto stateless
 sessions, then that is a bug.
 Mark


Thanks a lot Mark,
taking the latest binary passed the load testing one a single thread
atleast.
Though I need to confirm due to removal of modify() none of the
functionality
has got altered. It chokes a little in the middle but is not going out of
memory so I guess the leak is really fixed.

One last question on this:
On the Build 4MR2, I disposed the session and created a new one from the
cached
RuleBase and it took the load (on the code that had the memory leak)

So what approach is conceptually better; Keep the same statless session
for
ever or for each execution request use a new one?? I talking pure
performance/memory?!?!

I remember you saying creating sessions is cheap; so if I have a million
requests and for each one I create a new session is it still cheap? or a
single
stateless session servicing the requests is better?
Typical Application: telephone exchange; where numbers are bombarding the
engine. For each incomming request I'd assume a single session would be
the
most optimal solution as long as the rules are common. Right?!

I'm wondering if I should also maintain an image, object = {RuleBase +
Globals}
so I can create a session. but I think this would have a huge performance
cost
to create new sessions per request. Right?

Thanks for the Fix, its  life saver!


Thanks,
Arjun



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users