💡 Idea: Query Result Cache for BLite.Server #8
mrdevrobot
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
💡 Idea: Query Result Cache for BLite.Server
Category: Performance / BLite.Server
Problem
Every query to BLite.Server — whether via REST (
POST /query,GET /documents) or gRPC (Query) — hits the storage engine unconditionally, even when the same query is repeated many times against data that hasn't changed. In read-heavy scenarios (dashboards, reporting, repeated API calls) this wastes CPU and I/O for no benefit.Proposed solution
An opt-in, collection-scoped, write-invalidated query cache backed by
IMemoryCache.Key design points:
dbId(cross-tenant isolation), physical collection name, and a SHA-256 hash of the query payload.Insert,Update,Delete, orBulkWriteon a collection immediately evicts all cached results for that collection via aCancellationChangeToken. Transaction commit also triggers invalidation.FindById(already O(1) B-Tree), queries inside an active transaction, vector search endpoints.Configuration sketch (
appsettings.json):Affected surfaces: REST BLQL endpoints, REST
GET /documents, gRPCDynamicService.Query, gRPCDocumentService.Query.Why it matters
Open questions
/metricsor admin endpoint?"QueryCache": { "ExcludeCollections": ["logs"] })?Beta Was this translation helpful? Give feedback.
All reactions