Search code examples
droolsoptaplanner

Multiple inputs running in parallel in the same application vs. starting a new application for each input


As i can see when running the application in debug mode there are 4 different threads on which Drools is running. When i start the application with two threads running two inputs in parallel again the same 4 threads remain (they don't turn to 8 for example). My question is , is there a benefit from running the inputs in a separate application (and with this starting a separate Drools application) , or all of this is covered and we end up with the same results using one application and starting the inputs in parallel?


Solution

  • Advantages of using 1 JVM's:

    • heap pooling
    • JIT compilation only once in java code
    • JIT compilation only once in DRL code iff you reuse your kiebases
    • Ability to implement queueing and round-robin solving. See SolverManager issue and runnablePartThreadLimit's purpose in Partitioned Search (which will also be supported on SolverManager at some point).

    Advantages of using multiple JVM's:

    • Garbage Collector works more efficiently usually
    • Ability to link OS (especially on linux) process id's to specific cores. This allows to do round-robin solving through OS configuration.