Technical Decision Record (TDR) — Template
Title: [Short decision name]
Date: [YYYY-MM-DD]
Status: [Proposed / Approved / Rejected]
Authors: [Name(s)]
Context & Problem Statement:
- Brief context (business, system) and the specific problem to solve.
Decision:
- Chosen option (concise).
Alternatives Considered:
- Alt A: short description
- Alt B: short description
Evaluation Criteria:
- Performance (latency, throughput)
- Cost (infra, licensing, ops)
- Team skill / ramp-up
- Operational complexity (monitoring, debugging)
- Ecosystem & integration (connectors, SQL support)
- Reliability & fault tolerance
Decision Rationale:
- Mapping of alternatives to criteria; highlight trade-offs and measurable reasons.
Migration Plan:
- Phases (pilot, parallel-run, cutover), migration steps, data validation, timeline, responsible owners.
Rollback Plan:
- Conditions that trigger rollback, rollback steps, data reconciliation approach, estimated RTO/RPO.
Impacted Stakeholders:
- Teams, SLAs, downstream consumers, compliance, DBAs, SRE.
Open Questions & Risks:
- List unknowns and mitigations.
References:
- Links to benchmarks, docs, runbooks.
Filled Example — Spark vs Flink for Batch + Streaming ETL
Title: Choose ETL runtime for Unified Pipelines (Spark vs Flink)
Date: 2025-11-01
Status: Approved
Authors: Data Platform Team
Context & Problem Statement:
We need a single runtime to support nightly batch jobs (TB-scale) and low-latency streaming joins for enrichment (<5s) for analytics and ML features. Current stack is ad-hoc; goal: reduce maintenance, improve SLA, and enable feature engineering.
Decision:
Adopt Apache Spark Structured Streaming as primary runtime; introduce Flink for a narrow set of low-latency stateful streaming needs where Spark cannot meet latency requirements.
Alternatives Considered:
- Spark only (Structured Streaming + batch)
- Flink only (batch via Flink or Beam)
- Hybrid: Spark primary + Flink for strict low-latency
Evaluation Criteria & Summary:
- Performance: Spark excels at batch throughput and micro-batch streaming; Flink has lower end-to-end latency and better event-time state handling. → Tie, Flink wins for sub-second to few-second latency.
- Cost: Spark better utilizes EMR/Dataproc/YARN autoscaling for batch; Flink needs more always-on resources for low-latency stateful jobs. → Spark wins.
- Team skill: Team has 70% Spark experience, 10% Flink. Ramp cost for Flink significant. → Spark wins.
- Operational complexity: Flink operationally heavier (job manager, state backend tuning). → Spark wins.
- Ecosystem: Spark has broader connectors and SQL/ML integration. → Spark wins.
Decision Rationale:
Because majority workload is large-scale batch and micro-batch streaming, and team skill/cost favor Spark, choose Spark as primary. Reserve Flink for <5s stateful streaming/complex event processing where Spark cannot meet latency or exactly-once semantics. This hybrid minimizes cost and risk while enabling required latency where necessary.
Migration Plan:
- Pilot (2 weeks): Replatform 3 representative batch jobs to Structured Streaming/batch on Spark; validate outputs.
- Parallel-run (4 weeks): Run Spark pipelines in parallel with legacy. Add validation checks and row-level diffs.
- Low-latency area: Implement one Flink job for strict latency use-case, run alongside Spark enrichment as fallback.
- Cutover: Switch consumers once parity and monitoring are green. Owners: Platform Eng (migration), Data Owners (validation).
Rollback Plan:
- If data drift or SLA regressions > threshold (e.g., 1% bad rows or 30% latency increase), revert consumers to legacy pipelines or run Spark job in legacy mode.
- Keep previous cluster snapshots and use CDC/state checkpoints to replay events. Estimated RTO: 2 hours for batch; 15 min for streaming fallback.
Impacted Stakeholders:
- Data Platform, Analytics, ML Feature Teams, SRE, Compliance, Product owners.
Risks & Mitigations:
- Risk: Unexpected latency regressions — mitigation: keep Flink fallback and detailed SLIs.
- Risk: Skill gap — mitigation: training, pair-programming, hire 1 senior Flink engineer.
References:
- Internal benchmark results (link), Spark Structured Streaming guide, Flink stateful processing docs.