cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti History table causing slowness in activiti process

anilknayak
Champ in-the-making
Champ in-the-making
Hi,

we have been using activiti per 6 month with history enabled and we are using Oracle DB for the activiti, but recently got some performance issues.
following are the observations, what I got from the performance stand point while performance test of our application

we have seen that the records are growing in activiti history table, which is causing performance issues.
following are the statistics of activiti tables when we got the performance issues. Each execution is taking 12-17 second.


==============================
Table name : number records
==============================
ACT_RU_EXECUTION      :      23512
ACT_RU_TASK         :   11812
ACT_RU_IDENTITYLINK   :   15133
ACT_RU_VARIABLE      :   165008

==============================
Table name : number records
==============================
ACT_HI_IDENTITYLINK   :   1526867
ACT_HI_PROCINST      :   745489
ACT_HI_ACTINST      :   18169298
ACT_HI_TASKINST      :   3769590
ACT_HI_VARINST      :   9711507

with the above number of record in table, our process execution is very slow. but with the below statistics our application running exceptionally faster like each processes is executing in some millisecond .
We have deleted most records from the history table.

==============================
Table name : deleted number records
==============================
ACT_HI_IDENTITYLINK   :  199044
ACT_HI_PROCINST           :  87648
ACT_HI_ACTINST           :  2134173
ACT_HI_TASKINST           :  445314
ACT_HI_VARINST           :  1141642

could you please give us some suggestion for this slowness. we are having a very critical application. which need to be fixed.
our data can grow 100 time as we have today, going forward

7 REPLIES 7

jbarrez
Star Contributor
Star Contributor
Do you need all the historical data? You can change the history level if you don't need as much data.

In all the text above you speak about slowness and performance, but I don't see where exactly you see this happening? Process start? Task list? What is your environment?

shrey
Champ in-the-making
Champ in-the-making
Hi Joram,

Since we are using activti Rest API , we invoke service [ /service/task/{taskId}/complete ] to complete a user task. User task completion is followed by 1 system task(sync = on). Completion of these 2 task call consumes time.
We traced the call via dynatrace, so below query is taking around ~3 sec.
<code>
select * from ( select a.*, ROWNUM rnum from (     select RES.*            from ACT_HI_ACTINST RES      WHERE  RES.EXECUTION_ID_ = ?                              and RES.ACT_ID_ = ?  and RES.END_TIME_ is null   order by RES.ID_ asc        ) a where ROWNUM < ?) where rnum  >= ?
</code>

We are not sure why ACT_HI_* tables is referred for task. This is a Activiti internal query call. I assume this might be used to update task to ACT_HI_* tables.

Regards,
Shrey Srivastava

jbarrez
Star Contributor
Star Contributor
Yes, it is indeed needed for updating the history data for that task.
So that being said, one option is to clean out old data, or to lower the history level. Another option might be to check why this particulary query is so slow, and add a new index to speed it up.

ivan_activiti
Champ in-the-making
Champ in-the-making
We ran into the same issues with using history tables. Our requirement is to store all historic processing data and make it accessible to the application. Has anyone resolved it by adding indexes?

–Ivan

jbarrez
Star Contributor
Star Contributor
Indices will help if you have a particular use case.
But if it's simply too much data, you'll need to solve it differently (database level, typically)

shrey
Champ in-the-making
Champ in-the-making
Yes we did add few indices. I can share those here asap.
Hope that it can help with Activiti release as well.

shrey
Champ in-the-making
Champ in-the-making

1. Add an index on ACT_HI_TASKINST(PROC_INST_ID_) —-> added as part of 5.18
2. Add an index on ACT_HI_PROCINST(SUPER_PROCESS_INSTANCE_ID_)