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

Some contracts REST API endpoints show large slowdown with high number of entities #9967

Open
xin-hedera opened this issue Dec 16, 2024 · 3 comments · May be fixed by #10069
Open

Some contracts REST API endpoints show large slowdown with high number of entities #9967

xin-hedera opened this issue Dec 16, 2024 · 3 comments · May be fixed by #10069
Labels
bug Type: Something isn't working performance rest Area: REST API

Comments

@xin-hedera
Copy link
Collaborator

Description

Contracts REST API endpoints /contracts?limit=100 and /contracts/{id} show much lower RPS with high number of entities (around 100M).

Initial investigation points to the inefficiency of index entity__id_type on (id, type) used in the SQL query shared by both endpoints. When there are very few contracts entities among the hundreds of millions rows in the table, it'll take much longer to find the matching rows.

Two possible ways to fix

  • drop index entity__id_type, create a new index on just type, or (type, id), research if there's negative performance impact to other endpoints which depend on index entity__id_type
  • rewrite the getContracts SQL query in contractController.js to not use index entity__id_type

Steps to reproduce

Run k6 performance tests contracts and contractsId.

Additional context

No response

Hedera network

other

Version

v0.119.0

Operating system

None

@xin-hedera xin-hedera added bug Type: Something isn't working performance rest Area: REST API labels Dec 16, 2024
@HarshSawarkar
Copy link
Contributor

Hi I would like to work on this issue.

@HarshSawarkar
Copy link
Contributor

Hi I have linked a pr for above issue. Could you review it?

@HarshSawarkar
Copy link
Contributor

Also I tried to k6 performance test on contracts and contractsId but got the below error.Could you please guide me on how to run this test?

WARN[0003] Request Failed error="Get \"http://localhost/api/v1/contracts?limit=100\": dial tcp 127.0.0.1:80: connectex: No connection could be made because the target machine actively refused it."

Also, these were my k6.env configurations.

export BASE_URL=http://localhost
export DEFAULT_DURATION=120s
export DEFAULT_LIMIT=100
export DEFAULT_VUS=10    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type: Something isn't working performance rest Area: REST API
Projects
None yet
2 participants