12 décembre 2013 Le nouveau moteur de règles dans Operational Decision Manager 8.5.1: Et si on passait à la vitesse supérieure! Antony Viaud, Product Manager ODM © 2013 IBM Corporation Motivations pour un nouveau moteur de règles dans ODM Besoins accrus en performance: – Niveau élevé de TPS pour certains applicatifs – Temps de réponse de quelques millisecondes – Simulations basées sur des millions d’entrées Besoin de mieux utiliser les ressources matérielles: – Serveurs hautement disponibles – Consommation mémoire réduite ou limitée – Maximiser l’utilisation des CPUs et cores Une technologie de moteur de règle qui atteint ses limites – Conçue il y a 15 ans – Etendue au fils des besoins (ruleflow, table de décision, sequential…) – Optimisée 2 © 2013 IBM Corporation Transformer ces défis en opportunité Investissement massif sur une nouvelle génération de moteur de règles: – Réécriture du processus de compilation et d’exécution – Meilleurs temps d’exécution – Meilleure scalabilité – Consommation mémoire réduite – Temps de chargement très réduits – Architecture ouverte aux extensions Introduction progressive dans ODM – Nouveau moteur appelé « moteur de décision » / « decision engine » – Compatible avec le moteur actuel (« classic rule engine ») – Fortement testé – Chemin trivial de migration 3 © 2013 IBM Corporation Decision Engine Progressive Introduction in ODM In ODM for z/OS V8.0.1 (Nov 2012) – Supported in zRES In ODM for z/OS V8.5 (June 2013) – Extended to RES running on WAS on z/OS – Build and deploy from Decision Center In ODM V8.5.1 (Nov 29, 2013) – Extended support to distributed systems – Additional integration, mainly in RES and Rule Designer Next (roadmap) 4 © 2013 IBM Corporation Sources of improvements 5 © 2013 IBM Corporation Compilation processes Classic rule engine Business Rules Authoring Compilation Low level textual rules IRL Deployment Ruleset archive Parsing Loading Compilation and optimization Partial bytecode generation Costly parsing of IRL rules Heavy processing during ruleset loading, each and every time Only a partial bytecode generation Java class loading Execution 6 Executable rules Ruleflows still interpreted © 2013 IBM Corporation Compilation processes Decision Engine Business Rules Authoring Deployment Compilation Decision algorithm optimization Optimization during ruleset generation Intermediate code generation Intermediate object oriented code generation Ruleset Archive Loading Bytecode generation Java class loading Execution 7 Java bytecode generation Rules and ruleflows fully transformed into Java bytecode Executable rules © 2013 IBM Corporation Compilation processes Authoring Decision Engine (with intermediate code) Decision Engine (with Java bytecode) Business Rules Business Rules Compilation Compilation Decision algorithm optimization Deployment Intermediate code generation Optimization during ruleset generation Java bytecode generation (needs XOM) Ruleset Archive Loading Bytecode generation Java class loading Execution 8 Decision algorithm optimization Bytecode generation Ruleset archive Super fast Java bytecode loading. Java class loading Executable rules Executable rules © 2013 IBM Corporation Comparison between engines compilation processes Classic rule engine Authoring Deployment Loading Execution 9 Decision Engine Decision Engine (with intermediate code) (with Java bytecode) Business Rules Business Rules Business Rules Compilation Compilation Compilation Low level textual rules IRL Decision algorithm optimization Decision algorithm optimization Ruleset archive Intermediate code generation Bytecode generation Parsing Ruleset Archive Compilation and optimization Bytecode generation Java class loading Partial bytecode generation Java class loading Executable rules Java class loading Executable rules Ruleset archive Executable rules © 2013 IBM Corporation Additional redesign in the decision engine Decision table now treated with a dedicated artifact Ruleflows are fully compiled Legacy thread synchronization points removed Full rewrite means many opportunities to optimize the code. 10 © 2013 IBM Corporation Decision engine benefits 11 © 2013 IBM Corporation How to measure the gains Configuration: – Server – Client IBM x3550 M2 - Intel ® Xeon ® CPU X5570 @ 2.93 Ghz 2 x 4 cores x 2 threads ( 16 execution threads) 52 GB RAM. Microsoft ® Windows® Server 2008 WebSphere Application Server 8.5.0.2 (64 bit) IBM JVM Java 7 SR4 JVM Heap size from 1GB to 8GB DB2 Enterprise 9.7.0.441 (64-bit version) Rule Benchmark – Eight sizes of ruleset from 300 to 14560 rules – From 80 to 2000 rules fired per execution. – Decision tables only – Ruleflow of 5 rule tasks – Java or XML XOM – JSE, Web Service or REST invocation Acronyms: – DE: Decision Engine – CRE: Classic Rule Engine 12 © 2013 IBM Corporation Rule Execution Server - decision engine V8.5.1 Highlights Increased Execution Throughput: – Average improvement of 185% in average vs CRE (V8.5.0) – 29000 TPS on a 500 rule ruleset with sequential on Java XOM. – 37000 TPS on a 300 rule ruleset with Fastpath on Java XOM. Shorter Loading time: – Up to 15x times faster than CRE with large rulesets Less Memory consumption : – 1GB Heap (64 bits) recommended vs 4GB with CRE (64bits) – DE Java bytecode uses between 8x and 32x times less memory than CRE. (JSE test) Increased Scalability – DE is much more scalable than CRE 13 © 2013 IBM Corporation POJO RES Performance Sequential execution on JAVA XOM V8.5.0 Vs V8.5.1.0 % gain +110% +104% +228% +279% +280% +386% +384% +331% 35000 29237 30000 29212 25000 22397 TPS 20000 15000 13920 14350 10983 10000 6831 5159 5000 2895 1357 3667 754 2715 561 2253 523 0 300 500 1000 2912 5824 8736 11648 14560 JAVA XOM V8.5.0 (CRE) Ruleset size 14 JAVA XOM V8.5.1.0 (DE Java bytecode) © 2013 IBM Corporation Web Service Performance HTDS SOAP on XML XOM Sequential execution V8.5.0 Vs V8.5.1.0 % gain +37% +47% 5379 5492 +161% +243% +140% +77% +82% +30% 6000 5000 4360 3917 TPS 4000 3737 3000 2428 2000 1670 991 707 1000 412 545 309 218 396 203 264 0 300 500 1000 2912 5824 Ruleset size 8736 11648 14560 XML XOM V8.5.0 (CRE) XML XOM V8.5.1.0 (DE Java bytecode) 15 © 2013 IBM Corporation 16 © 2013 IBM Corporation 17 © 2013 IBM Corporation Minimum Heap Size (MB) for sequential execution (JSE) Java XOM CRE DE Intermediate code DE Java bytecode Ruleset size 300 500 1000 2912 5824 8736 11648 14560 0 32 16 4 32 16 4 4 64 8 16 32 16 128 128 200 192 256 256 300 400 20 64 100 Heap Size (MB) 16 256 384 500 512 600 640 700 18 © 2013 IBM Corporation Rule Execution Server V8.5.1 Release Highlights Benchmark Scenarios (relatives to 8.5.0, 8.0.1, 7.5.0.1 and 7.1.1.1 GAs) Rule Execution Server throughput improvement : comparison of V8.5.1 with Decision Engine (DE Java bytecode) Vs. previous releases using the Classic Rule Engine : – Versus 8.5.0 (*) • Between 10% and 400% faster (sequential) • Average improvement of 180% for sequential, 75% for Fastpath – Versus 8.0.1 (**) • Between 25% and 400% faster (sequential) • Average improvement factor of 190% for sequential, 90% for Fastpath – Versus 7.5.0.1 • Between 60% and 570% faster (sequential) • Average improvement of 250% for sequential, 125% for Fastpath – Versus 7.1.1.1 • Between 95% and 800% faster (sequential) • Average improvement of 335% for sequential, 160% for Fastpath (*) : addition of REST support have been integrated in statistics (**) : addition of Java XOM for HTDS (SOAP) support have been integrated in statistics 19 © 2013 IBM Corporation Decision Center & Rule Designer V8.5.1 Highlights Decision Center V8.5.1 improvements using the new Decision Engine (compared to Classic Rule Engine) – Full Build with Decision Engine is much faster than with Classic Rule Engine • Versus 8.5.0 / 8.0.1 : between 125% and 175% faster than Classic Rule Engine • Versus 7.1.1.1 : between 420% and 640% faster than Classic Rule Engine – Partial Build to execution : similar performance between the two engines. Rule Designer improvements using the new Decision Engine – Full Build : Decision Engine is between 100% to 180% faster than Classic Rule Engine – Partial Build to execution : similar performance between the 3 use cases (CRE, DE Intermediate code, DE Java bytecode), however DE Java bytecode is recommended for production use. 20 © 2013 IBM Corporation How to leverage the decision engine 21 © 2013 IBM Corporation Selecting the decision engine for compilation Choose build mode (in rule project properties) – Classic rule engine is the default mode – User can revert to previous mode – No change to the rule content Rule Designer compiles rule artifacts into a ruleset archive (.dsar) – contains compiled and optimized code – With Java bytecode or intermediate code Build mode synchronized with Decision Center 22 © 2013 IBM Corporation Comparison between engines compilation processes Decision Engine Decision Engine (with intermediate code) (with Java bytecode) Business Rules Authoring Deployment Business Rules Compilation Compilation Decision algorithm optimization Decision algorithm optimization Intermediate code generation Bytecode generation Ruleset Archive Loading Only supported mode from Decision Center Default mode for the decision engine in Rule Designer Ruleset archive Bytecode generation Java class loading Java class loading Executable rules Executable rules Execution 23 © 2013 IBM Corporation Rule Execution Server and the decision engine Same API between CRE and DE for ruleset execution and management When deploying decision engine rulesets from Decision Center (with intermediate code), there is a way to cache and reuse in the RES the ruleset that has been translated into Java bytecode – Benefit: much faster ruleset loading the second time the ruleset is loaded – How: activate the cache option (in server admin console or in connector deployment descriptor) … <config-property> ra.xml <config-property-name>compiledArchivesCacheProperties </config-property-name> <config-property-type>java.lang.String </config-property-type> <config-property-value>maxSize=20,path=/var/cache/xu/ca_cache <config-property-value> </config-property> … 24 © 2013 IBM Corporation Enabled features in Rule Execution Server console Add ruleset built with DE Compatible functions on ruleset view page – Test ruleset execution and view statistics dsar archive view (show rules and ruleflows hierarchical structure only) – Monitor options and HTDS options – HTDS description files view and download Decision warehouse available 25 © 2013 IBM Corporation Enabled features in Rule Designer Support creation of “New Client Project for RuleApps” to be used with DE rule project Enable local and remote debugging for DE archive Export DE ruleset archive with options Notification if the ruleset build mode of a rule project referenced in a RuleApp is changed New sample to display execution trace – 2 ruleApps deployed: one with CRE ruleset and one with DE ruleset – Execution traces are enabled 26 © 2013 IBM Corporation Main current limitations In Rule Designer – Can not use DVS to test the rulesets built with DE – Can not run rule analysis on rule project built with DE – Can not define custom rule language and translate custom rules into IRL in DE mode – Scorecard Modeler not supported in rule project built with DE In Decision Center – Can not use DVS for test suites/simulation for ruleset built with DE – Can not check ruleset archive at generation time (can check rule consistency) In Rule Execution Server – No rules – event bridge support 27 © 2013 IBM Corporation Prochaines étapes Test de decision engine avec plus de projets clients – Re – compilation avec decision engine – Exécution, vérification, mesure des gains Collaboration avec le Lab ODM Mise en production 28 © 2013 IBM Corporation Merci Des questions ? 29 © 2013 IBM Corporation