SlideShare una empresa de Scribd logo
1 de 22
Developing
    Configurable and
    High Performance
    Apps in Drools

    Ajay Mahajan
    Lead Architect




1
Agenda


      What, Where, Why, When

      Drools Eco-System & A Use Case

      Rule Definitions

      Usage - Deployment Modes


      Best Practices
                                       Value from Session

2
What, Where, Why, When




3
What is a Rule Engine




4
Where Does It Fit




                        Parameterization


                          Code

                          Config Files

                          Database


                           Rules Engine




5
Why Should I Bother




                                    • Many ways to define Rules
                   Flexibility &    • Group rules and define priorities
                  Configurability   • Plethora of functions that help in decisioning
    Rule Engine




                                    • User friendly and Business Like
                  Manageability     • Better Tooling Support
                                    • Easier Understanding & Visualization


                                    • Just define your rules not execution details
                  Declarative v/s   • Execution is handled by Rules Engine
                    Imperial          • Sequencing and Re-entry
6
FUDs – Fear, Uncertainty and Doubt
                  • True, as compared to if-else statements in code

       Slow       • However, Rules are precompiled
                  • In Some Cases, execution is faster if designed correctly




                  • Yes, they do have a learning curve

     Difficult    • Start small and Limit the features to those you really need
                  • You don’t have to learn each feature and function offered




      More        • Yes, rules engine do need more space than a java class file
                  • Precompiled Rules form a Rete graph


     Memory       • Use stateless models where use case allows
                  • Stateful models – Follow the optimizations and mind your memory



                  • Commercial Tools can get expensive, e.g. Blaze and Jrules

    Expensive     • Open Source Drools has evolved over time, in its version 5.5
                  • Drools used in high volume, mission critical systems

7
When Should I Use a Rule Engine
    IF (Requirements== expressed as rules)


    IF (Rules == many OR complex OR changing frequently)


    IF (Rules == managed separately from application code)


    IF (memory != very low)


    IF (Application == evolving)


    IF (Developers == have skills OR ok with learning curve)


    IF (Business Users == like to see / experiment with rules)


    IF ( Additional Complexity < Benefits in Flexibility + Configurability)


    THEN use Rules Engine
8
Drools Ecosystem




9
Jboss - Drools
            Expert
            • Main Rules Engine Component
            • Have Stabilized after going through product cycles
            • Highly Successful and widely used

            Rule Flow (replaced by jBPM)
            • Group into Rule sets and define flow chart to execute them
            • Graphical Environment to define work flows
            • jBPM using BPMN 2.0 is the way to go for any serious BPM

            Guvnor
            • Web Based GUI to manage the Rules
            • Split out as separate component in V5
            • Read Only in Production, but modify in test/UAT for business

            Planner
            • Resources– travelling salesman, scheduling, routing
            • Heuristic Rules
            • Relatively new

            Fusion
            • Event Processing- ESP / CEP use cases
            • Concept of Sliding Time window
            • Other products such as Esper and Twitter Storm

10
Drools Expert – Steps
              • DRL, Decision
     Define     Tables, DSL



              Compile    • To Knowledge base



                          Create      • Uses Knowledge base
                          Session

                                       Insert   • Causes Activations
                                       Facts

                                                   Fire       • RHS
                                                  Rules         Executes

11
Real Use Case



     Trades
                              Matching Engine               Match Statuses
     T1, T4, T3, T2
                                                            T1     C3
                                                            T2      C1 + C3
                                                            T3+T4       C4


                               Confirmation
                               C1, C2, C3, C4

      100’s of Trades and Confirmations inflowing per second at peak hr
      Flowing in any order, not necessarily one after the other
      One trade can exactly match to one confirmation
      A trade can match to more than one confirmation
      One or more trades can match to one Confirmation
12
DRL – Drools Rules Language
     rule "Perfect Match"
          salience 100

            when
                   t:Trade()
                   c:Confirm(qty == t.qty , confirmId == t.cusip , amt == t.amt , price == t.price )
            then
                   log("Perfect Match for " + t.toString() + c.toString());
                   Match perfectMatch = new Match(t,c, "Perfect");

                   // retract perfect matches
                   retract(t);
                   retract(c);
     end                                                               Trade to Confirm Matching

                                                                  Why is this
           The base language for Rules Definition                  blazing
               All other Forms compile to this language            fast ??

           Rich and Versatile
               Entire Syntax, features and Rules definition is available


           Least User Friendly
13
DSL - Domain Specific Language
     expander Match.dsl

     rule "Exact Match Trade to Confirm"
     when
          Match Trade and Confirm
               - on cusip with confirmId
               - on amt
               - on price
     then
          Log "Perfect Match“
          Create Match with Status “Perfect”
          Remove Matched Elements
     end


        This is real code not Pseudo code

        DSL combines with grammar definition and translates to DRL
        Very Easy to Understand for Users and Visualize
        Power of creating new business vocabulary
        Encourages reuse



14
Decision Table
                             RuleTable     TradeRequests
                             NAME          CONDITION
                                                   CONDITION        ACTION             ACTION              ACTION            ACTION              ACTION                ACTION
                                           event:Event
                                                   event:Event
                                           eventGroup
                                                   $param != null   TradeRequest tr = ne
                                                                                       tr.setStartCaptureDate(DateUtils.getBusinessDate(event.get$1(), $2+1));
                                                                                                           tr.setEndCaptureDate(DateUtils.getBusinessDate(event.get$1(), $2+1));
                                                                                                                             tr.setStartTradeDate(DateUtils.getBusinessDate(event.get$1(), $2));
                                                                                                                                                 tr.setEndTradeDate(Date
                                                                                                                                                                       tr.setSettlementF


Trade Condition                            Event                                       Start Capture       End Capture                                                 Settlement
(Comment Column)             Name          Group Date Present       Trade Type         Date                Date              Traded After        Traded Before         Flag
TD < ED ; F = F              IncOpenFail   I     effectiveDate      Open Fails                             FreezeDate, 0                         EffectiveDate, -1     "F"

TD < ED ; SD <= FD ; F = O   IncRegOpen    I       effectiveDate    Regular Open       EffectiveDate, -1   FreezeDate, 0                         EffectiveDate, -1     "O"
TD < ED ; FD < SD            IncExtSet     I       effectiveDate    Extended Settle    EffectiveDate, -1   FreezeDate, 0                         EffectiveDate, -1

ED<=TD ; SD <=FD ; CD <= FD IncShortSet    I       effectiveDate    Short Settle       EffectiveDate, 0    FreezeDate, 0     EffectiveDate, 0
TD < ED ; FD < PD           IncAsOf        I       effectiveDate    As of Trades       FreezeDate, 1                                             EffectiveDate, -1


                                                                                                                                            Corporate Actions

          Excel columns are designated as Conditions or Actions

          Top few control rows are hidden from users,
                     Control rows help translate the excel into DRL


          Easy to understand for Users, once basic Excel formats are given
          Fit for use cases where there is need for intense parameterization

15
Learning & Best Practices
       Experiences, Usage Models, Performance




16
Real Life Experiences

       Complex Matching Engines

       •   Multiple Engines used for various functional matching
       •   Performed at 600 transactions / sec on one instance of execution
       •   If the I/o (messaging / database) were commented, got 8k executions / sec
       •   Stateful models used, but memory was conversed through optimizations

       Corporate Actions – Event Validations, Trade Extraction

       • Stateless model that evaluates each event separately through set of rules
         • 100’s of rules based on event types defined in Decision Tables
       • Increase in number of rules barely dent the performance
         • For 10k executions, 2 rules take 320 ms, and 100 rules take 328 ms

       Risk Analysis & Calculations

       • Calculations have lot of parameters, such as credit rating, product type, etc.
       • Calculations segmented into small number of individual steps
       • The decision of which formulae to use, was done by a Rules Engine



17
Usage Models
     Synchronous Execution
          Request – Response Style                          Your            Rule
                                                          Application      Engine
          Can act on the decision immediately


     Asynchronous Pipeline
                                                                         Rule
          Messaging Style                               Events                      Actions
                                                                        Engine
          Very scalable and resilient


     In Process with the Application
          Jar file as part of the application
          Excellent for Stateless execution, as reduces I/o without increasing memory
          Stateful executions are challenge in clustered environment & need memory sizing


     Out of Process as a runtime component
          Central Deployment & Management
          Overheads in Communication, and hence affects performance
          Could become bottleneck / central point of failure
          Needs sophisticated scaling models (e.g. functional split based on Hash or some key)


18
Improving Performance ..1
     Keep Separate Deployable Units rather than a giant rule engine component
          Divide and Conquer


     Use Stateless Sessions where Business case allows
          You can cluster and load balance your services seamlessly
          You can use in-process deployments easily


     Limit the number of facts in Stateful Executions
          The degradation is exponential beyond 400k objects in memory
          If higher volumes anticipated, than plan for multi deployments using sharding concepts


     Limit the Size of the objects checked in memory
          Use DTO (Data Transfer Object) pattern


     Use Batched Mode of Execution
          Check in more objects if you can in one go into the memory




19
Improving Performance ..2
     Use Drools only for decisions, not performing actual actions
           Let the decisions be communicated to a downstream component or by the caller to Rules Engine


     Avoid using evals(), --- use only as a last resort
           The java code inside eval is difficult to optimize into rete tree


     Work on aggregates where possible
           Rather than Checking Individual facts into the memory


     If you want to dig deeper
           Read more on the Rete Algorithm




20
Development Tips
     Use the IDE
          Syntax Validations
          DSL conversions
          Drools Debugging

     Use events
          Understanding how rules activate and fire
          Helpful for troubleshooting
          Remember to turn off in production


     Keep individual rules small, simple and atomic
          Avoid cyclic triggering of rules when you update the facts
          Use Agenda groups & Activation groups wherever applicable




21
Ajay Mahajan



     ajay.mahajan@wipro.com




22

Más contenido relacionado

La actualidad más candente

Event Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveEvent Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveJonas Bonér
 
Rule Engine & Drools
Rule Engine & DroolsRule Engine & Drools
Rule Engine & DroolsSandip Jadhav
 
Drools 6 deep dive
Drools 6 deep diveDrools 6 deep dive
Drools 6 deep diveMario Fusco
 
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0Best practices in deploying IBM Operation Decision Manager Standard 8.8.0
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0Pierre Feillet
 
Redis Overview
Redis OverviewRedis Overview
Redis OverviewHoang Long
 
What is new in MariaDB 10.6?
What is new in MariaDB 10.6?What is new in MariaDB 10.6?
What is new in MariaDB 10.6?Mydbops
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcachedJurriaan Persyn
 
Procedures and triggers in SQL
Procedures and triggers in SQLProcedures and triggers in SQL
Procedures and triggers in SQLVikash Sharma
 
Distributed Lock Manager
Distributed Lock ManagerDistributed Lock Manager
Distributed Lock ManagerHao Chen
 
Database ,11 Concurrency Control
Database ,11 Concurrency ControlDatabase ,11 Concurrency Control
Database ,11 Concurrency ControlAli Usman
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Mark Proctor
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisDvir Volk
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresqlbotsplash.com
 
Introduction to NoSQL Databases
Introduction to NoSQL DatabasesIntroduction to NoSQL Databases
Introduction to NoSQL DatabasesDerek Stainer
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking VN
 

La actualidad más candente (20)

Event Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveEvent Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspective
 
Rule Engine & Drools
Rule Engine & DroolsRule Engine & Drools
Rule Engine & Drools
 
Drools 6 deep dive
Drools 6 deep diveDrools 6 deep dive
Drools 6 deep dive
 
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0Best practices in deploying IBM Operation Decision Manager Standard 8.8.0
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0
 
Redis Overview
Redis OverviewRedis Overview
Redis Overview
 
What is new in MariaDB 10.6?
What is new in MariaDB 10.6?What is new in MariaDB 10.6?
What is new in MariaDB 10.6?
 
Sql triggers
Sql triggersSql triggers
Sql triggers
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
Procedures and triggers in SQL
Procedures and triggers in SQLProcedures and triggers in SQL
Procedures and triggers in SQL
 
Drools
DroolsDrools
Drools
 
Distributed Lock Manager
Distributed Lock ManagerDistributed Lock Manager
Distributed Lock Manager
 
Database ,11 Concurrency Control
Database ,11 Concurrency ControlDatabase ,11 Concurrency Control
Database ,11 Concurrency Control
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresql
 
Introduction to NoSQL Databases
Introduction to NoSQL DatabasesIntroduction to NoSQL Databases
Introduction to NoSQL Databases
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKI
 
Chapter18
Chapter18Chapter18
Chapter18
 

Destacado

Developing Complex Business Rules with Drools Integration
Developing Complex Business Rules with Drools IntegrationDeveloping Complex Business Rules with Drools Integration
Developing Complex Business Rules with Drools IntegrationBonitasoft
 
Drools and jBPM 6 Overview
Drools and jBPM 6 OverviewDrools and jBPM 6 Overview
Drools and jBPM 6 OverviewMark Proctor
 
Rule Engine Evaluation for Complex Event Processing
Rule Engine Evaluation for Complex Event ProcessingRule Engine Evaluation for Complex Event Processing
Rule Engine Evaluation for Complex Event ProcessingChandra Divi
 
#CPBR7 - Métricas para startups
#CPBR7 - Métricas para startups#CPBR7 - Métricas para startups
#CPBR7 - Métricas para startupsSaulo Arruda
 
How a major industrial group automated its purchase order processes
How a major industrial group automated its purchase order processesHow a major industrial group automated its purchase order processes
How a major industrial group automated its purchase order processesAlain Bezançon
 
How a turnpike commission manages client requests case study by WorkflowGen
How a turnpike commission manages client requests case study by WorkflowGenHow a turnpike commission manages client requests case study by WorkflowGen
How a turnpike commission manages client requests case study by WorkflowGenAlain Bezançon
 
Business Rule Engine
Business Rule EngineBusiness Rule Engine
Business Rule EngineAnkur Singhal
 
Geospatial Indexing and Querying with MongoDB
Geospatial Indexing and Querying with MongoDBGeospatial Indexing and Querying with MongoDB
Geospatial Indexing and Querying with MongoDBGrant Goodale
 
Getting Started With #Drools 6 Slides - JBUG Denmark
Getting Started With #Drools 6 Slides - JBUG DenmarkGetting Started With #Drools 6 Slides - JBUG Denmark
Getting Started With #Drools 6 Slides - JBUG DenmarkMauricio (Salaboy) Salatino
 
IBM Smarter Business 2012 - Headless BPM
IBM Smarter Business 2012 - Headless BPMIBM Smarter Business 2012 - Headless BPM
IBM Smarter Business 2012 - Headless BPMIBM Sverige
 
Drools Happenings 7.0 - Devnation 2016
Drools Happenings 7.0 - Devnation 2016Drools Happenings 7.0 - Devnation 2016
Drools Happenings 7.0 - Devnation 2016Mark Proctor
 
Jboss jbpm and drools 1 introduction to drools architecture
Jboss jbpm and drools   1 introduction to drools architectureJboss jbpm and drools   1 introduction to drools architecture
Jboss jbpm and drools 1 introduction to drools architectureZoran Hristov
 
Conhecendo as Opcoes de Bancos de Dados na Nuvem da AWS
Conhecendo as Opcoes de Bancos de Dados na Nuvem da AWSConhecendo as Opcoes de Bancos de Dados na Nuvem da AWS
Conhecendo as Opcoes de Bancos de Dados na Nuvem da AWSAmazon Web Services LATAM
 
Jboss drools 4 scope - benefits, shortfalls
Jboss drools   4 scope - benefits, shortfalls Jboss drools   4 scope - benefits, shortfalls
Jboss drools 4 scope - benefits, shortfalls Zoran Hristov
 

Destacado (20)

Developing Complex Business Rules with Drools Integration
Developing Complex Business Rules with Drools IntegrationDeveloping Complex Business Rules with Drools Integration
Developing Complex Business Rules with Drools Integration
 
Drools and jBPM 6 Overview
Drools and jBPM 6 OverviewDrools and jBPM 6 Overview
Drools and jBPM 6 Overview
 
Cork JUG - Drools basics &amp; pitfalls
Cork JUG - Drools basics &amp; pitfallsCork JUG - Drools basics &amp; pitfalls
Cork JUG - Drools basics &amp; pitfalls
 
Rule Engine Evaluation for Complex Event Processing
Rule Engine Evaluation for Complex Event ProcessingRule Engine Evaluation for Complex Event Processing
Rule Engine Evaluation for Complex Event Processing
 
#CPBR7 - Métricas para startups
#CPBR7 - Métricas para startups#CPBR7 - Métricas para startups
#CPBR7 - Métricas para startups
 
Drools expert-docs
Drools expert-docsDrools expert-docs
Drools expert-docs
 
Melhores Práticas no Uso da Nuvem AWS
Melhores Práticas no Uso da Nuvem AWSMelhores Práticas no Uso da Nuvem AWS
Melhores Práticas no Uso da Nuvem AWS
 
How a major industrial group automated its purchase order processes
How a major industrial group automated its purchase order processesHow a major industrial group automated its purchase order processes
How a major industrial group automated its purchase order processes
 
How a turnpike commission manages client requests case study by WorkflowGen
How a turnpike commission manages client requests case study by WorkflowGenHow a turnpike commission manages client requests case study by WorkflowGen
How a turnpike commission manages client requests case study by WorkflowGen
 
Best practices webinar
Best practices webinarBest practices webinar
Best practices webinar
 
Business Rule Engine
Business Rule EngineBusiness Rule Engine
Business Rule Engine
 
Geospatial Indexing and Querying with MongoDB
Geospatial Indexing and Querying with MongoDBGeospatial Indexing and Querying with MongoDB
Geospatial Indexing and Querying with MongoDB
 
Getting Started With #Drools 6 Slides - JBUG Denmark
Getting Started With #Drools 6 Slides - JBUG DenmarkGetting Started With #Drools 6 Slides - JBUG Denmark
Getting Started With #Drools 6 Slides - JBUG Denmark
 
IBM Smarter Business 2012 - Headless BPM
IBM Smarter Business 2012 - Headless BPMIBM Smarter Business 2012 - Headless BPM
IBM Smarter Business 2012 - Headless BPM
 
Drools Happenings 7.0 - Devnation 2016
Drools Happenings 7.0 - Devnation 2016Drools Happenings 7.0 - Devnation 2016
Drools Happenings 7.0 - Devnation 2016
 
Jboss jbpm and drools 1 introduction to drools architecture
Jboss jbpm and drools   1 introduction to drools architectureJboss jbpm and drools   1 introduction to drools architecture
Jboss jbpm and drools 1 introduction to drools architecture
 
Arquiteturas de Alta Disponibilidade na AWS
Arquiteturas de Alta Disponibilidade na AWSArquiteturas de Alta Disponibilidade na AWS
Arquiteturas de Alta Disponibilidade na AWS
 
Drools Workshop @JBCNCONF 2016
Drools Workshop @JBCNCONF 2016Drools Workshop @JBCNCONF 2016
Drools Workshop @JBCNCONF 2016
 
Conhecendo as Opcoes de Bancos de Dados na Nuvem da AWS
Conhecendo as Opcoes de Bancos de Dados na Nuvem da AWSConhecendo as Opcoes de Bancos de Dados na Nuvem da AWS
Conhecendo as Opcoes de Bancos de Dados na Nuvem da AWS
 
Jboss drools 4 scope - benefits, shortfalls
Jboss drools   4 scope - benefits, shortfalls Jboss drools   4 scope - benefits, shortfalls
Jboss drools 4 scope - benefits, shortfalls
 

Similar a Developing Configurable and High Performance Apps in Drools

TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012Tieturi Oy
 
PricingEngine_v2.5
PricingEngine_v2.5PricingEngine_v2.5
PricingEngine_v2.5Wei Zhang
 
JBoss Drools - Open-Source Business Logic Platform
JBoss Drools - Open-Source Business Logic PlatformJBoss Drools - Open-Source Business Logic Platform
JBoss Drools - Open-Source Business Logic Platformelliando dias
 
Consolidated shared indexes in real time
Consolidated shared indexes in real timeConsolidated shared indexes in real time
Consolidated shared indexes in real timeJeff Mace
 
DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.Vlad Fedosov
 
JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTE
JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTEJBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTE
JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTEtsurdilovic
 
Effective Spring Transaction Management
Effective Spring Transaction ManagementEffective Spring Transaction Management
Effective Spring Transaction ManagementUMA MAHESWARI
 
Performance Tuning of .NET Application
Performance Tuning of .NET ApplicationPerformance Tuning of .NET Application
Performance Tuning of .NET ApplicationMainul Islam, CSM®
 
The Future of the Rules module in Drupal 8
The Future of the Rules module in Drupal 8The Future of the Rules module in Drupal 8
The Future of the Rules module in Drupal 8Stan Ascher
 
Droolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 SrpingDroolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 SrpingSrinath Perera
 
Scale Machine Learning from zero to millions of users (April 2020)
Scale Machine Learning from zero to millions of users (April 2020)Scale Machine Learning from zero to millions of users (April 2020)
Scale Machine Learning from zero to millions of users (April 2020)Julien SIMON
 
Hado“OPS” or Had “oops”
Hado“OPS” or Had “oops”Hado“OPS” or Had “oops”
Hado“OPS” or Had “oops”Rocket Fuel Inc.
 
Converting Your Legacy Data to S1000D
Converting Your Legacy Data to S1000DConverting Your Legacy Data to S1000D
Converting Your Legacy Data to S1000Ddclsocialmedia
 
RightScale Webinar: Enterprise-Grade Cloud Cost Management
RightScale Webinar: Enterprise-Grade Cloud Cost ManagementRightScale Webinar: Enterprise-Grade Cloud Cost Management
RightScale Webinar: Enterprise-Grade Cloud Cost ManagementRightScale
 
3rd party application integration with tally erp 9 | Tally Remote Support | ...
3rd party application integration with tally erp 9 | Tally Remote Support  | ...3rd party application integration with tally erp 9 | Tally Remote Support  | ...
3rd party application integration with tally erp 9 | Tally Remote Support | ...stannventures.Pvt.Ltd
 
The Lean Cloud for Startups with AWS - Cost Optimisation
The Lean Cloud for Startups with AWS - Cost OptimisationThe Lean Cloud for Startups with AWS - Cost Optimisation
The Lean Cloud for Startups with AWS - Cost OptimisationAmazon Web Services
 
Drools Presentation for Tallink.ee
Drools Presentation for Tallink.eeDrools Presentation for Tallink.ee
Drools Presentation for Tallink.eeAnton Arhipov
 

Similar a Developing Configurable and High Performance Apps in Drools (20)

TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
 
PricingEngine_v2.5
PricingEngine_v2.5PricingEngine_v2.5
PricingEngine_v2.5
 
JBoss Drools - Open-Source Business Logic Platform
JBoss Drools - Open-Source Business Logic PlatformJBoss Drools - Open-Source Business Logic Platform
JBoss Drools - Open-Source Business Logic Platform
 
Consolidated shared indexes in real time
Consolidated shared indexes in real timeConsolidated shared indexes in real time
Consolidated shared indexes in real time
 
DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.
 
Lets focus on business value
Lets focus on business valueLets focus on business value
Lets focus on business value
 
Lets focus on business value
Lets focus on business valueLets focus on business value
Lets focus on business value
 
JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTE
JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTEJBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTE
JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTE
 
Effective Spring Transaction Management
Effective Spring Transaction ManagementEffective Spring Transaction Management
Effective Spring Transaction Management
 
Performance Tuning of .NET Application
Performance Tuning of .NET ApplicationPerformance Tuning of .NET Application
Performance Tuning of .NET Application
 
The Future of the Rules module in Drupal 8
The Future of the Rules module in Drupal 8The Future of the Rules module in Drupal 8
The Future of the Rules module in Drupal 8
 
Droolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 SrpingDroolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 Srping
 
Scale Machine Learning from zero to millions of users (April 2020)
Scale Machine Learning from zero to millions of users (April 2020)Scale Machine Learning from zero to millions of users (April 2020)
Scale Machine Learning from zero to millions of users (April 2020)
 
Hado“OPS” or Had “oops”
Hado“OPS” or Had “oops”Hado“OPS” or Had “oops”
Hado“OPS” or Had “oops”
 
Converting Your Legacy Data to S1000D
Converting Your Legacy Data to S1000DConverting Your Legacy Data to S1000D
Converting Your Legacy Data to S1000D
 
RightScale Webinar: Enterprise-Grade Cloud Cost Management
RightScale Webinar: Enterprise-Grade Cloud Cost ManagementRightScale Webinar: Enterprise-Grade Cloud Cost Management
RightScale Webinar: Enterprise-Grade Cloud Cost Management
 
Lets focus on business value
Lets focus on business valueLets focus on business value
Lets focus on business value
 
3rd party application integration with tally erp 9 | Tally Remote Support | ...
3rd party application integration with tally erp 9 | Tally Remote Support  | ...3rd party application integration with tally erp 9 | Tally Remote Support  | ...
3rd party application integration with tally erp 9 | Tally Remote Support | ...
 
The Lean Cloud for Startups with AWS - Cost Optimisation
The Lean Cloud for Startups with AWS - Cost OptimisationThe Lean Cloud for Startups with AWS - Cost Optimisation
The Lean Cloud for Startups with AWS - Cost Optimisation
 
Drools Presentation for Tallink.ee
Drools Presentation for Tallink.eeDrools Presentation for Tallink.ee
Drools Presentation for Tallink.ee
 

Último

Emails, Facebook, WhatsApp and the Dhamma (English and Chinese).pdf
Emails, Facebook, WhatsApp and the Dhamma  (English and Chinese).pdfEmails, Facebook, WhatsApp and the Dhamma  (English and Chinese).pdf
Emails, Facebook, WhatsApp and the Dhamma (English and Chinese).pdfOH TEIK BIN
 
Human Design Gates Cheat Sheet | Kabastro.com
Human Design Gates Cheat Sheet | Kabastro.comHuman Design Gates Cheat Sheet | Kabastro.com
Human Design Gates Cheat Sheet | Kabastro.comKabastro
 
The Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docxThe Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docxFred Gosnell
 
Pathankot Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Pathankot Escorts 🥰 8617370543 Call Girls Offer VIP Hot GirlsPathankot Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Pathankot Escorts 🥰 8617370543 Call Girls Offer VIP Hot GirlsDeepika Singh
 
Codex Singularity: Search for the Prisca Sapientia
Codex Singularity: Search for the Prisca SapientiaCodex Singularity: Search for the Prisca Sapientia
Codex Singularity: Search for the Prisca Sapientiajfrenchau
 
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...Amil Baba Naveed Bangali
 
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...makhmalhalaaay
 
Deerfoot Church of Christ Bulletin 5 12 24
Deerfoot Church of Christ Bulletin 5 12 24Deerfoot Church of Christ Bulletin 5 12 24
Deerfoot Church of Christ Bulletin 5 12 24deerfootcoc
 
Popular Kala Jadu, Kala jadu Expert in Islamabad and Kala jadu specialist in ...
Popular Kala Jadu, Kala jadu Expert in Islamabad and Kala jadu specialist in ...Popular Kala Jadu, Kala jadu Expert in Islamabad and Kala jadu specialist in ...
Popular Kala Jadu, Kala jadu Expert in Islamabad and Kala jadu specialist in ...baharayali
 
Charkhi Dadri Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Charkhi Dadri Escorts 🥰 8617370543 Call Girls Offer VIP Hot GirlsCharkhi Dadri Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Charkhi Dadri Escorts 🥰 8617370543 Call Girls Offer VIP Hot GirlsDeepika Singh
 
"The Magnificent Surah Rahman: PDF Version"
"The Magnificent Surah Rahman: PDF Version""The Magnificent Surah Rahman: PDF Version"
"The Magnificent Surah Rahman: PDF Version"aijazuddin14
 
Lahore Bangali Baba Lahore Kala Jadu Baba In Lahore Bangali baba in lahore fa...
Lahore Bangali Baba Lahore Kala Jadu Baba In Lahore Bangali baba in lahore fa...Lahore Bangali Baba Lahore Kala Jadu Baba In Lahore Bangali baba in lahore fa...
Lahore Bangali Baba Lahore Kala Jadu Baba In Lahore Bangali baba in lahore fa...Amil Baba Mangal Maseeh
 
Amil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
Amil baba in Lahore /Amil baba in Karachi /Amil baba in PakistanAmil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
Amil baba in Lahore /Amil baba in Karachi /Amil baba in PakistanAmil Baba Mangal Maseeh
 
Exploring the Meaning of Jesus’ Ascension
Exploring the Meaning of Jesus’ AscensionExploring the Meaning of Jesus’ Ascension
Exploring the Meaning of Jesus’ AscensionbluetroyvictorVinay
 
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...baharayali
 
NO1 Trending Black Magic Specialist Expert Amil baba in Lahore Islamabad Rawa...
NO1 Trending Black Magic Specialist Expert Amil baba in Lahore Islamabad Rawa...NO1 Trending Black Magic Specialist Expert Amil baba in Lahore Islamabad Rawa...
NO1 Trending Black Magic Specialist Expert Amil baba in Lahore Islamabad Rawa...Amil Baba Naveed Bangali
 
Amil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
Amil baba in Lahore /Amil baba in Karachi /Amil baba in PakistanAmil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
Amil baba in Lahore /Amil baba in Karachi /Amil baba in PakistanAmil Baba Mangal Maseeh
 
Study of the Psalms Chapter 1 verse 3 - wanderean
Study of the Psalms Chapter 1 verse 3 - wandereanStudy of the Psalms Chapter 1 verse 3 - wanderean
Study of the Psalms Chapter 1 verse 3 - wandereanmaricelcanoynuay
 
About Kabala (English) | Kabastro.com | Kabala.vn
About Kabala (English) | Kabastro.com | Kabala.vnAbout Kabala (English) | Kabastro.com | Kabala.vn
About Kabala (English) | Kabastro.com | Kabala.vnKabastro
 

Último (20)

Emails, Facebook, WhatsApp and the Dhamma (English and Chinese).pdf
Emails, Facebook, WhatsApp and the Dhamma  (English and Chinese).pdfEmails, Facebook, WhatsApp and the Dhamma  (English and Chinese).pdf
Emails, Facebook, WhatsApp and the Dhamma (English and Chinese).pdf
 
Human Design Gates Cheat Sheet | Kabastro.com
Human Design Gates Cheat Sheet | Kabastro.comHuman Design Gates Cheat Sheet | Kabastro.com
Human Design Gates Cheat Sheet | Kabastro.com
 
famous No 1 astrologer / Best No 1 Amil baba in UK, Australia, Germany, USA, ...
famous No 1 astrologer / Best No 1 Amil baba in UK, Australia, Germany, USA, ...famous No 1 astrologer / Best No 1 Amil baba in UK, Australia, Germany, USA, ...
famous No 1 astrologer / Best No 1 Amil baba in UK, Australia, Germany, USA, ...
 
The Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docxThe Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docx
 
Pathankot Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Pathankot Escorts 🥰 8617370543 Call Girls Offer VIP Hot GirlsPathankot Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Pathankot Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
 
Codex Singularity: Search for the Prisca Sapientia
Codex Singularity: Search for the Prisca SapientiaCodex Singularity: Search for the Prisca Sapientia
Codex Singularity: Search for the Prisca Sapientia
 
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
 
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
 
Deerfoot Church of Christ Bulletin 5 12 24
Deerfoot Church of Christ Bulletin 5 12 24Deerfoot Church of Christ Bulletin 5 12 24
Deerfoot Church of Christ Bulletin 5 12 24
 
Popular Kala Jadu, Kala jadu Expert in Islamabad and Kala jadu specialist in ...
Popular Kala Jadu, Kala jadu Expert in Islamabad and Kala jadu specialist in ...Popular Kala Jadu, Kala jadu Expert in Islamabad and Kala jadu specialist in ...
Popular Kala Jadu, Kala jadu Expert in Islamabad and Kala jadu specialist in ...
 
Charkhi Dadri Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Charkhi Dadri Escorts 🥰 8617370543 Call Girls Offer VIP Hot GirlsCharkhi Dadri Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Charkhi Dadri Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
 
"The Magnificent Surah Rahman: PDF Version"
"The Magnificent Surah Rahman: PDF Version""The Magnificent Surah Rahman: PDF Version"
"The Magnificent Surah Rahman: PDF Version"
 
Lahore Bangali Baba Lahore Kala Jadu Baba In Lahore Bangali baba in lahore fa...
Lahore Bangali Baba Lahore Kala Jadu Baba In Lahore Bangali baba in lahore fa...Lahore Bangali Baba Lahore Kala Jadu Baba In Lahore Bangali baba in lahore fa...
Lahore Bangali Baba Lahore Kala Jadu Baba In Lahore Bangali baba in lahore fa...
 
Amil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
Amil baba in Lahore /Amil baba in Karachi /Amil baba in PakistanAmil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
Amil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
 
Exploring the Meaning of Jesus’ Ascension
Exploring the Meaning of Jesus’ AscensionExploring the Meaning of Jesus’ Ascension
Exploring the Meaning of Jesus’ Ascension
 
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
 
NO1 Trending Black Magic Specialist Expert Amil baba in Lahore Islamabad Rawa...
NO1 Trending Black Magic Specialist Expert Amil baba in Lahore Islamabad Rawa...NO1 Trending Black Magic Specialist Expert Amil baba in Lahore Islamabad Rawa...
NO1 Trending Black Magic Specialist Expert Amil baba in Lahore Islamabad Rawa...
 
Amil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
Amil baba in Lahore /Amil baba in Karachi /Amil baba in PakistanAmil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
Amil baba in Lahore /Amil baba in Karachi /Amil baba in Pakistan
 
Study of the Psalms Chapter 1 verse 3 - wanderean
Study of the Psalms Chapter 1 verse 3 - wandereanStudy of the Psalms Chapter 1 verse 3 - wanderean
Study of the Psalms Chapter 1 verse 3 - wanderean
 
About Kabala (English) | Kabastro.com | Kabala.vn
About Kabala (English) | Kabastro.com | Kabala.vnAbout Kabala (English) | Kabastro.com | Kabala.vn
About Kabala (English) | Kabastro.com | Kabala.vn
 

Developing Configurable and High Performance Apps in Drools

  • 1. Developing Configurable and High Performance Apps in Drools Ajay Mahajan Lead Architect 1
  • 2. Agenda What, Where, Why, When Drools Eco-System & A Use Case Rule Definitions Usage - Deployment Modes Best Practices Value from Session 2
  • 4. What is a Rule Engine 4
  • 5. Where Does It Fit Parameterization Code Config Files Database Rules Engine 5
  • 6. Why Should I Bother • Many ways to define Rules Flexibility & • Group rules and define priorities Configurability • Plethora of functions that help in decisioning Rule Engine • User friendly and Business Like Manageability • Better Tooling Support • Easier Understanding & Visualization • Just define your rules not execution details Declarative v/s • Execution is handled by Rules Engine Imperial • Sequencing and Re-entry 6
  • 7. FUDs – Fear, Uncertainty and Doubt • True, as compared to if-else statements in code Slow • However, Rules are precompiled • In Some Cases, execution is faster if designed correctly • Yes, they do have a learning curve Difficult • Start small and Limit the features to those you really need • You don’t have to learn each feature and function offered More • Yes, rules engine do need more space than a java class file • Precompiled Rules form a Rete graph Memory • Use stateless models where use case allows • Stateful models – Follow the optimizations and mind your memory • Commercial Tools can get expensive, e.g. Blaze and Jrules Expensive • Open Source Drools has evolved over time, in its version 5.5 • Drools used in high volume, mission critical systems 7
  • 8. When Should I Use a Rule Engine IF (Requirements== expressed as rules) IF (Rules == many OR complex OR changing frequently) IF (Rules == managed separately from application code) IF (memory != very low) IF (Application == evolving) IF (Developers == have skills OR ok with learning curve) IF (Business Users == like to see / experiment with rules) IF ( Additional Complexity < Benefits in Flexibility + Configurability) THEN use Rules Engine 8
  • 10. Jboss - Drools Expert • Main Rules Engine Component • Have Stabilized after going through product cycles • Highly Successful and widely used Rule Flow (replaced by jBPM) • Group into Rule sets and define flow chart to execute them • Graphical Environment to define work flows • jBPM using BPMN 2.0 is the way to go for any serious BPM Guvnor • Web Based GUI to manage the Rules • Split out as separate component in V5 • Read Only in Production, but modify in test/UAT for business Planner • Resources– travelling salesman, scheduling, routing • Heuristic Rules • Relatively new Fusion • Event Processing- ESP / CEP use cases • Concept of Sliding Time window • Other products such as Esper and Twitter Storm 10
  • 11. Drools Expert – Steps • DRL, Decision Define Tables, DSL Compile • To Knowledge base Create • Uses Knowledge base Session Insert • Causes Activations Facts Fire • RHS Rules Executes 11
  • 12. Real Use Case Trades Matching Engine Match Statuses T1, T4, T3, T2 T1 C3 T2 C1 + C3 T3+T4 C4 Confirmation C1, C2, C3, C4 100’s of Trades and Confirmations inflowing per second at peak hr Flowing in any order, not necessarily one after the other One trade can exactly match to one confirmation A trade can match to more than one confirmation One or more trades can match to one Confirmation 12
  • 13. DRL – Drools Rules Language rule "Perfect Match" salience 100 when t:Trade() c:Confirm(qty == t.qty , confirmId == t.cusip , amt == t.amt , price == t.price ) then log("Perfect Match for " + t.toString() + c.toString()); Match perfectMatch = new Match(t,c, "Perfect"); // retract perfect matches retract(t); retract(c); end Trade to Confirm Matching Why is this The base language for Rules Definition blazing All other Forms compile to this language fast ?? Rich and Versatile Entire Syntax, features and Rules definition is available Least User Friendly 13
  • 14. DSL - Domain Specific Language expander Match.dsl rule "Exact Match Trade to Confirm" when Match Trade and Confirm - on cusip with confirmId - on amt - on price then Log "Perfect Match“ Create Match with Status “Perfect” Remove Matched Elements end This is real code not Pseudo code DSL combines with grammar definition and translates to DRL Very Easy to Understand for Users and Visualize Power of creating new business vocabulary Encourages reuse 14
  • 15. Decision Table RuleTable TradeRequests NAME CONDITION CONDITION ACTION ACTION ACTION ACTION ACTION ACTION event:Event event:Event eventGroup $param != null TradeRequest tr = ne tr.setStartCaptureDate(DateUtils.getBusinessDate(event.get$1(), $2+1)); tr.setEndCaptureDate(DateUtils.getBusinessDate(event.get$1(), $2+1)); tr.setStartTradeDate(DateUtils.getBusinessDate(event.get$1(), $2)); tr.setEndTradeDate(Date tr.setSettlementF Trade Condition Event Start Capture End Capture Settlement (Comment Column) Name Group Date Present Trade Type Date Date Traded After Traded Before Flag TD < ED ; F = F IncOpenFail I effectiveDate Open Fails FreezeDate, 0 EffectiveDate, -1 "F" TD < ED ; SD <= FD ; F = O IncRegOpen I effectiveDate Regular Open EffectiveDate, -1 FreezeDate, 0 EffectiveDate, -1 "O" TD < ED ; FD < SD IncExtSet I effectiveDate Extended Settle EffectiveDate, -1 FreezeDate, 0 EffectiveDate, -1 ED<=TD ; SD <=FD ; CD <= FD IncShortSet I effectiveDate Short Settle EffectiveDate, 0 FreezeDate, 0 EffectiveDate, 0 TD < ED ; FD < PD IncAsOf I effectiveDate As of Trades FreezeDate, 1 EffectiveDate, -1 Corporate Actions Excel columns are designated as Conditions or Actions Top few control rows are hidden from users, Control rows help translate the excel into DRL Easy to understand for Users, once basic Excel formats are given Fit for use cases where there is need for intense parameterization 15
  • 16. Learning & Best Practices Experiences, Usage Models, Performance 16
  • 17. Real Life Experiences Complex Matching Engines • Multiple Engines used for various functional matching • Performed at 600 transactions / sec on one instance of execution • If the I/o (messaging / database) were commented, got 8k executions / sec • Stateful models used, but memory was conversed through optimizations Corporate Actions – Event Validations, Trade Extraction • Stateless model that evaluates each event separately through set of rules • 100’s of rules based on event types defined in Decision Tables • Increase in number of rules barely dent the performance • For 10k executions, 2 rules take 320 ms, and 100 rules take 328 ms Risk Analysis & Calculations • Calculations have lot of parameters, such as credit rating, product type, etc. • Calculations segmented into small number of individual steps • The decision of which formulae to use, was done by a Rules Engine 17
  • 18. Usage Models Synchronous Execution Request – Response Style Your Rule Application Engine Can act on the decision immediately Asynchronous Pipeline Rule Messaging Style Events Actions Engine Very scalable and resilient In Process with the Application Jar file as part of the application Excellent for Stateless execution, as reduces I/o without increasing memory Stateful executions are challenge in clustered environment & need memory sizing Out of Process as a runtime component Central Deployment & Management Overheads in Communication, and hence affects performance Could become bottleneck / central point of failure Needs sophisticated scaling models (e.g. functional split based on Hash or some key) 18
  • 19. Improving Performance ..1 Keep Separate Deployable Units rather than a giant rule engine component Divide and Conquer Use Stateless Sessions where Business case allows You can cluster and load balance your services seamlessly You can use in-process deployments easily Limit the number of facts in Stateful Executions The degradation is exponential beyond 400k objects in memory If higher volumes anticipated, than plan for multi deployments using sharding concepts Limit the Size of the objects checked in memory Use DTO (Data Transfer Object) pattern Use Batched Mode of Execution Check in more objects if you can in one go into the memory 19
  • 20. Improving Performance ..2 Use Drools only for decisions, not performing actual actions Let the decisions be communicated to a downstream component or by the caller to Rules Engine Avoid using evals(), --- use only as a last resort The java code inside eval is difficult to optimize into rete tree Work on aggregates where possible Rather than Checking Individual facts into the memory If you want to dig deeper Read more on the Rete Algorithm 20
  • 21. Development Tips Use the IDE Syntax Validations DSL conversions Drools Debugging Use events Understanding how rules activate and fire Helpful for troubleshooting Remember to turn off in production Keep individual rules small, simple and atomic Avoid cyclic triggering of rules when you update the facts Use Agenda groups & Activation groups wherever applicable 21
  • 22. Ajay Mahajan ajay.mahajan@wipro.com 22