Monday, August 12, 2019

Recent Drools DMN open source engine performance improvements

We are always looking to improve the performance of the Drools DMN open source engine. We have recently reviewed a DMN use-case where the actual input population of Input Data nodes varied to some degree; this highlighted a suboptimal behavior of the engine, which we improved in recent releases. I would like to share our findings!

Benchmark development


As we started running a supporting benchmark for this use-case, especially when investigating the scenario of large DMN models with sparse-populated input data nodes, we noticed some strange results: the flamegraph data highlighted a substantial performance hit when logging messages, consuming very significant time in comparison to the application logic itself.


This flamegraph highlight specifically that a large portion of time is consumed by stacktrace synthesis, artificially induced by the logging framework. The correction, in this case, was to tune the logging configuration to avoid this problem; specifically, we disabled a feature of the logging framework which is very convenient during debugging activities, enabling to quickly locate the original calling class and methods: unfortunately this feature come at the expense of synthesizing stacktraces, which originally contaminated the benchmark results. Lesson learned here: always check first if non-functional requirements are actually masking the real issue!

This was a necessary and propaedeutic step, before proceeding to investigate the use-case in more details.


Improving performance


Moving on and focusing now on DMN optimizations, we specifically developed a benchmark to be general enough, but also highlighting the use-case which was presented to us. This benchmark consists of a DMN model with many (500) decision nodes to be evaluated. Another parameter controls sparseness of input data nodes valorization for evaluation; ranging from a value of 1 where all inputs are populated, to 2 where only one out of two inputs is actually populated, etc.

This specific benchmark proved to be a very instrumental tool to highlight some potential improvements. 

Setting the comparison baseline to Drools release 7.23.0.Final, the first optimization implemented with DROOLS-4204 focused on improving context handling while evaluating FEEL expressions and demonstrated to offer a ~3x improvement, while further optimization implemented with DROOLS-4266 focusing on specific case for decision table input clauses demonstrated an additional ~2x improvement on top of DROOLS-4204.

We also collected these measurements in the following graphs.


This graph highlights the compounding improvements in the case of sparseness factor equal to 1, where all inputs are populated; this was a very important result, as in fact it did represent the main, “happy path” scenario in the original use-case.

In other words, we achieved a ~6x improvement in comparison to running the same use-case on 
7.23.0.Final. The lesson I learned here is to always strive for these kind of compounding improvements when possible, as they really build on top of each other, for greater results!

For completeness, we repeated the analysis with sparseness factor equals to 2 (1 every 2 inputs is actually populate) and 50 (1 every 50 inputs is actually populated) with the following measurements:



Results show that the optimizations were also significant for sparseness factor equal to 2, but not as relevant improvements as this factor grows -- which is expected, as the impact of the decision nodes evaluations on the overall logic of execution become now less relevant. 

For completeness, analysis was also performed with another, already existing benchmark for single decision table consisting of many rules rows:


Results show that these code changes considered as a whole, still offered a relevant improvement; although clearly not of the same magnitude as for the original use-case. This was another important check to ensure that these improvements were not overfitting on the specific use-case.

Conclusions


Considering Drools release 7.23.0.Final as the baseline, and a reference benchmark consisting of a DMN model with many decision nodes to be evaluated, we implemented several optimizations that once combined demonstrated to offer a total of ~6x speed-up on that specific use case!

I hope this was an interesting post to highlight some of the dimensions were to look into to achieve better performances; let us know you thoughts and feedback.

You can already benefit today from these Kie DMN open source engine improvements in the most recent releases of Drools! 



Share/Bookmark

8 comments:

  1. Drools is a business-rule the board framework with a forward-fastening and in reverse anchoring deduction based guidelines motor, permitting quick and dependable assessment of business rules and complex occasion handling. A standards motor is likewise a central building square to make a specialist framework which, in man-made brainpower, is a PC framework that copies the basic leadership capacity of a human master. I will share your post on my platform mobile app developer company USA

    ReplyDelete
  2. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. clenbuterol France

    ReplyDelete
  3. This short article posted only at the web site is truly good.

    ReplyDelete
  4. Search engine optimization reputable excellent influence sites to put the links talk about, as you cope with other areas of you could try this out Lookup marketing providers contextual Hyperlinks for your personalized clients, SEO change may be accomplished proficiently by our team...

    ReplyDelete
  5. DMN is trying to do for Business Decision Management what BPMN did for Business Process Management a decade ago: empower the business to take charge of the logic that drives its operations, through a vendor-independent diagramming language. To be effective, that language must be both usable by business analysts and stakeholders in the business and verifiable for completeness and consistency. DMN is both. Thanks for sharing ~ Charlotte W. from data analytics solutions

    ReplyDelete
  6. Keep it up!! You have done the nice job having provided the latest information.
    check out the post right here

    ReplyDelete

  7. TeaTv Apk Is Another One Of The Best Online Streaming Application For Smartphone Users. This Application Is Available For Android & IOS Users. Also, You Can Connect This Application Easily With Amazon Firestick, Android Smart TVs, Start Settop Box, Etc. There are more apk to online streaming is Mediabox apk for smartphone users ( Android and ios ) and
    Best Wishes Quotes 
    Watch Free online Movies 
    onhax 
    onhax android 
    Hulu Apk 

    ReplyDelete