Restrict size/resource usage of drools session

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Restrict size/resource usage of drools session

kurrent93
Hi

We have an application where users write their own rules via a UI, and these are then translated into drl, and run in a dedicated drools session. Each user can have one or more sessions.

However, there are times when something goes wrong - say a rule starts looping - and it consumes all the resources - the server is running at 100% cpu, and it then effects all users.

I realize we can optimize the the generated rules to prevent such issues, and we are working on this - however am interested to know if there are any ways - such as somehow sandboxing / restricting the resources that a drools session can use, so that should a rule cause problems, it will not effect the other running drools sessions.

Thanks for any advice on this problem.
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Restrict size/resource usage of drools session

laune
There are options to restrict the size of the JVM memory allocation pool.

Loops can go over two or more rules, so take care. Catching such loops
is possible, up to a limit.

-W

On 08/05/2014, kurrent93 <[hidden email]> wrote:

> Hi
>
> We have an application where users write their own rules via a UI, and
> these
> are then translated into drl, and run in a dedicated drools session. Each
> user can have one or more sessions.
>
> However, there are times when something goes wrong - say a rule starts
> looping - and it consumes all the resources - the server is running at 100%
> cpu, and it then effects all users.
>
> I realize we can optimize the the generated rules to prevent such issues,
> and we are working on this - however am interested to know if there are any
> ways - such as somehow sandboxing / restricting the resources that a drools
> session can use, so that should a rule cause problems, it will not effect
> the other running drools sessions.
>
> Thanks for any advice on this problem.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Restrict-size-resource-usage-of-drools-session-tp4029486.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Restrict size/resource usage of drools session

kurrent93
I was thinking of having a master session that can listen to activation events of the child sessions, and then can take action should a threshold be breached.

Can you recommend what eventlisteners would be useful in this scenario?
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Restrict size/resource usage of drools session

laune
If you can set a limit for activations following one insert, an
AgendaEventListener registering Before/AfterMatchFired is the natural
choice. You might also limit secondary insertions
(WorkingMemoryEventListener: ObjectInsertedEvent) or fact updates
(ObjectUpdatedEvent).

All of this is highly dependent on the scenarios enacted by the rule set.

-W


On 08/05/2014, kurrent93 <[hidden email]> wrote:

> I was thinking of having a master session that can listen to activation
> events of the child sessions, and then can take action should a threshold
> be
> breached.
>
> Can you recommend what eventlisteners would be useful in this scenario?
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Restrict-size-resource-usage-of-drools-session-tp4029486p4029488.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Restrict size/resource usage of drools session

kurrent93
Thanks, yes good idea. I will look into that.