Optimize rights lookup in list requests #3304
Labels
c/identity server
This is related to the Identity Server
in progress
We're working on it
performance
Something is slow or takes too much CPU/Memory/...
Milestone
Summary
We should optimize the rights lookup in list requests to reduce the number of DB roundtrips.
See also https://github.com/TheThingsIndustries/lorawan-stack/issues/1393#issuecomment-683651932
What is already there? What do you see now?
The current implementation checks the rights of the caller for each result in a list request, to make sure we don't return fields the caller doesn't have access to. If uncached, each of these rights checks results in a database roundtrip.
What is missing? What do you want to see?
Instead, we should investigate if we can query the rights for the entire page in a single DB roundtrip.
Environment
v3.9
How do you propose to implement this?
rights.BulkFetcher
interface that is implemented by the IS's DB fetcherrights.Preload(ctx context.Context, ids ...ttnpb.Identifiers) error
How do you propose to test this?
Use tracing to (no longer) see the many queries.
The text was updated successfully, but these errors were encountered: