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

Fix permissions graph performance #36610

Closed
1 task done
escherize opened this issue Dec 8, 2023 · 1 comment
Closed
1 task done

Fix permissions graph performance #36610

escherize opened this issue Dec 8, 2023 · 1 comment
Assignees
Labels
.Task Not a part of any Epic, used by the Task Issue Template
Milestone

Comments

@escherize
Copy link
Contributor

escherize commented Dec 8, 2023

Improve permissions graph performance

Resolves: #30474

Context

The api/permissions/graph endpoint can be pretty slow when the graph gets huge.

The thing that is slow is querying for, and transmitting the entire, potentially-enormous permissions graph. It has a
combinatorial explosion of every permission group id * database id. The response payload has been observed to be
25MB.

We should simply not return the entire graph when possible.

Endpoints to consider:

Legacy, slow, remained untouched until this is complete:

GET api/permissions/graph/

Faster GET endpoints:

GET api/permissions/graph/group/:group-id
GET api/permissions/graph/db/:group-id

These Offer a filtered view of the graph, by either group-id or db-id, and return all graph entries for each
group-id or db-id respectively.

I have observed a 200x speedup when using these compared to GET api/permissions/graph/ with a large permissions graph.

Speedup PUT endpoint:

PUT api/permissions/graph/

Should start observing an optional query param of 'full', which defaults to true. That way it will have the same behavior for callers.

When skip-graph=true, instead of returning the entire graph, we will return just the revision number.

  • (Question for FE: does it make sense to return the affected portion?)

Frontend updates

Tasks

  1. npfitz

Instead of relying on the global permissions graph we will need to have the client ask for parts of the permission graph.

On Admin > Permissions

http://localhost:3000/admin/permissions/data/group

If groups are selected, then, hitting GET api/permissions/graph/group/:group-id for the group-id will return the data needed.
If dbs are selected, then, hitting GET api/permissions/graph/db/:db-id for the db-id will return the data needed.

@escherize escherize added the .Task Not a part of any Epic, used by the Task Issue Template label Dec 8, 2023
@escherize escherize self-assigned this Dec 8, 2023
@npfitz npfitz added this to the 0.49 milestone Jan 12, 2024
@escherize
Copy link
Contributor Author

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.Task Not a part of any Epic, used by the Task Issue Template
Projects
None yet
Development

No branches or pull requests

2 participants