Skip to content

Commit b0f7188

Browse files
ivanauthclaudetstirrat15
authored
docs: enhance performance guide with additional configuration options (#502)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Tanner Stirrat <tstirrat@gmail.com>
1 parent 5e7e88f commit b0f7188

2 files changed

Lines changed: 48 additions & 5 deletions

File tree

app/spicedb/getting-started/installing-zed/page.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ zed schema compile <file> [flags]
13131313
zed schema compile schema.zed 1> compiled.zed
13141314
Write to a file:
13151315
zed schema compile root.zed --out compiled.zed
1316-
1316+
13171317
```
13181318

13191319
### Options
@@ -1608,7 +1608,4 @@ zed version [flags]
16081608
--request-id string optional id to send along with SpiceDB requests for tracing
16091609
--skip-version-check if true, no version check is performed against the server
16101610
--token string token used to authenticate to SpiceDB
1611-
```
1612-
1613-
1614-
1611+
```

app/spicedb/ops/performance/page.mdx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import { Callout } from "nextra/components";
22

33
# Improving Performance
44

5+
<Callout type="info">
6+
SpiceDB's server-side configuration defaults favor correctness over raw speed. API requests,
7+
however, default to `minimize_latency` consistency for read operations, favoring cache utilization
8+
over strict freshness. The flags documented on this page allow you to further tune SpiceDB for
9+
your specific workload.
10+
</Callout>
11+
512
## By enabling cross-node communication
613

714
SpiceDB can be deployed in a clustered configuration where multiple nodes work together to serve API requests. In such a configuration, and for the CheckPermissions API, enabling a feature called **dispatch** allows nodes to break down one API request into smaller "questions" and forward those to other nodes within the cluster. This helps reduce latency and improve overall performance.
@@ -59,6 +66,24 @@ spicedb serve ...
5966

6067
The `upstream-addr` should be the DNS address of the load balancer at which _all_ SpiceDB nodes are accessible at the default dispatch port of `:50053`.
6168

69+
### Dispatch Chunk Size
70+
71+
The `--dispatch-chunk-size` flag controls the maximum number of object IDs included in a single dispatched request.
72+
This is particularly impactful for lookup operations (such as LookupResources and LookupSubjects) that need to process many objects,
73+
or checks that need to consider a "wide arrow," where SpiceDB needs to walk a relation that has many entries in
74+
order to resolve a check.
75+
76+
```sh
77+
spicedb serve \
78+
--dispatch-chunk-size=100
79+
```
80+
81+
<Callout type="info">
82+
Larger chunk sizes reduce dispatch overhead but increase memory usage per request. Start with the
83+
default (100) and increase if you observe high dispatch latency with large lookup or check
84+
operations.
85+
</Callout>
86+
6287
## By enabling Materialize
6388

6489
[Materialize] is a separate service that allows for the precomputation of permission query results.
@@ -90,3 +115,24 @@ To configure the schema cache, use the following flags:
90115
# When false: always uses JIT caching
91116
--enable-experimental-watchable-schema-cache=false
92117
```
118+
119+
## By tuning revision quantization
120+
121+
The `--datastore-revision-quantization-interval` and `--datastore-revision-quantization-max-staleness-percent` flags control how SpiceDB groups revisions for caching.
122+
Increasing these values improves cache hit rates at the cost of data freshness.
123+
124+
See the [load testing guide](/spicedb/ops/load-testing#spicedb-quantization-performance) for details on how quantization affects performance, and the [hotspot caching blog post](https://authzed.com/blog/hotspot-caching-in-google-zanzibar-and-spicedb) for a deeper explanation.
125+
126+
## By tuning connection pools
127+
128+
For PostgreSQL, CockroachDB, and MySQL datastores, connection pool sizing significantly impacts performance under load.
129+
Key flags include `--datastore-conn-pool-read-max-open`, `--datastore-conn-pool-write-max-open`, and the corresponding min and jitter settings.
130+
131+
See the [datastores reference](/spicedb/concepts/datastores) for the full list of connection pool flags and defaults, and the [best practices guide](/best-practices#tune-connections-to-datastores) for sizing recommendations.
132+
133+
## By tuning the transaction overlap strategy (CockroachDB only)
134+
135+
The `--datastore-tx-overlap-strategy` flag controls how SpiceDB handles concurrent write transactions.
136+
CockroachDB users can trade consistency guarantees for write throughput by selecting from strategies: `static` (default), `prefix`, `request`, or `insecure`.
137+
138+
See the [CockroachDB datastore documentation](/spicedb/concepts/datastores#overlap-strategy) for detailed strategy descriptions and trade-offs.

0 commit comments

Comments
 (0)