Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements - /account/balance performance #283

Open
Kartiiyer12 opened this issue Feb 14, 2025 · 0 comments
Open

Improvements - /account/balance performance #283

Kartiiyer12 opened this issue Feb 14, 2025 · 0 comments

Comments

@Kartiiyer12
Copy link
Collaborator

Kartiiyer12 commented Feb 14, 2025

  • Library/Tool: cardano-rosetta-java (v1.2.1)
  • Network: Mainnet
  • Setup: Docker

Request API Call /account/balance

Request:

POST {{URL}}/account/balance
{
    "network_identifier": {
        "blockchain": "cardano",
        "network": "mainnet"
    },
    "account_identifier": {
        "address": "addr1v804tgee0m3ww7z93zh64wr9flqh9psdhnxg6cykfudgulg6f633p",
        "metadata": {}
    }
}

Result:
The query took 1 min 30 secs to get back the result. Interestingly,

  • If queried again after few blocks, the response is under 2 seconds.
  • Querying after 10 blocks takes 14 seconds to return the result.
  • Querying after 50 blocks (aka 15 min) took a minute to get the response.

Issue
In the logs, I saw warnings as -
`WARN 161879 --- [l-1 housekeeper] com.zaxxer.hikari.pool.ProxyLeakTask : Connection leak detection triggered for org.postgresql.jdbc.PgConnection@13df6ef on thread http-nio-8082-exec-4, stack trace follows

java.lang.Exception: Apparent connection leak detected
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:128) ~[HikariCP-5.0.1.jar!/:na]
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-6.4.4.Final.jar!/:6.4.4.Final]
at `

For which I increased the below env variables-
SPRING_DATASOURCE_HIKARI_LEAKDETECTIONTHRESHOLD=180000

After setting the above env variable, no warning logs appeared as the initial leak detection was default to 1 min.

Background

There was a discussion earlier that we can address balances can be cached when queried and then subsequent call for the balance will only from the previous block when the balance was cached to the latest block which can improve the performance but can take up larger space. The rosetta-java even with only transaction data takes up 644 GB vs entire db-sync taking 512 GB.

@Kartiiyer12 Kartiiyer12 changed the title Improvements Improvements - /account/balance performance Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant