Experimentation allows you to serve different website experiences to your clients. Typically, it is used for A/B testing, canary releases, trunk-based development, dark releases, feature releases, and segmented releases.
Sample Use Cases:
- Send 5% of your traffic to a new version of your website, while the rest of your clients continue to use the existing version of your website.
- Send 20% of your traffic to a different homepage.
- Split traffic between three calls to actions to compare effectiveness.
Quick Start
Set up your experiments through the following steps:
-
Identify the environment (e.g.,
production
) that will be configured. -
Define one or more experiment(s) for that environment.For each experiment, you must define two or more variants. Each variant identifies the percentage of traffic to which a set of actions will be applied.
-
Apply your experiment(s) to that environment by deploying your changes.
How Does It Work?
Once you have deployed at least one experiment, then each client will be assigned a random value from 0 - 99 through the
x-edg-experiments
cookie. This value will persist until the client clears their cookies. This random value is critical for determining the variant(s) that will be assigned to the client. An experiment must contain two or more variants and each variant identifies the set of actions that will be applied to a request.A client is eligible to participate in an experiment if the request satisfies the experiment’s criteria. Edgio processes the request with the set of actions associated with each variant assigned to the client.
Edgio checks an experiment’s criteria after it has processed the request through Rules.
Edgio adds experimentation metadata to each experiment-eligible request. Specifically, it adds a header to the request sent from Edgio to the origin and it adds metadata to the response sent from Edgio to the client. This allows you to use variant information within your application(s).
The Edgio Experimentation repository (https://github.com/Edgio/Experimentation) contains utilities to facilitate the extraction of experiment and variant metadata.
Edgio uses a different formula to calculate the cache key for requests that satisfy at least one experiment. View the cache key syntax.
Experiments
An experiment:
- Identifies the set of traffic to which it will be applied.
- Contains two or more variants. Each variant identifies the percentage of traffic to which its actions (aka features) will be applied.
A single experiment with three variants is illustrated below.
Criteria
You may define criteria that identifies the set of traffic to which an experiment will be applied. If you do not define any criteria, then the experiment is applicable to all requests.
Set up each desired match criteria by:
-
Selecting the type of variable.For example, you may identify requests by HTTP method, path, or request headers.
-
Defining how a request will be compared against a value or state. In some cases, this involves selecting a comparison operator and defining the value that will be compared against the request.
Variants
A variant identifies the percentage of traffic to which a set of actions (aka features) will be applied. The available actions are categorized as follows:
- Access: Controls access to content.
- Caching: Customizes when and how content is cached.
- Client: Controls how the client communicates with our CDN.
- Comment: Adds a note or metadata to your configuration. This feature is solely informational and does not affect your configuration.
- Headers: Adds, modifies, or deletes headers from the request or response.
- Logs: Customizes how log data is stored.
- Origin: Controls how the CDN communicates with an origin server.
- Response: Customizes the response sent to the client and determines whether we will allow prefetching instructions to be sent to the client.
- Set Variables: Assigns a value to one or more user-defined variable(s) that are passed to your bespoke traffic processing solution.
- URL: Redirects or rewrites requests to a different URL.
Managing Experiments
You may create, enable, disable, and delete experiments. You may also adjust the distribution of traffic between variants.
Key information:
- An experiment is read-only once it has been deployed. However, you may enable, disable, or delete it at anytime.
- Apply your changes to the current environment by clicking Deploy Changes.
To create an experiment
-
Load the Experimentation page.
- From the Edgio Console, select the desired private space or organization.
- Select the desired property.
- From the left-hand pane, select the desired environment from under the Environments section.
- From the left-hand pane, select Experimentation.
-
Click + Add Experiment. A blank experiment configuration will appear.
-
From the Name option, assign a name to the experiment.Edgio populates the
x-edg-experiments-info
upstream request header with this name. -
Optional. Restrict this experiment to a subset of your website traffic by defining one or more criterion.
-
Click + Add Criteria.
-
From the Variable option, select the desired variable.For example, you may identify requests by HTTP method, path, or request headers.
-
Define how a request will be compared against a value or state. In some cases, this involves selecting a comparison operator and defining the value that will be compared against the request.
-
Click Add Condition.
-
Optional. Add another match criterion by repeating steps 4.i - 4.iv. Repeat this step as needed.
-
-
Define two or more variants.
-
From the Name option, assign a name to this variant.Edgio populates the
x-edg-experiments-info
upstream request header with this name. -
Set the Percentage option to the percentage of this experiment’s traffic to which this variant will be applied.The traffic percentage defined for all variants defined within a specific experiment must add up to 100%. For example, if you have 3 variants and you have assigned 33% to 2 of them, then the third variant must be assigned 34% (33% + 33% + 34% = 100).
-
Define the set of actions that will be applied to traffic assigned to this variant.
- Click + Add Action.
- Select the desired feature.
- Configure the selected feature.
- Click Add Feature.
- Optional. Add another action by repeating steps 5.iii.a - 5.iii.d. Repeat this step as needed.
-
Configure the second variant by repeating steps 5.i - 5.iii.Your configuration should now look similar to this one:
-
Optional. Add and configure another variant. Repeat this step as needed.
- Click + Add Variant.
- Repeat steps 5.i - 5.iii.
-
-
Apply your experiment(s) to your traffic by clicking Deploy Changes.
Once you have deployed an experiment, you may only modify how traffic is distributed between variants.
If you must modify a deployed experiment’s criteria, variables, or actions, then you will need to recreate it and then delete the old experiment.
To modify an experiment’s traffic distribution
-
Load the Experimentation page.
- From the Edgio Console, select the desired private space or organization.
- Select the desired property.
- From the left-hand pane, select the desired environment from under the Environments section.
- From the left-hand pane, select Experimentation.
-
Modify the desired variant’s traffic percentage.
-
Expand the desired experiment.
-
Find the desired variant and set its Percentage option to the desired percentage of this experiment’s traffic.
-
Repeat the previous step for each of the experiment’s variants.Make sure that the sum of the traffic percentages assigned to all variants within that experiment add up to 100%.
-
-
Apply your changes by clicking Deploy Changes.
To enable or disable an experiment’s status
-
Load the Experimentation page.
- From the Edgio Console, select the desired private space or organization.
- Select the desired property.
- From the left-hand pane, select the desired environment from under the Environments section.
- From the left-hand pane, select Experimentation.
-
Perform either of the following steps:
- Enable: From the desired experiment, toggle the Active option to the on position ().
- Disable: From the desired experiment, toggle the Active option to the off position ().
-
Click Deploy Changes.
To delete an experiment
-
Load the Experimentation page.
- From the Edgio Console, select the desired private space or organization.
- Select the desired property.
- From the left-hand pane, select the desired environment from under the Environments section.
- From the left-hand pane, select Experimentation.
-
Click on the icon next to the desired experiment.
-
When prompted, confirm the deletion by clicking Delete experiment.
-
Click Deploy Changes.
Experimentation Metadata
Edgio provides experimentation metadata to the client and origin server.
- Client: Edgio sets the
x-edg-experiments
cookie and theserver-timing
response header. - Origin: Edgio sets the
x-edg-experiments-info
header for requests proxied from our network to the origin.
The Edgio Experimentation repository (https://github.com/Edgio/Experimentation) contains utilities to facilitate the extraction of experiment and variant metadata.
x-edg-experiments Cookie
This cookie assigns a value from 0 - 99 to a client. Once a client has been assigned a number, it will persist until the client clears their cookies. This ensures a consistent experience across multiple browsing sessions.
Sample Cookie:
x-edg-experiments=24
x-edg-experiments-info Upstream Request Header
The
x-edg-experiments-info
request header tracks the variants assigned to a client. Edgio adds this header to requests proxied through our network to the origin or the Edgio cloud.Edgio does not currently add this header to requests processed by Edge Functions. However, we plan on adding this header to requests forwarded to Edge Functions in the future.
It contains the following syntax for each variant that has been assigned to a client:
%22<EXPERIMENT>_<BUCKET>%22%3A%22<VARIANT>_<VARIANT ID>%22
The above variables are defined below:
<EXPERIMENT>
: The name of the experiment.<BUCKET>
: The system-defined ID of the bucket assigned to the client.<VARIANT>
: The name of the variant. If the client has not been assigned to a variant, then it will returnnull
instead of<VARIANT>_<VARIANT_ID>
.<VARIANT ID>
: The variant’s system-defined ID.
If multiple experiments have been applied to the client, then they will be delimited by a comma.
Sample Value:
x-edg-experiments-info: %7B%22Landing_page_1238476236%22%3A%22New_landing_page_816213%22,%22Banner_8123712%22:%22Existing_banner_712312%22%7D
The decoded version of the above URL-encoded value is:
{"Landing_page_1238476236":"New_landing_page_816213","Banner_8123712":"Existing_banner_712312"}
Server-Timing Response Header
The
server-timing
response header tracks the variants assigned to a client. It contains the following syntax for each variant that has been assigned to a client:experiments;desc=%7B%22<EXPERIMENT>_<BUCKET>%22%3A%22<VARIANT>_<VARIANT ID>%22%7D
Definitions for the above variables are provided within the x-edg-experiments-info Upstream Request Header section.
Sample Server-Timing Response Header:
edgio_cache;desc=UNCACHEABLE,edgio_pop;desc=lac,edgio_country;desc=US,experiments;desc=%7B%22myexperiment_1695661110792%22%3A%22altlandingpage_1695661135500%22%7D
Metadata Script
The following shell script submits 10 requests to a sample Experimentation site that splits traffic between the following sites:
- 80% of requests are sent to the Full-Featured sample site
- 20% of requests are sent to the Simple sample site
The output for this script includes:
- The value for the
Server-Timing
response header. This value identifies the variant assigned to the request. - The
x-edg-experiments
cookie. This value determines the variant that will be served to the client.
Bash
1#!/bin/bash23# Function to extract the value of a header from response4extract_header() {5 echo "$1" | grep -i "^$2:" | awk '{print substr($0, index($0,$2))}'6}78# Function to perform curl request and process the response9curl_and_process() {10 local response=$(curl -s -D - "https://edgio-community-examples-entry.glb.edgio.link/" -o /dev/null)11 local server_timing=$(extract_header "$response" "Server-Timing")12 local cookies=$(extract_header "$response" "Set-Cookie")13 local x_edg_experiment_cookie=$(echo "$cookies" | awk -F';' '{for(i=1; i<=NF; i++) if ($i ~ /x-edg-experiments=/) print $i}' | sed 's/^.*x-edg-experiments=//')1415 echo "Server-Timing: $server_timing"16 echo "x-edg-experiments: $x_edg_experiment_cookie"17}1819# Perform 10 curls and process each response20for i in {1..10}; do21 echo "Response $i:"22 curl_and_process23 echo "------------------------"24done
Run the above script on your own site by updating the URL in the above curl request to a URL that points to your experiment.
Sample output:
Request # | X-Edg-Experiments | Server-Timing |
---|---|---|
1 | 60 | … desc=%7B%22Performance_Site_1715124149014%22%3A%22Full_Featured_1715124111690%22%7D |
2 | 6 | … desc=%7B%22Performance_Site_1715124149014%22%3A%22Full_Featured_1715124111690%22%7D |
3 | 79 | … desc=%7B%22Performance_Site_1715124149014%22%3A%22Full_Featured_1715124111690%22%7D |
4 | 23 | … desc=%7B%22Performance_Site_1715124149014%22%3A%22Full_Featured_1715124111690%22%7D |
5 | 43 | … desc=%7B%22Performance_Site_1715124149014%22%3A%22Full_Featured_1715124111690%22%7D |
6 | 57 | … desc=%7B%22Performance_Site_1715124149014%22%3A%22Full_Featured_1715124111690%22%7D |
7 | 5 | … desc=%7B%22Performance_Site_1715124149014%22%3A%22Full_Featured_1715124111690%22%7D |
8 | 24 | … desc=%7B%22Performance_Site_1715124149014%22%3A%22Full_Featured_1715124111690%22%7D |
9 | 84 | … desc=%7B%22Performance_Site_1715124149014%22%3A%22Simple_1715124128520%22%7D |
10 | 86 | … desc=%7B%22Performance_Site_1715124149014%22%3A%22Simple_1715124128520%22%7D |
The last two requests were assigned the Simple sample site variant since they were assigned a value of 84 and 86, respectively.