[rules-users] CPU Spike creating a StatefulKnowledgeSession using OSGi

Leonardo Gomes leonardo.f.gomes at gmail.com
Wed Jan 11 03:17:41 EST 2012


I'm not sure which version he's using, but there were already some fixes
around this on 5.2 and/or 5.3, done by Surdilovic, if I recall well..

I've applied the same sort of approach here, but haven't proposed a pull
request, because I didn't have time to check if it was already fixed on 5.4:
https://github.com/leogomes/drools-compiler/commit/e42e3480c4c6a0a0cbfe5f3d198ec493ecf45035

However, the problem of looking up excessively the classpath, specially in
cases where we will never find what we are looking for, remains for the
compilation step. Other than an OSGI environment, you can notice it also
while running on Weblogic 11g with a lot of stuff on your classpath. I
tried to start a thread to discuss that on the dev's list sometime ago:

http://drools.46999.n3.nabble.com/Rules-compilation-and-unnecessary-attempts-to-getResourceAsStream-td3481614.html

Cheers,
Leo.



2010/8/10 Mark Proctor <mproctor at codehaus.org>

> **
> On 10/08/2010 17:22, David Conde wrote:
>
> Hi Pavel,
>
>  I've changed it over to use a stateless session and I'm seeing the
> same behavior. I've done some debugging and it seems to be very slow
> loading up the SessionConfiguration due to all of the loading that happens
> in ChainedProperties.
>
> it could well be that.
>
> When looking for property we search the available classpaths. With OSGi
> you have to add a lot of classpaths to it, so it searches them all...
>
> Other than telling it not to search the classpath for .properties files,
> not sure what else we can do here...
>
> Mark
>
>
>  Thanks,
> Dave
>
> On 10 August 2010 13:53, Pavel Tavoda <pavel.tavoda at gmail.com> wrote:
>
>> Interesting. Normally it should be fast. Try to change your patter and
>> load binary compiled serialized package from disk. You can find it in
>> documentation.
>> Also consider using stateless session. Do you really need stateful
>> session?
>>
>> Pavel
>>
>> 2010/8/9 David Conde <dconde at calomtech.com>:
>> > Is it possible that this might be invoking the compiler when a session
>> is
>> > created? I have all of the init code in the service start call and
>> stored as
>> > members of the service for reuse but I must create a new knowledge
>> session
>> > for each run.
>> > Any ideas?
>> > Thanks,
>> > Dave
>> >
>> > ---------- Forwarded message ----------
>> > From: David Conde <dconde at calomtech.com>
>> > Date: 9 August 2010 11:17
>> > Subject: Re: [rules-users] CPU Spike creating a StatefulKnowledgeSession
>> > using OSGi
>> > To: Rules Users List <rules-users at lists.jboss.org>
>> >
>> >
>> > The line that it spikes on is StatefulKnowledgeSession ksession =
>> > kbase.newStatefulKnowledgeSession();.
>> > Cheers,
>> > Dave
>> >
>> > On 9 August 2010 11:09, Pavel Tavoda <pavel.tavoda at gmail.com> wrote:
>> >>
>> >> Is it session creation or rule compilation?
>> >>
>> >> Pavel
>> >>
>> >> 2010/8/9 David Conde <dconde at calomtech.com>:
>> >> > Good Morning,
>> >> > I now have drools running on the Spring DM-Server but I am seeing a
>> CPU
>> >> > spike when creating a StatefulKnowledgeSession. I've tested this
>> outside
>> >> > of
>> >> > an OSGi environment and I don't see the spike. Does anyone know any
>> >> > settings
>> >> > that I can change that might make this go away?
>> >> > Thanks,
>> >> > Dave
>> >> >
>> >> > --
>> >> > David Conde
>> >> > CTO Calom Technologies
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > rules-users mailing list
>> >> > rules-users at lists.jboss.org
>> >> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >> >
>> >> >
>> >>
>> >> _______________________________________________
>> >> rules-users mailing list
>> >> rules-users at lists.jboss.org
>> >> https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > rules-users mailing list
>> > rules-users at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>> >
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> _______________________________________________
> rules-users mailing listrules-users at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120111/690aa0c7/attachment.html 


More information about the rules-users mailing list