Forum Stats

  • 3,853,352 Users
  • 2,264,207 Discussions
  • 7,905,326 Comments

Discussions

Rulebase performance slow under load

RP24
RP24 Member Posts: 76 Red Ribbon

Hey,

We are using an embedded form of rules in our application and we have seen in the load tests that when same scenario is submitted multiple times to rules the determination completion takes different amount of time and are way apart rather than similar. For example: sometimes the determination is completed in 5 seconds and other times it takes only 1 or 2 seconds for the same scenario submitted multiple times.

Is there a way to debug this like why it takes different amount of time?

Also, is there a way we can make execution faster by doing some settings for OPA?

Note: we are on 10.4.6 version.

Tagged:
«1

Answers

  • Brad Tuckett-Oracle
    Brad Tuckett-Oracle Moderator Posts: 643 Employee
    edited Feb 23, 2018 6:35PM

    Can you provide more context:

    • what OPA component you are using (Web Determinations?)
      • If this is Web Determinations, does this involve document generation?
    • what is the web server (is it the same for the application and OPA?)
    • what sort of determinations are involved:
      • reference relationships?
      • inferred relationships?
      • temporal reasoning?

    Also, have you reviewed the "Performance" section of the OPA 10.4 developer guide? (https://docs.oracle.com/html/E79064_01/toc.htm#Performance/Performance_Tuning.htm)

    Brad Tuckett, Intelligent Advisor team

  • RP24
    RP24 Member Posts: 76 Red Ribbon
    edited Feb 23, 2018 11:36PM

    Hey

    We have embedded OPA within application so its not web determination. The application invokes session.think

    Weblogic is the application server

    It has all kinds of relationships like reference, inferred and temporal as well.

    Yes I have reviewed the performance.

  • Brad Tuckett-Oracle
    Brad Tuckett-Oracle Moderator Posts: 643 Employee
    edited Feb 24, 2018 12:22AM

    OK so you are using the Determinations Engine API (https://docs.oracle.com/html/E79064_01/toc.htm#Custom Development/Embed_Determinations.htm).

    • How are you loading the data - is it coming from a database or a web service or just inputs on a web page? 
    • Have you tried profiling the call to session.think() to see if that's where the performance is varying? 
    • Are there any custom functions or inference listeners involved?  If so, have these been profiled?
    • Is the same OPA session object being used for each scenario or go you create a new session each time?

    Brad Tuckett, Intelligent Advisor team

  • Ian Clough
    Ian Clough Member Posts: 206 Blue Ribbon
    edited Feb 24, 2018 6:24AM

    You might want to look at the memory settings for you Web Logic domain and possibly investigate garbage collection either using a JVM monitor or enabling GC logging in WLS.

    One other mistake I have seen using the engine API is to create an engine instance and reload the rulebase (can be slow) for each session. The engine can be a singleton and each rulebase only needs to be loaded once, you then create sessions from the required rulebase.

  • RP24
    RP24 Member Posts: 76 Red Ribbon
    edited Feb 26, 2018 6:29PM

    The memory is good across weblogic.  Also, we are using cache so it doesn't always need to do I/O for the rulebase.

    From the API, the Engine is a static field so only 1 instance is created of it.

  • RP24
    RP24 Member Posts: 76 Red Ribbon
    edited Feb 26, 2018 6:26PM

    Data is coming from the DB and slowness is reported specifically when session.think()  happens by the performance tool.

    Yes there are inference listeners but the performance tool is not showing slowness there.

    No custom function exists

    Yes. New session is created each time makes determinations.

  • RP24
    RP24 Member Posts: 76 Red Ribbon
    edited Feb 27, 2018 10:40AM

    I was just wondering since Engine is a static field , Is there any kind of Synchronization imposed on Engine's method calls?

  • Ian Clough
    Ian Clough Member Posts: 206 Blue Ribbon
    edited Feb 27, 2018 3:41PM

    What performance tool are you using and what methods / classes have you instrumented? It is not unknown for the performance measurement tool itself to impact performance significantly especially if you try to instrument too much, too soon.

  • RP24
    RP24 Member Posts: 76 Red Ribbon
    edited Feb 27, 2018 5:22PM

    I am using AppDynamics

  • Brad Tuckett-Oracle
    Brad Tuckett-Oracle Moderator Posts: 643 Employee
    edited Feb 27, 2018 10:56PM

    There is a lock within Engine.createSession() to ensure a unique session ID.

    Brad Tuckett, Intelligent Advisor team

This discussion has been closed.