Since 2023, Mercari has been gradually migrating our content delivery network (CDN) provider from Fastly to Cloudflare. We have completed the traffic migration for almost all existing services, and all new services are now using Cloudflare.
In this article, I will focus on the migration process itself, not on comparing CDN providers, while explaining the approach we took to ensure a smooth migration. I will also introduce our internal "CDN as a Service" model, which is the ultimate goal of our CDN efforts.
At Mercari, our network team has managed hundreds of Fastly services across both development and production environments. Our team also maintains Cloud Networking like a GCP Virtual Private Cloud (VPC) and Data Center Networking. We needed to find a way to conduct the migration smoothly within given time constraints.
Though both Fastly and Cloudflare are CDN providers, they do not behave in exactly the same way. For example: Fastly separates cache respecting the origin’s Vary header, but Cloudflare currently only supports this for images. We needed to investigate which features were being used in Fastly and how to implement them in Cloudflare.