Skip to content

Querying DB performance issue - flow delays #6442

@adamturski

Description

@adamturski

In Corda4 we could query states without invoking a flow. In Corda5 the only way to query DB is starting the flow and run the query there. We have found that on our env there are some delays (not related to DB query itself):

  • between REST call and Flow start - around 50-100ms
  • between Flow completion and result available on REST endpoint - around 100-300ms
  • additional delay between client and Corda as client does not know when flow is completed so it has to call for flow result every X ms, e.g. 50ms - around 5-50ms

Assuming that flow, which simply queries state by its linearId, will have execution time e.g. 10ms (real example) then from client perspective total execution time will be around 165-460ms:

  • optimistic: 50+100+5+10=165ms
  • pessimistic: 100+300+50+10=460ms

Questions:

  1. Is there any plan to provide a way to notify client that flow is completed, different than polling REST endpoint, e.g. dedicated Kafka topic? We use enterprise version and even then there is no out of the box solution.
  2. Is these delays exists by design or is it something wrong with our env? What are default expected delays for flows?
  3. Is there a plan to allow querying states without invoking a flow?
  4. Is there any Corda cluster config (e.g. corda.flow, corda.messaging) which can be changed to improve overall performance?
  5. Are Corda cluster resources enough or maybe some workers should have more CPU/RAM?

Env:
Kubernetes: GCP Autopilot
Kafka: Raft cluster (3 instances) 2 CPU, 6GB RAM each instance
Database: Postgresql 15
Corda Flow Worker: 2CPU, 3GB RAM
Corda Rest Worker: 2CPU, 3GB RAM
Corda * Worker: 1CPU, 1.5GB RAM
Corda enterprise Helm chart: 5.2.1

Logs:
corda.log

corda2.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions