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

Implement ListRelations as a single network request instead of multiple Check requests #1591

Open
1 task done
gurleensethi opened this issue May 2, 2024 · 2 comments
Open
1 task done
Labels
enhancement New feature or request

Comments

@gurleensethi
Copy link

Checklist

Describe the problem you'd like to have solved

While investigating the openfga/go-sdk source code to address some performance issues, I discovered that the ListRelations function is actually executing multiple parallel Check requests (see call to BatchCheck and multiple requests within BatchCheck).

This approach becomes problematic when managing a high number of relations, such as 300, for several reasons:

  1. There is a maximum limit on concurrent Check requests that can be executed, although this can be mitigated by increasing the MaxParallelRequests setting.
  2. The substantial overhead from numerous parallel network requests contributes to decreased performance (this is huge).
  3. Since all relations involve the same User + Object, each request repeatedly retrieves the corresponding tuple from the database (can be mitigated to some extent by enabling node caching).

image

Describe the ideal solution

Ideally, calling ListRelations (and even CheckBatch for that matter) should result in only a single call to the OpenFGA server, this should help a lot with performance.

image

Alternatives and current workarounds

No response

Additional context

No response

@gurleensethi gurleensethi added the enhancement New feature or request label May 2, 2024
@rhamzeh
Copy link
Member

rhamzeh commented May 3, 2024

Hi @gurleensethi - thanks for raising this. It's already on our Roadmap: https://github.com/orgs/openfga/projects/1?pane=issue&itemId=28481432

The SDKs will switch the underlying method being used once it is ready on the server

@aaguiarz
Copy link
Member

aaguiarz commented May 3, 2024

Hi @gurleensethi

Can you expand on the use case for requesting 300 relations?

If you prefer to discuss in a quick call you can reach out to me at andres.aguiar @ openfga.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants