How nammayatri/shudhi works
Shudhi is a Go sidecar for discovering, inspecting, and invalidating in-memory cache entries across service pods. The main workflow is: a sidecar identifies its app and registers in Redis; an operator uses the dashboard to browse registered keys and request a value or fleet-wide clear; sidecars route reads to a target pod and deliver clears to each pod, which calls its local app. Redis provides discovery, request/response messaging, key metadata, and a durable per-service refresh log. Dashboard internals and some HTTP handlers are unsampled, so those links rely on README statements.
Main entry points: nginx.conf Dashboard proxy · handlers.go Key browsing · main.go HTTP server · pubsub.go Pod request relay
Components 19
Dashboard
- Cache dashboard
dashboard/index.html - Dashboard proxy
dashboard/nginx.conf
Sidecar API
- Service discovery
handlers.go - Pod discovery
handlers.go - Key browsing
handlers.go - Key registration
handlers.go - Value inspection
handlers.go - Clear orchestration
handlers.go
Coordination
- Redis coordination
- Pod request relay
pubsub.go - Durable clear log
pubsub.go - Local clear worker
pubsub.go
Sidecar runtime
- HTTP server
main.go - Configuration
config.go - App connection
config.go - Pod registration
lifecycle.go
Other components
- Operator
- Service apps
- Peer sidecars
Connections 29
- Operator → Cache dashboard: uses
README.md - Cache dashboard → Dashboard proxy: sends requests
README.md - Dashboard proxy → Service discovery: proxies API
README.md - Dashboard proxy → Pod discovery: proxies API
README.md - Dashboard proxy → Key browsing: proxies API
README.md - Dashboard proxy → Value inspection: proxies API
README.md - Dashboard proxy → Clear orchestration: proxies API
README.md - HTTP server → Configuration: loads
main.go - HTTP server → App connection: starts connection
main.go - HTTP server → Service discovery: serves routes
main.go - App connection → Service apps: fetches identity
config.go - App connection → Pod registration: registers pod
config.go - Pod registration → Redis coordination: writes presence
lifecycle.go - Service discovery → Redis coordination: scans registry
handlers.go - Pod discovery → Redis coordination: reads pod records
handlers.go - Key registration → Redis coordination: stores key metadata
handlers.go - Key browsing → Redis coordination: aggregates keys
handlers.go - Key browsing → Peer sidecars: proxies pod query
handlers.go - Key browsing → Service apps: queries local keys
handlers.go - Value inspection → Peer sidecars: routes pod read
handlers.go - Peer sidecars → Pod request relay: relays if needed
README.md - Pod request relay → Redis coordination: publishes requests
pubsub.go - Pod request relay → Service apps: requests cached value
pubsub.go - Clear orchestration → Durable clear log: appends clear
README.md - Clear orchestration → Peer sidecars: broadcasts clear
README.md - Durable clear log → Redis coordination: stores stream and cursors
pubsub.go - Local clear worker → Durable clear log: reads per-pod entries
pubsub.go - Local clear worker → Service apps: calls refresh endpoint
pubsub.go - Clear orchestration → Redis coordination: updates key registry
handlers.go