Redis
Redis 7 serves as the platform's caching layer, session store, pub/sub messaging system, and rate limiting backend. It is one of the most widely used infrastructure components, with 16 services depending on it for low-latency data access and real-time communication.
Role in the Platform
| Aspect | Details |
|---|---|
| Version | 7 |
| Deployment | Kubernetes StatefulSet via Helm |
| Services using it | 16 services |
| Multi-tenancy | Tenant-prefixed key namespacing |
Use Cases
| Use Case | Pattern | Key Format |
|---|---|---|
| Query result caching | Read-through cache | {tenant_id}:query:{hash} |
| Session storage | Key-value with TTL | {tenant_id}:session:{session_id} |
| Configuration broadcast | Pub/Sub | Channel: config:changes |
| AI response streaming | Pub/Sub | Channel: ai:stream:{session_id} |
| Rate limiting | Sliding window counter | ratelimit:{tenant_id}:{window} |
| Dashboard refresh | Pub/Sub | Channel: dashboard:refresh:{id} |
| Token blacklist | Set with TTL | blacklist:{jti} |
Tenant-Aware Cache Manager
The TenantAwareCacheManager in commons-java ensures all cache keys include the tenant prefix:
public class TenantAwareCacheManager {
private String buildKey(String key) {
String tenantId = TenantContext.getCurrentTenantIdOrDefault("system");
return tenantId + ":" + key;
}
}This prevents cross-tenant cache pollution, as keys from different tenants can never collide.
Pub/Sub Channels
| Channel Pattern | Publisher | Subscriber | Purpose |
|---|---|---|---|
config:changes | Config Service | All services | Zero-downtime config updates |
ai:stream:{sessionId} | AI Service | WebSocket bridge | Streaming AI response tokens |
dashboard:refresh:{id} | BI Service | Frontend WebSocket | Live dashboard data updates |
health:status:{namespace} | All services | Observability API | Real-time health status |
Configuration
| Parameter | Development | Production |
|---|---|---|
| Max memory | 256Mi | 2Gi |
| Eviction policy | allkeys-lru | allkeys-lru |
| Persistence | Disabled | AOF with 1-second fsync |
| Replicas | 1 | 3 (1 primary + 2 replicas) |
Related Pages
- PostgreSQL -- Primary relational database
- Kafka -- Durable event streaming
- Event-Driven Architecture -- Redis Pub/Sub patterns