Resend Migrates Its Email API to Go, Cutting Median Latency by Half
Brief
Resend rebuilt its email API in Go while preserving the behavior existing integrations relied on. The company says the migration improved resource use and median latency, though production rollout still required capacity and connection-pool tuning.
Migration and compatibility
- The work took seven weeks and roughly 140 pull requests; by October, Go handled all email API traffic.
- A test harness sent the same requests to the Node.js and Go services and compared responses, errors, database rows, S3 objects, idempotency, and rate limits.
- For HTML-to-text conversion, a Go port matched all 60 fixtures generated from the Node implementation.
Results from the 50% rollout
- Both services ran on the same task size; Go used about 62% less CPU per request.
- Median POST /emails latency fell from 58 ms to 31 ms; p95 fell from 149 ms to 107 ms, and p99 from 498 ms to 420 ms.
- Memory per task fell from about 1.3 GB to 180 MB.
Operational adjustments
- During rollout, Resend doubled task sizes twice and added capacity ahead of recurring top-of-hour traffic spikes.
- The team introduced per-request timeouts for S3 uploads and tuned Redis connection pools as traffic increased.
- Resend notes that much of the slow tail comes from waiting on S3 and the database, limiting how much API-service improvements can reduce tail latency.
Generated by AI from the original article. Check the source for full details.