#I have another question about snap

1 messages · Page 1 of 1 (latest)

wet niche
#

snaptokens independent from the tenants, they're just timestamps that created response of writeAPI, deleteAPI, etc. So each snap token represent active state of whole data you have after the specific for eg. write operation happens.

#

creating redis readmodel should work, my approach would be:

  • Although its not dependent, store snap tokens per tenant to ease the management.

  • In your Redis read model, you could structure the data as follows:

    • Key: tenant_id:latest_snap_token
    • Value: The latest snap token for that tenant
  • Update this value whenever you receive a new snap token from a Write API or other relevant API calls for that tenant.

  • When making API calls that accept a snap token, retrieve the latest token for the relevant tenant from your Redis store.

#

Btw its worth to mention, snap token usage is not neccesary. If you don't provide the snap token it would directly query from the permission db. The snap token usage decision, depends on the expected performance.

#

Also there are other ways to improve the performance, such as structuring the infra correctly and polishing the schema (reducing complex hierarchies or attributes if possible). So lets say you set up your system and enhance the parts as much as you can, then test the permify got 30ms and its not enough for you then I would suggest to try the snap tokens.