Re: [rules-users] Pooling stateful sessions to have threaded executions of a ruleset

2014-04-13 Thread Mark Proctor
as it says in the docs. we’ve designed things to put in foundations for future 
multi-threaded exploitation, but there is nothing there now.

The  example code doesn’t make too much sense to me. As you are saying you are 
using them as a pool, but you are disposing after use.

Mark
On 11 Apr 2014, at 08:48, Mercier Jonathan jmerc...@genoscope.cns.fr wrote:

 Le 09/04/2014 11:20, Maxime Falaize a écrit :
 I confirm that the multithreaded rules evaluation is not currently 
 supported. See 
 https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/RuleBaseConfiguration.java#L683
 
 
 2014-04-07 12:27 GMT+02:00 Maxime Falaize maxime.fala...@gmail.com:
 I'm sorry but I don't understand what you are talking about. In this 
 article, there is nothing about multithreaded rules evaluation. It just says 
 that the Phreak algorithm is designed for thread safety and future multicore 
 processors exploitation. It doesn't mean that it is already multithreaded. 
 Moreover I tested my appliciation with and without multithreaded sessions (I 
 am using Drools 6.0.1.Final) and I noted a faster execution in the 
 multithreaded one.
 
 
 2014-04-04 13:53 GMT+02:00 jmercier jmerc...@genoscope.cns.fr:
 
 Le 04/03/2014 09:55, Maxime Falaize a écrit :
  Hello,
 
  I want to ask you if it is a good practive to pool stateful sessions
  for a specific ruleset to improve the execution performance.
  Actually in my application I execute my rules by calling SOAP
  webservice. For performance purpose, I test multithreaded calls to my
  webservice and I noted that when I pool sessions in the server side,
  it improves the performance a lot.
 
  To pool sessions, I just declare multiple ksession tag in my
  kmodule.xml :
 
  kbase name=KBase packages=com.example.*
  ksession name=KSession1/
   ksession name=KSession2/
  ksession name=KSession3/
  ksession name=KSession4/
  ksession name=KSession5/
   /kbase
 
  In my spring webservice endpoint I just put that code to handle the
  pool :
 
  @Endpoint
  public class ExampleEndpoint implements InitializingBean {
 
  @Autowired
  private ExampleRuleService ruleService;
   private MapInteger, Boolean isRunningMap = new
  HashMapInteger, Boolean();
  private static final int NB_POOL_SESSIONS = 5;
 
  @PayloadRoot(localPart = com.example.ExampleRequest)
   @ResponsePayload
  public ExampleResponse handleRequest(
  @RequestPayload ExampleRequest request) throws
  InterruptedException {
  KieServices ks = KieServices.Factory.get();
  KieContainer kc = ks.getKieClasspathContainer();
   while (true) {
  for (int i = 0; i  NB_POOL_SESSIONS; i++) {
  boolean run = false;
 
  synchronized (isRunningMap) {
  if (!isRunningMap.get(i)) {
   isRunningMap.put(i, true);
  run = true;
  }
  }
 
  if (run) {
  KieSession ksession = kc.newKieSession(KSession
  + (i + 1));
   ExampleResponse response =
  ruleService.run(ksession, request);
  ksession.dispose();
 
  isRunningMap.put(i, false);
  return response;
   }
  }
  Thread.sleep(100);
  }
  }
 
  public void afterPropertiesSet() throws Exception {
  for (int i = 1; i = NB_POOL_SESSIONS; i++) {
  isRunningMap.put((i - 1), false);
   }
  }
 
  }
 
  It works well because in my benchmark I improve 5 times the
  performance (as I have 5 different threads) but I wondered if it is a
  good practice and if it does not hide any issues that I could have in
  the future.
 
  Thanks for your help.
 
  --
  Maxime FALAIZE
  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
 
 
 Hi maxime,
 
 I do not remember if use drools 6 or drools 5. If you using drools 6.
 Phreaks algorithm use multi threading according to use 'from
 accummulate' far i understand here:
 http://planet.jboss.org/post/drools_6_performance_with_the_phreak_algorithm
 
 Instead to put a thread by ksession here rules evaluation are
 multi-threaded.
 
 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
 
 
 
 -- 
 Maxime FALAIZE
 
 
 
 -- 
 Maxime FALAIZE
 
 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
 
 Ah yes. Maybe Mark Proktor could tell  some information about this
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 

[rules-users] how KnowledgeAgent to use guvnor cluster?

2014-04-13 Thread 窦晓峰
Hello, every one:

 I am newbie for drools and guvnor, so excuse me if the question is
duplicated for others.

 I am use guvnor 5.5.0 final and set up two nodes guvnor cluster
successfully. But I don’t know how to configure the knowledge agent to use
the cluster for HA?(before the cluster set up a nginx for banlance?)

 

Thx a lot

 

 

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users