Facing issue while running performance test with high response time in CRDB

Hello Flowable Team,
Facing high response time issue while running the performance test on locust for 10 user and 1 spawn rate for CREATE and GET. I have configured 4 Vcpu and the Flowable version is 22.1.1. It is a 5 node cluster.

Also, looking into crdb, we discovered that the below query is taking more time for execution. Please help on how to fix this issue and if their is any recommendations.

SELECT DISTINCT
res.*,
p.key_ AS processdefinitionkey,
p.id_ AS processdefinitionid,
p.name_ AS processdefinitionname,
p.version_ AS processdefinitionversion,
p.deployment_id_ AS deploymentid,
var.id_ AS var_id_,
var.name_ AS var_name_,
var.type_ AS var_type_,
var.rev_ AS var_rev_,
var.proc_inst_id_ AS var_proc_inst_id_,
var.execution_id_ AS var_execution_id_,
var.task_id_ AS var_task_id_,
var.bytearray_id_ AS var_bytearray_id_,
var.double_ AS var_double_,
var.text_ AS var_text_,
var.text2_ AS var_text2_,
var.long_ AS var_long_
FROM act_ru_execution AS res
INNER JOIN act_re_procdef AS p ON res.proc_def_id_ = p.id_
LEFT JOIN act_ru_variable AS var ON res.proc_inst_id_ = var.execution_id_
INNER JOIN act_ru_variable AS a0 ON res.proc_inst_id_ = a0.proc_inst_id_
INNER JOIN act_ru_variable AS a1 ON res.proc_inst_id_ = a1.proc_inst_id_
WHERE (
(
(
(
(
(
(
(((res.parent_id_ IS NULL) AND p.key_ = $1) AND res.name_ = $2)
AND a0.execution_id_ = a0.proc_inst_id_
)
AND a0.name_ = $3
)
AND a0.type_ = $4
)
AND a0.text_ = $5
)
AND a1.execution_id_ = a1.proc_inst_id_
)
AND a1.name_ = $6
)
AND a1.type_ = $7
)
AND a1.text_ = $8
ORDER BY res.id_ ASC
LIMIT $9
OFFSET $10

Thanks,
Bhavya

Hey @bkumar614,

Which Flowable version are you using? In 6.7.0 we did some improvements around the way we query data needed for paging. Can you try with a newer version?

Keep in mind, that you are trying to query for a process instance that has 2 variables with a specific value. Depending on the size of the data, this can be slow, since there might not be any indices on some of the columns.

Cheers,
Filip