As I said on the forum, I think there is a missing index on ACT_RU_TASK.PARENT_TASK_ID_. I've performed some stress tests with Oracle DB.
1) Without the index
a) Running and completing 10k process / empty DB / no process running in the background / 300-1000ms delay between each request - avg response time 95ms
then
b) Only running 500k process / no delay between requests - avg response time 1259ms
then
c) Running and completing 10k process / 500k process running in the background / 300-1000ms delay between each request - avg response time 8000ms
2) With index created
Exactly the same tests, times are better:
a) avg response time 84ms
b) avg response time 1248ms
c) avg response time 104ms
Also CPU Consumption is smaller.
Cheers.