Skip to content

Cloudflare's DNS team measures record propagation from every data center and uses the result to promote or roll back a release. Vercel Flags can fail a deployment check when a declared flag is missing, and Cloudflare Worker Previews now show CPU and heap profiles before merge.

Published

On November 23, Cloudflare and Vercel published three posts about checking a release before and while it ships. All three deal with the same problem: unit tests pass and dashboards are green, yet something is wrong on the user's side.

  • Cloudflare's DNS team said it measures DNS record propagation from every data center with its internal test framework Flamingo, and uses those measurements to decide whether a release goes ahead or is rolled back.
  • Vercel Flags shipped a deployment check that fails when a feature flag is declared in code but has not been created in the project.
  • Cloudflare Worker Previews can now be profiled, so a branch's CPU and heap profile is visible before merge.

The three checks apply at different points. The profile is read before merge, the flag check runs when a deployment is ready, and the DNS probes keep running while a release rolls out.

Image: devs7udio, the point at which each of the three checks applies

Cloudflare runs a CDN and DNS. On its engineering blog, the DNS team wrote that an incident during a rollout led it to change how it tests.

  • What happened. During a rollout of the service that publishes DNS records to the edge, a scheduling bug left some record changes unpublished for hours.
  • What the service looked like. It stayed up and was healthy.
  • What users saw. New hostnames were slow to resolve, and certificates could not be issued until the bug was fixed.

The post gives three reasons DNS failures are hard to catch: they are slow to show, spread across the network, and partial in where they cause impact. So the team decided to test DNS the way customers experience it: constantly, from every data center, and against production.

When a DNS record changes, the change has to propagate to the authoritative nameservers before the new value is widely available. The post says delays in that propagation affect time-sensitive operations such as certificate issuance and traffic failover.

Flamingo is an end-to-end test framework that Cloudflare uses internally. It is not a public product. According to the post, it runs hundreds of millions of tests a day against Cloudflare's edge.

  • Language and test format. It is written in Rust. Tests are written in a custom DSL with a setup, request, response format. The reason given is that with a general programming language, a failing test means debugging both the system under test and the test itself.
  • Modular design. It was first built for multi-step HTTP testing. The middle step, the request, can be replaced with another action, so the team added a module that sends DNS queries in place of HTTP requests.
  • What the DNS team got. Scheduling, reporting and metrics were already in Flamingo. The DNS team did not have to run a separate probing service.

The probes measure how quickly customer record changes propagate to the authoritative nameservers and to the public resolver 1.1.1.1. The test continuously writes a timestamp into a TXT record. From every data center it then queries three authoritative nameserver IPs and 1.1.1.1 for that record, and asserts that the value returned is fresh enough.

  • Authoritative nameservers
    90s

    The value returned must have been written within this time

  • Public resolver 1.1.1.1
    600s

    The value returned must have been written within this time

Source: Cloudflare Blog, Probing DNS at Cloudflare

This is one test from the post. It queries one authoritative nameserver directly.

Source codetext
TEST test-propagation-delay-direct-108-162-193-62
MOD dns
SET $hostname "some.probe.domain"
SET $authNs 108.162.193.62:53 # amir.ns.cloudflare.com
QUERY $hostname TXT
TARGET $authNs
ASSERT DNS.RCODE IS NOERROR
ASSERT DNS.FLAGS CONTAINS AA
ASSERT DNS.ANSWERS[0] GT SUBTRACT(TIMESTAMP(), "90")

The last three lines are the conditions. They check that the response code is NOERROR, that the AA flag for an authoritative answer is set, and that the timestamp in the answer is greater than the current time minus 90 seconds.

The post says Flamingo also has modules for testing TCP, UDP, WebSockets and several more.

The results of the synthetic traffic that Flamingo keeps sending through production become a service-level indicator (SLI). An SLI is a series of measurements of the end-to-end experience a user has, and a service-level objective (SLO) is the target percentage that those measurements have to meet. The post says that when the synthetic traffic hits issues, the team can be fairly confident customers are hitting them too, and triages accordingly.

Image: Cloudflare Blog

Release decisions use error budgets and burn rates.

  • Error budget. The percentage of downtime a service is willing to tolerate.
  • Burn rate. The rate at which that budget is being used.
  • 10% of the budget burned over three days. Not urgent, but it is affecting customers and has to be dealt with.
  • 10% of the budget burned within an hour. An incident is occurring, and customer impact will be substantial if it is not fixed at once.
DNS probesQuery continuously from every data center
SLIShare of probes that completed within the threshold
Error budget burn rateHow fast the budget is being used
Release systemPromotes the change or rolls it back
  • DNS probes → SLI
  • SLI → Error budget burn rate
  • Error budget burn rate → Release system

During a deployment the team looks at these SLOs and tells the release system to promote the change or roll it back. In the screen shown in the post, the recommendation for the test plans, the SLO evaluations and the alert check is progress in every row.

Image: Cloudflare Blog

The post says that if Flamingo detects a spike in propagation latency in a canary data center, the rollout of a new software version can be halted automatically. It gives no figures for how many incidents this has prevented.

Vercel Flags is Vercel's feature flag service. A flag is declared in code and created in the Vercel project.

The changelog entry is about a flag that is declared but not created in the project. In that case the app does not fail. It falls back to the flag's default value, and that default may turn on a feature that was meant to stay off.

The new Flag Definitions Present deployment check finds deployments with such flags.

데이터 표
When it runsWhen a deployment is ready
When it failsWhen any flag declared in code is missing from the project
What a failure showsThe missing flags are listed in the check results. Create each one, then redeploy
What the check readsThe Flags SDK discovery endpoint
Required versionWith the flags package v4.5.0 or later on Vercel it works without FLAGS_SECRET. Earlier versions still require the secret
Where to enable itThe project's Build and Deployment settings
PlansTeams on all plans

Source: Vercel Changelog, November 23

To block a deployment, the check has to be enabled in settings and marked as required. Only then does a deployment with missing flags stay out of production. Setup details are in Vercel's Deployment Checks documentation.

Cloudflare Workers is Cloudflare's serverless runtime. Following on-demand CPU and memory profiling for Workers and Durable Objects, Cloudflare now lets Worker Previews be profiled as well. This shows what a pull request costs in CPU and memory before it is merged.

  1. Send traffic to a Preview.
  2. Capture a CPU or heap profile from one of its deployments.
  3. See which functions in the branch use the most CPU time or memory.
  4. Push a fix, profile the next deployment, and compare.

Production stays untouched the whole time.

Image: Cloudflare Developers Changelog

In the changelog's example, formatPrice takes almost a third of the CPU time because it creates a new Intl.NumberFormat for every product. The entry notes that a slowdown like this is easy to miss in code review but stands out in a flamegraph.

In the dashboard, open the Preview, select Observability, and switch the view to Flamegraph. Choose a profile type and a Preview deployment, then select Capture profile. The result can be explored as a flamegraph or a table, or downloaded as a pprof file.

With the Cloudflare CLI, a profile is captured as below. The API can do the same.

Source codebash
cf previews deployments profile latest \
  --worker my-worker \
  --preview my-preview \
  --duration-ms 5000 \
  --profile-type cpu > preview-cpu.pprof
  • Durable Objects. Every Preview gets its own Durable Object namespaces. To see what one object is doing on a branch, profile it by ID, as in production.
  • Coding agents. Each Preview deployment has its own ID, so every profile maps to an exact version of the code. The changelog describes an agent that deploys a Preview, sends it load, captures a profile, rewrites the hottest function and deploys again, until CPU time stops dropping.

This feature does not block a merge automatically. A person or an agent reads the profile and decides whether to fix anything.

데이터 표
WhenDuring rollout and continuouslyWhen a deployment is readyBefore merge
Looks atReal DNS answers and propagation time per data centerWhether flags declared in code exist in the projectCPU time and memory per function
Missed beforeRecords published late while the service was healthyBehavior changed quietly by a default valueSlowdowns missed in code review
On failureThe rollout is halted or rolled backIf marked required, the deployment does not reach productionNothing is blocked automatically. A person or an agent fixes it
AvailabilityInternal Cloudflare tooling, not a public productAll Vercel plansCloudflare Workers users

Sources: Cloudflare Blog, Vercel Changelog, Cloudflare Developers Changelog

Interpretation: all three posts are about cases where the signal that internal state is healthy and the result users get do not match. A health check says whether the service is up. It does not say whether a record was published on time, whether a flag has the intended value, or whether a function got slower.

Interpretation: there are three things a solo developer or a small team can take from this.

  • Pick one response users really receive and check it from outside. After a deploy, do not stop at the health check. Confirm that the value you just changed is visible at the public address. Cloudflare's probe works the same way: it writes a timestamp and reads it from outside to see whether the value is fresh. A single scheduled job can do something similar.
  • Compare configuration that lives outside the code before deploying. With flags and environment variables, a build can pass even when a name the code expects is missing from the real settings. Add a check that compares the two lists before a deploy.
  • Measure performance once on a preview before merge. If a slowdown is noticed after it reaches production, the change that caused it has to be found among several merges.

Flamingo is internal Cloudflare tooling, so it cannot be adopted as it is. What can be adopted is the rule that a release stops when a measurement crosses a threshold. Deciding the threshold and the way to stop before the release shortens the time spent deciding when something goes wrong.