Migrating Node.js services to Go under real traffic
When the Node service that worked fine at launch stops keeping up.
Node.js is a good way to ship fast. Most of the services in our ad stack at Advergic started in Node, including the analytics service and the bot detection platform. Then we pointed traffic from more publisher sites at them, and they started having problems: latency spikes, memory climbing until restarts, and one slow dependency backing up everything behind it.
We moved those services to Go. Here's how I approach that kind of migration, and when I'd tell you not to do it.
First, check it's really Node's fault
A rewrite is expensive. Before starting one, I profile the service and look for the cheaper fixes: an unindexed query, a missing cache, a synchronous call on the hot path, a queue consumer with no backpressure. If one of those is the real problem, fixing it in Node takes days instead of weeks.
Go makes sense when the problem is the shape of the work: lots of concurrent requests that each fan out to several stores, CPU-heavy work like hashing or scoring on every event, or strict latency budgets where garbage collection pauses and event loop blocking keep showing up in your p99.
How I run the migration
- Start with the hottest path. Move the endpoint or consumer that takes the most traffic first, not the whole service.
- Keep the contract identical. Same API, same message formats, same database. The Go service should be a drop-in replacement.
- Run both side by side. Mirror real traffic to the Go version and compare outputs before it serves anything.
- Shift traffic gradually. A small percentage first, watching error rates and latency, with a one-line rollback.
- Watch it properly. Prometheus metrics, Grafana dashboards and OpenTelemetry traces from day one, so you can see the difference and catch regressions.
Things that bite during a Node to Go move
- Request contexts that aren't passed through, so work keeps running after the client has gone
- Goroutines started without limits, which just moves the overload somewhere else
- Subtle differences in JSON handling, number types and time zones that break consumers
- Hashing or serialization that has to match the old service byte for byte
How I can help
- Deciding whether a migration is worth it, based on profiling your actual service
- Rewriting high-traffic Node.js services or workers in Go
- Setting up shadow traffic, gradual rollout and observability for the switch
Node service struggling under load?
Email haiderzamanusafxay@gmail.com with what it does and what's going wrong. I'll tell you honestly whether Go is the answer.