ADR-00015 — Node vs Go: Migration Pipeline Runtime
- Status: Approved / Implemented
- Date: 2026-09-27
- Authors: Engineering Team
Context
tenant-migration and tenant-migration-orchestrator are built on Node/NestJS, even though Go is this platform’s default backend runtime per ADR-00011. This ADR states why, traceable to SR-007’s FR-03.
This decision is not “Node outperforms Go” — ADR-00011 already establishes Go as the stronger general-purpose default for exactly the memory/cold-start reasons BRD-007 cares about. This ADR instead rests on workload-shape fit — the migration pipeline’s dominant cost is waiting on many concurrent I/O operations (reading CSV rows, calling per-record target-service APIs, publishing per-record Pub/Sub messages), not CPU-bound aggregation — plus a fact specific to this codebase’s history, stated plainly rather than glossed over: these two services predate any Go migration template and are themselves the working source pattern @templates/node-mongo-microservice/ was built from.
Decision Drivers
- Non-blocking I/O fit for a bulk verify→execute→publish and consume→dispatch pipeline — a workload dominated by concurrent waits on downstream calls, not CPU-bound work.
- NestJS’s module system fit for pipeline orchestration — a fixed sequence of stages (verify, execute, per-record publish; consume, dispatch) maps cleanly onto NestJS’s module/provider structure.
- Avoiding the cost of discarding a working, already-instrumented implementation for no workload-shape benefit — a legitimate driver distinct from, and in addition to, the two above.
Options Evaluated
Option 1 — Node/NestJS (CHOSEN)
- The event loop’s non-blocking I/O model is a good fit for a pipeline whose per-record work is mostly “wait for a downstream call to return,” letting many records progress concurrently without one goroutine-equivalent per record — a different concurrency shape than Go’s, suited to this specific workload rather than to CPU-bound aggregation.
tenant-migration/tenant-migration-orchestratorare the real, running implementation this pipeline has had since before@templates/node-mongo-microservice/existed — they are the template’s source pattern, not an instance scaffolded from it (see the platform’s layered architecture standard’s Template Selection Matrix note).- Cons & Accepted Trade-offs:
node-lang-core-libis genuinely behindgo-lang-core-libin parity (no TypeScript types, inconsistent typed-error coverage, no server-side request-duration metric — see the platform’s cross-cutting principles’ “Node’s known gaps”) — an accepted cost given this pipeline’s smaller footprint (two services plus one Cloud Function runtime) relative to Go’s nine.- Node’s per-instance baseline memory and cold-start behavior is not as favorable as Go’s (per ADR-00011) — accepted because this pipeline is not the autoscale-under-spike workload BRD-007’s BR-02 is primarily concerned with; it runs on a bulk, scheduled/triggered cadence rather than absorbing unpredictable customer-facing traffic bursts.
Option 2 — Go
- Pros: Consistency with the platform’s default runtime; stronger startup/memory characteristics per ADR-00011; a Go Pub/Sub publisher pattern already exists (
product-catalog’sinternal/message_publisher/recent_view_event_publisher.go) that a rewritten pipeline could follow. - Cons (Why Rejected):
- Rewriting
tenant-migration/tenant-migration-orchestratorin Go would discard a working, already-instrumented pipeline — including its verify/execute/publish sequencing, its Pub/Sub envelope handling, and its accumulated bug fixes — for a workload-shape benefit that doesn’t clearly exist here, since the pipeline’s bottleneck is downstream-call latency, not the runtime’s own CPU/memory efficiency. - Go’s goroutine-per-concurrent-operation model is not a worse fit than Node’s event loop for this workload in principle, but there is no concrete, identified problem with the current Node implementation that a Go rewrite would fix — see the platform’s own no-over-engineering principle (avoid a change made for hypothetical rather than demonstrated benefit).
- Rewriting
Final Decision
Option 1 (Node/NestJS) is selected, unchanged from the existing implementation. The decision rests on non-blocking I/O being a reasonable fit for a downstream-call-bound pipeline, NestJS’s module structure suiting a staged pipeline’s shape, and — stated plainly — the fact that rewriting an already-working, already-instrumented pipeline in Go has no identified workload-shape benefit to justify discarding it.