如何提高流口水的表现?

发布于 2024-12-10 02:25:30 字数 175 浏览 0 评论 0原文

有没有办法记录/监控 Drools 规则集中规则所花费的时间?

有没有一种方法可以确保一个规则不会执行多次(这似乎发生在我的情况下)

提高 Drools 性能的一般准则是什么?

目前我正在使用一个包含 100 条奇怪规则的 DRL 文件。

我们将提供您需要的任何其他信息。

Is there a way to log / monitor the time taken for rule in a Drools rule set?

Is there a way to make sure that one rule is not executed more than once(It seems to be happening in my case)

What are the general guidelines on improving Drools performance?

Currently I am using a one single DRL file with 100 odd rules.

Any additiional information you need will be provided.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

耳钉梦 2024-12-17 02:25:30

如果您的目标是记录/监视规则执行,则可以使用事件监听器,例如 AgendaEventListener (http://docs.jboss.org/drools/release/5.3.0.CR1/drools-expert-docs/html_single/ index.html#d0e2003) 或激活 Drools MBeans 以使用您选择的任何 JMX 控制台监视 Drools 应用程序。 MBeans 将为您提供每个规则的统计信息和汇总统计信息。

如何提高性能是一个非常广泛的问题,答案会比我在这里回答的要长得多,但简短的版本是:像 Drools 这样的规则引擎是一个类似于关系数据库的关系引擎,但具有不同的目标和优化。尽管如此,许多相同的原则都适用,并且您可以通过首先编写具有更严格约束的规则、在多个规则之间共享约束以及正确使用推理/链接来提高性能。

仅供参考,如果您在旧金山地区,我们将在下周规则节 (http://rulesfest.org/html/home.html) 期间举办免费的 Drools 训练营(但您仍然需要注册)。将呈现许多相关主题。

If your goal is to log/monitor rules execution, you can use either the Event Listeners, like AgendaEventListener (http://docs.jboss.org/drools/release/5.3.0.CR1/drools-expert-docs/html_single/index.html#d0e2003) or activate Drools MBeans to monitor a Drools application using any JMX console of your choice. MBeans will give you per rule stats and summarized stats.

How to improve performance is a very broad question and the answer would be much longer than I can answer here, but the short version is: a rules engine like Drools is a relational engine similar to relational databases, but with different goals and optimizations. Nevertheless, many of the same principles apply, and you can improve performance by writing rules with tighter constraints first, sharing constraints among multiple rules and making proper use of inference/chaining.

Just FYI, if you are in the San Francisco area, we will have a free Drools bootcamp (but you still have to register) next week during the Rules Fest (http://rulesfest.org/html/home.html) where we will present many of related topics.

筑梦 2024-12-17 02:25:30

我在使用 drools 时发现的唯一基本陷阱是关于何时进行块创作。不要在when块中使用计算。
这就是 drools 对 getters 的说法!

Person( age == 50 )

// this is the same as:
Person( getAge() == 50 )

注意
我们建议使用属性访问 (age) 而不是显式使用 getter (getAge()),因为通过字段索引可以增强性能。 (来源 )

Droolsassert 测试库可以帮助您检测多次触发的规则并记录/监控每个规则所花费的时间。

The only pitfall I found fundamental while working with drools is about when block authoring. Don't use computations in when blocks.
This is what drools says even about getters!:

Person( age == 50 )

// this is the same as:
Person( getAge() == 50 )

Note
We recommend using property access (age) over using getters explicitly (getAge()) because of performance enhancements through field indexing. (source)

Droolsassert testing library can help you detect rules which are triggered more than once and log/monitor time taken by each rule.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文