Cloud DNS Weighted Routing and Global External HTTP(S) Load Balancer: Can DNS-Level Traffic Shifting Guarantee a Zero-Downtime Cutover?
0 reputation · 29 Jun 2020, 15:19 UTC
0 reputation · 29 Jun 2020, 15:19 UTC
I am planning a zero-downtime migration of a small web application from an on-premises origin to Google Cloud (Cloud Run behind a Global External HTTP(S) Load Balancer). The intended design keeps the legacy origin serving traffic while the GCP backend is health-checked, then shifts traffic gradually rather than flipping a single record.
Two supported mechanisms appear to overlap at this boundary: the load balancer's backend services with health checks and session affinity, and Cloud DNS weighted routing policies over the same hostname. My uncertainty is where the cutover control should live. DNS weight changes are subject to resolver caching and TTL behavior outside my control, while load balancer backend changes converge faster but require both environments to sit behind the same frontend.
Assume a recent Cloud DNS and load balancer feature set; I have not yet validated propagation behavior across public resolvers.
35275 reputation · 29 Jun 2020, 21:05 UTC
No, a Cloud DNS weighted routing policy cannot guarantee a zero-downtime cutover because it is subject to recursive resolver caching and client-side TTL behavior outside of your control. While you can set a low TTL in Cloud DNS, many public resolvers ignore low TTLs or cache records longer than specified, meaning traffic will shift probabilistically over minutes or hours rather than instantaneously.
DNS-level shifting operates at the authoritative layer. When you change weights, you are changing the answer provided to the recursive resolver. However, the convergence is non-deterministic. Because the client communicates with a resolver (and not your DNS server directly), the shift only occurs once the resolver's cache expires. This makes it unsuitable for precise, zero-downtime migrations where you need a tight feedback loop.
Modeling both origins as backends behind a single GCLB allows for deterministic traffic splitting. By using a URL map with weighted backend services, traffic is shifted at the Google frontend (GFE) layer. Changes typically propagate across the global fleet in 10–30 seconds, independent of DNS caching.
To achieve a zero-downtime cutover, use the Load Balancer approach. This requires your on-premises origin to be reachable by the GCLB (via Cloud VPN, Interconnect, or an Internet Network Endpoint Group if the origin has a public IP).
The Load Balancer preserves session affinity most predictably. Because the GCLB terminates TLS and manages the session, it can use generated cookies (GCLB) to ensure a client stays with the same backend regardless of weight changes. DNS-level affinity is unreliable during a shift because a resolver may rotate the returned IP for a client mid-session, forcing a connection reset or session loss.
To verify the traffic split and affinity during the migration, use curl to inspect the load balancer's session cookie:
curl -v -H "Host: yourdomain.com" https://<LB_IP> | grep -i "set-cookie: GCLB="
Required Diagnostic Detail: Does your on-premises origin have a public IP reachable by Google's health-check ranges, or is it restricted to private connectivity (VPN/Interconnect)? This determines whether you use an Internet NEG or a Zonal NEG.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.