v
hi enable-experimental-watchable-schema-cache this work if we use postgresql ? As far as I understand, the .zed schema is now regularly dumped into the cache, regardless of changes. I found a mention of an experimental flag and would like to try it
v
yeah, it should work. It's not as simple as "dumped into cache", but in practical terms yes that's what happens. Give it a go and let us know if you have any feedback.
v
Can you also tell me why this data is dumped into the cache and how it is used for CheckPermissions?
v
the schema is loaded in memory and updated based on a database changestream, in postgres case, on a poll interval. If the schema changes but the cache is not updated in time for a check request, then the cache falls back to the original approach of loading schemas after the computed revision.
under normal circumstances (i.e. a schema does not change that often) you typically get pretty high schema cache usage
v
Did I understand correctly that you just explained why the enable-experimental-watchable-schema-cache flag is needed?
v
I didn't explain why it's needed - I explained how it works
it's opt in, you can keep it disabled if you want to
But it gives a nice perf improvement by avoiding some rountrips to the DB
v
Above, I tried to clarify why the diagram is being unloaded at all? How does spicedb use it when checking access?
v
what do you mean with "diagram"?
v
*schema
y
@vkololalistar0092 it uses the same caching semantics as any other data in the database
if you change the schema, you can still make an
at_exact_snapshot
call from before you wrote the schema and get a response that uses the old schema
v
the schema is being unloaded because SpiceDB does not know what data is being invalidated by changes in the database, that's why we have a revision system in place. The
enable-experimental-watchable-schema-cache
does exactly that: it listens to the database to know when a schema cache should be invalidated.
As Tanner pointed out, nothing in the API semantics changes at all.
v
thanks for the explanation 🙂
2 Views