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

feat(x/intent): use fixed Intent in Actions and improve ActionsByAddress query performance #117

Merged
merged 5 commits into from
Mar 22, 2024

Conversation

Pitasi
Copy link
Contributor

@Pitasi Pitasi commented Mar 22, 2024

ActionsByAddress was our slowest query, so it's the first one I'm tackling before v0.2 to improve performance on our nodes.

I benchmarked the current vs new implementation using a simple script:

time for i in (seq 1000)
      grpcurl --plaintext -d '{"pagination": {"count_total":true, "limit":1},"address":"warden10kmgv5gzygnecf46x092ecfe5xcvvv9r870rq4"}' localhost:9090 warden.intent.Query.ActionsByAddress
end

on a node that has 45584 actions, of which only 3 had to be returned by the query.

After this PR:

Executed in   15.21 secs    fish         external

Before this PR:

Executed in  188.73 secs    fish         external

It's not a super precise benchmark, but I think it's reasonable to say that we gained at least an order of magnitude here, that will result in massive improvements in production since I didn't consider concurrent users and GC pressure.

This PR comes with an important breaking change, though:

Actions will store a fixed version of the Intent at the time the Action is created

This means, that if an Action was using the default Intent of the Space (i.e. "one of the owners"), the group of owners could change after the Action is created. In this new version, the list of owners is fixed at the time the Action is created and can't be changed later (the user can revoke this action and create a new one, if it needs it).

I personally think this is clearer and avoids unexpected flows with the Actions, especially if we'll allow to edit Intent definitions after creation (which is something we want to do).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant