Fork me on GitHub
#clara
<
2015-11-24
>
ragge13:11:28

@ryanbrush: are there any guidelines/limits for the number of facts?

ryanbrush14:11:08

@ragge Not really, besides the limits of the JVM. We frequently have 100,000+ facts in our sessions, and I've tested into the millions (although for a limited scenario). Most of the work is done in Clojure group-by and reducer functions, which scale well.

ryanbrush14:11:06

@ragge The only thing to keep in mind is doing a non-equality cartesian join over lots of facts. Rule constraints that join on equals use hash-based joins, which scale well. This constraint applies pretty commonly to rule engines.

ragge16:11:23

@ryanbrush: thanks for your reply, will definitely give it a go for our use case (which is currently around 50k facts)

ryanbrush16:11:35

@ragge Sounds good. Clara's performance should at least be competitive with other JVM-based rule engines and is working well with a large number of facts for us. If you do run into a workload that isn't doing well, please let me know.

albaker17:11:37

is there a performance measurement of Clara?

albaker17:11:09

or guidelines, like how much memory you should budget for number of facts/rules?

ryanbrush21:11:53

@albaker I use Criterium (https://github.com/hugoduncan/criterium) against a function that loads and exercises our Clara rulesets to measure performance. I did post the program I wrote some time ago to benchmark Clara itself at https://github.com/rbrush/clara-benchmark, but generally its easier just to write your own test function and use Criterium to measure.

ryanbrush21:11:21

@albaker Some considerations for a memory budget: each condition on a rule will compile into its own function, and identical conditions between rules are reused, reducing the overall size. The facts are mostly just stored in Clojure sequences, or maps grouped by fact type. In general, the memory footprint will be dominated by the size of the facts you have.

ryanbrush21:11:07

I think the best way to think of it as you're just writing Clojure functions and creating Clojure structures. Clara will wire things together, but the footprint is generally a function of the size of your data.

albaker23:11:33

Cool, thanks!