sp132
09/16/2025, 7:13 AM--dispatch-cache-num-counters flag (which I'm setting with SPICEDB_DISPATCH_CACHE_NUM_COUNTERS env var). In my testing it doesn't have any effect at all - whether it's 1 or 1000000.
I've prepopulated the database with 10000 users and 10000 grants (1 to 1 relation) and running a following scenario on them:
yaml
{{- range $j := enumerate 2000 }}
---
name: "min latency check"
weight: 80
steps:
- op: CheckPermission
resource: core/geohash_grant:{{ $j }}
permission: view
subject: core/user:{{ $j }}
consistency: MinimizeLatency
expectNoPermission: false
---
name: "fully consistent check"
weight: 20
steps:
- op: CheckPermission
resource: core/geohash_grant:{{ $j }}
permission: view
subject: core/user:{{ $j }}
consistency: FullyConsistent
expectNoPermission: false
{{- end }}
On a screenshot there are couple of annotations:
- a first one is where I set SPICEDB_DISPATCH_CACHE_NUM_COUNTERS to 1
- a second one is where i set SPICEDB_DISPATCH_CACHE_NUM_COUNTERS to 1000000
- a third one with improvement is change to datastore quantization interval from 5s to 15s
- a fourth one where I've removed fully consistent check from the Thumper script
- a fifth one - quantization interval is set to the default value of 5s again
LFU cache metrics (second screenshot) show a much higher hitrate (although SPICEDB_DISPATCH_CACHE_NUM_COUNTERS doesn't seem to have an effect on it either).
Can someone explain what SPICEDB_DISPATCH_CACHE_NUM_COUNTERS is suppose to be doing please?
https://cdn.discordapp.com/attachments/844600078948630559/1417407970375110686/image.png?ex=68ca5f8a&is=68c90e0a&hm=8e317f384c0b67d17f398af6a1d8c87b1212b731e882fa02cfa2dc7ba5ba9b31&
https://cdn.discordapp.com/attachments/844600078948630559/1417407970945273856/image.png?ex=68ca5f8a&is=68c90e0a&hm=00c8718de1b94354e10492461e08413b1bd174a7bae0f94a278e407a5d73de58&yetitwo
09/16/2025, 1:47 PMyetitwo
09/16/2025, 1:49 PMristretto cache implementation. i'm currently trying to figure out which cache we use by default.sp132
09/17/2025, 6:34 AMristretto and LFU cache in general and it's just surprising to me that these parameters don't seem to have any effect.
Regardless of num-counters added and evicted keys remained roughly the same over the course of the load test.
https://cdn.discordapp.com/attachments/1417407971188805773/1417760662456631337/image.png?ex=68cba802&is=68ca5682&hm=a84cad34deac9a0c9172543b3c58585538628e7f1c0d6317ef77102b08a7a325&sp132
09/17/2025, 6:40 AMspicedb_dispatch_client_check_from_cache_total drops drastically.