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

chore: update info regarding cache controller #941

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

adriantam
Copy link
Member

@adriantam adriantam commented Jan 22, 2025

Description

Updating how cache controller affects consistency. Should not be merged in until OpenFGA v1.8.5 is released.

References

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

Testing

Screenshot 2025-01-22 at 3 13 01 PM
Screenshot 2025-01-22 at 3 13 08 PM

@adriantam adriantam requested a review from a team as a code owner January 22, 2025 20:15
Copy link
Contributor

github-actions bot commented Jan 22, 2025

PR Preview Action v1.4.8
🚀 Deployed preview to https://openfga.github.io/openfga.dev/pr-preview/pr-941/
on branch gh-pages at 2025-01-29 16:40 UTC

| check-iterator-cache-enabled | Enables in-memory caching of database iterators. Each iterator is the result of a database query, for example, usersets related to a specific object, or objects related to a specific user, up to a certain number of tuples per iterator |
| check-iterator-cache-max-results | Configures the number of tuples that will be stored for each database iterator |
| check-iterator-cache-ttl | Specifies the time that items will be kept in the cache of database iterators |
| cache-controller-enabled | When enabled, cache controller will verify whether check subproblem cache and check iterator cache needs to be invalidated when there is a check or list objects API request. The invalidation determination is based on whether there are recent write or deletes for the store. This feature allows a larger check-query-cache-ttl and check-iterator-cache-ttl.|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The invalidation determination is based on whether there are recent write or deletes for the store.
Just if there is recent writes/deletes? Is it not also looking at if the recent writes/deletes are related to the check/LO request?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature allows a larger check-query-cache-ttl and check-iterator-cache-ttl.

at the expense of...?

Thinking of it from a user perspective, it's not clear why this feature is not ON by default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it not also looking at if the recent writes/deletes are related to the check/LO request

Partially - if there are many recent changes, it will invalidate all subproblem cache and iterator cache. If there are only a few recent changes, it will invalidate subproblem cache and only the iterator cache associated with the recent changes.

I am a bit hesitant to add this distinction here to avoid confusing the reader.

Copy link
Member Author

@adriantam adriantam Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at the expense of

at the expense of additional datastore queries for recent writes and deletes.

| check-iterator-cache-max-results | Configures the number of tuples that will be stored for each database iterator |
| check-iterator-cache-ttl | Specifies the time that items will be kept in the cache of database iterators |
| cache-controller-enabled | When enabled, cache controller will verify whether check subproblem cache and check iterator cache needs to be invalidated when there is a check or list objects API request. The invalidation determination is based on whether there are recent write or deletes for the store. This feature allows a larger check-query-cache-ttl and check-iterator-cache-ttl.|
| cache-controller-ttl | Specifies the time that cache controller result is cached. While cache controller result is cached, server will not read datastore to check whether subproblem cache and iterator cache needs to be invalidated. |
Copy link
Contributor

@tylernix tylernix Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While cache controller result is cached, server will not read datastore to check whether subproblem cache and iterator cache needs to be invalidated

This contradicts the cache-controller-enabled description: "When enabled, cache controller will verify whether check subproblem cache and check iterator cache needs to be invalidated when there is a check or list objects API request."

Is this intended? Can we clarify?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If cache controller is enabled and cache controller result is cached, it will not query the datastore to verify whether invalidation is needed. If cache controller is enabled but result is not in cache, it will query the datastore to verify whether invalidation is needed.

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.

3 participants