Re: [rules-users] Fusion appears to be working properly, but...

2011-10-14 Thread Edson Tirelli
   Wolfgang is correct. Just an additional distinction that is important:
expiring an event is different then retracting an event/fact. Imagine that
there was a computer with infinite processing power and infinite memory. In
that case, we would never need to expire any events, we would just keep them
all in memory forever. This is obviously not the case, but it gives us the
sense of truth. An event represents something that happened and as so it
is true. Since the past can't be changed, it will be true forever. So
expiring an event is a way to optimize the resource consumption of the
limited hardware we have, but it does not make events false. So any
activation created due to events, will remain active until they are fired,
even if the events that created it expire.

   In other words: if your event has an expiration policy of 2 seconds, it
comes into the system and activates rules for the next 2 seconds. After that
time, that event will no longer create any other activation. Also:

* If you are running fireUntilHalt(), the rules will fire asap, depending on
the conflict resolution with other rules.

* If you are running fireAllRules(), even if it takes 10 minutes for your
application to fire the rules, they will still fire, because **expiration**
of events do not cancel activations. **Retraction** of facts/events and
**modifications** of facts might cause activations to be cancelled.

   Hope it is clear.

   Edson

2011/10/14 Wolfgang Laun wolfgang.l...@gmail.com

 On 14 October 2011 06:31, slyfox bobby.richa...@gmail.com wrote:

 thanks for the response, that makes a little more sense.  That is an issue
 because the whole idea of CEP is to process events as they happen.  My
 next
 step is adding camel support so that I can consume the amqp feed without
 manually inserting into the session.  I guess fireuntilhalt is my only
 option.  But what does fire until halt do, is it just a continuous loop or
 is is smart enough to only process events when they come in?


 There is one reasons for the thread running a Drools engine until halt
 to become active: when a fact is inserted. After doing the work resulting
 from this, the thread falls back into suspension.


 so what would happen if the event is given an expiration of say 2 seconds?
 if you were calling fireallrules in anything over a 2 second interval you
 would miss a lot.


 An event that has expired any time before you fireAllRules is discarded
 soon after this call is entered. What could you miss in the time between
 the scheduled expiry and the actual removal?

 Note that any application that expects to produce real-time reactions
 is bound to fireUntilHalt.



 I do not really see the benefit of fusion then, seems like its redundant?
  I
 hope that I am missing something.


 There isn't really a Fusion thing. (Think of it as a marketing gag.)
 The Drools Rule Engine is capable of dealing with facts that have the
 distinct traits of what is called event: timestamp, duration and
 expiry; the Engine is clever enough to retract stale events automatically,
 and there's a set of operators for comparing numbers that may
 represent points in time with some fancy overlap options. If you don't
 need anything of this, don't use it; OTOH, if you compare dates, just
 using the temporal operators may help.

 -W


 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3420701.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



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




-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Fusion appears to be working properly, but...

2011-10-14 Thread slyfox
Thank you both, that helps a lot.  So fusion really helps to just manage the
lifetime of a fact?

I am trying to migrate my hand coding trading and analysis application to
drools.  

I think it will work fine for currencies, perhaps only 100 messages per
second, but I am worried about equity options data which could be 100k+
messages a second.

Do you guys have any tips or trick for dealing with that amount of data,
like a messages per second to rule ratio?  Granted I know that is arbitrary
because its based on the rule complexity.  But perhaps simple two - three
line basic rules.  Is it even possible to answer this?

Are there any metrics on the capabilities of drools for high message, high
rule count scenarios?

Thanks again.
Bobby

--
View this message in context: 
http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3421986.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


Re: [rules-users] Fusion appears to be working properly, but...

2011-10-14 Thread Mauricio Salatino
You need to analyze if you can handle 100k objects creation per second in
java first.. I think that will be the first bottle neck :)

On Fri, Oct 14, 2011 at 12:16 PM, slyfox bobby.richa...@gmail.com wrote:

 Thank you both, that helps a lot.  So fusion really helps to just manage
 the
 lifetime of a fact?

 I am trying to migrate my hand coding trading and analysis application to
 drools.

 I think it will work fine for currencies, perhaps only 100 messages per
 second, but I am worried about equity options data which could be 100k+
 messages a second.

 Do you guys have any tips or trick for dealing with that amount of data,
 like a messages per second to rule ratio?  Granted I know that is arbitrary
 because its based on the rule complexity.  But perhaps simple two - three
 line basic rules.  Is it even possible to answer this?

 Are there any metrics on the capabilities of drools for high message, high
 rule count scenarios?

 Thanks again.
 Bobby

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3421986.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




-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
- Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

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


Re: [rules-users] Fusion appears to be working properly, but...

2011-10-14 Thread Wolfgang Laun
And before the object creation, you'll have to get the data into your system...
-W

2011/10/14 Mauricio Salatino sala...@gmail.com:
 You need to analyze if you can handle 100k objects creation per second in
 java first.. I think that will be the first bottle neck :)

 On Fri, Oct 14, 2011 at 12:16 PM, slyfox bobby.richa...@gmail.com wrote:

 Thank you both, that helps a lot.  So fusion really helps to just manage
 the
 lifetime of a fact?

 I am trying to migrate my hand coding trading and analysis application to
 drools.

 I think it will work fine for currencies, perhaps only 100 messages per
 second, but I am worried about equity options data which could be 100k+
 messages a second.

 Do you guys have any tips or trick for dealing with that amount of data,
 like a messages per second to rule ratio?  Granted I know that is
 arbitrary
 because its based on the rule complexity.  But perhaps simple two - three
 line basic rules.  Is it even possible to answer this?

 Are there any metrics on the capabilities of drools for high message, high
 rule count scenarios?

 Thanks again.
 Bobby

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3421986.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



 --
  - CTO @ http://www.plugtree.com
  - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jugargentina.org
  - Co-Founder @ http://www.jbug.com.ar

  - Salatino Salaboy Mauricio -

 ___
 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


Re: [rules-users] Fusion appears to be working properly, but...

2011-10-14 Thread slyfox
ok bad example.

Are there any metrics on drools performance that I could reference?

--
View this message in context: 
http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3422055.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


Re: [rules-users] Fusion appears to be working properly, but...

2011-10-14 Thread Wolfgang Laun
No such thing, just like there is no metrics on the performance of a
C program. Reason: it depends.

Before you invest heavily, rig up a set of rules according to what
you'll need, create some data and benchmark *your application*, or at
least as close as possible. The speed of Drools for solving the Zebra
puzzle or Sudokus is irrelevant for you.

-W

On 14 October 2011 17:43, slyfox bobby.richa...@gmail.com wrote:
 ok bad example.

 Are there any metrics on drools performance that I could reference?

 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3422055.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

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


Re: [rules-users] Fusion appears to be working properly, but...

2011-10-14 Thread Edson Tirelli
   Unfortunately, it is a hard question to answer, because it is the same as
asking: what is the performance of a database (postgreSQL, Oracle, etc)? It
is totally dependent on the data you load, the queries you write and the
indexes you use.

   So you need to think about overhead and pay-off of using such a
technology. If you are considering performance alone, an nothing else (ease
of rule maintenance, knowledge management lifecycle, time to market,
training costs, etc) and you have 10 rules, the optimizations that the
engine bring into place will probably not pay off in terms of performance
and it would be more performant to write the 10 rules in java. If you have
10k rules, then the optimizations will pay off multiple times and you will
have better performance than coding the rules in java (unless you are coding
your rules like a rules engine compiler does).

   The more rules you have, the more advantage you have using a rules
engine.

   Finally, when talking about high volumes, you will have to think about
horizontal scalability as it vertical scalability is much more expensive to
achieve. Using multiple agents is an easy way to do that, as long as you can
partition your data.

   I can tell you I've personally worked with customers with knowledge bases
in the order of several tens of thousands of rules large, as well as
customers with millions of facts simultaneously in memory. So it is possible
to scale, but the performance of your system will depend on your use case
and the more rules you have, the more benefits you get.

   Edson




2011/10/14 slyfox bobby.richa...@gmail.com

 ok bad example.

 Are there any metrics on drools performance that I could reference?

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3422055.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




-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Fusion appears to be working properly, but...

2011-10-13 Thread slyfox
It seems like I have fusion working correctly, yet the rules are not firing.

I have a quote object 

class Quote {
private String symbol;
private double bid;
private double ask;

   //eclipse generated getters and setter
}

in my drl I have the following:
import path.to.quote;

declare entry-point Incoming Quotes
@doc (incoming quotes)
end

declare Quote
@role (event)
//@expires(2s)
end

rule show something
when
FXQuote(symbol == EUR/USD, s:symbol) from entry-point 
Incoming Quotes
then
System.out.println(euro quote);
end

in my code I am inserting manually:
quoteStream = ksession.getWorkingMemoryEntryPoint(Incoming Quotes);
...
quoteStream.insert(quote); 

I have verified I am getting quote objects with symbol == EUR/USD yet the
rule is not firing


I only say that it *appears* that I have the stream set up properly because
everything compiles and runs and in my log file I see the incoming quotes:

org.drools.audit.event.ObjectLogEvent
  type1/type
  factId6/factId
  objectToStringcom.trendfx.fxlib.FXQuote@103ec0d/objectToString
/org.drools.audit.event.ObjectLogEvent
org.drools.audit.event.ObjectLogEvent
  type3/type
  factId2/factId
  objectToStringcom.trendfx.fxlib.FXQuote@145f918/objectToString
/org.drools.audit.event.ObjectLogEvent
org.drools.audit.event.ObjectLogEvent
  type3/type
  factId3/factId
  objectToStringcom.trendfx.fxlib.FXQuote@184843c/objectToString
/org.drools.audit.event.ObjectLogEvent
org.drools.audit.event.ObjectLogEvent
  type3/type
  factId5/factId
  objectToStringcom.trendfx.fxlib.FXQuote@1912b66/objectToString
/org.drools.audit.event.ObjectLogEvent

etc..

simple rule but no output, tried debugging but since I can only add
breakpoints to RHS this doesnt really help me

Thanks,
Bobby







--
View this message in context: 
http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3420043.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


Re: [rules-users] Fusion appears to be working properly, but...

2011-10-13 Thread Mauricio Salatino
did you call the fire all rules method?

On Thu, Oct 13, 2011 at 7:23 PM, slyfox bobby.richa...@gmail.com wrote:

 It seems like I have fusion working correctly, yet the rules are not
 firing.

 I have a quote object

 class Quote {
private String symbol;
private double bid;
private double ask;

   //eclipse generated getters and setter
 }

 in my drl I have the following:
 import path.to.quote;

 declare entry-point Incoming Quotes
@doc (incoming quotes)
 end

 declare Quote
@role (event)
//@expires(2s)
 end

 rule show something
when
FXQuote(symbol == EUR/USD, s:symbol) from entry-point
 Incoming Quotes
then
System.out.println(euro quote);
 end

 in my code I am inserting manually:
 quoteStream = ksession.getWorkingMemoryEntryPoint(Incoming Quotes);
 ...
 quoteStream.insert(quote);

 I have verified I am getting quote objects with symbol == EUR/USD yet the
 rule is not firing


 I only say that it *appears* that I have the stream set up properly because
 everything compiles and runs and in my log file I see the incoming quotes:

 org.drools.audit.event.ObjectLogEvent
  type1/type
  factId6/factId
  objectToStringcom.trendfx.fxlib.FXQuote@103ec0d/objectToString
 /org.drools.audit.event.ObjectLogEvent
 org.drools.audit.event.ObjectLogEvent
  type3/type
  factId2/factId
  objectToStringcom.trendfx.fxlib.FXQuote@145f918/objectToString
 /org.drools.audit.event.ObjectLogEvent
 org.drools.audit.event.ObjectLogEvent
  type3/type
  factId3/factId
  objectToStringcom.trendfx.fxlib.FXQuote@184843c/objectToString
 /org.drools.audit.event.ObjectLogEvent
 org.drools.audit.event.ObjectLogEvent
  type3/type
  factId5/factId
  objectToStringcom.trendfx.fxlib.FXQuote@1912b66/objectToString
 /org.drools.audit.event.ObjectLogEvent

 etc..

 simple rule but no output, tried debugging but since I can only add
 breakpoints to RHS this doesnt really help me

 Thanks,
 Bobby







 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3420043.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




-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
- Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

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


Re: [rules-users] Fusion appears to be working properly, but...

2011-10-13 Thread slyfox
i did not but I was under the impression that the fireallrules method was for
expert an not fusion.  So anytime I have an 'event' come in I must call this
method?

I see that it works now, but this seems inefficient to me, how does this
differentiate fusion, if its just like expert in a loop?

Thanks for the response,
Bobby



--
View this message in context: 
http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3420143.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


Re: [rules-users] Fusion appears to be working properly, but...

2011-10-13 Thread Edson Tirelli
   Fusion is a set of features added to all the Expert features, so in the
end, they just leverage each other... it is not like Fusion only uses
events, and Expert only uses facts... the goal of the Drools platform is to
make it completely transparent for the user to write their
rules/queries/processes using all the features together...

   Having said that, yes, you must either call fireAllRules() from time to
time (for instance, after each insert, or every 20 seconds, or whatever), or
you can start a thread and call fireUntilHalt() to place the engine in
reactive mode (probably what you were looking for).

   Edson

2011/10/13 slyfox bobby.richa...@gmail.com

 i did not but I was under the impression that the fireallrules method was
 for
 expert an not fusion.  So anytime I have an 'event' come in I must call
 this
 method?

 I see that it works now, but this seems inefficient to me, how does this
 differentiate fusion, if its just like expert in a loop?

 Thanks for the response,
 Bobby



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3420143.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




-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Fusion appears to be working properly, but...

2011-10-13 Thread slyfox
thanks for the response, that makes a little more sense.  That is an issue
because the whole idea of CEP is to process events as they happen.  My next
step is adding camel support so that I can consume the amqp feed without
manually inserting into the session.  I guess fireuntilhalt is my only
option.  But what does fire until halt do, is it just a continuous loop or
is is smart enough to only process events when they come in?

so what would happen if the event is given an expiration of say 2 seconds? 
if you were calling fireallrules in anything over a 2 second interval you
would miss a lot.  

I do not really see the benefit of fusion then, seems like its redundant?  I
hope that I am missing something.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3420701.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


Re: [rules-users] Fusion appears to be working properly, but...

2011-10-13 Thread Wolfgang Laun
On 14 October 2011 06:31, slyfox bobby.richa...@gmail.com wrote:

 thanks for the response, that makes a little more sense.  That is an issue
 because the whole idea of CEP is to process events as they happen.  My next
 step is adding camel support so that I can consume the amqp feed without
 manually inserting into the session.  I guess fireuntilhalt is my only
 option.  But what does fire until halt do, is it just a continuous loop or
 is is smart enough to only process events when they come in?


There is one reasons for the thread running a Drools engine until halt
to become active: when a fact is inserted. After doing the work resulting
from this, the thread falls back into suspension.


 so what would happen if the event is given an expiration of say 2 seconds?
 if you were calling fireallrules in anything over a 2 second interval you
 would miss a lot.


An event that has expired any time before you fireAllRules is discarded
soon after this call is entered. What could you miss in the time between
the scheduled expiry and the actual removal?

Note that any application that expects to produce real-time reactions
is bound to fireUntilHalt.



 I do not really see the benefit of fusion then, seems like its redundant?
  I
 hope that I am missing something.


There isn't really a Fusion thing. (Think of it as a marketing gag.)
The Drools Rule Engine is capable of dealing with facts that have the
distinct traits of what is called event: timestamp, duration and
expiry; the Engine is clever enough to retract stale events automatically,
and there's a set of operators for comparing numbers that may
represent points in time with some fancy overlap options. If you don't
need anything of this, don't use it; OTOH, if you compare dates, just
using the temporal operators may help.

-W


 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-but-tp3420043p3420701.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

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