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

Auth: Fine-grained permission request cache #14513

Closed
wants to merge 7 commits into from

Conversation

markylaing
Copy link
Contributor

I was playing with some ideas to get some quick wins for performance in the fine-grained authorization driver.

The OpenFGADatastore receives very specific queries such as:

  • Which groups are related to instance:/1.0/instances/c1?project=default as can_view?
  • Which objects of type instance are members of group foo related to as can_view?

Each of these queries are executed case-by-case. This always hits the database, even if there are no permissions at all for entities of type instance.

This PR implements pre-loading of the auth_groups_permissions table to reduce the total number of database calls. Qualitatively, I've seen this reduce the total number of database calls when listing projects with recursion from 85 to 10.

@gabrielmougard it might be worth comparing this with your work in #14476. We can test performance and try to make further optimisations so that loading the additional entitlements is low-cost.

…parsing.

If `(Type).URL`, was called on non-project specific entities with a
project parameter it was being set on the URL. For example:

```
TypeServer.URL("default", "")
```

Returned the URL: `/1.0?project=default`.

This isn't what we want.

Additionally, the project query parameter was not being persisted on
`ParseURL` for operations or warnings.

Additional unit tests have been added to account for these cases.

Signed-off-by: Mark Laing <[email protected]>
@markylaing markylaing self-assigned this Nov 24, 2024
@gabrielmougard
Copy link
Contributor

@markylaing thanks! Taking a look

@markylaing
Copy link
Contributor Author

Closing in favour of #14557

@markylaing markylaing closed this Nov 29, 2024
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

Successfully merging this pull request may close these issues.

2 participants