← Back to blog

Migrating to Cloudflare Workers

When we launched PixServe in September 2019, we ran everything on a single VPS in US-East. It was simple and it worked — for a while. But as traffic grew and users showed up from Europe, Asia, and South America, the latency numbers told a clear story: a single origin server wasn't going to cut it.

We evaluated several options: multi-region deployment with load balancing, a traditional CDN in front of our origin, and Cloudflare Workers. Workers won for a few reasons. There are no cold starts, the runtime is V8-based (so our existing JavaScript code ported cleanly), and Cloudflare's network spans over 300 cities worldwide. Every request is handled at the edge location closest to the user.

The migration took about six weeks. The trickiest part was moving our URL routing and access control logic into the Workers runtime while maintaining backward compatibility with every existing image URL. We used Workers KV for metadata lookups and R2 for object storage, which gave us a fully serverless stack with no origin server to maintain.

The results were immediate. Our p50 image delivery latency dropped from 180ms to 12ms. Bandwidth costs fell by 60% thanks to more efficient caching at the edge. And we no longer worry about scaling — Workers handles traffic spikes automatically. It's been the single best infrastructure decision we've made.