title: Drools - same KieSession for multiple requests
body: <p>I use drools 6.3.0 in my projects.  I have around 3 thousands rules with 2 categories. Say, category1 with 1500 rules and category2 with 1500 rules.
  There are 20k orders with different data. Each order will have set of different attributes. Now, creating kiesession for each request is taking time and it is really slow. So, planning to use the same kiesession for executing all the orders and orders will be processed using multi threading.</p>
  
  <p>Below is my current approach.</p>
  
  <pre><code> KieBase kieBase = null;
   KieServices kieServices = KieServices.Factory.get();
   KieRepository kieRepository = kieServices.getRepository();
          kieRepository.addKieModule(new KieModule() {
              @Override
              public ReleaseId getReleaseId() {
                  return kieRepository.getDefaultReleaseId();
              }
          });
  
   KieFileSystem kfs = kieServices.newKieFileSystem();
  
   kfs.write(******);  // Load 3k rules in a for loop
   KieBuilder kb = kieServices.newKieBuilder(kfs);
              kb.buildAll();
   KieContainer kContainer = kieServices.newKieContainer(kieRepository.getDefaultReleaseId());
   kieBase = kContainer.getKieBase();
  
   kContainer = kieServices.newKieContainer(kieRepository.getDefaultReleaseId());
              kieBase = kContainer.getKieBase();
   KieSession kieSession = kieBase.newKieSession();
  </code></pre>
  
  <p>This is how i create kiesession and would like to use this kiesession for all the order execution.</p>
  
  <p>I want to execute orders in parallel using thread pool.</p>
  
  <p>This is how</p>
  
  <p>// Here the entry is based on the category and some id. 
  Each rule will have id and category. For each id and cateogory, there would be set of rules which should be evaluated.</p>
  
  <p>The flow is like,  </p>
  
  <p>1) Take 20k orders from DB
  2) For each order, get ids to be executed
  3) For each id, format entry point like <code>entry = id+_category</code></p>
  
  <p>4) insert order attributes data and fireRules.</p>
  
  <pre><code>final EntryPoint entryPoint = ksession.getEntryPoint(entry);
          if (entryPoint != null) {
              entryPoint.insert(data);
              ksession.fireAllRules();
          } else {
              log.warn("No rules to be executed");
          }
  </code></pre>
  
  <p>Now, as i have to execute the orders in parallel, </p>
  
  <p>Each order will call the below code in parallal,</p>
  
  <pre><code>entryPoint.insert(data);
  ksession.fireAllRules();
  </code></pre>
  
  <p>Since, each order will have different attributes and inserting different data to entrypoint, it is causing problem and not getting the expected result.</p>
  
  <p>Is there anyway to achieve this?</p>
  
  <p>Thanks</p>