https://authzed.com logo
#spicedb
Title
# spicedb
k

krtkvrm

10/12/2021, 6:49 PM
We tried spicedb locally with postgres 13, and have some questions 1. When we tried to run the [code](https://github.com/rsbh/authz-spicedb) against the spiceDB, we in the logs that we are actively querying the database:
Copy code
4:07PM INF Query args=[] module=pgx pid=232 rowCount=1 sql="SELECT NOW()"
4:07PM INF Query args=["2021-10-12T10:37:24.672923Z"] module=pgx pid=232 rowCount=1 sql="SELECT MIN(id), MAX(id) FROM relation_tuple_transaction WHERE timestamp >= $1"
4:07PM INF Query args=[] module=pgx pid=232 rowCount=1 sql="SELECT MAX(id) FROM relation_tuple_transaction"
4:07PM INF finished server unary call grpc.code=OK grpc.method=CheckPermission grpc.method_type=unary grpc.service=authzed.api.v1.PermissionsService grpc.start_time=2021-10-12T16:07:29+05:30 grpc.time_ms=9.295 kind=server system=grpc
and when we stopped the db, the queries failed. Is there any mode in which we just cache the whole relationship graph in spicedb memory so we dont query pg for reads? something like sync the db whenever there is a write or periodically say every 1 mins Our startup command
Copy code
$ spicedb serve --grpc-preshared-key "shield" --grpc-no-tls --datastore-engine postgres --datastore-conn-uri "postgres://shield_dev:@0.0.0.0:5432/shield_dev?sslmode=disable"
2. Do we need to run migrations for fresh db only.. right?
Copy code
$ spicedb migrate HEAD --datastore-engine postgres --datastore-conn-uri "postgres://shield_dev:@0.0.0.0:5432/shield_dev?sslmode=disable"
3. Is there any approach to make it HA? One approach can be to use consul to balance load between multiple spicedb (as its grpc), but if we go with in-memory along with PG (if its possible from question 1), is there a way to sync the updates on all the spicedb instances/pods once there is a write or they could just periodically sync it