Multi-region backends with Go and Node.js services
Multi-region backends with Go and Node.js services
Multi-region is not a deployment checkbox. It is a set of decisions about where data lives and which failures you are willing to accept.
Start with the latency budget
Write down the acceptable p99 for each request, then work backwards. A cross-region call costs more than most code optimisations will save. Keep synchronous reads local and replicate asynchronously.
Data locality
Choose an owner region per entity. Other regions can serve cached reads, but writes route to the owner. This is far simpler than trying to make every region writable and then resolving conflicts.
Health checks in both runtimes
r.GET("/health", func(c *gin.Context) {
if err := db.Ping(c.Request.Context()); err != nil {
c.JSON(503, gin.H{"status": "degraded"}); return
}
c.JSON(200, gin.H{"status": "ok"})
})
app.get('/health', async (req, res) => {
try { await db.query('SELECT 1'); res.json({ status: 'ok' }) }
catch { res.status(503).json({ status: 'degraded' }) }
})
A health check that only says the process is alive is not useful. Check the dependencies that matter to the request path.
Operational notes
- Keep configuration identical across regions and differ only in region-specific values.
- Practice failover. A plan that has never been executed is a document, not a capability.
- Watch replication lag as a first-class metric.
Key takeaways
Multi-region works when ownership is explicit, synchronous calls stay local and failure is rehearsed. The runtime of a service matters far less than these decisions.