pepegar
07/08/2024, 8:21 AMvroldanbet
07/08/2024, 9:08 AM--datastore-conn-pool-write-max-lifetime-jitter
and --datastore-conn-pool-read-max-lifetime-jitter
, as otherwise all connections expire at the same time. You want to enable connection balancing for cockroach (--datastore-connection-balancing
) as well. If you don't care about the new enemy problem much, you should enable --datastore-tx-overlap-strategy=insecure
for cockroach.
I assume you are running SpiceDB in cluster mode (dispatching enabled) at that there is enough compute to support the amount of dispatch fanout you app is likely generating. I'd typically take a overall look at metrics looking for smoking guns, make sure there is enough compute, cache hit ratios, types of requests (avoid full consistency as much as possible). You want to make sure you do cursored LookupResources
, use at_least_as_fresh
or minimize_latency
consistency levels as much as possible, look into tuning staleness parameters (--datastore-revision-quantization-max-staleness-percent
and --datastore-revision-quantization-interval
), and look into concurrency limits (which would cap you clusters ability to fan out dispatches). Definitely also give --enable-experimental-watchable-schema-cache
a go since it will likely reduce the amount of queries necessary per API call.pepegar
07/08/2024, 9:33 AMpepegar
07/08/2024, 9:38 AMpepegar
07/08/2024, 9:47 AMvroldanbet
07/08/2024, 10:06 AMtx-overlap-strategy
is insecure
(that's why I said only use if you don't care about the new enemy problem). Cockroach transactions are not externally consistent - only for data within the same range. For that reason transaction overlap was introduced only with the cockroach datastore, to enforce transactions are externally consistent, which comes with a performance
penalty during writes.
I recommend you read https://github.com/authzed/spicedb/blob/5ed2d0f28b42da82fad93601fec49c41a2d03a0e/internal/datastore/crdb/README.md to determine which strategy makes sense for your workload.
Please note this is mostly relevant for writes not so much for readspepegar
07/08/2024, 11:02 AM