Executive Summary: Migrating Cache-Dependent Systems to a Resilient Databricks Architecture
The Core Business Problem: Systemic Failure Amplification
- The Load-Transfer Threat: A Redis cache outage is not just a latency issue; it is a load-transfer event. Demand normally absorbed by the cache shifts to primary databases (PostgreSQL/InfluxDB) that are not sized for cache-level read traffic.
- Cascading Outages: Naive read fallbacks consume database connections, memory, and CPU, effectively blocking critical, authoritative writes and triggering systemic retry storms.
- On-Premises Limitations: Scaling fixed on-premises infrastructure (adding read replicas or expanding memory) merely delays saturation and increases costs without solving the underlying problem of inefficient, synchronized analytical demand.
Strategic Objective & Target Architecture
- Fallback as an Emergency Capability: The migration abandons the unrealistic promise of "full feature continuity" during an outage. Instead, fallback is treated as a scarce, heavily governed emergency capability.
-
Separation of Planes:
- Operational Plane: Spring Boot, Vue, Kafka, and PostgreSQL remain strictly for transactional workflows, API routing, and authoritative writes.
- Intelligence Plane: Databricks assumes all heavy analytical processing, utilizing Delta Lake and Lakeflow pipelines to incrementally build "Gold" data products, keeping expensive queries away from operational databases.
- Governed Redis Tier: Redis no longer caches ad hoc database queries. It exclusively serves certified, materialized Gold outputs published directly from Databricks.
Key Resilience & Degradation Mechanisms
-
Endpoint Classification (The Availability Contract):
- Critical: Receive reserved, strictly bounded fallback capacity (e.g., active containment state).
- Important: Serve bounded stale data safely to maintain visibility (e.g., dashboard trends).
- Deferrable: Fail fast with explicit unavailability (e.g., large historical exports).
- Stale-While-Revalidate: A local in-memory cache (Caffeine) preserves the last-known-good response to survive brief outages. Vue transparently displays data freshness (e.g., "Data as of 5 mins ago") instead of hiding the outage.
- Bounded Concurrency & Bulkheads: Strict semaphore limits isolate fallback read pools from PostgreSQL write pools, guaranteeing that a read storm can never starve authoritative transaction writes.
- Single-Flight Coordination: If a cache key is missing, only one request executes the Databricks SQL fallback query, while concurrent requests wait briefly for the shared result, preventing database stampedes.
- Circuit Breakers (Resilience4j): Fast failure detection isolates failing dependencies (Redis, Databricks SQL) immediately to prevent thread exhaustion.
- Controlled Cache Rewarming: Recovery is staged by product priority. Redis is repopulated carefully to avoid hitting the database with a "cold-cache" traffic spike upon restart.
Migration Execution & Operations
- Medallion Architecture: Kafka events, InfluxDB history, and PostgreSQL change data capture (CDC) flow through Bronze (raw evidence), Silver (conformed semantics), and Gold (consumption-ready aggregates) tables.
- Data Quality as an Availability Gate: Fast but incorrect data is worse than unavailable data. Strict quality checks prevent malformed or incomplete data from being published to Redis.
- Chaos Testing & Validation: The architecture's success is validated not just by average latency, but by its ability to withstand simulated Redis failures, synchronized key expirations, and Kafka lag without dropping a single authoritative database write.
- Strategic Outcome: Databricks becomes the governed resilience layer that fully decouples heavy data intelligence from transactional survival, allowing the enterprise to degrade safely during infrastructure crises.
Top comments (0)