2 min read
Sub-millisecond reads for experiment and feature flag configurations.
Today, we're introducing Edge Config: an ultra-low latency data store for configuration data.
Globally distributed on Vercel's Edge Network, this new storage system gives you near-instant reads of your configuration data from Edge Middleware, Edge Functions, and Serverless Functions. Edge Config is already being used by customers to manage things like A/B testing and feature flag configuration data.
Edge Config is now generally available. Check out the documentation or deploy it on Vercel.
A unique storage product
Edge Config allows you to distribute data to our Edge Network without needing to perform a deployment. Instead, your data is actively replicated to all our regions before it’s requested. This means your data will always be available, instantly.
The Edge Config architecture acts similarly to a push-based Content Delivery Network (CDN). Pull-based CDNs load the data on the first request and keep it around until it expires, while push-based CDNs get the data before it is requested and keep it around until a new version is pushed.
While Vercel handles most aspects of our infrastructure like a pull-based CDN, Edge Config works more closely to a push-based CDN. It propagates your config data to all our regions before it's requested, and keeps it in cache until a new version is published.
Edge Config is amazing. We’ve been hoping for a product like this for a while, and now it’s here! Really excited to see how this plays out with the increased traffic we’ll be seeing over the next few weeks.
Your data is structured as JSON, but Edge Config is not a general-purpose key/value store. Instead, it is optimized for fast, inexpensive reads and infrequent writes. Writes of configuration values may take a few seconds to propagate globally, but reads return with very low latency.
Most lookups return in 5 ms or less, and 99% of reads will return under 15 ms.
Edge Config is incredibly fast to read and doesn't require a redeploy to update and maintain config data, making it great for:
A/B testing and feature flags
Maintaining complex and dynamic redirects
Configuring and updating bespoke request blocking rules, without a redeploy
Tools for rapid experimentation
The response to Edge Middleware has been staggering. As customers embrace it for A/B testing and feature flags, they've experienced less layout shift and less need for third-party scripts.
By also moving the config data for these experiments to the edge, you can get further performance improvement by eliminating the network requests to retrieve that data.
Speedway Motors has a strong culture of experimentation and fast iteration, but balances that with a strong dedication to end-user performance. In a banner promotion A/B test, switching to Edge Config gave them an immediate improvement in Core Web Vitals and SEO.
Edge Config API
The API for Edge Config allows you to query whether a key exists quickly and to get the value of a single key or even multiple values in a single query.
import { get } from '@vercel/edge-config';
const featureFlagEnabled = await get("featureFlagEnabled")
Get started with Edge Config
Just by calling get
or getAll
, you’ll read from your default Edge Config. You can create new Edge Configs in your account and use a connection string to connect to a different Edge Config.
import { createClient } from '@vercel/edge-config';
const edgeConfig = createClient(process.env.FEATURE_FLAGS_CONFIG);
const featureFlags = await edgeConfig.getAll(["requireSignup", "showDiscountBanner"]);
Example A/B test using Edge Config
As of April 2023 Edge Config is generally available—you can get started with our new Statsig and HappyKit integrations, Edge Config SDK, or by using one of our examples.