Your SlideShare is downloading. ×

Best practices webinar

2,325
views

Published on

Your enterprise can become truly intelligent …

Your enterprise can become truly intelligent
-------------------------------------------
Get there with Red Hat’s JBoss® Enterprise Business Rules Management System (BRMS), a key component of our vision for the intelligent, integrated enterprise. It delivers the power of business rules, complex event processing, and business process management in a single open source distribution—all accessible from a common set of authoring tools.

JBoss Enterprise BRMS supports a broad range of decision-management and process-driven applications with a unique combination of open source technologies:

- jBPM5 business process management
- Drools business rules
- Drools Fusion complex event processing

Build rule, event, and process-driven applications that scale across the enterprise
-------------------------------------------
Discover best practices for constructing BRMS applications that support large numbers of rules operating on big data. We’ll illustrate common use cases with real-world case studies and give you practical tips for estimating computing resource requirements.


0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,325
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
50
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. JBoss Enterprise BRMS The Road to Large Scale Enterprise Solutions Phil Simpson, Product Marketing Manager Eric Schabell, JBoss Technology Evangelist1
  • 2. JBoss BRMS Overview2
  • 3. JBoss Enterprise BRMS Business Events Interacts Web-based Decision with... Enterprise development tools Service ApplicationBusiness Analysts Web Event Processor Repository Service Deploy Business Process Business Business Process Rule & Manager Definitions Event Definitions Java Code Rule Engine JBDS, with BRMS r plugins i to on M & ge ana M Business Developers Users Management Business Console Data Operations 3
  • 4. JBoss Enterprise BRMS Business Events Interacts Web-based Decision with... Enterprise development tools Service ApplicationBusiness Analysts Web Event Processor Repository Service Deploy Business Process Business Business Process Rule & Manager Definitions Event Definitions Java Code Rule Engine JBDS, with BRMS r plugins i to on M & ge ana M Business Developers Users Management Business Console Data Operations 4
  • 5. JBoss Enterprise BRMS Business Events Interacts Web-based Decision with... Enterprise development tools Service ApplicationBusiness Analysts Web Event Processor Repository Service Deploy Business Process Business Business Process Rule & Manager Definitions Event Definitions Java Code Rule Engine JBDS, with BRMS r plugins i to on M & ge ana M Business Developers Users Management Business Console Data Operations 5
  • 6. JBoss Enterprise BRMS Business Events Interacts Web-based with... development tools Decision Enterprise (Guvnor) Service ApplicationBusiness Analysts Web Event Processor Repository Service Deploy Business Process Business Business Process Rule & Manager Definitions Event Definitions Java Code Rule Engine JBDS, with BRMS r plugins i to on M & ge ana M Business Developers Users Management Business Console Data Operations 6
  • 7. JBoss Enterprise BRMS Business Events Interacts Web-based Decision with... Enterprise development tools Service ApplicationBusiness Analysts Web Event Processor Repository Service Deploy Business Process Business Business Process Rule & Manager Definitions Event Definitions Java Code Rule Engine JBDS, with BRMS r plugins i to on M & ge ana M Business Developers Users Management Business Console Data Operations 7
  • 8. Best Practices Developing BRMS Applications that Scale ● BRMS Adoption Goals ● Under the Hood ● Best Practices ● BPM ● Architecture ● Rules Authoring8
  • 9. BRMS adoption goals9
  • 10. Goal #1: Decision Automation Conclusion: Time is Money! Business Event Value Loss Business Value Reaction Time Time Loss Adapted from a presentation by James Taylor, Sep/201110
  • 11. Goal #2: Expressiveness and Visibility rule “Send shipment pick-up SMS alert” rule “Send shipment pick-up SMS alert” when when There is a shipment order There is a shipment order There is a route assigned to There is a route assigned to the order the order There is a truck GPS reading There is a truck GPS reading and the truck is 15 minutes and the truck is 15 minutes away from the pick-up location away from the pick-up location then then Send SMS to customer: “Arriving in 15 minutes” Send SMS to customer: “Arriving in 15 minutes” end end Focus on “what to do” instead of “how to do it”11
  • 12. Goal #3: Performance and Scalability ● Real time, online, systems ● Millisecond response times ● Hundreds of thousands of rules ● JBoss BRMS: 700k+ rules ● Millions of data instances (facts) ● Incremental (re-)evaluation ● Changes in data cant reset reasoning12
  • 13. Goal #4..#6: other technical goals ● Logic, Data and Tasks split ● Centralization of Knowledge ● Consistency ● Testing / Simulation Knowledge Knowledge ● Auditing Base (rules/events/ Inference Session Engine (data) processes) ● Explanation Facility Tasks13
  • 14. JBoss BRMS: under the hood14
  • 15. Engines Algorithm – 30 seconds crash course Rete Network: Computers View Data Customer Order Decision Table: Users View Customer Order Total Discount Amount < $1000 >=$1000Gold 15% Gold SilverSilver < $1000 5%Silver >= $1000 10% Clear, Concise, Objective Discount: 15% Discount: 5% Discount: 10% Efficient, Effective15
  • 16. JBoss BRMS – some optimizations ● Support to POJOs as facts ● no mapping/data copy necessary ● Full split between Knowledge Base and Session ● lightweight session creation ● knowledge base sharing ● Completely Dynamic Knowledge Base ● Hot addition/removal/updates of rules/queries/processes ● Full support to First Order Logic and Set operations ● JIT compilation for constraints and data access16
  • 17. JBoss BRMS – More optimizations Data Alpha Hashing Customer Order Node Sharing Gold Silver < $1000 >=$1000 Data Indexing Lazy Matching Discount: 15% Discount: 5% Discount: 10%17
  • 18. JBoss Enterprise BRMS18
  • 19. Best Practices – BPM Architecture Interaction Layer EJB / POJO ESB Web Services Human Tasks Process Implementation Layer JBPM Console Reporting, BAM Dashboards Process RepositoryQueues Process Initialization Layer BPMN2 Authoring for BPMN2 Authoring for Business Users Developers Developer 19 Customer
  • 20. Best Practices – Process Initialization EJB MDB ● How do you start your process? Queues ● web services, EJBs, API call, RESTful ● what about prioritization of processes Process Initialization Layer ● use message queues ● other complex ideas to start processes ● Centralize startProcess in single location ● minimizes change effects in this layer Customer20
  • 21. Process Implementation LayerBest Practices – Process Implementation ● Java nodes ● do you keep it clean? ● single unit of action per process step ● human task / admin interfaces ● Centralize you jBPM API access ● single WS / DAO / BOM / RESTful ● Domain specific nodes ● extensions via work item handlers ● Design process for reuse ● smallest unit of work21
  • 22. Best Practices – Process Interaction ● Processes interact with your Enterprise ● Web Services, EJB, GUI, POJO, Exceptions, Bean Script, Rules... ● jBPM API & jBPM History DB & RESTful ● history / tasks / reporting ● single DAO ● single Web Service ● JBoss ESB + jBPM ● externalize rules calls in Decision Service (WS) Interaction Layer22 Human Tasks EJB / POJO ESB Web Services
  • 23. Best Practices – Always good BPM practices... ● Simplify everything (KISS) ● apply OO to process design ● methods == sub-process + context in/out ● encapsulate == sub-process ● reuse == process repo (maven potential) ● unit testing == per node, sub-process, process ● exception handling (Exception Framework)23
  • 24. Best Practices – Rule Architecture ● Partition your Knowledge Bases properly ● Subject matter ● Transaction / Service / Unit of Work ● Business Entity ● Avoid monolithic Knowledge Bases ● Avoid fine grained Knowledge Bases Knowledge Inference Knowledge Base Engine Session Tasks24
  • 25. Best Practices – Rule Architecture ● Batch data loads ● Load 1000 facts and fire the rules faster than fire rules after each loaded fact ● Partition the data into multiple sessions ● Transaction / Service / Unit of work ● Creating a new session is cheap ● Cheaper than removing facts Knowledge Knowledge Inference Base Engine Session Tasks25
  • 26. Best Practices – Rule Architecture ● Quality of the data/fact model is directly proportional to the performance and maintainability of the rules using it ● Think about the DBMS analogy ● Flatter models improve performance ● Smaller classes help avoiding recursions Knowledge Inference Knowledge Base Engine Session Tasks26
  • 27. JBoss BRMS – Best Practices in Rules Authoring27
  • 28. Best Practices – Rules Authoring ● Dont try to micro-control rules execution ● Use the Conflict Resolution Strategies instead ● Salience ● Agenda groups ● Ruleflow / Processes ● Dynamic Enablement Knowledge Inference Knowledge Base Engine Session Tasks28
  • 29. Best Practices – Rules Authoring ● Dont overload rules ● Each rule should describe one and only one scenario→action mapping ● The engine will optimize shared conditions ● The engine supports inference Knowledge Inference Knowledge Base Engine Session Tasks29
  • 30. Best Bad Practices – Rules Authoring rule “1 – Teenagers and Elders get Discount” rule “1 – Teenagers and Elders get Discount” when when Person age is between 16 and 18 or Person age is greater or equal to 65 Person age is between 16 and 18 or Person age is greater or equal to 65 then then Assign 25% ticket discount Assign 25% ticket discount end end rule “2 – Elders can buy tickets in area A” rule “2 – Elders can buy tickets in area A” when when Person age is greater or equal to 65 Person age is greater or equal to 65 then then Allow sales of area A tickets Allow sales of area A tickets end end Rules are being overloaded with multiple concepts, increasing maintenance and testing costs.30
  • 31. Best Practices – Rules Authoringrule “0.a – Teenagers are 16-18”rule “0.a – Teenagers are 16-18” rule “0.b – Elders are older than 65” rule “0.b – Elders are older than 65”whenwhen when when Person age is between 16 and 18 Person age is between 16 and 18 Person is older than 65 Person is older than 65thenthen then then Assert: the person is a Teenager Assert: the person is a Teenager Assert: the person is an Elder Assert: the person is an Elderendend end end rule “1 – Teenagers and Elders get discount” rule “1 – Teenagers and Elders get discount” rule “2 – Elders can buy tickets in area A” rule “2 – Elders can buy tickets in area A” when when when when Teenager or Elder Teenager or Elder Elder Elder then then then then Assign 25% ticket discount Assign 25% ticket discount Allow sales of area A tickets Allow sales of area A tickets end end end end31
  • 32. Best Practices – Rules Authoring ● One calculation (accumulate) per rule ● Accumulates have O(n) performance ● Sequences of accumulates have O(nm) performance ● n = number of matching facts ● m = number of accumulates rule “Sum debits” rule “Sum debits” when whenrule “Sum debits and credits”rule “Sum debits and credits” accumulate( Debit( $d : amount ), accumulate( Debit( $d : amount ),whenwhen $debits: sum( $d ) ) $debits: sum( $d ) ) accumulate( Debit( $d : amount ), accumulate( Debit( $d : amount ), then ... then ... $debits: sum( $d ) ) $debits: sum( $d ) ) accumulate( Credit( $c : amount), accumulate( Credit( $c : amount), rule “Sum credits” rule “Sum credits” $credits: sum( $c ) ) $credits: sum( $c ) ) when whenthen ...then ... accumulate( Credit( $c : amount ), accumulate( Credit( $c : amount ), $credits: sum( $c ) ) $credits: sum( $c ) ) then ... then ...32
  • 33. Best Practices – Rules Authoring ● Rules vs Queries Rules Queries Control Invoked by the engine Invoked by the application Parameters Dont support parameters Support parameters Results Execute actions Return results rule “Approve VIP customers” rule “Approve VIP customers” query “Get customers by type”( $type ) query “Get customers by type”( $type ) when when when when $c : Customer( type == “VIP” ) $c : Customer( type == “VIP” ) $c : Customer( type == $type ) $c : Customer( type == $type ) then then end end insert( new Approved( $c ) ); insert( new Approved( $c ) ); end end “Use the right tool for the right job!”33
  • 34. Best Practices – Rules Authoring ● Declared Types ● Facts used only by the rules ● Facts that change frequently with the rules ● POJOs ● Facts shared by both rules and application ● No data copy – very efficient ● Easier to integrate, easier to test ● When in doubt, use POJOs “Use the right tool for the right job!”34
  • 35. Questions?35
  • 36. Add references ● JBoss Enterprise BRMS Best Practices Guide http://www.redhat.com/promo/integrated_enterprise/brms-best-practices- form.html ● JBoss Enterprise BRMS Best Practices, Edson Tirelli, http://www.redhat.com/summit/sessions/jboss.html ● JBoss BRMS, http://www.redhat.com/products/jbossenterprisemiddleware/business-rules/ ● BRMS Best Practices Process Initialization Layer, http://howtojboss.com/2012/08/15/brms-best-practices-process-initialization- layer/36
  • 37. Thank you!Find out More: http://www.redhat.com/brms

×