Skip to content

A URL shortener at 30k req/s on a 6-core homelab

See the project

This series is about getting a URL shortener to 30k req/s on a 6-core i7-8700, the same box that runs the rest of my Kubernetes homelab.

I thought that would be easy. It wasn’t, and the bottlenecks were almost never in the code. They were CPU limits, a hypervisor promising more CPU than it had, and a proxy I had never thought to question.

Along the way:

  1. My first deploy to the cluster collapsed to ~180 successful req/s
  2. The metrics pointed at Redis, but the problem was somewhere else
  3. Dropping a standard piece of Kubernetes networking got me to ~30k req/s

This section is personal. Skip to Part 1: It works on my machine if you’re here for the technical content.

30k requests per second isn’t much by big-tech standards. It’s a lot to me: I’ve never worked on a system that needed that scale, and I can count on one hand the people I know who have.

Most of this was new to me. I had little exposure to Go (I’m mostly a DevOps guy who also uses Python, and yes, I dislike calling DevOps a role), had never used k6 and had never built a Grafana dashboard. I run Kubernetes at home because I like it and want to keep learning it, not because a URL shortener needs it.

AI could have done most of this for me, but then I wouldn’t have learnt much. So I did everything new and hard by hand first, until I understood it, and only then used AI to polish what was there (where it’s a fantastic productivity boost).

Going back to docs, man pages and Stack Overflow was slow, but so is learning. It was the most fun I’ve had coding in a while.