On Aug 27, 2007, at 11:15 AM, Yang Song wrote:
Hi, Robert,
I am very interested in the database access part, because I am also
considering to add the database access code into my rule. But my
current concern is the performance.
It would be very appreciated if can let me know how many times of
database access is in your whole test suite, which cost 6 seconds?
Is it always validating the same user or randomly picking different
users to validate -- if using the same query, database may get
result cached which will result a better performance? Did you add
any arbitrary object caching in your java code for performance
optimization?
Basically, the test was to validate the configuration for each of 19
sites. The configuration for each site consists of about 1500
records, and the validation is extremely simple -- is the value for
one particular field valid for this particular site. Each site needed
to query a complete set of data; the two queries involved in that are
what took 6 seconds.
Our database is not known for its performance. Apparently it gets the
data back to us pretty quick, but it takes a second or two to set up
the query. And, yes, we're caching database connections. We're
constantly debating with our DBAs over database performance.
In this particular case, a better strategy for querying the data is
to load the configuration for multiple sites at once. The rules
wouldn't be that much more complicated (one or two additional
conditions), and we'd be hitting the database less frequently. I'd
bet I could get this test down to under 30 seconds with this
approach, maybe even down to under 10. Trying to write the procedural
code to handle this would be difficult, and still wouldn't give us
the flexibility the users are asking for.
I've not tried hitting the database during rule evaluation, but may
have to in future phases of the project. Let me know how it goes for
you!
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users