I'll use a university's library system to explain my use case. Students
register in the library system and provide their profile: gender, age,
department, previously completed courses, currectly registered courses,
books already borrowed, etc. Each book in the library system will define
some borrowing rules based on students' profile, for example, a textbook for
the computer algorithm can only be borrowed by students currently registered
with that class; another textbook may only be borrowed by students in the
math department; there could also be rules such that students can only
borrow 2 computer networking book at most. As a result of the borrowing
rules, when a student searches/browses in the library system, he will only
see the books that can be borrowed by him. So, the requirement really comes
down to the line of efficiently generating the list of books that a student
is eligible to borrow.
Here is how I vision the design using Drools - each book will have a rule
with a few field constraints on the student profile as LHS, the RHS of the
book rule simply adds the book id to a global result list, then all the book
rules are loaded into a RuleBase. When a student searches/browsers the
library system, a stateless session is created from the RuleBase and the
student's profile is asserted as the fact, then every book that the student
can borrow will fire its book rule and you get the complete list of books
that the students can borrow in the global result list.
A few assumptions: the library will handle millions of books; I don't
expect the book rule be too complicated, 3 simple field constraints for each
rule on average at the most; the number of students that the system needs to
handle is in the range of 100K, so the load is fairly heavy. My questions
are: how much memory will Drools take if loaded with a million book rules?
How fast will it be for all those million rules to fire? If Drools is the
right fit, I'd like to hear some best practices in designing such a system
from you experienced users. Thanks.