---
title: "Migrating our Email API to Go"
description: "Resend migrated its email API from a Node.js service to Go over seven weeks and roughly 140 pull requests. The existing Node service suffered from failure modes where CPU-heavy request parsing and serialization blocked the event loop during bursts, and S3 timeouts surfaced as customer-facing errors. The new Go service was built to match the old API’s behavior exactly, using a test harness that compared responses, errors, database state, S3 objects, idempotency, and rate limits between the two implementations. During a 50% rollout, Go showed roughly half the median latency and about one-seventh the memory usage per task compared to Node, with 62% less CPU per request. The team also had to tune capacity, timeouts, and connection pools during the rollout, as lower average resource consumption did not predict burst requirements."
---

# Migrating our Email API to Go

[Resend](https://yomu.fyi/company/resend) · Derich Pacheco, Fabio Kubo, Bu Kinoshita, and Felipe Volpone · Nov 12, 2026

**Type:** Problem & solution

## Summary

Resend migrated its email API from a Node.js service to Go over seven weeks and roughly 140 pull requests. The existing Node service suffered from failure modes where CPU-heavy request parsing and serialization blocked the event loop during bursts, and S3 timeouts surfaced as customer-facing errors. The new Go service was built to match the old API’s behavior exactly, using a test harness that compared responses, errors, database state, S3 objects, idempotency, and rate limits between the two implementations. During a 50% rollout, Go showed roughly half the median latency and about one-seventh the memory usage per task compared to Node, with 62% less CPU per request. The team also had to tune capacity, timeouts, and connection pools during the rollout, as lower average resource consumption did not predict burst requirements.

## Context

The existing Node.js email API had failure modes: during bursts of large requests, CPU-heavy parsing and serialization blocked the event loop, making the whole task unresponsive. S3 timeouts also surfaced as customer-facing 408 and 524 errors. The team needed more predictable behavior under load, lower resource usage, and better control over operation timeouts.

## Approach / What changed

The team built a new Go service over seven weeks, matching the old API’s behavior using a test harness that sent the same requests to both Node and Go and compared responses, errors, database rows, S3 objects, idempotency, and rate limits. They also ported the specific HTML-to-text conversion behavior to match exactly. The rollout was gradual, with capacity tuning, per-request S3 timeouts, and Redis connection pool adjustments.

## Takeaways

- The Go service used about 62% less CPU per request and showed roughly half the median latency and one-seventh the memory per task compared to the Node service during a 50% rollout.
- To ensure backward compatibility, the team built a test harness that compared not just HTTP responses but also database state, S3 objects, idempotency behavior, and rate limits between the old and new implementations.
- Lower average resource consumption did not predict burst capacity; the team had to double task sizes twice during the rollout and tune timeouts and connection pools based on production evidence.

## FAQ

### Why did you migrate from Node to Go?

The Node service had failure modes where CPU-heavy request parsing and serialization blocked the event loop during bursts, and S3 timeouts caused customer-facing errors. The migration aimed for more predictable behavior under load, lower resource usage, and better timeout control.

### How did you ensure the new API behaved identically to the old one?

They built a test harness that sent the same requests to both Node and Go and compared responses, errors, database rows, S3 objects, idempotency, and rate limits. They also ported the specific HTML-to-text conversion behavior to match exactly.

### What performance improvements did you see?

During a 50% rollout, Go showed roughly half the median latency (58 ms to 31 ms), about one-seventh the memory per task (1.3 GB to 180 MB), and 62% less CPU per request compared to Node.

**Tags:** [API](https://yomu.fyi/topic/api), [Email](https://yomu.fyi/topic/email), [Go](https://yomu.fyi/topic/go), [Migrations](https://yomu.fyi/topic/migration), [Performance](https://yomu.fyi/topic/performance)

- Source: [Resend](https://resend.com/blog/migrating-our-email-api-to-go)
- Source URL: https://resend.com/blog/migrating-our-email-api-to-go
- Ingested by Yomu: 2026-11-13T06:00:17.547Z

[Read original post](https://resend.com/blog/migrating-our-email-api-to-go)
