cancel
Showing results for 
Search instead for 
Did you mean: 

Event handler - decrease fetch time

racadent
Champ in-the-making
Champ in-the-making
Hi,

Is there any way to tell Activiti to fetch events (signals and messages) more frequent? I have messages in Activiti which are triggered by application and Activiti needs certain amount of time (0.x seconds) to fetch them and execute.

Can I configure that time with different value?

I know it could be overhead for the db, but current value doesn't fit our business logic.
6 REPLIES 6

trademak
Star Contributor
Star Contributor
Hi,

Signals and messages are handled directly, but depending on the way you use it, the handling of the message and signal can more or less time.
Do you also pass an executionId, or or only the signal or message name?
How many process instances can be waiting for a signal in your case?
Also, by default no index is created on the event name in the event subscription table (ACT_RU_EVENT_SUBSCR).

Best regards,

racadent
Champ in-the-making
Champ in-the-making
I have very simple diagram and I will try to describe, because I could not upload attachment:

Start message event->Event gateway->2 events (e1, e2)-> both events go to End event.

And I have a small test:


  for (int i = 0; i<5;i++) {
   System.out.println("Message triggered: " + dformat.format(new Date().getTime()));
   runtimeService.startProcessInstanceByMessage("r_msg"); //start with message name
   System.out.println("Message finished, now trigger the event e1: " + dformat.format(new Date().getTime()));
   runtimeService.signalEventReceived("e1"); //trigger event e1
   System.out.println("Event finished: " + dformat.format(new Date().getTime()) + "\n");
  }


I get the following output:


Message triggered: 2013-02-28 12:42:06,223
Message finished, now trigger the event e1: 2013-02-28 12:42:06,824
Event finished: 2013-02-28 12:42:07,054

Message triggered: 2013-02-28 12:42:07,054
Message finished, now trigger the event e1: 2013-02-28 12:42:07,254
Event finished: 2013-02-28 12:42:07,461

Message triggered: 2013-02-28 12:42:07,461
Message finished, now trigger the event e1: 2013-02-28 12:42:07,672
Event finished: 2013-02-28 12:42:07,893

Message triggered: 2013-02-28 12:42:07,893
Message finished, now trigger the event e1: 2013-02-28 12:42:08,107
Event finished: 2013-02-28 12:42:08,334

Message triggered: 2013-02-28 12:42:08,334
Message finished, now trigger the event e1: 2013-02-28 12:42:08,541
Event finished: 2013-02-28 12:42:08,756


As you can see Activiti needs ~200ms to start message and another ~200ms to trigger the event!?.
There are no more process instances that are waiting for the event and I have also created index on the EVENT_NAME_ column in ACT_RU_EVENT_SUBSCR. Mashine has quite good performanse (i7,6gb).

Also, when I query to the db directly and do select * from ACT_RU_EVENT_SUBSCR where EVENT_NAME_ = 'r_msg' I get:

(1 row(s) affected)

SQL Server Execution Times:
   CPU time = 0 ms,  elapsed time = 0 ms.

jbarrez
Star Contributor
Star Contributor
Such micro benchmarks are hard to say anything about … it could very well be a problem with the connection pooling … The only way to really know where time is spent, is attaching a profiler.

racadent
Champ in-the-making
Champ in-the-making
Ok and my question is: do I have the problem (with ~200ms response) or it is usual Activiti behavior?

I suppose from your answer that I have a problem (db, hardware…).

racadent
Champ in-the-making
Champ in-the-making
Yes, connection pool was missing. Thanks a lot!

jbarrez
Star Contributor
Star Contributor
And that was just a random guess from me Smiley Tongue