OpenMetadata/docker/development/docker-compose.cache-off.yml
Sriharsha Chintalapani c20a29b11b cache: lineage cache, per-type metrics, invalidation registry, search-cache
Add Redis-backed lineage response cache and search response cache, both
gated by the existing CACHE_PROVIDER toggle and falling through to direct
computation when the cache is unavailable. The cache remains optional —
verified end-to-end by toggling CACHE_PROVIDER=none on a live stack and
confirming all paths continue to work (just without the L2 hit).

Coverage:
- CachedLineage wraps LineageRepository.getLineage with hybrid TTL +
  direct invalidation (60s default). Direct edits invalidate the affected
  root cache entries; transitive changes fall through to TTL.
- CachedSearchLayer wraps /api/v1/search/query with auth-aware caching
  (cache key includes principal so users with different ACLs don't share
  results). 30s default TTL.

Observability:
- /api/v1/system/cache/stats response now includes a metrics block with
  hits/misses/hitRatio/evictions/errors/writes plus read/write latency
  Timers, and a byType breakdown so coverage gaps are visible per
  entity-type and per cache-layer.

Correctness:
- New Invalidatable interface + CacheBundle registry + invalidateEntity
  helper so future cache layers plug in by implementing one method
  instead of editing multiple mutation paths.
- Edge mutations in LineageRepository.addLineage/deleteLineage invalidate
  both endpoints; entity mutations in EntityRepository.postUpdate /
  postDelete / restoreEntity invalidate the lineage rooted at the entity.
- Pub/sub handler in CacheBundle iterates registered Invalidatables so
  remote-pod evictions flow to all layers automatically.

Tooling:
- docker-compose.cache-off.yml overlay flips CACHE_PROVIDER=none for
  local A/B testing without tearing down DB/ES volumes.
- CachedSearchLayerIT exercises hit-on-second-call, distinct-query
  misses, distinct-page-size misses, and byType shape via the metrics
  endpoint. Each test gracefully no-ops when the cluster runs cache-off.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 21:44:47 -07:00

8 lines
403 B
YAML

# Override that disables the cache while leaving the rest of the stack intact.
# Used in the local A/B benchmark to flip cache off without tearing down volumes.
# Apply on TOP of base compose (NOT the redis overlay):
# docker compose -f docker-compose.yml -f docker-compose.cache-off.yml up -d --no-deps openmetadata-server
services:
openmetadata-server:
environment:
CACHE_PROVIDER: none